@interopio/desktop 6.0.2 → 6.2.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/changelog.md +27 -12
- package/desktop.d.ts +226 -7
- package/dist/desktop.browser.js +841 -708
- package/dist/desktop.browser.js.map +1 -1
- package/dist/desktop.browser.min.js +1 -1
- package/dist/desktop.browser.min.js.map +1 -1
- package/dist/desktop.es.js +841 -708
- package/dist/desktop.es.js.map +1 -1
- package/dist/desktop.umd.js +841 -708
- package/dist/desktop.umd.js.map +1 -1
- package/dist/desktop.umd.min.js +1 -1
- package/dist/desktop.umd.min.js.map +1 -1
- package/package.json +4 -6
- package/dist/desktop.umd.js.7z +0 -0
package/dist/desktop.browser.js
CHANGED
|
@@ -1031,12 +1031,12 @@
|
|
|
1031
1031
|
};
|
|
1032
1032
|
}
|
|
1033
1033
|
createRegistry$1.default = createRegistry$1;
|
|
1034
|
-
var lib$1
|
|
1034
|
+
var lib$1 = createRegistry$1;
|
|
1035
1035
|
|
|
1036
1036
|
var InProcTransport = (function () {
|
|
1037
1037
|
function InProcTransport(settings, logger) {
|
|
1038
1038
|
var _this = this;
|
|
1039
|
-
this.registry = lib$1
|
|
1039
|
+
this.registry = lib$1();
|
|
1040
1040
|
this.gw = settings.facade;
|
|
1041
1041
|
this.gw.connect(function (_client, message) {
|
|
1042
1042
|
_this.messageHandler(message);
|
|
@@ -1092,7 +1092,7 @@
|
|
|
1092
1092
|
function SharedWorkerTransport(workerFile, logger) {
|
|
1093
1093
|
var _this = this;
|
|
1094
1094
|
this.logger = logger;
|
|
1095
|
-
this.registry = lib$1
|
|
1095
|
+
this.registry = lib$1();
|
|
1096
1096
|
this.worker = new SharedWorker(workerFile);
|
|
1097
1097
|
this.worker.port.onmessage = function (e) {
|
|
1098
1098
|
_this.messageHandler(e.data);
|
|
@@ -1242,7 +1242,7 @@
|
|
|
1242
1242
|
function WS(settings, logger) {
|
|
1243
1243
|
this.startupTimer = timer("connection");
|
|
1244
1244
|
this._running = true;
|
|
1245
|
-
this._registry = lib$1
|
|
1245
|
+
this._registry = lib$1();
|
|
1246
1246
|
this.wsRequests = [];
|
|
1247
1247
|
this.settings = settings;
|
|
1248
1248
|
this.logger = logger;
|
|
@@ -1433,44 +1433,44 @@
|
|
|
1433
1433
|
// Found this seed-based random generator somewhere
|
|
1434
1434
|
// Based on The Central Randomizer 1.3 (C) 1997 by Paul Houle (houle@msc.cornell.edu)
|
|
1435
1435
|
|
|
1436
|
-
var seed
|
|
1436
|
+
var seed = 1;
|
|
1437
1437
|
|
|
1438
1438
|
/**
|
|
1439
1439
|
* return a random number based on a seed
|
|
1440
1440
|
* @param seed
|
|
1441
1441
|
* @returns {number}
|
|
1442
1442
|
*/
|
|
1443
|
-
function getNextValue
|
|
1444
|
-
seed
|
|
1445
|
-
return seed
|
|
1443
|
+
function getNextValue() {
|
|
1444
|
+
seed = (seed * 9301 + 49297) % 233280;
|
|
1445
|
+
return seed/(233280.0);
|
|
1446
1446
|
}
|
|
1447
1447
|
|
|
1448
|
-
function setSeed$1
|
|
1449
|
-
seed
|
|
1448
|
+
function setSeed$1(_seed_) {
|
|
1449
|
+
seed = _seed_;
|
|
1450
1450
|
}
|
|
1451
1451
|
|
|
1452
1452
|
var randomFromSeed$1 = {
|
|
1453
|
-
nextValue: getNextValue
|
|
1454
|
-
seed: setSeed$1
|
|
1453
|
+
nextValue: getNextValue,
|
|
1454
|
+
seed: setSeed$1
|
|
1455
1455
|
};
|
|
1456
1456
|
|
|
1457
|
-
var randomFromSeed
|
|
1457
|
+
var randomFromSeed = randomFromSeed$1;
|
|
1458
1458
|
|
|
1459
|
-
var ORIGINAL
|
|
1459
|
+
var ORIGINAL = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-';
|
|
1460
1460
|
var alphabet$2;
|
|
1461
|
-
var previousSeed
|
|
1461
|
+
var previousSeed;
|
|
1462
1462
|
|
|
1463
|
-
var shuffled
|
|
1463
|
+
var shuffled;
|
|
1464
1464
|
|
|
1465
|
-
function reset
|
|
1466
|
-
shuffled
|
|
1465
|
+
function reset() {
|
|
1466
|
+
shuffled = false;
|
|
1467
1467
|
}
|
|
1468
1468
|
|
|
1469
|
-
function setCharacters
|
|
1469
|
+
function setCharacters(_alphabet_) {
|
|
1470
1470
|
if (!_alphabet_) {
|
|
1471
|
-
if (alphabet$2 !== ORIGINAL
|
|
1472
|
-
alphabet$2 = ORIGINAL
|
|
1473
|
-
reset
|
|
1471
|
+
if (alphabet$2 !== ORIGINAL) {
|
|
1472
|
+
alphabet$2 = ORIGINAL;
|
|
1473
|
+
reset();
|
|
1474
1474
|
}
|
|
1475
1475
|
return;
|
|
1476
1476
|
}
|
|
@@ -1479,8 +1479,8 @@
|
|
|
1479
1479
|
return;
|
|
1480
1480
|
}
|
|
1481
1481
|
|
|
1482
|
-
if (_alphabet_.length !== ORIGINAL
|
|
1483
|
-
throw new Error('Custom alphabet for shortid must be ' + ORIGINAL
|
|
1482
|
+
if (_alphabet_.length !== ORIGINAL.length) {
|
|
1483
|
+
throw new Error('Custom alphabet for shortid must be ' + ORIGINAL.length + ' unique characters. You submitted ' + _alphabet_.length + ' characters: ' + _alphabet_);
|
|
1484
1484
|
}
|
|
1485
1485
|
|
|
1486
1486
|
var unique = _alphabet_.split('').filter(function(item, ind, arr){
|
|
@@ -1488,50 +1488,50 @@
|
|
|
1488
1488
|
});
|
|
1489
1489
|
|
|
1490
1490
|
if (unique.length) {
|
|
1491
|
-
throw new Error('Custom alphabet for shortid must be ' + ORIGINAL
|
|
1491
|
+
throw new Error('Custom alphabet for shortid must be ' + ORIGINAL.length + ' unique characters. These characters were not unique: ' + unique.join(', '));
|
|
1492
1492
|
}
|
|
1493
1493
|
|
|
1494
1494
|
alphabet$2 = _alphabet_;
|
|
1495
|
-
reset
|
|
1495
|
+
reset();
|
|
1496
1496
|
}
|
|
1497
1497
|
|
|
1498
|
-
function characters
|
|
1499
|
-
setCharacters
|
|
1498
|
+
function characters(_alphabet_) {
|
|
1499
|
+
setCharacters(_alphabet_);
|
|
1500
1500
|
return alphabet$2;
|
|
1501
1501
|
}
|
|
1502
1502
|
|
|
1503
|
-
function setSeed
|
|
1504
|
-
randomFromSeed
|
|
1505
|
-
if (previousSeed
|
|
1506
|
-
reset
|
|
1507
|
-
previousSeed
|
|
1503
|
+
function setSeed(seed) {
|
|
1504
|
+
randomFromSeed.seed(seed);
|
|
1505
|
+
if (previousSeed !== seed) {
|
|
1506
|
+
reset();
|
|
1507
|
+
previousSeed = seed;
|
|
1508
1508
|
}
|
|
1509
1509
|
}
|
|
1510
1510
|
|
|
1511
|
-
function shuffle
|
|
1511
|
+
function shuffle() {
|
|
1512
1512
|
if (!alphabet$2) {
|
|
1513
|
-
setCharacters
|
|
1513
|
+
setCharacters(ORIGINAL);
|
|
1514
1514
|
}
|
|
1515
1515
|
|
|
1516
1516
|
var sourceArray = alphabet$2.split('');
|
|
1517
1517
|
var targetArray = [];
|
|
1518
|
-
var r = randomFromSeed
|
|
1518
|
+
var r = randomFromSeed.nextValue();
|
|
1519
1519
|
var characterIndex;
|
|
1520
1520
|
|
|
1521
1521
|
while (sourceArray.length > 0) {
|
|
1522
|
-
r = randomFromSeed
|
|
1522
|
+
r = randomFromSeed.nextValue();
|
|
1523
1523
|
characterIndex = Math.floor(r * sourceArray.length);
|
|
1524
1524
|
targetArray.push(sourceArray.splice(characterIndex, 1)[0]);
|
|
1525
1525
|
}
|
|
1526
1526
|
return targetArray.join('');
|
|
1527
1527
|
}
|
|
1528
1528
|
|
|
1529
|
-
function getShuffled
|
|
1530
|
-
if (shuffled
|
|
1531
|
-
return shuffled
|
|
1529
|
+
function getShuffled() {
|
|
1530
|
+
if (shuffled) {
|
|
1531
|
+
return shuffled;
|
|
1532
1532
|
}
|
|
1533
|
-
shuffled
|
|
1534
|
-
return shuffled
|
|
1533
|
+
shuffled = shuffle();
|
|
1534
|
+
return shuffled;
|
|
1535
1535
|
}
|
|
1536
1536
|
|
|
1537
1537
|
/**
|
|
@@ -1539,29 +1539,29 @@
|
|
|
1539
1539
|
* @param index
|
|
1540
1540
|
* @returns {string}
|
|
1541
1541
|
*/
|
|
1542
|
-
function lookup
|
|
1543
|
-
var alphabetShuffled = getShuffled
|
|
1542
|
+
function lookup(index) {
|
|
1543
|
+
var alphabetShuffled = getShuffled();
|
|
1544
1544
|
return alphabetShuffled[index];
|
|
1545
1545
|
}
|
|
1546
1546
|
|
|
1547
1547
|
function get () {
|
|
1548
|
-
return alphabet$2 || ORIGINAL
|
|
1548
|
+
return alphabet$2 || ORIGINAL;
|
|
1549
1549
|
}
|
|
1550
1550
|
|
|
1551
|
-
var alphabet_1
|
|
1551
|
+
var alphabet_1 = {
|
|
1552
1552
|
get: get,
|
|
1553
|
-
characters: characters
|
|
1554
|
-
seed: setSeed
|
|
1555
|
-
lookup: lookup
|
|
1556
|
-
shuffled: getShuffled
|
|
1553
|
+
characters: characters,
|
|
1554
|
+
seed: setSeed,
|
|
1555
|
+
lookup: lookup,
|
|
1556
|
+
shuffled: getShuffled
|
|
1557
1557
|
};
|
|
1558
1558
|
|
|
1559
|
-
var crypto
|
|
1559
|
+
var crypto = typeof window === 'object' && (window.crypto || window.msCrypto); // IE 11 uses window.msCrypto
|
|
1560
1560
|
|
|
1561
|
-
var randomByte
|
|
1561
|
+
var randomByte;
|
|
1562
1562
|
|
|
1563
|
-
if (!crypto
|
|
1564
|
-
randomByte
|
|
1563
|
+
if (!crypto || !crypto.getRandomValues) {
|
|
1564
|
+
randomByte = function(size) {
|
|
1565
1565
|
var bytes = [];
|
|
1566
1566
|
for (var i = 0; i < size; i++) {
|
|
1567
1567
|
bytes.push(Math.floor(Math.random() * 256));
|
|
@@ -1569,12 +1569,12 @@
|
|
|
1569
1569
|
return bytes;
|
|
1570
1570
|
};
|
|
1571
1571
|
} else {
|
|
1572
|
-
randomByte
|
|
1573
|
-
return crypto
|
|
1572
|
+
randomByte = function(size) {
|
|
1573
|
+
return crypto.getRandomValues(new Uint8Array(size));
|
|
1574
1574
|
};
|
|
1575
1575
|
}
|
|
1576
1576
|
|
|
1577
|
-
var randomByteBrowser
|
|
1577
|
+
var randomByteBrowser = randomByte;
|
|
1578
1578
|
|
|
1579
1579
|
// This file replaces `format.js` in bundlers like webpack or Rollup,
|
|
1580
1580
|
// according to `browser` config in `package.json`.
|
|
@@ -1617,8 +1617,8 @@
|
|
|
1617
1617
|
}
|
|
1618
1618
|
};
|
|
1619
1619
|
|
|
1620
|
-
var alphabet$1 = alphabet_1
|
|
1621
|
-
var random = randomByteBrowser
|
|
1620
|
+
var alphabet$1 = alphabet_1;
|
|
1621
|
+
var random = randomByteBrowser;
|
|
1622
1622
|
var format = format_browser;
|
|
1623
1623
|
|
|
1624
1624
|
function generate$1(number) {
|
|
@@ -1642,65 +1642,65 @@
|
|
|
1642
1642
|
// Ignore all milliseconds before a certain time to reduce the size of the date entropy without sacrificing uniqueness.
|
|
1643
1643
|
// This number should be updated every year or so to keep the generated id short.
|
|
1644
1644
|
// To regenerate `new Date() - 0` and bump the version. Always bump the version!
|
|
1645
|
-
var REDUCE_TIME
|
|
1645
|
+
var REDUCE_TIME = 1567752802062;
|
|
1646
1646
|
|
|
1647
1647
|
// don't change unless we change the algos or REDUCE_TIME
|
|
1648
1648
|
// must be an integer and less than 16
|
|
1649
|
-
var version$1
|
|
1649
|
+
var version$1 = 7;
|
|
1650
1650
|
|
|
1651
1651
|
// Counter is used when shortid is called multiple times in one second.
|
|
1652
|
-
var counter
|
|
1652
|
+
var counter;
|
|
1653
1653
|
|
|
1654
1654
|
// Remember the last time shortid was called in case counter is needed.
|
|
1655
|
-
var previousSeconds
|
|
1655
|
+
var previousSeconds;
|
|
1656
1656
|
|
|
1657
1657
|
/**
|
|
1658
1658
|
* Generate unique id
|
|
1659
1659
|
* Returns string id
|
|
1660
1660
|
*/
|
|
1661
|
-
function build
|
|
1661
|
+
function build(clusterWorkerId) {
|
|
1662
1662
|
var str = '';
|
|
1663
1663
|
|
|
1664
|
-
var seconds = Math.floor((Date.now() - REDUCE_TIME
|
|
1664
|
+
var seconds = Math.floor((Date.now() - REDUCE_TIME) * 0.001);
|
|
1665
1665
|
|
|
1666
|
-
if (seconds === previousSeconds
|
|
1667
|
-
counter
|
|
1666
|
+
if (seconds === previousSeconds) {
|
|
1667
|
+
counter++;
|
|
1668
1668
|
} else {
|
|
1669
|
-
counter
|
|
1670
|
-
previousSeconds
|
|
1669
|
+
counter = 0;
|
|
1670
|
+
previousSeconds = seconds;
|
|
1671
1671
|
}
|
|
1672
1672
|
|
|
1673
|
-
str = str + generate(version$1
|
|
1673
|
+
str = str + generate(version$1);
|
|
1674
1674
|
str = str + generate(clusterWorkerId);
|
|
1675
|
-
if (counter
|
|
1676
|
-
str = str + generate(counter
|
|
1675
|
+
if (counter > 0) {
|
|
1676
|
+
str = str + generate(counter);
|
|
1677
1677
|
}
|
|
1678
1678
|
str = str + generate(seconds);
|
|
1679
1679
|
return str;
|
|
1680
1680
|
}
|
|
1681
1681
|
|
|
1682
|
-
var build_1
|
|
1682
|
+
var build_1 = build;
|
|
1683
1683
|
|
|
1684
|
-
var alphabet
|
|
1684
|
+
var alphabet = alphabet_1;
|
|
1685
1685
|
|
|
1686
|
-
function isShortId
|
|
1686
|
+
function isShortId(id) {
|
|
1687
1687
|
if (!id || typeof id !== 'string' || id.length < 6 ) {
|
|
1688
1688
|
return false;
|
|
1689
1689
|
}
|
|
1690
1690
|
|
|
1691
1691
|
var nonAlphabetic = new RegExp('[^' +
|
|
1692
|
-
alphabet
|
|
1692
|
+
alphabet.get().replace(/[|\\{}()[\]^$+*?.-]/g, '\\$&') +
|
|
1693
1693
|
']');
|
|
1694
1694
|
return !nonAlphabetic.test(id);
|
|
1695
1695
|
}
|
|
1696
1696
|
|
|
1697
|
-
var isValid
|
|
1697
|
+
var isValid = isShortId;
|
|
1698
1698
|
|
|
1699
1699
|
(function (module) {
|
|
1700
1700
|
|
|
1701
|
-
var alphabet = alphabet_1
|
|
1702
|
-
var build = build_1
|
|
1703
|
-
var isValid$1
|
|
1701
|
+
var alphabet = alphabet_1;
|
|
1702
|
+
var build = build_1;
|
|
1703
|
+
var isValid$1 = isValid;
|
|
1704
1704
|
|
|
1705
1705
|
// if you are using cluster or multiple servers use this to make each instance
|
|
1706
1706
|
// has a unique value for worker
|
|
@@ -1757,14 +1757,14 @@
|
|
|
1757
1757
|
module.exports.seed = seed;
|
|
1758
1758
|
module.exports.worker = worker;
|
|
1759
1759
|
module.exports.characters = characters;
|
|
1760
|
-
module.exports.isValid = isValid$1
|
|
1760
|
+
module.exports.isValid = isValid$1;
|
|
1761
1761
|
} (lib$2));
|
|
1762
1762
|
|
|
1763
1763
|
(function (module) {
|
|
1764
1764
|
module.exports = libExports;
|
|
1765
1765
|
} (shortid$1));
|
|
1766
1766
|
|
|
1767
|
-
var shortid
|
|
1767
|
+
var shortid = /*@__PURE__*/getDefaultExportFromCjs(shortidExports);
|
|
1768
1768
|
|
|
1769
1769
|
function domainSession (domain, connection, logger, successMessages, errorMessages) {
|
|
1770
1770
|
if (domain == null) {
|
|
@@ -1776,7 +1776,7 @@
|
|
|
1776
1776
|
var tryReconnecting = false;
|
|
1777
1777
|
var _latestOptions;
|
|
1778
1778
|
var _connectionOn = false;
|
|
1779
|
-
var callbacks = lib$1
|
|
1779
|
+
var callbacks = lib$1();
|
|
1780
1780
|
connection.disconnected(handleConnectionDisconnected);
|
|
1781
1781
|
connection.loggedIn(handleConnectionLoggedIn);
|
|
1782
1782
|
connection.on("success", function (msg) { return handleSuccessMessage(msg); });
|
|
@@ -1908,7 +1908,7 @@
|
|
|
1908
1908
|
entry.success(msg);
|
|
1909
1909
|
}
|
|
1910
1910
|
function getNextRequestId() {
|
|
1911
|
-
return shortid
|
|
1911
|
+
return shortid();
|
|
1912
1912
|
}
|
|
1913
1913
|
function send(msg, tag, options) {
|
|
1914
1914
|
options = options || {};
|
|
@@ -1988,7 +1988,7 @@
|
|
|
1988
1988
|
this.datePrefixLen = this.datePrefix.length;
|
|
1989
1989
|
this.dateMinLen = this.datePrefixLen + 1;
|
|
1990
1990
|
this.datePrefixFirstChar = this.datePrefix[0];
|
|
1991
|
-
this.registry = lib$1
|
|
1991
|
+
this.registry = lib$1();
|
|
1992
1992
|
this._isLoggedIn = false;
|
|
1993
1993
|
this.shouldTryLogin = true;
|
|
1994
1994
|
this.initialLogin = true;
|
|
@@ -2418,7 +2418,7 @@
|
|
|
2418
2418
|
this.parentPingTimeout = 5000;
|
|
2419
2419
|
this.connectionRequestTimeout = 7000;
|
|
2420
2420
|
this.defaultTargetString = "*";
|
|
2421
|
-
this.registry = lib$1
|
|
2421
|
+
this.registry = lib$1();
|
|
2422
2422
|
this.messages = {
|
|
2423
2423
|
connectionAccepted: { name: "connectionAccepted", handle: this.handleConnectionAccepted.bind(this) },
|
|
2424
2424
|
connectionRejected: { name: "connectionRejected", handle: this.handleConnectionRejected.bind(this) },
|
|
@@ -2581,8 +2581,8 @@
|
|
|
2581
2581
|
var _a;
|
|
2582
2582
|
_this.connectionResolve = resolve;
|
|
2583
2583
|
_this.connectionReject = reject;
|
|
2584
|
-
_this.myClientId = (_a = _this.myClientId) !== null && _a !== void 0 ? _a : shortid
|
|
2585
|
-
var bridgeInstanceId = _this.getMyWindowId() || shortid
|
|
2584
|
+
_this.myClientId = (_a = _this.myClientId) !== null && _a !== void 0 ? _a : shortid();
|
|
2585
|
+
var bridgeInstanceId = _this.getMyWindowId() || shortid();
|
|
2586
2586
|
var request = {
|
|
2587
2587
|
glue42core: {
|
|
2588
2588
|
type: _this.messages.connectionRequest.name,
|
|
@@ -2706,7 +2706,7 @@
|
|
|
2706
2706
|
this.publicWindowId = this.getMyWindowId();
|
|
2707
2707
|
if (this.identity) {
|
|
2708
2708
|
this.identity.windowId = this.publicWindowId;
|
|
2709
|
-
this.identity.instance = this.identity.instance ? this.identity.instance : this.publicWindowId || shortid
|
|
2709
|
+
this.identity.instance = this.identity.instance ? this.identity.instance : this.publicWindowId || shortid();
|
|
2710
2710
|
}
|
|
2711
2711
|
if (this.identity && data.appName) {
|
|
2712
2712
|
this.identity.application = data.appName;
|
|
@@ -3031,7 +3031,7 @@
|
|
|
3031
3031
|
if ((_a = window.name) === null || _a === void 0 ? void 0 : _a.includes("g42")) {
|
|
3032
3032
|
return window.name;
|
|
3033
3033
|
}
|
|
3034
|
-
this.selfAssignedWindowId = this.selfAssignedWindowId || "g42-".concat(shortid
|
|
3034
|
+
this.selfAssignedWindowId = this.selfAssignedWindowId || "g42-".concat(shortid());
|
|
3035
3035
|
return this.selfAssignedWindowId;
|
|
3036
3036
|
};
|
|
3037
3037
|
return WebPlatformTransport;
|
|
@@ -3115,7 +3115,7 @@
|
|
|
3115
3115
|
this.logger = logger;
|
|
3116
3116
|
this.messageHandlers = {};
|
|
3117
3117
|
this.ids = 1;
|
|
3118
|
-
this.registry = lib$1
|
|
3118
|
+
this.registry = lib$1();
|
|
3119
3119
|
this._connected = false;
|
|
3120
3120
|
this.isTrace = false;
|
|
3121
3121
|
this._swapTransport = false;
|
|
@@ -3737,7 +3737,7 @@
|
|
|
3737
3737
|
if (typeof window !== "undefined" && typeof window.glue42electron !== "undefined") {
|
|
3738
3738
|
return window.glue42electron.application;
|
|
3739
3739
|
}
|
|
3740
|
-
var uid = shortid
|
|
3740
|
+
var uid = shortid();
|
|
3741
3741
|
if (Utils$1.isNode()) {
|
|
3742
3742
|
if (nodeStartingContext) {
|
|
3743
3743
|
return nodeStartingContext.applicationConfig.name;
|
|
@@ -6864,7 +6864,7 @@
|
|
|
6864
6864
|
timeout = additionalOptions.methodResponseTimeoutMs;
|
|
6865
6865
|
additionalOptionsCopy = additionalOptions;
|
|
6866
6866
|
invokePromises = serversMethodMap.map(function (serversMethodPair) {
|
|
6867
|
-
var invId = shortid
|
|
6867
|
+
var invId = shortid();
|
|
6868
6868
|
var method = serversMethodPair.methods[0];
|
|
6869
6869
|
var server = serversMethodPair.server;
|
|
6870
6870
|
var invokePromise = _this.protocol.client.invoke(invId, method, argumentObj, server, additionalOptionsCopy);
|
|
@@ -7645,7 +7645,7 @@
|
|
|
7645
7645
|
});
|
|
7646
7646
|
this.wrapped.user = resolvedIdentity.user;
|
|
7647
7647
|
this.wrapped.instance = resolvedIdentity.instance;
|
|
7648
|
-
this.wrapped.application = (_a = resolvedIdentity.application) !== null && _a !== void 0 ? _a : shortid
|
|
7648
|
+
this.wrapped.application = (_a = resolvedIdentity.application) !== null && _a !== void 0 ? _a : shortid();
|
|
7649
7649
|
this.wrapped.applicationName = resolvedIdentity.applicationName;
|
|
7650
7650
|
this.wrapped.pid = (_c = (_b = resolvedIdentity.pid) !== null && _b !== void 0 ? _b : resolvedIdentity.process) !== null && _c !== void 0 ? _c : Math.floor(Math.random() * 10000000000);
|
|
7651
7651
|
this.wrapped.machine = resolvedIdentity.machine;
|
|
@@ -7669,7 +7669,7 @@
|
|
|
7669
7669
|
this.API = API;
|
|
7670
7670
|
this.servers = {};
|
|
7671
7671
|
this.methodsCount = {};
|
|
7672
|
-
this.callbacks = lib$1
|
|
7672
|
+
this.callbacks = lib$1();
|
|
7673
7673
|
var peerId = this.API.instance.peerId;
|
|
7674
7674
|
this.myServer = {
|
|
7675
7675
|
id: peerId,
|
|
@@ -7924,7 +7924,7 @@
|
|
|
7924
7924
|
this.repository = repository;
|
|
7925
7925
|
this.serverRepository = serverRepository;
|
|
7926
7926
|
this.ERR_URI_SUBSCRIPTION_FAILED = "com.tick42.agm.errors.subscription.failure";
|
|
7927
|
-
this.callbacks = lib$1
|
|
7927
|
+
this.callbacks = lib$1();
|
|
7928
7928
|
this.nextStreamId = 0;
|
|
7929
7929
|
session.on("add-interest", function (msg) {
|
|
7930
7930
|
_this.handleAddInterest(msg);
|
|
@@ -8186,7 +8186,7 @@
|
|
|
8186
8186
|
this.clientRepository = clientRepository;
|
|
8187
8187
|
this.serverRepository = serverRepository;
|
|
8188
8188
|
this.logger = logger;
|
|
8189
|
-
this.callbacks = lib$1
|
|
8189
|
+
this.callbacks = lib$1();
|
|
8190
8190
|
this.streaming = new ServerStreaming(session, clientRepository, serverRepository);
|
|
8191
8191
|
this.session.on("invoke", function (msg) { return _this.handleInvokeMessage(msg); });
|
|
8192
8192
|
}
|
|
@@ -8398,7 +8398,7 @@
|
|
|
8398
8398
|
}
|
|
8399
8399
|
TimedCache.prototype.add = function (element) {
|
|
8400
8400
|
var _this = this;
|
|
8401
|
-
var id = shortid
|
|
8401
|
+
var id = shortid();
|
|
8402
8402
|
this.cache.push({ id: id, element: element });
|
|
8403
8403
|
var timeoutId = setTimeout(function () {
|
|
8404
8404
|
var elementIdx = _this.cache.findIndex(function (entry) { return entry.id === id; });
|
|
@@ -9260,7 +9260,7 @@
|
|
|
9260
9260
|
canUpdateMetric: canUpdateMetric,
|
|
9261
9261
|
system: "Glue42",
|
|
9262
9262
|
service: (_c = (_b = identity === null || identity === void 0 ? void 0 : identity.service) !== null && _b !== void 0 ? _b : iodesktop === null || iodesktop === void 0 ? void 0 : iodesktop.applicationName) !== null && _c !== void 0 ? _c : internalConfig.application,
|
|
9263
|
-
instance: (_e = (_d = identity === null || identity === void 0 ? void 0 : identity.instance) !== null && _d !== void 0 ? _d : identity === null || identity === void 0 ? void 0 : identity.windowId) !== null && _e !== void 0 ? _e : shortid
|
|
9263
|
+
instance: (_e = (_d = identity === null || identity === void 0 ? void 0 : identity.instance) !== null && _d !== void 0 ? _d : identity === null || identity === void 0 ? void 0 : identity.windowId) !== null && _e !== void 0 ? _e : shortid(),
|
|
9264
9264
|
disableAutoAppSystem: disableAutoAppSystem,
|
|
9265
9265
|
pagePerformanceMetrics: typeof config !== "boolean" ? config === null || config === void 0 ? void 0 : config.pagePerformanceMetrics : undefined
|
|
9266
9266
|
});
|
|
@@ -12499,7 +12499,7 @@
|
|
|
12499
12499
|
};
|
|
12500
12500
|
}
|
|
12501
12501
|
createRegistry.default = createRegistry;
|
|
12502
|
-
var lib
|
|
12502
|
+
var lib = createRegistry;
|
|
12503
12503
|
|
|
12504
12504
|
function objectValues(source) {
|
|
12505
12505
|
if (!source) {
|
|
@@ -12531,7 +12531,7 @@
|
|
|
12531
12531
|
this._name = _name;
|
|
12532
12532
|
this._agm = _agm;
|
|
12533
12533
|
this._configuration = _configuration;
|
|
12534
|
-
this._registry = lib
|
|
12534
|
+
this._registry = lib();
|
|
12535
12535
|
_appManager.onInstanceStarted((instance) => {
|
|
12536
12536
|
if (instance.application && instance.application.name !== this._name) {
|
|
12537
12537
|
return;
|
|
@@ -12795,7 +12795,7 @@
|
|
|
12795
12795
|
this._activities = _activities;
|
|
12796
12796
|
this._windows = _windows;
|
|
12797
12797
|
this._configuration = _configuration;
|
|
12798
|
-
this._registry = lib
|
|
12798
|
+
this._registry = lib();
|
|
12799
12799
|
if (startFailed) {
|
|
12800
12800
|
return;
|
|
12801
12801
|
}
|
|
@@ -12979,7 +12979,7 @@
|
|
|
12979
12979
|
this._configuration = _configuration;
|
|
12980
12980
|
this._apps = {};
|
|
12981
12981
|
this._instances = [];
|
|
12982
|
-
this._registry = lib
|
|
12982
|
+
this._registry = lib();
|
|
12983
12983
|
this.getConfigurations = async (apps) => {
|
|
12984
12984
|
const args = {
|
|
12985
12985
|
v2: {
|
|
@@ -13236,7 +13236,7 @@
|
|
|
13236
13236
|
class EntitlementsImpl {
|
|
13237
13237
|
constructor(_agm) {
|
|
13238
13238
|
this._agm = _agm;
|
|
13239
|
-
this._registry = lib
|
|
13239
|
+
this._registry = lib();
|
|
13240
13240
|
this._isMethodRegistered = false;
|
|
13241
13241
|
this.handleBranchModified = (branch) => {
|
|
13242
13242
|
this._registry.execute("branchChanged", branch);
|
|
@@ -13582,309 +13582,124 @@
|
|
|
13582
13582
|
return api;
|
|
13583
13583
|
};
|
|
13584
13584
|
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
|
|
13589
|
-
|
|
13590
|
-
|
|
13591
|
-
|
|
13592
|
-
|
|
13593
|
-
|
|
13594
|
-
/**
|
|
13595
|
-
* return a random number based on a seed
|
|
13596
|
-
* @param seed
|
|
13597
|
-
* @returns {number}
|
|
13598
|
-
*/
|
|
13599
|
-
function getNextValue() {
|
|
13600
|
-
seed = (seed * 9301 + 49297) % 233280;
|
|
13601
|
-
return seed/(233280.0);
|
|
13602
|
-
}
|
|
13603
|
-
|
|
13604
|
-
function setSeed$1(_seed_) {
|
|
13605
|
-
seed = _seed_;
|
|
13606
|
-
}
|
|
13607
|
-
|
|
13608
|
-
var randomFromSeed = {
|
|
13609
|
-
nextValue: getNextValue,
|
|
13610
|
-
seed: setSeed$1
|
|
13585
|
+
let urlAlphabet =
|
|
13586
|
+
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
|
|
13587
|
+
let nanoid = (size = 21) => {
|
|
13588
|
+
let id = '';
|
|
13589
|
+
let i = size;
|
|
13590
|
+
while (i--) {
|
|
13591
|
+
id += urlAlphabet[(Math.random() * 64) | 0];
|
|
13592
|
+
}
|
|
13593
|
+
return id
|
|
13611
13594
|
};
|
|
13612
13595
|
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
13620
|
-
|
|
13621
|
-
|
|
13622
|
-
|
|
13623
|
-
|
|
13624
|
-
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
|
|
13628
|
-
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
|
|
13633
|
-
|
|
13634
|
-
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13656
|
-
|
|
13657
|
-
|
|
13658
|
-
|
|
13659
|
-
|
|
13660
|
-
|
|
13661
|
-
|
|
13662
|
-
|
|
13663
|
-
|
|
13664
|
-
|
|
13665
|
-
|
|
13666
|
-
|
|
13667
|
-
|
|
13668
|
-
|
|
13669
|
-
|
|
13670
|
-
|
|
13671
|
-
|
|
13672
|
-
|
|
13673
|
-
|
|
13674
|
-
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
|
|
13680
|
-
|
|
13596
|
+
class Utils {
|
|
13597
|
+
static getGDMajorVersion() {
|
|
13598
|
+
if (typeof window === "undefined") {
|
|
13599
|
+
return -1;
|
|
13600
|
+
}
|
|
13601
|
+
if (!window.glueDesktop) {
|
|
13602
|
+
return -1;
|
|
13603
|
+
}
|
|
13604
|
+
if (!window.glueDesktop.version) {
|
|
13605
|
+
return -1;
|
|
13606
|
+
}
|
|
13607
|
+
const ver = Number(window.glueDesktop.version.substr(0, 1));
|
|
13608
|
+
return isNaN(ver) ? -1 : ver;
|
|
13609
|
+
}
|
|
13610
|
+
static callbackifyPromise(action, successCallback, errorCallback) {
|
|
13611
|
+
const fail = (error) => {
|
|
13612
|
+
let msg = error;
|
|
13613
|
+
if (error instanceof Error) {
|
|
13614
|
+
msg = error.message;
|
|
13615
|
+
}
|
|
13616
|
+
if (typeof errorCallback === "function") {
|
|
13617
|
+
errorCallback(msg);
|
|
13618
|
+
return;
|
|
13619
|
+
}
|
|
13620
|
+
return Promise.reject(msg);
|
|
13621
|
+
};
|
|
13622
|
+
try {
|
|
13623
|
+
return action()
|
|
13624
|
+
.then((result) => {
|
|
13625
|
+
if (typeof successCallback === "function") {
|
|
13626
|
+
successCallback(result);
|
|
13627
|
+
}
|
|
13628
|
+
return result;
|
|
13629
|
+
})
|
|
13630
|
+
.catch((error) => {
|
|
13631
|
+
return fail(error);
|
|
13632
|
+
});
|
|
13633
|
+
}
|
|
13634
|
+
catch (err) {
|
|
13635
|
+
return fail(err);
|
|
13636
|
+
}
|
|
13637
|
+
}
|
|
13638
|
+
static getMonitor(bounds, displays) {
|
|
13639
|
+
const monitorsSortedByOverlap = displays.map((m) => {
|
|
13640
|
+
const { left, top, workingAreaWidth: width, workingAreaHeight: height } = m;
|
|
13641
|
+
const overlap = this.calculateTotalOverlap({ left, top, width, height }, bounds);
|
|
13642
|
+
return {
|
|
13643
|
+
monitor: m,
|
|
13644
|
+
totalOverlap: overlap
|
|
13645
|
+
};
|
|
13646
|
+
}).sort((a, b) => b.totalOverlap - a.totalOverlap);
|
|
13647
|
+
return monitorsSortedByOverlap[0].monitor;
|
|
13648
|
+
}
|
|
13649
|
+
static getDisplayCenterOfScreen(a, currentDisplay, primaryDisplay) {
|
|
13650
|
+
const physicalWidth = a.width / currentDisplay.scaleFactor;
|
|
13651
|
+
const physicalHeight = a.height / currentDisplay.scaleFactor;
|
|
13652
|
+
const physicalDisplayLeft = currentDisplay.workArea.left / primaryDisplay.scaleFactor;
|
|
13653
|
+
const physicalDisplayTop = currentDisplay.workArea.top / primaryDisplay.scaleFactor;
|
|
13654
|
+
const physicalDisplayWidth = currentDisplay.workArea.width / currentDisplay.scaleFactor;
|
|
13655
|
+
const physicalDisplayHeight = currentDisplay.workArea.height / currentDisplay.scaleFactor;
|
|
13656
|
+
const physicalHOffset = Math.max((physicalDisplayWidth - physicalWidth) / 2, 0);
|
|
13657
|
+
const physicalVOffset = Math.max((physicalDisplayHeight - physicalHeight) / 2, 0);
|
|
13658
|
+
const centeredPhysicalLeft = Math.floor(physicalDisplayLeft + physicalHOffset);
|
|
13659
|
+
const centeredPhysicalTop = Math.floor(physicalDisplayTop + physicalVOffset);
|
|
13660
|
+
const left = centeredPhysicalLeft * primaryDisplay.scaleFactor;
|
|
13661
|
+
const top = centeredPhysicalTop * primaryDisplay.scaleFactor;
|
|
13662
|
+
return {
|
|
13663
|
+
left,
|
|
13664
|
+
top,
|
|
13665
|
+
width: a.width,
|
|
13666
|
+
height: a.height
|
|
13667
|
+
};
|
|
13668
|
+
}
|
|
13669
|
+
static isNode() {
|
|
13670
|
+
if (typeof Utils._isNode !== "undefined") {
|
|
13671
|
+
return Utils._isNode;
|
|
13672
|
+
}
|
|
13673
|
+
if (typeof window !== "undefined") {
|
|
13674
|
+
Utils._isNode = false;
|
|
13675
|
+
return false;
|
|
13676
|
+
}
|
|
13677
|
+
try {
|
|
13678
|
+
Utils._isNode = Object.prototype.toString.call(global.process) === "[object process]";
|
|
13679
|
+
}
|
|
13680
|
+
catch (e) {
|
|
13681
|
+
Utils._isNode = false;
|
|
13682
|
+
}
|
|
13683
|
+
return Utils._isNode;
|
|
13684
|
+
}
|
|
13685
|
+
static generateId() {
|
|
13686
|
+
return nanoid(10);
|
|
13687
|
+
}
|
|
13688
|
+
static calculateTotalOverlap(r1, r2) {
|
|
13689
|
+
const r1x = r1.left;
|
|
13690
|
+
const r1y = r1.top;
|
|
13691
|
+
const r1xMax = r1x + r1.width;
|
|
13692
|
+
const r1yMax = r1y + r1.height;
|
|
13693
|
+
const r2x = r2.left;
|
|
13694
|
+
const r2y = r2.top;
|
|
13695
|
+
const r2xMax = r2x + r2.width;
|
|
13696
|
+
const r2yMax = r2y + r2.height;
|
|
13697
|
+
const xOverlap = Math.max(0, Math.min(r1xMax, r2xMax) - Math.max(r1x, r2x));
|
|
13698
|
+
const yOverlap = Math.max(0, Math.min(r1yMax, r2yMax) - Math.max(r1y, r2y));
|
|
13699
|
+
return xOverlap * yOverlap;
|
|
13700
|
+
}
|
|
13681
13701
|
}
|
|
13682
13702
|
|
|
13683
|
-
function getShuffled() {
|
|
13684
|
-
if (shuffled) {
|
|
13685
|
-
return shuffled;
|
|
13686
|
-
}
|
|
13687
|
-
shuffled = shuffle();
|
|
13688
|
-
return shuffled;
|
|
13689
|
-
}
|
|
13690
|
-
|
|
13691
|
-
/**
|
|
13692
|
-
* lookup shuffled letter
|
|
13693
|
-
* @param index
|
|
13694
|
-
* @returns {string}
|
|
13695
|
-
*/
|
|
13696
|
-
function lookup(index) {
|
|
13697
|
-
var alphabetShuffled = getShuffled();
|
|
13698
|
-
return alphabetShuffled[index];
|
|
13699
|
-
}
|
|
13700
|
-
|
|
13701
|
-
var alphabet_1 = {
|
|
13702
|
-
characters: characters,
|
|
13703
|
-
seed: setSeed,
|
|
13704
|
-
lookup: lookup,
|
|
13705
|
-
shuffled: getShuffled
|
|
13706
|
-
};
|
|
13707
|
-
|
|
13708
|
-
var crypto = typeof window === 'object' && (window.crypto || window.msCrypto); // IE 11 uses window.msCrypto
|
|
13709
|
-
|
|
13710
|
-
function randomByte() {
|
|
13711
|
-
if (!crypto || !crypto.getRandomValues) {
|
|
13712
|
-
return Math.floor(Math.random() * 256) & 0x30;
|
|
13713
|
-
}
|
|
13714
|
-
var dest = new Uint8Array(1);
|
|
13715
|
-
crypto.getRandomValues(dest);
|
|
13716
|
-
return dest[0] & 0x30;
|
|
13717
|
-
}
|
|
13718
|
-
|
|
13719
|
-
var randomByteBrowser = randomByte;
|
|
13720
|
-
|
|
13721
|
-
function encode(lookup, number) {
|
|
13722
|
-
var loopCounter = 0;
|
|
13723
|
-
var done;
|
|
13724
|
-
|
|
13725
|
-
var str = '';
|
|
13726
|
-
|
|
13727
|
-
while (!done) {
|
|
13728
|
-
str = str + lookup( ( (number >> (4 * loopCounter)) & 0x0f ) | randomByteBrowser() );
|
|
13729
|
-
done = number < (Math.pow(16, loopCounter + 1 ) );
|
|
13730
|
-
loopCounter++;
|
|
13731
|
-
}
|
|
13732
|
-
return str;
|
|
13733
|
-
}
|
|
13734
|
-
|
|
13735
|
-
var encode_1 = encode;
|
|
13736
|
-
|
|
13737
|
-
/**
|
|
13738
|
-
* Decode the id to get the version and worker
|
|
13739
|
-
* Mainly for debugging and testing.
|
|
13740
|
-
* @param id - the shortid-generated id.
|
|
13741
|
-
*/
|
|
13742
|
-
function decode(id) {
|
|
13743
|
-
var characters = alphabet_1.shuffled();
|
|
13744
|
-
return {
|
|
13745
|
-
version: characters.indexOf(id.substr(0, 1)) & 0x0f,
|
|
13746
|
-
worker: characters.indexOf(id.substr(1, 1)) & 0x0f
|
|
13747
|
-
};
|
|
13748
|
-
}
|
|
13749
|
-
|
|
13750
|
-
var decode_1 = decode;
|
|
13751
|
-
|
|
13752
|
-
// Ignore all milliseconds before a certain time to reduce the size of the date entropy without sacrificing uniqueness.
|
|
13753
|
-
// This number should be updated every year or so to keep the generated id short.
|
|
13754
|
-
// To regenerate `new Date() - 0` and bump the version. Always bump the version!
|
|
13755
|
-
var REDUCE_TIME = 1459707606518;
|
|
13756
|
-
|
|
13757
|
-
// don't change unless we change the algos or REDUCE_TIME
|
|
13758
|
-
// must be an integer and less than 16
|
|
13759
|
-
var version$1 = 6;
|
|
13760
|
-
|
|
13761
|
-
// Counter is used when shortid is called multiple times in one second.
|
|
13762
|
-
var counter;
|
|
13763
|
-
|
|
13764
|
-
// Remember the last time shortid was called in case counter is needed.
|
|
13765
|
-
var previousSeconds;
|
|
13766
|
-
|
|
13767
|
-
/**
|
|
13768
|
-
* Generate unique id
|
|
13769
|
-
* Returns string id
|
|
13770
|
-
*/
|
|
13771
|
-
function build(clusterWorkerId) {
|
|
13772
|
-
|
|
13773
|
-
var str = '';
|
|
13774
|
-
|
|
13775
|
-
var seconds = Math.floor((Date.now() - REDUCE_TIME) * 0.001);
|
|
13776
|
-
|
|
13777
|
-
if (seconds === previousSeconds) {
|
|
13778
|
-
counter++;
|
|
13779
|
-
} else {
|
|
13780
|
-
counter = 0;
|
|
13781
|
-
previousSeconds = seconds;
|
|
13782
|
-
}
|
|
13783
|
-
|
|
13784
|
-
str = str + encode_1(alphabet_1.lookup, version$1);
|
|
13785
|
-
str = str + encode_1(alphabet_1.lookup, clusterWorkerId);
|
|
13786
|
-
if (counter > 0) {
|
|
13787
|
-
str = str + encode_1(alphabet_1.lookup, counter);
|
|
13788
|
-
}
|
|
13789
|
-
str = str + encode_1(alphabet_1.lookup, seconds);
|
|
13790
|
-
|
|
13791
|
-
return str;
|
|
13792
|
-
}
|
|
13793
|
-
|
|
13794
|
-
var build_1 = build;
|
|
13795
|
-
|
|
13796
|
-
function isShortId(id) {
|
|
13797
|
-
if (!id || typeof id !== 'string' || id.length < 6 ) {
|
|
13798
|
-
return false;
|
|
13799
|
-
}
|
|
13800
|
-
|
|
13801
|
-
var characters = alphabet_1.characters();
|
|
13802
|
-
var len = id.length;
|
|
13803
|
-
for(var i = 0; i < len;i++) {
|
|
13804
|
-
if (characters.indexOf(id[i]) === -1) {
|
|
13805
|
-
return false;
|
|
13806
|
-
}
|
|
13807
|
-
}
|
|
13808
|
-
return true;
|
|
13809
|
-
}
|
|
13810
|
-
|
|
13811
|
-
var isValid = isShortId;
|
|
13812
|
-
|
|
13813
|
-
var lib = createCommonjsModule(function (module) {
|
|
13814
|
-
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
// if you are using cluster or multiple servers use this to make each instance
|
|
13822
|
-
// has a unique value for worker
|
|
13823
|
-
// Note: I don't know if this is automatically set when using third
|
|
13824
|
-
// party cluster solutions such as pm2.
|
|
13825
|
-
var clusterWorkerId = 0;
|
|
13826
|
-
|
|
13827
|
-
/**
|
|
13828
|
-
* Set the seed.
|
|
13829
|
-
* Highly recommended if you don't want people to try to figure out your id schema.
|
|
13830
|
-
* exposed as shortid.seed(int)
|
|
13831
|
-
* @param seed Integer value to seed the random alphabet. ALWAYS USE THE SAME SEED or you might get overlaps.
|
|
13832
|
-
*/
|
|
13833
|
-
function seed(seedValue) {
|
|
13834
|
-
alphabet_1.seed(seedValue);
|
|
13835
|
-
return module.exports;
|
|
13836
|
-
}
|
|
13837
|
-
|
|
13838
|
-
/**
|
|
13839
|
-
* Set the cluster worker or machine id
|
|
13840
|
-
* exposed as shortid.worker(int)
|
|
13841
|
-
* @param workerId worker must be positive integer. Number less than 16 is recommended.
|
|
13842
|
-
* returns shortid module so it can be chained.
|
|
13843
|
-
*/
|
|
13844
|
-
function worker(workerId) {
|
|
13845
|
-
clusterWorkerId = workerId;
|
|
13846
|
-
return module.exports;
|
|
13847
|
-
}
|
|
13848
|
-
|
|
13849
|
-
/**
|
|
13850
|
-
*
|
|
13851
|
-
* sets new characters to use in the alphabet
|
|
13852
|
-
* returns the shuffled alphabet
|
|
13853
|
-
*/
|
|
13854
|
-
function characters(newCharacters) {
|
|
13855
|
-
if (newCharacters !== undefined) {
|
|
13856
|
-
alphabet_1.characters(newCharacters);
|
|
13857
|
-
}
|
|
13858
|
-
|
|
13859
|
-
return alphabet_1.shuffled();
|
|
13860
|
-
}
|
|
13861
|
-
|
|
13862
|
-
/**
|
|
13863
|
-
* Generate unique id
|
|
13864
|
-
* Returns string id
|
|
13865
|
-
*/
|
|
13866
|
-
function generate() {
|
|
13867
|
-
return build_1(clusterWorkerId);
|
|
13868
|
-
}
|
|
13869
|
-
|
|
13870
|
-
// Export all other functions as properties of the generate function
|
|
13871
|
-
module.exports = generate;
|
|
13872
|
-
module.exports.generate = generate;
|
|
13873
|
-
module.exports.seed = seed;
|
|
13874
|
-
module.exports.worker = worker;
|
|
13875
|
-
module.exports.characters = characters;
|
|
13876
|
-
module.exports.decode = decode_1;
|
|
13877
|
-
module.exports.isValid = isValid;
|
|
13878
|
-
});
|
|
13879
|
-
lib.generate;
|
|
13880
|
-
lib.seed;
|
|
13881
|
-
lib.worker;
|
|
13882
|
-
lib.characters;
|
|
13883
|
-
lib.decode;
|
|
13884
|
-
lib.isValid;
|
|
13885
|
-
|
|
13886
|
-
var shortid = lib;
|
|
13887
|
-
|
|
13888
13703
|
const T42JumpListAction = "T42.JumpList.Action";
|
|
13889
13704
|
class JumpListManager {
|
|
13890
13705
|
constructor() {
|
|
@@ -13974,7 +13789,7 @@
|
|
|
13974
13789
|
const updateAction = {
|
|
13975
13790
|
icon: action.icon,
|
|
13976
13791
|
callback: action.callback,
|
|
13977
|
-
callbackId:
|
|
13792
|
+
callbackId: Utils.generateId(),
|
|
13978
13793
|
singleInstanceTitle: action.singleInstanceTitle,
|
|
13979
13794
|
multiInstanceTitle: action.multiInstanceTitle,
|
|
13980
13795
|
operation
|
|
@@ -14070,7 +13885,7 @@
|
|
|
14070
13885
|
this._windows = {};
|
|
14071
13886
|
this._pendingWindows = {};
|
|
14072
13887
|
this._pendingWindowsStates = {};
|
|
14073
|
-
this._registry = lib
|
|
13888
|
+
this._registry = lib();
|
|
14074
13889
|
}
|
|
14075
13890
|
init(logger) {
|
|
14076
13891
|
this._logger = logger;
|
|
@@ -14135,10 +13950,12 @@
|
|
|
14135
13950
|
}
|
|
14136
13951
|
waitFor(id) {
|
|
14137
13952
|
return new Promise((resolve, reject) => {
|
|
14138
|
-
let
|
|
13953
|
+
let unReady;
|
|
13954
|
+
let unRemoved;
|
|
14139
13955
|
const timeout = setTimeout(() => {
|
|
14140
|
-
|
|
14141
|
-
|
|
13956
|
+
unReady();
|
|
13957
|
+
unRemoved();
|
|
13958
|
+
reject(`Window with id "${id}" was not ready within ${this.waitForTimeoutInMilliseconds} milliseconds.`);
|
|
14142
13959
|
}, this.waitForTimeoutInMilliseconds);
|
|
14143
13960
|
const win = this._windows[id];
|
|
14144
13961
|
if (win) {
|
|
@@ -14146,14 +13963,25 @@
|
|
|
14146
13963
|
resolve(win);
|
|
14147
13964
|
}
|
|
14148
13965
|
else {
|
|
14149
|
-
|
|
13966
|
+
const cleanup = () => {
|
|
13967
|
+
clearTimeout(timeout);
|
|
13968
|
+
unReady();
|
|
13969
|
+
unRemoved();
|
|
13970
|
+
};
|
|
13971
|
+
unReady = this.onReadyWindow((w) => {
|
|
14150
13972
|
if (w.API.id !== id) {
|
|
14151
13973
|
return;
|
|
14152
13974
|
}
|
|
14153
|
-
|
|
14154
|
-
un();
|
|
13975
|
+
cleanup();
|
|
14155
13976
|
resolve(w);
|
|
14156
13977
|
});
|
|
13978
|
+
unRemoved = this.onRemoved((w) => {
|
|
13979
|
+
if (w.API.id !== id) {
|
|
13980
|
+
return;
|
|
13981
|
+
}
|
|
13982
|
+
cleanup();
|
|
13983
|
+
reject(`Window with id "${id}" was removed before it became ready.`);
|
|
13984
|
+
});
|
|
14157
13985
|
}
|
|
14158
13986
|
});
|
|
14159
13987
|
}
|
|
@@ -14177,110 +14005,6 @@
|
|
|
14177
14005
|
}
|
|
14178
14006
|
var windowStore = new WindowStore();
|
|
14179
14007
|
|
|
14180
|
-
class Utils {
|
|
14181
|
-
static getGDMajorVersion() {
|
|
14182
|
-
if (typeof window === "undefined") {
|
|
14183
|
-
return -1;
|
|
14184
|
-
}
|
|
14185
|
-
if (!window.glueDesktop) {
|
|
14186
|
-
return -1;
|
|
14187
|
-
}
|
|
14188
|
-
if (!window.glueDesktop.version) {
|
|
14189
|
-
return -1;
|
|
14190
|
-
}
|
|
14191
|
-
const ver = Number(window.glueDesktop.version.substr(0, 1));
|
|
14192
|
-
return isNaN(ver) ? -1 : ver;
|
|
14193
|
-
}
|
|
14194
|
-
static callbackifyPromise(action, successCallback, errorCallback) {
|
|
14195
|
-
const fail = (error) => {
|
|
14196
|
-
let msg = error;
|
|
14197
|
-
if (error instanceof Error) {
|
|
14198
|
-
msg = error.message;
|
|
14199
|
-
}
|
|
14200
|
-
if (typeof errorCallback === "function") {
|
|
14201
|
-
errorCallback(msg);
|
|
14202
|
-
return;
|
|
14203
|
-
}
|
|
14204
|
-
return Promise.reject(msg);
|
|
14205
|
-
};
|
|
14206
|
-
try {
|
|
14207
|
-
return action()
|
|
14208
|
-
.then((result) => {
|
|
14209
|
-
if (typeof successCallback === "function") {
|
|
14210
|
-
successCallback(result);
|
|
14211
|
-
}
|
|
14212
|
-
return result;
|
|
14213
|
-
})
|
|
14214
|
-
.catch((error) => {
|
|
14215
|
-
return fail(error);
|
|
14216
|
-
});
|
|
14217
|
-
}
|
|
14218
|
-
catch (err) {
|
|
14219
|
-
return fail(err);
|
|
14220
|
-
}
|
|
14221
|
-
}
|
|
14222
|
-
static getMonitor(bounds, displays) {
|
|
14223
|
-
const monitorsSortedByOverlap = displays.map((m) => {
|
|
14224
|
-
const { left, top, workingAreaWidth: width, workingAreaHeight: height } = m;
|
|
14225
|
-
const overlap = this.calculateTotalOverlap({ left, top, width, height }, bounds);
|
|
14226
|
-
return {
|
|
14227
|
-
monitor: m,
|
|
14228
|
-
totalOverlap: overlap
|
|
14229
|
-
};
|
|
14230
|
-
}).sort((a, b) => b.totalOverlap - a.totalOverlap);
|
|
14231
|
-
return monitorsSortedByOverlap[0].monitor;
|
|
14232
|
-
}
|
|
14233
|
-
static getDisplayCenterOfScreen(a, currentDisplay, primaryDisplay) {
|
|
14234
|
-
const physicalWidth = a.width / currentDisplay.scaleFactor;
|
|
14235
|
-
const physicalHeight = a.height / currentDisplay.scaleFactor;
|
|
14236
|
-
const physicalDisplayLeft = currentDisplay.workArea.left / primaryDisplay.scaleFactor;
|
|
14237
|
-
const physicalDisplayTop = currentDisplay.workArea.top / primaryDisplay.scaleFactor;
|
|
14238
|
-
const physicalDisplayWidth = currentDisplay.workArea.width / currentDisplay.scaleFactor;
|
|
14239
|
-
const physicalDisplayHeight = currentDisplay.workArea.height / currentDisplay.scaleFactor;
|
|
14240
|
-
const physicalHOffset = Math.max((physicalDisplayWidth - physicalWidth) / 2, 0);
|
|
14241
|
-
const physicalVOffset = Math.max((physicalDisplayHeight - physicalHeight) / 2, 0);
|
|
14242
|
-
const centeredPhysicalLeft = Math.floor(physicalDisplayLeft + physicalHOffset);
|
|
14243
|
-
const centeredPhysicalTop = Math.floor(physicalDisplayTop + physicalVOffset);
|
|
14244
|
-
const left = centeredPhysicalLeft * primaryDisplay.scaleFactor;
|
|
14245
|
-
const top = centeredPhysicalTop * primaryDisplay.scaleFactor;
|
|
14246
|
-
return {
|
|
14247
|
-
left,
|
|
14248
|
-
top,
|
|
14249
|
-
width: a.width,
|
|
14250
|
-
height: a.height
|
|
14251
|
-
};
|
|
14252
|
-
}
|
|
14253
|
-
static isNode() {
|
|
14254
|
-
if (typeof Utils._isNode !== "undefined") {
|
|
14255
|
-
return Utils._isNode;
|
|
14256
|
-
}
|
|
14257
|
-
if (typeof window !== "undefined") {
|
|
14258
|
-
Utils._isNode = false;
|
|
14259
|
-
return false;
|
|
14260
|
-
}
|
|
14261
|
-
try {
|
|
14262
|
-
Utils._isNode = Object.prototype.toString.call(global.process) === "[object process]";
|
|
14263
|
-
}
|
|
14264
|
-
catch (e) {
|
|
14265
|
-
Utils._isNode = false;
|
|
14266
|
-
}
|
|
14267
|
-
return Utils._isNode;
|
|
14268
|
-
}
|
|
14269
|
-
static calculateTotalOverlap(r1, r2) {
|
|
14270
|
-
const r1x = r1.left;
|
|
14271
|
-
const r1y = r1.top;
|
|
14272
|
-
const r1xMax = r1x + r1.width;
|
|
14273
|
-
const r1yMax = r1y + r1.height;
|
|
14274
|
-
const r2x = r2.left;
|
|
14275
|
-
const r2y = r2.top;
|
|
14276
|
-
const r2xMax = r2x + r2.width;
|
|
14277
|
-
const r2yMax = r2y + r2.height;
|
|
14278
|
-
const xOverlap = Math.max(0, Math.min(r1xMax, r2xMax) - Math.max(r1x, r2x));
|
|
14279
|
-
const yOverlap = Math.max(0, Math.min(r1yMax, r2yMax) - Math.max(r1y, r2y));
|
|
14280
|
-
return xOverlap * yOverlap;
|
|
14281
|
-
}
|
|
14282
|
-
}
|
|
14283
|
-
|
|
14284
14008
|
class JumpListActions {
|
|
14285
14009
|
constructor(windowId, configuration) {
|
|
14286
14010
|
this.windowId = windowId;
|
|
@@ -14346,7 +14070,7 @@
|
|
|
14346
14070
|
|
|
14347
14071
|
var windowFactory = (id, options, executor, logger, appManagerGetter, displayAPIGetter, channelsAPIGetter, agm) => {
|
|
14348
14072
|
var _a, _b, _c, _d;
|
|
14349
|
-
const _registry = lib
|
|
14073
|
+
const _registry = lib();
|
|
14350
14074
|
const getChannels = () => {
|
|
14351
14075
|
const channels = channelsAPIGetter();
|
|
14352
14076
|
if (!channels) {
|
|
@@ -14367,6 +14091,8 @@
|
|
|
14367
14091
|
let _groupId = options.groupId;
|
|
14368
14092
|
let _isGroupHeaderVisible = options.isGroupHeaderVisible;
|
|
14369
14093
|
let _isTabHeaderVisible = options.isTabHeaderVisible;
|
|
14094
|
+
let _isGroupHibernated = options.isGroupHibernated;
|
|
14095
|
+
let _isGroupVisible = options.isGroupVisible;
|
|
14370
14096
|
let _isTabSelected = (_c = options.isTabSelected) !== null && _c !== void 0 ? _c : false;
|
|
14371
14097
|
let _settings = options.settings;
|
|
14372
14098
|
const _applicationName = options.applicationName;
|
|
@@ -14849,6 +14575,15 @@
|
|
|
14849
14575
|
function getConfiguration() {
|
|
14850
14576
|
return executor.getWindowConfiguration(resultWindow);
|
|
14851
14577
|
}
|
|
14578
|
+
function getDockingPlacement() {
|
|
14579
|
+
return executor.getDockingPlacement(resultWindow);
|
|
14580
|
+
}
|
|
14581
|
+
function dock(opts) {
|
|
14582
|
+
return executor.dock(resultWindow, opts);
|
|
14583
|
+
}
|
|
14584
|
+
async function clone(cloneOptions) {
|
|
14585
|
+
return executor.clone(resultWindow, cloneOptions);
|
|
14586
|
+
}
|
|
14852
14587
|
function onTitleChanged(callback) {
|
|
14853
14588
|
if (!isFunction(callback)) {
|
|
14854
14589
|
throw new Error("callback should be a function");
|
|
@@ -15015,6 +14750,9 @@
|
|
|
15015
14750
|
function onNeighboursChanged(callback) {
|
|
15016
14751
|
return onEventCore("neighbours-changed", callback);
|
|
15017
14752
|
}
|
|
14753
|
+
function onDockingChanged(callback) {
|
|
14754
|
+
return onEventCore("docking-changed", callback);
|
|
14755
|
+
}
|
|
15018
14756
|
function onEventCore(key, callback, replayArguments) {
|
|
15019
14757
|
if (!isFunction(callback)) {
|
|
15020
14758
|
throw new Error("callback must be a function");
|
|
@@ -15050,6 +14788,8 @@
|
|
|
15050
14788
|
_groupId = updated.groupId;
|
|
15051
14789
|
_isGroupHeaderVisible = updated.isGroupHeaderVisible;
|
|
15052
14790
|
_isTabHeaderVisible = updated.isTabHeaderVisible;
|
|
14791
|
+
_isGroupHibernated = updated.isGroupHibernated;
|
|
14792
|
+
_isGroupVisible = updated.isGroupVisible;
|
|
15053
14793
|
_isTabSelected = updated.isTabSelected;
|
|
15054
14794
|
_settings = updated.settings;
|
|
15055
14795
|
_isVisible = updated.isVisible;
|
|
@@ -15263,6 +15003,13 @@
|
|
|
15263
15003
|
_registry.execute("placementSettingsChanged", resultWindow);
|
|
15264
15004
|
});
|
|
15265
15005
|
}
|
|
15006
|
+
function handleDockingChanged(data) {
|
|
15007
|
+
_registry.execute("docking-changed", resultWindow, {
|
|
15008
|
+
docked: data.docked,
|
|
15009
|
+
position: data.position,
|
|
15010
|
+
claimScreenArea: data.claimScreenArea
|
|
15011
|
+
});
|
|
15012
|
+
}
|
|
15266
15013
|
function handleGroupChanged(newGroup, oldGroup) {
|
|
15267
15014
|
_group = newGroup;
|
|
15268
15015
|
_groupId = newGroup === null || newGroup === void 0 ? void 0 : newGroup.id;
|
|
@@ -15568,6 +15315,9 @@
|
|
|
15568
15315
|
download,
|
|
15569
15316
|
configure,
|
|
15570
15317
|
getConfiguration,
|
|
15318
|
+
getDockingPlacement,
|
|
15319
|
+
dock,
|
|
15320
|
+
clone,
|
|
15571
15321
|
getChannel: async () => {
|
|
15572
15322
|
var _a;
|
|
15573
15323
|
const wins = await getChannels().getWindowsWithChannels({ windowIds: [_id] });
|
|
@@ -15605,6 +15355,7 @@
|
|
|
15605
15355
|
onZoomFactorChanged,
|
|
15606
15356
|
onPlacementSettingsChanged,
|
|
15607
15357
|
onNeighboursChanged,
|
|
15358
|
+
onDockingChanged,
|
|
15608
15359
|
onNavigating,
|
|
15609
15360
|
get tabs() {
|
|
15610
15361
|
return getAllTabs();
|
|
@@ -15694,11 +15445,21 @@
|
|
|
15694
15445
|
handleWindowDetached,
|
|
15695
15446
|
handleZoomFactorChanged,
|
|
15696
15447
|
handleIsStickyChanged,
|
|
15697
|
-
handlePlacementSettingsChanged
|
|
15448
|
+
handlePlacementSettingsChanged,
|
|
15449
|
+
handleDockingChanged
|
|
15450
|
+
};
|
|
15451
|
+
const groupArgs = {
|
|
15452
|
+
get isGroupHibernated() {
|
|
15453
|
+
return _isGroupHibernated;
|
|
15454
|
+
},
|
|
15455
|
+
get isGroupVisible() {
|
|
15456
|
+
return _isGroupVisible;
|
|
15457
|
+
},
|
|
15698
15458
|
};
|
|
15699
15459
|
return {
|
|
15700
15460
|
API: resultWindow,
|
|
15701
|
-
Events: events
|
|
15461
|
+
Events: events,
|
|
15462
|
+
GroupCreationArgs: groupArgs
|
|
15702
15463
|
};
|
|
15703
15464
|
};
|
|
15704
15465
|
|
|
@@ -15723,7 +15484,7 @@
|
|
|
15723
15484
|
constructor() {
|
|
15724
15485
|
this.GroupMethodName = "T42.Group.Execute";
|
|
15725
15486
|
this.WndMethodName = "T42.Wnd.Execute";
|
|
15726
|
-
this._registry = lib
|
|
15487
|
+
this._registry = lib();
|
|
15727
15488
|
this._finished = Promise.resolve();
|
|
15728
15489
|
this.unsubCallbacks = {};
|
|
15729
15490
|
}
|
|
@@ -16192,6 +15953,9 @@
|
|
|
16192
15953
|
async setModalState(windowId, isModal) {
|
|
16193
15954
|
return this.execute("setModalState", { windowId, options: { isModal } });
|
|
16194
15955
|
}
|
|
15956
|
+
async autoArrange(displayId) {
|
|
15957
|
+
return this.execute("autoArrange", { options: { displayId } });
|
|
15958
|
+
}
|
|
16195
15959
|
async handleFlydownBoundsRequested(targetId, data) {
|
|
16196
15960
|
const cancelCallback = () => data.cancel = true;
|
|
16197
15961
|
const callbackData = {
|
|
@@ -16317,7 +16081,7 @@
|
|
|
16317
16081
|
}
|
|
16318
16082
|
showDialog(resultWindow, options) {
|
|
16319
16083
|
return new Promise((res, rej) => {
|
|
16320
|
-
const token =
|
|
16084
|
+
const token = Utils.generateId();
|
|
16321
16085
|
const un = this._registry.add("event", (args) => {
|
|
16322
16086
|
if (args.type === "DialogResult" && args.windowId === resultWindow.id && args.data.token === token) {
|
|
16323
16087
|
un();
|
|
@@ -16372,6 +16136,9 @@
|
|
|
16372
16136
|
return this.nonWindowHandlers(callback, gdWindow.id, "OnClosing");
|
|
16373
16137
|
}
|
|
16374
16138
|
}
|
|
16139
|
+
onGroupClosing(callback, group) {
|
|
16140
|
+
return this.nonWindowHandlersCore(group.id, "OnClosing", true, callback);
|
|
16141
|
+
}
|
|
16375
16142
|
onRefreshing(callback, gdWindow) {
|
|
16376
16143
|
const glue42gd = typeof window !== "undefined" && window.glue42gd;
|
|
16377
16144
|
if (glue42gd && gdWindow.windowType === "electron") {
|
|
@@ -16390,27 +16157,66 @@
|
|
|
16390
16157
|
return this.nonWindowHandlers(callback, gdWindow.id, "OnNavigating");
|
|
16391
16158
|
}
|
|
16392
16159
|
}
|
|
16160
|
+
async clone(window, cloneOptions) {
|
|
16161
|
+
const args = {
|
|
16162
|
+
windowId: window.id,
|
|
16163
|
+
options: cloneOptions
|
|
16164
|
+
};
|
|
16165
|
+
const result = await this.execute("clone", args);
|
|
16166
|
+
const win = await windowStore.waitFor(result.id);
|
|
16167
|
+
return win.API;
|
|
16168
|
+
}
|
|
16393
16169
|
async goBack(resultWindow) {
|
|
16394
16170
|
await this.execute("goBack", { windowId: resultWindow.id });
|
|
16395
16171
|
}
|
|
16396
16172
|
async goForward(resultWindow) {
|
|
16397
16173
|
await this.execute("goForward", { windowId: resultWindow.id });
|
|
16398
16174
|
}
|
|
16399
|
-
|
|
16400
|
-
|
|
16175
|
+
async getDockingPlacement(window) {
|
|
16176
|
+
return this.execute("getDockingPlacement", { windowId: window.id });
|
|
16177
|
+
}
|
|
16178
|
+
dock(window, options) {
|
|
16179
|
+
return this.execute("dock", { windowId: window.id, options });
|
|
16180
|
+
}
|
|
16181
|
+
clearCallbacks(id) {
|
|
16182
|
+
const keys = Object.keys(this.unsubCallbacks);
|
|
16183
|
+
keys.forEach((key) => {
|
|
16184
|
+
if (key.startsWith(id)) {
|
|
16185
|
+
delete this.unsubCallbacks[key];
|
|
16186
|
+
}
|
|
16187
|
+
});
|
|
16188
|
+
}
|
|
16189
|
+
nonWindowHandlers(callback, targetId, type) {
|
|
16190
|
+
return this.nonWindowHandlersCore(targetId, type, false, callback);
|
|
16191
|
+
}
|
|
16192
|
+
nonWindowHandlersCore(targetId, type, isGroup, callback) {
|
|
16193
|
+
const id = `${targetId}-${type}`;
|
|
16401
16194
|
const unsub = () => {
|
|
16195
|
+
var _a;
|
|
16402
16196
|
if (this.unsubCallbacks[id]) {
|
|
16403
16197
|
const callbacks = this.unsubCallbacks[id];
|
|
16404
16198
|
this.unsubCallbacks[id] = callbacks.filter((cb) => cb !== callback);
|
|
16199
|
+
if (this.unsubCallbacks[id].length === 0) {
|
|
16200
|
+
delete this.unsubCallbacks[id];
|
|
16201
|
+
}
|
|
16405
16202
|
}
|
|
16406
|
-
const cbs = this.unsubCallbacks[id];
|
|
16203
|
+
const cbs = (_a = this.unsubCallbacks[id]) !== null && _a !== void 0 ? _a : [];
|
|
16407
16204
|
if (cbs.length === 0) {
|
|
16408
|
-
|
|
16409
|
-
|
|
16410
|
-
|
|
16411
|
-
|
|
16412
|
-
|
|
16413
|
-
|
|
16205
|
+
const options = {
|
|
16206
|
+
unsubscribe: true
|
|
16207
|
+
};
|
|
16208
|
+
if (isGroup) {
|
|
16209
|
+
this.executeGroup(type, {
|
|
16210
|
+
groupId: targetId,
|
|
16211
|
+
options
|
|
16212
|
+
});
|
|
16213
|
+
}
|
|
16214
|
+
else {
|
|
16215
|
+
this.execute(type, {
|
|
16216
|
+
windowId: targetId,
|
|
16217
|
+
options
|
|
16218
|
+
});
|
|
16219
|
+
}
|
|
16414
16220
|
}
|
|
16415
16221
|
};
|
|
16416
16222
|
if (this.unsubCallbacks[id]) {
|
|
@@ -16420,10 +16226,12 @@
|
|
|
16420
16226
|
else {
|
|
16421
16227
|
this.unsubCallbacks[id] = [callback];
|
|
16422
16228
|
}
|
|
16423
|
-
|
|
16424
|
-
|
|
16425
|
-
}
|
|
16426
|
-
|
|
16229
|
+
if (isGroup) {
|
|
16230
|
+
this.executeGroup(type, { groupId: targetId });
|
|
16231
|
+
}
|
|
16232
|
+
else {
|
|
16233
|
+
this.execute(type, { windowId: targetId });
|
|
16234
|
+
}
|
|
16427
16235
|
return unsub;
|
|
16428
16236
|
}
|
|
16429
16237
|
reformatFlydownOptions(windowId, options) {
|
|
@@ -16520,7 +16328,7 @@
|
|
|
16520
16328
|
async executeWithToken(methodName, options) {
|
|
16521
16329
|
let un;
|
|
16522
16330
|
try {
|
|
16523
|
-
const token =
|
|
16331
|
+
const token = Utils.generateId();
|
|
16524
16332
|
const event = new Promise((r) => {
|
|
16525
16333
|
un = this._registry.add("event", (data) => {
|
|
16526
16334
|
if (data.token === token) {
|
|
@@ -16599,7 +16407,7 @@
|
|
|
16599
16407
|
|
|
16600
16408
|
class GDEnvironment {
|
|
16601
16409
|
constructor(agm, logger, appManagerGetter, displayAPIGetter, channelsAPIGetter, wndId) {
|
|
16602
|
-
this._registry = lib
|
|
16410
|
+
this._registry = lib();
|
|
16603
16411
|
this._waitTimeout = 10000;
|
|
16604
16412
|
this._agm = agm;
|
|
16605
16413
|
this._logger = logger.subLogger("gd-env");
|
|
@@ -16703,6 +16511,9 @@
|
|
|
16703
16511
|
onWindowLostFocus(callback) {
|
|
16704
16512
|
return this._registry.add("lost-focus", callback);
|
|
16705
16513
|
}
|
|
16514
|
+
onWindowsAutoArrangeChanged(callback) {
|
|
16515
|
+
return this._registry.add("windows-auto-arranged-changed", callback);
|
|
16516
|
+
}
|
|
16706
16517
|
respondToEvent(args) {
|
|
16707
16518
|
if (args.type === "ShowFlydownBoundsRequested") {
|
|
16708
16519
|
return this.executor.handleFlydownBoundsRequested(args.data.windowId, args.data);
|
|
@@ -16721,6 +16532,7 @@
|
|
|
16721
16532
|
const existingWindow = windowStore.get(w.id);
|
|
16722
16533
|
if (existingWindow) {
|
|
16723
16534
|
existingWindow.Events.handleUpdate(this.mapToWindowConstructorOptions(w));
|
|
16535
|
+
existingWindow.GroupCreationArgs = this.mapToGroupCreationArgs(w);
|
|
16724
16536
|
}
|
|
16725
16537
|
else {
|
|
16726
16538
|
const win = this.createWindow(w.id, w);
|
|
@@ -16754,6 +16566,12 @@
|
|
|
16754
16566
|
this._registry.execute("window-event", windowInfo);
|
|
16755
16567
|
return;
|
|
16756
16568
|
}
|
|
16569
|
+
if (windowInfo.type === "OnWindowsAutoArrangeChanged") {
|
|
16570
|
+
const info = windowInfo;
|
|
16571
|
+
this._registry.execute("windows-auto-arranged-changed", info.data);
|
|
16572
|
+
this._registry.execute("window-event", windowInfo);
|
|
16573
|
+
return;
|
|
16574
|
+
}
|
|
16757
16575
|
const windowObjectAndEvents = windowStore.get((windowInfo).windowId);
|
|
16758
16576
|
if (!windowObjectAndEvents) {
|
|
16759
16577
|
this._logger.error(`received update for unknown window. Stream:', ${JSON.stringify(windowInfo, null, 4)}`);
|
|
@@ -16860,16 +16678,27 @@
|
|
|
16860
16678
|
if (windowInfo.type === "PlacementSettingsChanged") {
|
|
16861
16679
|
theWindowEvents.handlePlacementSettingsChanged(windowInfo.data);
|
|
16862
16680
|
}
|
|
16681
|
+
if (windowInfo.type === "DockingChanged") {
|
|
16682
|
+
theWindowEvents.handleDockingChanged(windowInfo.data);
|
|
16683
|
+
}
|
|
16863
16684
|
this._registry.execute("window-event", extendedStreamEvent);
|
|
16864
16685
|
}
|
|
16865
16686
|
createWindow(windowId, options) {
|
|
16866
16687
|
const windowObjAndEvents = windowFactory(windowId, this.mapToWindowConstructorOptions(options), executor, this._logger, this._appManagerGetter, this._displayAPIGetter, this._channelsAPIGetter, this._agm);
|
|
16688
|
+
windowObjAndEvents.GroupCreationArgs = this.mapToGroupCreationArgs(options);
|
|
16867
16689
|
windowStore.add(windowObjAndEvents);
|
|
16868
16690
|
return windowObjAndEvents;
|
|
16869
16691
|
}
|
|
16870
16692
|
async focusChanged(theWindowEvents, theWindow, focus) {
|
|
16871
16693
|
theWindowEvents.handleFocusChanged(focus);
|
|
16872
|
-
|
|
16694
|
+
try {
|
|
16695
|
+
if (!this._configuration.windowAvailableOnURLChanged) {
|
|
16696
|
+
await windowStore.waitFor(theWindow.id);
|
|
16697
|
+
}
|
|
16698
|
+
}
|
|
16699
|
+
catch (error) {
|
|
16700
|
+
return;
|
|
16701
|
+
}
|
|
16873
16702
|
if (focus) {
|
|
16874
16703
|
this._registry.execute("got-focus", theWindow);
|
|
16875
16704
|
}
|
|
@@ -16910,6 +16739,12 @@
|
|
|
16910
16739
|
applicationName: args.applicationName
|
|
16911
16740
|
};
|
|
16912
16741
|
}
|
|
16742
|
+
mapToGroupCreationArgs(args) {
|
|
16743
|
+
return {
|
|
16744
|
+
isGroupHibernated: args.isGroupHibernated,
|
|
16745
|
+
isGroupVisible: args.isGroupVisible
|
|
16746
|
+
};
|
|
16747
|
+
}
|
|
16913
16748
|
getExtendedStreamEvent(streamEvent) {
|
|
16914
16749
|
try {
|
|
16915
16750
|
if (!streamEvent.windowId) {
|
|
@@ -16960,15 +16795,18 @@
|
|
|
16960
16795
|
};
|
|
16961
16796
|
|
|
16962
16797
|
var groupFactory = (id, executor) => {
|
|
16963
|
-
const _registry = lib
|
|
16798
|
+
const _registry = lib();
|
|
16964
16799
|
const _windowsId = [];
|
|
16965
|
-
let _isHibernatedFlag
|
|
16966
|
-
let _isVisible
|
|
16800
|
+
let _isHibernatedFlag;
|
|
16801
|
+
let _isVisible;
|
|
16967
16802
|
async function addWindow(winId) {
|
|
16803
|
+
var _a, _b, _c, _d;
|
|
16968
16804
|
if (_windowsId.indexOf(winId) === -1) {
|
|
16969
16805
|
_windowsId.push(winId);
|
|
16970
16806
|
const win = windowStore.get(winId);
|
|
16971
16807
|
win.Events.handleGroupChanged(groupObject, undefined);
|
|
16808
|
+
_isHibernatedFlag = (_b = (_a = win.GroupCreationArgs.isGroupHibernated) !== null && _a !== void 0 ? _a : _isHibernatedFlag) !== null && _b !== void 0 ? _b : false;
|
|
16809
|
+
_isVisible = (_d = (_c = win.GroupCreationArgs.isGroupVisible) !== null && _c !== void 0 ? _c : _isVisible) !== null && _d !== void 0 ? _d : true;
|
|
16972
16810
|
await executor.finished;
|
|
16973
16811
|
_registry.execute("window-added", groupObject, win.API);
|
|
16974
16812
|
}
|
|
@@ -17042,7 +16880,7 @@
|
|
|
17042
16880
|
const _isGroupHeaderVisible = windowWithHiddenHeader === undefined;
|
|
17043
16881
|
return _isGroupHeaderVisible;
|
|
17044
16882
|
}
|
|
17045
|
-
function
|
|
16883
|
+
function isHibernated() {
|
|
17046
16884
|
return _isHibernatedFlag;
|
|
17047
16885
|
}
|
|
17048
16886
|
function onHeaderVisibilityChanged(callback) {
|
|
@@ -17063,6 +16901,21 @@
|
|
|
17063
16901
|
}
|
|
17064
16902
|
return _registry.add("group-visibility-changed", callback);
|
|
17065
16903
|
}
|
|
16904
|
+
function onClosing(callback) {
|
|
16905
|
+
if (typeof callback !== "function") {
|
|
16906
|
+
throw new Error("callback must be a function");
|
|
16907
|
+
}
|
|
16908
|
+
const callbackWrap = (success, error, prevent) => {
|
|
16909
|
+
const promise = callback(prevent);
|
|
16910
|
+
if (promise === null || promise === void 0 ? void 0 : promise.then) {
|
|
16911
|
+
promise.then(success).catch(error);
|
|
16912
|
+
}
|
|
16913
|
+
else {
|
|
16914
|
+
success();
|
|
16915
|
+
}
|
|
16916
|
+
};
|
|
16917
|
+
return executor.onGroupClosing(callbackWrap, groupObject);
|
|
16918
|
+
}
|
|
17066
16919
|
const groupObject = {
|
|
17067
16920
|
id,
|
|
17068
16921
|
get windows() {
|
|
@@ -17073,7 +16926,7 @@
|
|
|
17073
16926
|
return _getGroupHeaderVisibility();
|
|
17074
16927
|
},
|
|
17075
16928
|
get isHibernated() {
|
|
17076
|
-
return
|
|
16929
|
+
return isHibernated();
|
|
17077
16930
|
},
|
|
17078
16931
|
get isVisible() {
|
|
17079
16932
|
return _isVisible;
|
|
@@ -17129,7 +16982,8 @@
|
|
|
17129
16982
|
onHeaderVisibilityChanged,
|
|
17130
16983
|
onWindowAdded,
|
|
17131
16984
|
onWindowRemoved,
|
|
17132
|
-
onVisibilityChanged
|
|
16985
|
+
onVisibilityChanged,
|
|
16986
|
+
onClosing,
|
|
17133
16987
|
};
|
|
17134
16988
|
const internal = {
|
|
17135
16989
|
get windows() {
|
|
@@ -17148,7 +17002,7 @@
|
|
|
17148
17002
|
};
|
|
17149
17003
|
|
|
17150
17004
|
var groupsFactory = (environment, logger) => {
|
|
17151
|
-
const _registry = lib
|
|
17005
|
+
const _registry = lib();
|
|
17152
17006
|
const _groups = {};
|
|
17153
17007
|
let heardForWindowsCounter = -1;
|
|
17154
17008
|
const windows = windowStore.list;
|
|
@@ -17320,6 +17174,7 @@
|
|
|
17320
17174
|
const group = groupWrapper.groupAPI;
|
|
17321
17175
|
if (group.windows.length === 0) {
|
|
17322
17176
|
delete _groups[group.id];
|
|
17177
|
+
executor.clearCallbacks(group.id);
|
|
17323
17178
|
_registry.execute("group-removed", group);
|
|
17324
17179
|
}
|
|
17325
17180
|
}
|
|
@@ -17399,7 +17254,7 @@
|
|
|
17399
17254
|
};
|
|
17400
17255
|
|
|
17401
17256
|
var WindowsFactory = (agm, logger, appManagerGetter, displayAPIGetter, channelsGetter, gdMajorVersion) => {
|
|
17402
|
-
const _registry = lib
|
|
17257
|
+
const _registry = lib();
|
|
17403
17258
|
const _logger = logger;
|
|
17404
17259
|
let groups;
|
|
17405
17260
|
let environment;
|
|
@@ -17519,6 +17374,9 @@
|
|
|
17519
17374
|
const winId = win ? win.id : "";
|
|
17520
17375
|
return executor.configure(winId, options);
|
|
17521
17376
|
}
|
|
17377
|
+
function autoArrange(displayId) {
|
|
17378
|
+
return executor.autoArrange(displayId);
|
|
17379
|
+
}
|
|
17522
17380
|
function windowAdded(callback) {
|
|
17523
17381
|
return _registry.add("window-added", callback);
|
|
17524
17382
|
}
|
|
@@ -17605,6 +17463,9 @@
|
|
|
17605
17463
|
}
|
|
17606
17464
|
};
|
|
17607
17465
|
}
|
|
17466
|
+
function onArrangementChanged(callback) {
|
|
17467
|
+
return environment.onWindowsAutoArrangeChanged(callback);
|
|
17468
|
+
}
|
|
17608
17469
|
function onEvent(callback) {
|
|
17609
17470
|
let unsubFunc;
|
|
17610
17471
|
let unsubscribed = false;
|
|
@@ -17649,6 +17510,7 @@
|
|
|
17649
17510
|
onTabAttached: tabAttached,
|
|
17650
17511
|
onTabDetached: tabDetached,
|
|
17651
17512
|
onWindowFrameColorChanged,
|
|
17513
|
+
onArrangementChanged,
|
|
17652
17514
|
get groups() {
|
|
17653
17515
|
return groups.groupsAPI;
|
|
17654
17516
|
},
|
|
@@ -17657,7 +17519,8 @@
|
|
|
17657
17519
|
onEvent,
|
|
17658
17520
|
createFlydown,
|
|
17659
17521
|
showPopup,
|
|
17660
|
-
configure
|
|
17522
|
+
configure,
|
|
17523
|
+
autoArrange
|
|
17661
17524
|
};
|
|
17662
17525
|
};
|
|
17663
17526
|
|
|
@@ -17858,6 +17721,9 @@
|
|
|
17858
17721
|
if (Array.isArray(layout.instances)) {
|
|
17859
17722
|
layoutObject.options.instances = layout.instances;
|
|
17860
17723
|
}
|
|
17724
|
+
if (typeof layout.setAsCurrent === "boolean") {
|
|
17725
|
+
layoutObject.options.setAsCurrent = layout.setAsCurrent;
|
|
17726
|
+
}
|
|
17861
17727
|
}
|
|
17862
17728
|
else {
|
|
17863
17729
|
return reject(new Error(`layout type ${layout.type} is not supported`));
|
|
@@ -18153,7 +18019,7 @@
|
|
|
18153
18019
|
invokeMethodAndTrack(methodName, args, resolve, reject, skipStreamEvent) {
|
|
18154
18020
|
let streamEventReceived = skipStreamEvent;
|
|
18155
18021
|
let agmResult;
|
|
18156
|
-
const token =
|
|
18022
|
+
const token = Utils.generateId();
|
|
18157
18023
|
args.token = token;
|
|
18158
18024
|
const handleResult = () => {
|
|
18159
18025
|
if (streamEventReceived && agmResult) {
|
|
@@ -18395,7 +18261,7 @@
|
|
|
18395
18261
|
}
|
|
18396
18262
|
config.mode = config.mode || "slim";
|
|
18397
18263
|
const logger = config.logger;
|
|
18398
|
-
const callbacks = lib
|
|
18264
|
+
const callbacks = lib();
|
|
18399
18265
|
let acsStream;
|
|
18400
18266
|
if (config.mode === "full" || "fullWaitSnapshot") {
|
|
18401
18267
|
acsStream = new ACSStream(config.agm, callbacks);
|
|
@@ -18412,7 +18278,7 @@
|
|
|
18412
18278
|
constructor(_agm, _logger) {
|
|
18413
18279
|
this._agm = _agm;
|
|
18414
18280
|
this._logger = _logger;
|
|
18415
|
-
this._registry = lib
|
|
18281
|
+
this._registry = lib();
|
|
18416
18282
|
this._registered = false;
|
|
18417
18283
|
this.all = async () => {
|
|
18418
18284
|
const displays = await this.callGD(DisplayCommand.GetAll, {});
|
|
@@ -18659,7 +18525,7 @@
|
|
|
18659
18525
|
this.subsKey = "subs";
|
|
18660
18526
|
this.changedKey = "changed";
|
|
18661
18527
|
this.isInitialJoin = true;
|
|
18662
|
-
this.registry = lib
|
|
18528
|
+
this.registry = lib();
|
|
18663
18529
|
this.pendingReplays = {};
|
|
18664
18530
|
this.shared.subscribe(this.handler.bind(this));
|
|
18665
18531
|
if (typeof window !== "undefined" && typeof window.glue42gd !== "undefined") {
|
|
@@ -18673,7 +18539,7 @@
|
|
|
18673
18539
|
if (typeof callback !== "function") {
|
|
18674
18540
|
throw new Error("Please provide the callback as a function!");
|
|
18675
18541
|
}
|
|
18676
|
-
const id =
|
|
18542
|
+
const id = Utils.generateId();
|
|
18677
18543
|
this.pendingReplays[id] = true;
|
|
18678
18544
|
if (this.lastUpdate) {
|
|
18679
18545
|
let lastUpdate = Object.assign({}, this.lastUpdate);
|
|
@@ -18938,7 +18804,7 @@
|
|
|
18938
18804
|
class HotkeysImpl {
|
|
18939
18805
|
constructor(agm) {
|
|
18940
18806
|
this.agm = agm;
|
|
18941
|
-
this.registry = lib
|
|
18807
|
+
this.registry = lib();
|
|
18942
18808
|
this.firstHotkey = true;
|
|
18943
18809
|
this.hotkeys = new Map();
|
|
18944
18810
|
}
|
|
@@ -19018,7 +18884,7 @@
|
|
|
19018
18884
|
};
|
|
19019
18885
|
}
|
|
19020
18886
|
|
|
19021
|
-
var version = "6.0
|
|
18887
|
+
var version = "6.2.0";
|
|
19022
18888
|
|
|
19023
18889
|
var prepareConfig = (options) => {
|
|
19024
18890
|
function getLibConfig(value, defaultMode, trueMode) {
|
|
@@ -19086,7 +18952,7 @@
|
|
|
19086
18952
|
class Glue42Notification {
|
|
19087
18953
|
constructor(options) {
|
|
19088
18954
|
this.options = options;
|
|
19089
|
-
this.callbacks = lib
|
|
18955
|
+
this.callbacks = lib();
|
|
19090
18956
|
this.actions = options.actions;
|
|
19091
18957
|
this.body = options.body;
|
|
19092
18958
|
this.badge = options.badge;
|
|
@@ -19152,21 +19018,21 @@
|
|
|
19152
19018
|
class Notifications {
|
|
19153
19019
|
constructor(interop, logger) {
|
|
19154
19020
|
this.interop = interop;
|
|
19155
|
-
this.logger = logger;
|
|
19156
19021
|
this.NotificationsSubscribeStream = "T42.GNS.Subscribe.Notifications";
|
|
19157
19022
|
this.NotificationsCounterStream = "T42.Notifications.Counter";
|
|
19158
19023
|
this.RaiseNotificationMethodName = "T42.GNS.Publish.RaiseNotification";
|
|
19159
19024
|
this.NotificationsExecuteMethod = "T42.Notifications.Execute";
|
|
19160
19025
|
this.methodsRegistered = false;
|
|
19161
19026
|
this.NOTIFICATIONS_CONFIGURE_METHOD_NAME = "T42.Notifications.Configure";
|
|
19162
|
-
this.methodNameRoot = "T42.Notifications.Handler-" +
|
|
19027
|
+
this.methodNameRoot = "T42.Notifications.Handler-" + Utils.generateId();
|
|
19163
19028
|
this.nextId = 0;
|
|
19164
19029
|
this.notifications = {};
|
|
19165
|
-
this.registry = lib
|
|
19030
|
+
this.registry = lib();
|
|
19166
19031
|
this.subscribedForNotifications = false;
|
|
19167
19032
|
this.subscribedCounterStream = false;
|
|
19168
19033
|
this.subscriptionsCountForNotifications = 0;
|
|
19169
19034
|
this.subscriptionsCountForCounter = 0;
|
|
19035
|
+
this.logger = logger.subLogger("notifications");
|
|
19170
19036
|
this._panel = new PanelAPI(interop, this.onStreamEventCore.bind(this));
|
|
19171
19037
|
this.subscribeInternalEvents();
|
|
19172
19038
|
}
|
|
@@ -19177,7 +19043,7 @@
|
|
|
19177
19043
|
return this._panel.toAPI();
|
|
19178
19044
|
}
|
|
19179
19045
|
async raise(options) {
|
|
19180
|
-
var _a, _b, _c;
|
|
19046
|
+
var _a, _b, _c, _d;
|
|
19181
19047
|
this.validate(options);
|
|
19182
19048
|
if (!this.methodsRegistered) {
|
|
19183
19049
|
const bunchOfPromises = [];
|
|
@@ -19190,9 +19056,11 @@
|
|
|
19190
19056
|
const id = String(this.nextId++);
|
|
19191
19057
|
const type = (_a = options.type) !== null && _a !== void 0 ? _a : "Notification";
|
|
19192
19058
|
const notification = {
|
|
19059
|
+
id: options.id,
|
|
19060
|
+
state: (_b = options.state) !== null && _b !== void 0 ? _b : "Active",
|
|
19193
19061
|
title: options.title,
|
|
19194
19062
|
type,
|
|
19195
|
-
severity: (
|
|
19063
|
+
severity: (_c = options.severity) !== null && _c !== void 0 ? _c : "None",
|
|
19196
19064
|
description: options.body,
|
|
19197
19065
|
glueRoutingDetailMethodName: `${this.methodNameRoot}_${STARTING_INDEX}`,
|
|
19198
19066
|
actions: [],
|
|
@@ -19209,7 +19077,7 @@
|
|
|
19209
19077
|
this.notifications[id] = g42notification;
|
|
19210
19078
|
try {
|
|
19211
19079
|
const invocationResult = await this.interop.invoke(this.RaiseNotificationMethodName, { notification });
|
|
19212
|
-
g42notification.id = (
|
|
19080
|
+
g42notification.id = (_d = invocationResult.returned) === null || _d === void 0 ? void 0 : _d.id;
|
|
19213
19081
|
}
|
|
19214
19082
|
catch (err) {
|
|
19215
19083
|
const errorMessage = err.message;
|
|
@@ -19228,7 +19096,7 @@
|
|
|
19228
19096
|
return result.returned;
|
|
19229
19097
|
}
|
|
19230
19098
|
async configure(options) {
|
|
19231
|
-
var _a, _b, _c, _d;
|
|
19099
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19232
19100
|
if (!options || Array.isArray(options)) {
|
|
19233
19101
|
throw new Error("Invalid options - should be an object.");
|
|
19234
19102
|
}
|
|
@@ -19253,6 +19121,24 @@
|
|
|
19253
19121
|
if (((_c = options.sourceFilter) === null || _c === void 0 ? void 0 : _c.blocked) && !Array.isArray((_d = options.sourceFilter) === null || _d === void 0 ? void 0 : _d.blocked)) {
|
|
19254
19122
|
throw new Error("Expected type of sourceFilter.blocked - array.");
|
|
19255
19123
|
}
|
|
19124
|
+
if (options.toasts && typeof options.toasts !== "object") {
|
|
19125
|
+
throw new Error("Expected type of (options.toasts - object.");
|
|
19126
|
+
}
|
|
19127
|
+
if (((_e = options.toasts) === null || _e === void 0 ? void 0 : _e.mode) && typeof options.toasts.mode !== "string") {
|
|
19128
|
+
throw new Error("Expected type of (options.toasts.mode - string.");
|
|
19129
|
+
}
|
|
19130
|
+
if (((_f = options.toasts) === null || _f === void 0 ? void 0 : _f.stackBy) && typeof options.toasts.stackBy !== "string") {
|
|
19131
|
+
throw new Error("Expected type of (options.toasts.stackBy - string.");
|
|
19132
|
+
}
|
|
19133
|
+
if (options.placement && typeof options.placement !== "object") {
|
|
19134
|
+
throw new Error("Expected type of (options.placement - object.");
|
|
19135
|
+
}
|
|
19136
|
+
if (((_g = options.placement) === null || _g === void 0 ? void 0 : _g.toasts) && typeof options.placement.toasts !== "string") {
|
|
19137
|
+
throw new Error("Expected type of (options.placement.toasts - string.");
|
|
19138
|
+
}
|
|
19139
|
+
if (((_h = options.placement) === null || _h === void 0 ? void 0 : _h.panel) && typeof options.placement.panel !== "string") {
|
|
19140
|
+
throw new Error("Expected type of (options.placement.panel - string.");
|
|
19141
|
+
}
|
|
19256
19142
|
const result = await this.interop.invoke(this.NOTIFICATIONS_CONFIGURE_METHOD_NAME, options);
|
|
19257
19143
|
return result.returned;
|
|
19258
19144
|
}
|
|
@@ -19264,6 +19150,17 @@
|
|
|
19264
19150
|
const interopResult = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "list" });
|
|
19265
19151
|
return interopResult.returned.notifications;
|
|
19266
19152
|
}
|
|
19153
|
+
async updateData(id, data) {
|
|
19154
|
+
const replacer = (key, value) => typeof value === "undefined" ? null : value;
|
|
19155
|
+
const attribute = {
|
|
19156
|
+
key: "data",
|
|
19157
|
+
value: {
|
|
19158
|
+
stringValue: JSON.stringify(data, replacer)
|
|
19159
|
+
}
|
|
19160
|
+
};
|
|
19161
|
+
const interopResult = await this.interop.invoke(this.NotificationsExecuteMethod, { command: "create-or-update-attribute", data: { id, attribute } });
|
|
19162
|
+
return interopResult.returned;
|
|
19163
|
+
}
|
|
19267
19164
|
onRaised(callback) {
|
|
19268
19165
|
return this.onStreamEventCore("on-notification-raised", callback);
|
|
19269
19166
|
}
|
|
@@ -19295,6 +19192,17 @@
|
|
|
19295
19192
|
this.closeStreamCounterSubscriptionIfNoNeeded();
|
|
19296
19193
|
};
|
|
19297
19194
|
}
|
|
19195
|
+
onDataChanged(callback) {
|
|
19196
|
+
if (typeof callback !== "function") {
|
|
19197
|
+
throw new Error("Please provide the callback as a function!");
|
|
19198
|
+
}
|
|
19199
|
+
this.subscribe();
|
|
19200
|
+
const un = this.registry.add("on-notification-data-changed", callback);
|
|
19201
|
+
return () => {
|
|
19202
|
+
un();
|
|
19203
|
+
this.closeStreamSubscriptionIfNoNeeded();
|
|
19204
|
+
};
|
|
19205
|
+
}
|
|
19298
19206
|
async clearAll() {
|
|
19299
19207
|
await this.interop.invoke(this.NotificationsExecuteMethod, { command: "clearAll" });
|
|
19300
19208
|
}
|
|
@@ -19323,17 +19231,7 @@
|
|
|
19323
19231
|
if (!state) {
|
|
19324
19232
|
throw new Error("The 'state' argument cannot be null or undefined");
|
|
19325
19233
|
}
|
|
19326
|
-
|
|
19327
|
-
throw new Error("The 'state' argument must be a string");
|
|
19328
|
-
}
|
|
19329
|
-
const validStates = [
|
|
19330
|
-
"Active",
|
|
19331
|
-
"Acknowledged",
|
|
19332
|
-
"Stale"
|
|
19333
|
-
];
|
|
19334
|
-
if (!validStates.includes(state)) {
|
|
19335
|
-
throw new Error(`The state argument: ${state} is not valid!`);
|
|
19336
|
-
}
|
|
19234
|
+
this.validateState(state);
|
|
19337
19235
|
await this.interop.invoke(this.NotificationsExecuteMethod, { command: "updateState", data: { id, state } });
|
|
19338
19236
|
}
|
|
19339
19237
|
toAPI() {
|
|
@@ -19351,11 +19249,13 @@
|
|
|
19351
19249
|
onClosed: this.onClosed.bind(this),
|
|
19352
19250
|
onConfigurationChanged: this.onConfigurationChanged.bind(this),
|
|
19353
19251
|
onCounterChanged: this.onCounterChanged.bind(this),
|
|
19252
|
+
onDataChanged: this.onDataChanged.bind(this),
|
|
19354
19253
|
clearAll: this.clearAll.bind(this),
|
|
19355
19254
|
clearOld: this.clearOld.bind(this),
|
|
19356
19255
|
clear: this.clear.bind(this),
|
|
19357
19256
|
click: this.click.bind(this),
|
|
19358
|
-
setState: this.setState.bind(this)
|
|
19257
|
+
setState: this.setState.bind(this),
|
|
19258
|
+
updateData: this.updateData.bind(this),
|
|
19359
19259
|
};
|
|
19360
19260
|
}
|
|
19361
19261
|
onStreamEventCore(key, callback) {
|
|
@@ -19441,6 +19341,22 @@
|
|
|
19441
19341
|
if (options.toastExpiry && typeof options.toastExpiry !== "number") {
|
|
19442
19342
|
throw new Error("invalid options - toastExpiry should be a number");
|
|
19443
19343
|
}
|
|
19344
|
+
if (options.state) {
|
|
19345
|
+
this.validateState(options.state);
|
|
19346
|
+
}
|
|
19347
|
+
}
|
|
19348
|
+
validateState(state) {
|
|
19349
|
+
if (typeof (state) !== "string") {
|
|
19350
|
+
throw new Error("The 'state' argument must be a string");
|
|
19351
|
+
}
|
|
19352
|
+
const validStates = [
|
|
19353
|
+
"Active",
|
|
19354
|
+
"Acknowledged",
|
|
19355
|
+
"Stale"
|
|
19356
|
+
];
|
|
19357
|
+
if (!validStates.includes(state)) {
|
|
19358
|
+
throw new Error(`The state argument: ${state} is not valid!`);
|
|
19359
|
+
}
|
|
19444
19360
|
}
|
|
19445
19361
|
subscribe() {
|
|
19446
19362
|
this.subscriptionsCountForNotifications++;
|
|
@@ -19552,7 +19468,7 @@
|
|
|
19552
19468
|
if (notification.state === "Closed") {
|
|
19553
19469
|
this.registry.execute("on-notification-closed", { id: notification.id });
|
|
19554
19470
|
}
|
|
19555
|
-
else
|
|
19471
|
+
else {
|
|
19556
19472
|
this.registry.execute("on-notification-raised", notification);
|
|
19557
19473
|
}
|
|
19558
19474
|
}
|
|
@@ -19560,14 +19476,22 @@
|
|
|
19560
19476
|
handleDeltas(message) {
|
|
19561
19477
|
const deltas = message.deltas;
|
|
19562
19478
|
deltas.forEach((info) => {
|
|
19479
|
+
var _a;
|
|
19563
19480
|
const id = info.id;
|
|
19564
|
-
const delta = info.delta;
|
|
19481
|
+
const delta = (_a = info.delta) !== null && _a !== void 0 ? _a : {};
|
|
19565
19482
|
if (delta.state === "Closed") {
|
|
19566
|
-
this.registry.execute("on-notification-closed", { id });
|
|
19483
|
+
this.registry.execute("on-notification-closed", { id, ...delta });
|
|
19567
19484
|
}
|
|
19568
|
-
else {
|
|
19485
|
+
else if (delta.state) {
|
|
19569
19486
|
this.registry.execute("on-state-changed", { id }, delta.state);
|
|
19570
19487
|
}
|
|
19488
|
+
else if (delta.attributes) {
|
|
19489
|
+
const attributes = delta.attributes;
|
|
19490
|
+
const dataAttribute = attributes.find((a) => a.key === "data");
|
|
19491
|
+
if (dataAttribute) {
|
|
19492
|
+
this.registry.execute("on-notification-data-changed", { id }, JSON.parse(dataAttribute.value.stringValue));
|
|
19493
|
+
}
|
|
19494
|
+
}
|
|
19571
19495
|
});
|
|
19572
19496
|
}
|
|
19573
19497
|
handleOnClosed(id) {
|
|
@@ -19719,7 +19643,7 @@
|
|
|
19719
19643
|
constructor(contexts, interop) {
|
|
19720
19644
|
this.contexts = contexts;
|
|
19721
19645
|
this.interop = interop;
|
|
19722
|
-
this.registry = lib
|
|
19646
|
+
this.registry = lib();
|
|
19723
19647
|
this.isSubscribed = false;
|
|
19724
19648
|
this.getConfiguration();
|
|
19725
19649
|
}
|
|
@@ -19796,12 +19720,12 @@
|
|
|
19796
19720
|
const INTENTS_RESOLVER_INTEROP_PREFIX = "T42.Intents.Resolver.Control";
|
|
19797
19721
|
const INTENTS_RESOLVER_WIDTH = 400;
|
|
19798
19722
|
const INTENTS_RESOLVER_HEIGHT = 440;
|
|
19799
|
-
const DEFAULT_RESOLVER_RESPONSE_TIMEOUT =
|
|
19723
|
+
const DEFAULT_RESOLVER_RESPONSE_TIMEOUT = 60 * 1000;
|
|
19800
19724
|
const INTENT_HANDLER_DEFAULT_PROPS = ["applicationName", "type"];
|
|
19801
19725
|
const INTENTS_RESOLVER_APP_NAME = "intentsResolver";
|
|
19802
|
-
const
|
|
19803
|
-
const
|
|
19804
|
-
const
|
|
19726
|
+
const DEFAULT_METHOD_RESPONSE_TIMEOUT_MS = 60 * 1000;
|
|
19727
|
+
const DEFAULT_RAISE_TIMEOUT_MS = 90 * 1000;
|
|
19728
|
+
const DEFAULT_PICK_HANDLER_BY_TIMEOUT_MS = 90 * 1000;
|
|
19805
19729
|
|
|
19806
19730
|
const PromisePlus = (executor, timeoutMilliseconds, timeoutMessage) => {
|
|
19807
19731
|
return new Promise((resolve, reject) => {
|
|
@@ -19852,6 +19776,179 @@
|
|
|
19852
19776
|
});
|
|
19853
19777
|
};
|
|
19854
19778
|
|
|
19779
|
+
const validateIntentHandlerAsResponse = (handler) => {
|
|
19780
|
+
if (typeof handler !== "object") {
|
|
19781
|
+
return { isValid: false, error: `Response object has invalid 'handler' key. Expected an object, got ${typeof handler}` };
|
|
19782
|
+
}
|
|
19783
|
+
const compulsoryKeysExist = INTENT_HANDLER_DEFAULT_PROPS.filter((key) => !(key in handler));
|
|
19784
|
+
if (compulsoryKeysExist.length) {
|
|
19785
|
+
return { isValid: false, error: `Handler in Response object does not provide compulsory keys: ${compulsoryKeysExist.join(", ")}` };
|
|
19786
|
+
}
|
|
19787
|
+
return { isValid: true, ok: handler };
|
|
19788
|
+
};
|
|
19789
|
+
const validateRaiseIntentsResolverResponse = (responseObj) => {
|
|
19790
|
+
const invalidKey = Object.keys(responseObj).some((key) => key !== "intent" && key !== "handler");
|
|
19791
|
+
if (invalidKey) {
|
|
19792
|
+
return { isValid: false, error: "Response is not a valid object. Expected { intent: string, handler: IntentHandler }" };
|
|
19793
|
+
}
|
|
19794
|
+
if (typeof responseObj.intent !== "string") {
|
|
19795
|
+
return { isValid: false, error: `Response object has invalid 'intent' key. Expected a string, got ${typeof responseObj.intent}` };
|
|
19796
|
+
}
|
|
19797
|
+
const { isValid, error } = validateIntentHandlerAsResponse(responseObj.handler);
|
|
19798
|
+
return isValid
|
|
19799
|
+
? { isValid: true, ok: { intent: responseObj.intent, handler: responseObj.handler } }
|
|
19800
|
+
: { isValid: false, error };
|
|
19801
|
+
};
|
|
19802
|
+
const validateFilterHandlersResolverResponse = (responseObj) => {
|
|
19803
|
+
if (!responseObj.handler) {
|
|
19804
|
+
return { isValid: false, error: "Response is not a valid object. Expected { handler: IntentHandler }" };
|
|
19805
|
+
}
|
|
19806
|
+
const { isValid, error } = validateIntentHandlerAsResponse(responseObj.handler);
|
|
19807
|
+
return isValid
|
|
19808
|
+
? { isValid: true, ok: { handler: responseObj.handler } }
|
|
19809
|
+
: { isValid: false, error };
|
|
19810
|
+
};
|
|
19811
|
+
const validateIntentRequestTarget = (target) => {
|
|
19812
|
+
if (!target) {
|
|
19813
|
+
return;
|
|
19814
|
+
}
|
|
19815
|
+
if (typeof target !== "string" && typeof target !== "object") {
|
|
19816
|
+
throw new Error(`Please provide the intent target as one of the valid values: "reuse", "startNew", { app: string }, { instance: string } `);
|
|
19817
|
+
}
|
|
19818
|
+
};
|
|
19819
|
+
const validateIntentRequestContext = (context) => {
|
|
19820
|
+
if (!context) {
|
|
19821
|
+
return;
|
|
19822
|
+
}
|
|
19823
|
+
if (typeof context !== "object") {
|
|
19824
|
+
throw new Error(`Please provide the intent context as an object`);
|
|
19825
|
+
}
|
|
19826
|
+
if (context.type && typeof context.type !== "string") {
|
|
19827
|
+
throw new Error(`Please provide the intent context as an object with 'type' property as string`);
|
|
19828
|
+
}
|
|
19829
|
+
if (context.data && typeof context.data !== "object") {
|
|
19830
|
+
throw new Error(`Please provide the intent context as an object with 'data' property as object`);
|
|
19831
|
+
}
|
|
19832
|
+
};
|
|
19833
|
+
const validateIntentRequestHandler = (handler) => {
|
|
19834
|
+
if (!handler.applicationName) {
|
|
19835
|
+
throw new Error(`Please provide applicationName for handler ${JSON.stringify(handler)}`);
|
|
19836
|
+
}
|
|
19837
|
+
if (!handler.type) {
|
|
19838
|
+
throw new Error(`Please provide type for handler ${JSON.stringify(handler)}`);
|
|
19839
|
+
}
|
|
19840
|
+
if (handler.type === "instance" && !handler.instanceId) {
|
|
19841
|
+
throw new Error(`Please provide instanceId for handler ${JSON.stringify(handler)}`);
|
|
19842
|
+
}
|
|
19843
|
+
};
|
|
19844
|
+
const validateIntentRequestTimeout = (timeout) => {
|
|
19845
|
+
if (!timeout) {
|
|
19846
|
+
return;
|
|
19847
|
+
}
|
|
19848
|
+
if (typeof timeout !== "number") {
|
|
19849
|
+
throw new Error(`Please provide the timeout as a number`);
|
|
19850
|
+
}
|
|
19851
|
+
if (timeout <= 0) {
|
|
19852
|
+
throw new Error(`Please provide the timeout as a positive number`);
|
|
19853
|
+
}
|
|
19854
|
+
};
|
|
19855
|
+
const validateWaitUserResponseIndefinitely = (waitUserResponseIndefinitely) => {
|
|
19856
|
+
if (!waitUserResponseIndefinitely) {
|
|
19857
|
+
return;
|
|
19858
|
+
}
|
|
19859
|
+
if (typeof waitUserResponseIndefinitely !== "boolean") {
|
|
19860
|
+
throw new Error("Please provide waitUserResponseIndefinitely as a boolean");
|
|
19861
|
+
}
|
|
19862
|
+
};
|
|
19863
|
+
const validateHandlerFilter = (handlerFilter) => {
|
|
19864
|
+
if (!handlerFilter) {
|
|
19865
|
+
throw new Error(`Provide 'handlerFilter' with at least one filter criteria of the following: 'intent' | 'contextTypes' | 'resultType' | 'applicationNames'`);
|
|
19866
|
+
}
|
|
19867
|
+
const { title, openResolver, timeout, intent, contextTypes, resultType, applicationNames } = handlerFilter;
|
|
19868
|
+
if (typeof title !== "undefined" && (typeof title !== "string" || !title.length)) {
|
|
19869
|
+
throw new Error(`Provide 'title' as a non empty string`);
|
|
19870
|
+
}
|
|
19871
|
+
if (typeof openResolver !== "undefined" && typeof openResolver !== "boolean") {
|
|
19872
|
+
throw new Error(`Provide 'openResolver' prop as a boolean`);
|
|
19873
|
+
}
|
|
19874
|
+
if (typeof timeout !== "undefined" && (typeof timeout !== "number" || timeout <= 0)) {
|
|
19875
|
+
throw new Error(`Provide 'timeout' prop as a positive number`);
|
|
19876
|
+
}
|
|
19877
|
+
if (typeof intent !== "undefined" && (typeof intent !== "string" || !intent.length)) {
|
|
19878
|
+
throw new Error(`Provide 'intent' as a non empty string`);
|
|
19879
|
+
}
|
|
19880
|
+
if (typeof contextTypes !== "undefined" && (!Array.isArray(contextTypes) || contextTypes.some(ctx => typeof ctx !== "string"))) {
|
|
19881
|
+
throw new Error(`Provide 'contextTypes' as an array of non empty strings`);
|
|
19882
|
+
}
|
|
19883
|
+
if (typeof resultType !== "undefined" && (typeof resultType !== "string" || !resultType.length)) {
|
|
19884
|
+
throw new Error(`Provide 'resultType' as a non empty string`);
|
|
19885
|
+
}
|
|
19886
|
+
if (typeof applicationNames !== "undefined" && (!Array.isArray(applicationNames) || applicationNames.some(appName => typeof appName !== "string"))) {
|
|
19887
|
+
throw new Error(`Provide 'applicationNames' as an array of non empty strings`);
|
|
19888
|
+
}
|
|
19889
|
+
const errorMsg = "Provide at least one filter criteria of the following: 'intent' | 'contextTypes' | 'resultType' | 'applicationNames'";
|
|
19890
|
+
if (!Object.keys(handlerFilter).length) {
|
|
19891
|
+
throw new Error(errorMsg);
|
|
19892
|
+
}
|
|
19893
|
+
if (!intent && !resultType && (!contextTypes || !contextTypes.length) && (!applicationNames || !applicationNames.length)) {
|
|
19894
|
+
throw new Error(errorMsg);
|
|
19895
|
+
}
|
|
19896
|
+
};
|
|
19897
|
+
const validateIntentsResolverResponse = (method, responseObj) => {
|
|
19898
|
+
return method === "raise" ? validateRaiseIntentsResolverResponse(responseObj) : validateFilterHandlersResolverResponse(responseObj);
|
|
19899
|
+
};
|
|
19900
|
+
const validateIntentRequest = (request) => {
|
|
19901
|
+
validateIntentRequestContext(request.context);
|
|
19902
|
+
validateIntentRequestTarget(request.target);
|
|
19903
|
+
validateIntentRequestTimeout(request.timeout);
|
|
19904
|
+
validateWaitUserResponseIndefinitely(request.waitUserResponseIndefinitely);
|
|
19905
|
+
if (request.handlers) {
|
|
19906
|
+
request.handlers.forEach((handler) => validateIntentRequestHandler(handler));
|
|
19907
|
+
}
|
|
19908
|
+
};
|
|
19909
|
+
const validateIntentHandler = (handler) => {
|
|
19910
|
+
if (typeof handler !== "object") {
|
|
19911
|
+
throw new Error("IntentHandler must be an object");
|
|
19912
|
+
}
|
|
19913
|
+
if (typeof handler.applicationName !== "string" || !handler.applicationName.length) {
|
|
19914
|
+
throw new Error(`Please provide 'applicationName' as a non-empty string`);
|
|
19915
|
+
}
|
|
19916
|
+
if (typeof handler.type !== "string" || !["app", "instance"].includes(handler.type)) {
|
|
19917
|
+
throw new Error(`Invalid 'type' property. Expected 'app' | 'instance' got ${handler.type}`);
|
|
19918
|
+
}
|
|
19919
|
+
if (typeof handler.applicationTitle !== "undefined" && typeof handler.applicationTitle !== "string") {
|
|
19920
|
+
throw new Error(`Provide 'applicationTitle' as a string`);
|
|
19921
|
+
}
|
|
19922
|
+
if (typeof handler.applicationDescription !== "undefined" && typeof handler.applicationDescription !== "string") {
|
|
19923
|
+
throw new Error(`Provide 'applicationDescription' as a string`);
|
|
19924
|
+
}
|
|
19925
|
+
if (typeof handler.applicationIcon !== "undefined" && typeof handler.applicationIcon !== "string") {
|
|
19926
|
+
throw new Error(`Provide 'applicationIcon' as a string`);
|
|
19927
|
+
}
|
|
19928
|
+
if (typeof handler.displayName !== "undefined" && typeof handler.displayName !== "string") {
|
|
19929
|
+
throw new Error(`Provide 'displayName' as a string`);
|
|
19930
|
+
}
|
|
19931
|
+
if (typeof handler.contextTypes !== "undefined" && (!Array.isArray(handler.contextTypes) || handler.contextTypes.some(ctx => typeof ctx !== "string"))) {
|
|
19932
|
+
throw new Error(`Provide 'contextTypes' as an array of non empty strings`);
|
|
19933
|
+
}
|
|
19934
|
+
if (typeof handler.instanceId !== "undefined" && typeof handler.instanceId !== "string") {
|
|
19935
|
+
throw new Error(`Provide 'instanceId' as a string`);
|
|
19936
|
+
}
|
|
19937
|
+
if (typeof handler.instanceTitle !== "undefined" && typeof handler.instanceTitle !== "string") {
|
|
19938
|
+
throw new Error(`Provide 'instanceTitle' as a string`);
|
|
19939
|
+
}
|
|
19940
|
+
if (typeof handler.resultType !== "undefined" && typeof handler.resultType !== "string") {
|
|
19941
|
+
throw new Error(`Provide 'resultType' as a string`);
|
|
19942
|
+
}
|
|
19943
|
+
};
|
|
19944
|
+
const clearNullUndefined = (obj) => {
|
|
19945
|
+
Object.keys(obj).forEach(key => {
|
|
19946
|
+
if (obj[key] === null || obj[key] === undefined) {
|
|
19947
|
+
delete obj[key];
|
|
19948
|
+
}
|
|
19949
|
+
});
|
|
19950
|
+
};
|
|
19951
|
+
|
|
19855
19952
|
class Intents {
|
|
19856
19953
|
constructor(interop, windows, logger, options, appManager) {
|
|
19857
19954
|
this.interop = interop;
|
|
@@ -19896,7 +19993,7 @@
|
|
|
19896
19993
|
if (typeof intentRequest === "string") {
|
|
19897
19994
|
intentRequest = { intent: intentRequest };
|
|
19898
19995
|
}
|
|
19899
|
-
|
|
19996
|
+
validateIntentRequest(intentRequest);
|
|
19900
19997
|
await Promise.all(this.unregisterIntentPromises);
|
|
19901
19998
|
const timeout = intentRequest.timeout || DEFAULT_RAISE_TIMEOUT_MS;
|
|
19902
19999
|
const resolverInstance = {};
|
|
@@ -20054,9 +20151,9 @@
|
|
|
20054
20151
|
intentFlag = rest;
|
|
20055
20152
|
}
|
|
20056
20153
|
try {
|
|
20057
|
-
await this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args) => {
|
|
20154
|
+
await this.interop.register({ name: methodName, flags: { intent: intentFlag } }, (args, caller) => {
|
|
20058
20155
|
if (this.myIntents.has(intentName)) {
|
|
20059
|
-
return handler(args);
|
|
20156
|
+
return handler(args, caller);
|
|
20060
20157
|
}
|
|
20061
20158
|
});
|
|
20062
20159
|
}
|
|
@@ -20068,20 +20165,79 @@
|
|
|
20068
20165
|
unsubscribe: () => this.unsubscribeIntent(intentName)
|
|
20069
20166
|
};
|
|
20070
20167
|
}
|
|
20168
|
+
async filterHandlers(handlerFilter) {
|
|
20169
|
+
var _a, _b;
|
|
20170
|
+
validateHandlerFilter(handlerFilter);
|
|
20171
|
+
if (handlerFilter.openResolver && !this.useIntentsResolverUI) {
|
|
20172
|
+
throw new Error("Cannot resolve 'filterHandlers' request using Intents Resolver UI because it's globally disabled");
|
|
20173
|
+
}
|
|
20174
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Received 'filterHandlers' command with request: ${JSON.stringify(handlerFilter)}`);
|
|
20175
|
+
const filteredHandlers = this.filterHandlersBy(await this.all(), handlerFilter);
|
|
20176
|
+
if (!filteredHandlers || !filteredHandlers.length) {
|
|
20177
|
+
return { handlers: [] };
|
|
20178
|
+
}
|
|
20179
|
+
const { open, reason } = this.checkIfResolverShouldBeOpenedForFilterHandlers(filteredHandlers, handlerFilter);
|
|
20180
|
+
if (!open) {
|
|
20181
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.trace(`Intent Resolver UI won't be used. Reason: ${reason}`);
|
|
20182
|
+
return { handlers: filteredHandlers };
|
|
20183
|
+
}
|
|
20184
|
+
const resolverInstance = { instanceId: undefined };
|
|
20185
|
+
const timeout = handlerFilter.timeout || DEFAULT_PICK_HANDLER_BY_TIMEOUT_MS;
|
|
20186
|
+
const handler = await PromiseWrap(() => this.startResolverApp({ request: handlerFilter, resolverInstance, method: 'filterHandlers' }), timeout, `Timeout of ${timeout}ms hit for 'filterHandlers' request with filter: ${JSON.stringify(handlerFilter)}`);
|
|
20187
|
+
return { handlers: [handler] };
|
|
20188
|
+
}
|
|
20189
|
+
async getIntents(handler) {
|
|
20190
|
+
var _a;
|
|
20191
|
+
this.logger.trace(`Received 'getIntents' command with handler ${JSON.stringify(handler)}`);
|
|
20192
|
+
validateIntentHandler(handler);
|
|
20193
|
+
const intents = await this.all();
|
|
20194
|
+
clearNullUndefined(handler);
|
|
20195
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Extracting valid intents for the passed handler`);
|
|
20196
|
+
const intentsWithInfo = this.extractIntentsWithInfoByHandler(intents, handler);
|
|
20197
|
+
this.logger.trace(`Returning intents for handler ${JSON.stringify(handler)}`);
|
|
20198
|
+
return { intents: intentsWithInfo };
|
|
20199
|
+
}
|
|
20200
|
+
filterHandlersBy(intents, filter) {
|
|
20201
|
+
const filteredIntentsWithHandlers = intents.filter((intent) => {
|
|
20202
|
+
if (filter.intent && filter.intent !== intent.name) {
|
|
20203
|
+
return;
|
|
20204
|
+
}
|
|
20205
|
+
if (filter.resultType) {
|
|
20206
|
+
const filteredHandlers = intent.handlers.filter((handler) => handler.resultType && handler.resultType === filter.resultType);
|
|
20207
|
+
if (!filteredHandlers.length)
|
|
20208
|
+
return;
|
|
20209
|
+
intent.handlers = filteredHandlers;
|
|
20210
|
+
}
|
|
20211
|
+
if (filter.contextTypes) {
|
|
20212
|
+
const filteredHandlers = intent.handlers.filter((handler) => { var _a; return (_a = filter.contextTypes) === null || _a === void 0 ? void 0 : _a.every((contextType) => { var _a; return (_a = handler.contextTypes) === null || _a === void 0 ? void 0 : _a.includes(contextType); }); });
|
|
20213
|
+
if (!filteredHandlers.length)
|
|
20214
|
+
return;
|
|
20215
|
+
intent.handlers = filteredHandlers;
|
|
20216
|
+
}
|
|
20217
|
+
if (filter.applicationNames) {
|
|
20218
|
+
const filteredHandlers = intent.handlers.filter((handler) => { var _a; return (_a = filter.applicationNames) === null || _a === void 0 ? void 0 : _a.includes(handler.applicationName); });
|
|
20219
|
+
if (!filteredHandlers.length)
|
|
20220
|
+
return;
|
|
20221
|
+
intent.handlers = filteredHandlers;
|
|
20222
|
+
}
|
|
20223
|
+
return intent;
|
|
20224
|
+
});
|
|
20225
|
+
return filteredIntentsWithHandlers.map((intent) => intent.handlers).flat(1);
|
|
20226
|
+
}
|
|
20071
20227
|
async coreRaiseIntent({ request, resolverInstance, timeout }) {
|
|
20072
20228
|
var _a, _b;
|
|
20073
20229
|
const intentDef = await this.get(request.intent);
|
|
20074
20230
|
if (typeof intentDef === "undefined") {
|
|
20075
20231
|
throw new Error(`Intent ${request.intent} not found.`);
|
|
20076
20232
|
}
|
|
20077
|
-
const { open, reason } = this.
|
|
20233
|
+
const { open, reason } = this.checkIfResolverShouldBeOpenedForRaise(intentDef, request);
|
|
20078
20234
|
if (!open) {
|
|
20079
20235
|
this.logger.trace(`Intent Resolver UI won't be used. Reason: ${reason}`);
|
|
20080
20236
|
return request.waitUserResponseIndefinitely
|
|
20081
20237
|
? PromiseWrap(() => this.raiseIntent(request, timeout), timeout, `Timeout of ${timeout}ms hit for raise to resolve`)
|
|
20082
20238
|
: this.raiseIntent(request, timeout);
|
|
20083
20239
|
}
|
|
20084
|
-
const resolverHandler = await this.startResolverApp(request, resolverInstance);
|
|
20240
|
+
const resolverHandler = await this.startResolverApp({ request, method: "raise", resolverInstance });
|
|
20085
20241
|
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Raising intent to target handler: ${JSON.stringify(resolverHandler)} with timeout of ${timeout}`);
|
|
20086
20242
|
if (request.waitUserResponseIndefinitely) {
|
|
20087
20243
|
return PromiseWrap(() => this.raiseIntentToTargetHandler(request, resolverHandler, timeout), timeout, `Timeout of ${timeout}ms hit for raise to resolve`);
|
|
@@ -20139,22 +20295,29 @@
|
|
|
20139
20295
|
result: result.returned
|
|
20140
20296
|
};
|
|
20141
20297
|
}
|
|
20142
|
-
async startResolverApp(
|
|
20298
|
+
async startResolverApp({ request, method, resolverInstance }) {
|
|
20143
20299
|
var _a, _b, _c, _d;
|
|
20144
|
-
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Intents Resolver UI with app name ${this.intentsResolverAppName} will be used`);
|
|
20145
|
-
const responseMethodName = await this.registerIntentResolverMethod();
|
|
20300
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Intents Resolver UI with app name ${this.intentsResolverAppName} will be used for request: ${JSON.stringify(request)}`);
|
|
20301
|
+
const responseMethodName = await this.registerIntentResolverMethod(method);
|
|
20146
20302
|
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.trace(`Registered interop method ${responseMethodName}`);
|
|
20147
|
-
const startContext = this.buildStartContext(
|
|
20303
|
+
const startContext = this.buildStartContext(method, request, responseMethodName);
|
|
20148
20304
|
const startOptions = await this.buildStartOptions();
|
|
20149
20305
|
(_c = this.logger) === null || _c === void 0 ? void 0 : _c.trace(`Starting Intents Resolver UI with context: ${JSON.stringify(startContext)} and options: ${JSON.stringify(startOptions)}`);
|
|
20150
20306
|
const instance = await this.appManager.application(this.intentsResolverAppName).start(startContext, startOptions);
|
|
20151
|
-
|
|
20152
|
-
resolverInstance.instanceId = instance.id;
|
|
20153
|
-
}
|
|
20307
|
+
resolverInstance.instanceId = instance.id;
|
|
20154
20308
|
(_d = this.logger) === null || _d === void 0 ? void 0 : _d.trace(`Intents Resolver instance with id ${instance.id} opened`);
|
|
20155
|
-
this.subscribeOnInstanceStopped(instance);
|
|
20156
|
-
|
|
20157
|
-
|
|
20309
|
+
this.subscribeOnInstanceStopped(instance, method);
|
|
20310
|
+
const timeout = request.timeout || method === "raise" ? DEFAULT_RAISE_TIMEOUT_MS : DEFAULT_PICK_HANDLER_BY_TIMEOUT_MS;
|
|
20311
|
+
this.createResponsePromise({
|
|
20312
|
+
intent: method === "raise" ? request.intent : undefined,
|
|
20313
|
+
instanceId: instance.id,
|
|
20314
|
+
responseMethodName,
|
|
20315
|
+
timeout,
|
|
20316
|
+
errorMsg: `Timeout of ${timeout}ms hit waiting for the user to choose a handler ${method === "raise"
|
|
20317
|
+
? `for intent ${request.intent}`
|
|
20318
|
+
: `for '${method}' method with filter ${JSON.stringify(request)}`}`
|
|
20319
|
+
});
|
|
20320
|
+
const handler = await this.handleInstanceResponse(instance.id, method);
|
|
20158
20321
|
return handler;
|
|
20159
20322
|
}
|
|
20160
20323
|
async windowsIdToTitle(id, windowsInfos) {
|
|
@@ -20166,43 +20329,43 @@
|
|
|
20166
20329
|
const title = await (window === null || window === void 0 ? void 0 : window.getTitle());
|
|
20167
20330
|
return title;
|
|
20168
20331
|
}
|
|
20169
|
-
async handleInstanceResponse(instanceId) {
|
|
20170
|
-
var _a;
|
|
20332
|
+
async handleInstanceResponse(instanceId, method) {
|
|
20333
|
+
var _a, _b;
|
|
20171
20334
|
try {
|
|
20172
|
-
const
|
|
20173
|
-
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Intent handler chosen for intent ${intent}: ${JSON.stringify(handler)}`);
|
|
20335
|
+
const response = await this.intentsResolverResponsePromises[instanceId].promise;
|
|
20336
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.trace(`Intent handler chosen ${method === "raise" ? `for intent ${response.intent} ` : ""}: ${JSON.stringify(response.handler)}. Stopping resolver instance with id ${instanceId}`);
|
|
20174
20337
|
this.stopResolverInstance(instanceId);
|
|
20175
|
-
|
|
20338
|
+
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.trace(`Instance with id ${instanceId} successfully stopped`);
|
|
20339
|
+
return response.handler;
|
|
20176
20340
|
}
|
|
20177
20341
|
catch (error) {
|
|
20178
20342
|
this.stopResolverInstance(instanceId);
|
|
20179
20343
|
throw new Error(error);
|
|
20180
20344
|
}
|
|
20181
20345
|
}
|
|
20182
|
-
async registerIntentResolverMethod() {
|
|
20183
|
-
const methodName = INTENTS_RESOLVER_INTEROP_PREFIX +
|
|
20184
|
-
await this.interop.register(methodName, this.resolverResponseHandler
|
|
20346
|
+
async registerIntentResolverMethod(method) {
|
|
20347
|
+
const methodName = INTENTS_RESOLVER_INTEROP_PREFIX + Utils.generateId();
|
|
20348
|
+
await this.interop.register(methodName, (args, callerId) => this.resolverResponseHandler(args, callerId, method));
|
|
20185
20349
|
return methodName;
|
|
20186
20350
|
}
|
|
20187
|
-
resolverResponseHandler(args, callerId) {
|
|
20351
|
+
resolverResponseHandler(args, callerId, method) {
|
|
20188
20352
|
const { instance } = callerId;
|
|
20189
|
-
const isValid =
|
|
20353
|
+
const isValid = validateIntentsResolverResponse(method, args);
|
|
20190
20354
|
if (!isValid) {
|
|
20191
|
-
this.logger.trace(`Intent Resolver sent invalid response. Error: ${isValid.error}`);
|
|
20355
|
+
this.logger.trace(`Intent Resolver instance with id ${callerId.instance} sent invalid response. Error: ${isValid.error}`);
|
|
20192
20356
|
this.intentsResolverResponsePromises[instance].reject(isValid.error);
|
|
20193
20357
|
this.stopResolverInstance(instance);
|
|
20358
|
+
return;
|
|
20194
20359
|
}
|
|
20195
20360
|
const validResponse = isValid.ok;
|
|
20196
20361
|
this.intentsResolverResponsePromises[instance].resolve(validResponse);
|
|
20197
20362
|
this.cleanUpIntentResolverPromise(instance);
|
|
20198
20363
|
}
|
|
20199
|
-
buildStartContext(request, methodName) {
|
|
20200
|
-
const
|
|
20201
|
-
|
|
20202
|
-
|
|
20203
|
-
|
|
20204
|
-
};
|
|
20205
|
-
return startContext;
|
|
20364
|
+
buildStartContext(method, request, methodName) {
|
|
20365
|
+
const baseStartContext = { callerId: this.interop.instance.instance, methodName };
|
|
20366
|
+
return method === "raise"
|
|
20367
|
+
? { ...baseStartContext, intent: request }
|
|
20368
|
+
: { ...baseStartContext, handlerFilter: request };
|
|
20206
20369
|
}
|
|
20207
20370
|
async buildStartOptions() {
|
|
20208
20371
|
const win = this.windows.my();
|
|
@@ -20213,29 +20376,35 @@
|
|
|
20213
20376
|
return {
|
|
20214
20377
|
top: (bounds.height - INTENTS_RESOLVER_HEIGHT) / 2 + bounds.top,
|
|
20215
20378
|
left: (bounds.width - INTENTS_RESOLVER_WIDTH) / 2 + bounds.left,
|
|
20379
|
+
width: INTENTS_RESOLVER_WIDTH,
|
|
20380
|
+
height: INTENTS_RESOLVER_HEIGHT
|
|
20216
20381
|
};
|
|
20217
20382
|
}
|
|
20218
|
-
createResponsePromise(
|
|
20219
|
-
let resolve;
|
|
20220
|
-
let reject;
|
|
20221
|
-
const waitResponseTimeout = intentRequest.waitUserResponseIndefinitely ? MAX_SET_TIMEOUT_DELAY : this.intentsResolverResponseTimeout;
|
|
20383
|
+
createResponsePromise({ instanceId, intent, responseMethodName, timeout, errorMsg }) {
|
|
20384
|
+
let resolve = () => { };
|
|
20385
|
+
let reject = () => { };
|
|
20222
20386
|
const promise = PromisePlus((res, rej) => {
|
|
20223
20387
|
resolve = res;
|
|
20224
20388
|
reject = rej;
|
|
20225
|
-
},
|
|
20226
|
-
this.intentsResolverResponsePromises[instanceId] = { intent
|
|
20389
|
+
}, timeout, errorMsg);
|
|
20390
|
+
this.intentsResolverResponsePromises[instanceId] = { intent, resolve, reject, promise, methodName: responseMethodName };
|
|
20227
20391
|
}
|
|
20228
20392
|
async invokeStartApp(application, context, options) {
|
|
20229
20393
|
const result = await this.interop.invoke("T42.ACS.StartApplication", { Name: application, options });
|
|
20230
20394
|
return result.returned.Id;
|
|
20231
20395
|
}
|
|
20232
|
-
subscribeOnInstanceStopped(instance) {
|
|
20233
|
-
const
|
|
20396
|
+
subscribeOnInstanceStopped(instance, method) {
|
|
20397
|
+
const { application } = instance;
|
|
20398
|
+
const unsub = application.onInstanceStopped((inst) => {
|
|
20399
|
+
if (inst.id !== instance.id) {
|
|
20400
|
+
return;
|
|
20401
|
+
}
|
|
20234
20402
|
const intentPromise = this.intentsResolverResponsePromises[inst.id];
|
|
20235
20403
|
if (!intentPromise) {
|
|
20236
20404
|
return unsub();
|
|
20237
20405
|
}
|
|
20238
|
-
|
|
20406
|
+
const errorMsg = `Cannot resolve ${method === "raise" ? `raised intent ${intentPromise.intent}` : `'${method}' method`} - User closed ${instance.application.name} app without choosing a handler`;
|
|
20407
|
+
intentPromise.reject(errorMsg);
|
|
20239
20408
|
this.cleanUpIntentResolverPromise(inst.id);
|
|
20240
20409
|
unsub();
|
|
20241
20410
|
});
|
|
@@ -20249,23 +20418,6 @@
|
|
|
20249
20418
|
unregisterPromise.catch((error) => this.logger.warn(error));
|
|
20250
20419
|
delete this.intentsResolverResponsePromises[instanceId];
|
|
20251
20420
|
}
|
|
20252
|
-
validateIntentsResolverResponse(responseObj) {
|
|
20253
|
-
const invalidKey = Object.keys(responseObj).some((key) => key !== "intent" && key !== "handler");
|
|
20254
|
-
if (invalidKey) {
|
|
20255
|
-
return { isValid: false, error: "Response is not a valid object. Expected { intent: string, handler: IntentHandler }" };
|
|
20256
|
-
}
|
|
20257
|
-
if (typeof responseObj.intent !== "string") {
|
|
20258
|
-
return { isValid: false, error: `Response object has invalid 'intent' key. Expected a string, got ${typeof responseObj.intent}` };
|
|
20259
|
-
}
|
|
20260
|
-
if (typeof responseObj.handler !== "object") {
|
|
20261
|
-
return { isValid: false, error: `Response object has invalid 'handler' key. Expected an object, got ${typeof responseObj.handler}` };
|
|
20262
|
-
}
|
|
20263
|
-
const compulsoryKeysExist = INTENT_HANDLER_DEFAULT_PROPS.filter((key) => !(key in responseObj.handler));
|
|
20264
|
-
if (compulsoryKeysExist.length) {
|
|
20265
|
-
return { isValid: false, error: `Handler in Response object does not provide compulsory keys: ${compulsoryKeysExist.join(", ")}` };
|
|
20266
|
-
}
|
|
20267
|
-
return { isValid: true, ok: { intent: responseObj.intent, handler: { ...responseObj.handler } } };
|
|
20268
|
-
}
|
|
20269
20421
|
handleRaiseOnError(instanceId) {
|
|
20270
20422
|
if (!instanceId) {
|
|
20271
20423
|
return;
|
|
@@ -20288,18 +20440,34 @@
|
|
|
20288
20440
|
this.intentsResolverAppName = (_c = (_b = options.intents) === null || _b === void 0 ? void 0 : _b.intentsResolverAppName) !== null && _c !== void 0 ? _c : INTENTS_RESOLVER_APP_NAME;
|
|
20289
20441
|
this.intentsResolverResponseTimeout = (_e = (_d = options.intents) === null || _d === void 0 ? void 0 : _d.methodResponseTimeoutMs) !== null && _e !== void 0 ? _e : DEFAULT_RESOLVER_RESPONSE_TIMEOUT;
|
|
20290
20442
|
}
|
|
20291
|
-
|
|
20443
|
+
checkIfResolverShouldBeOpenedForRaise(intent, request) {
|
|
20444
|
+
const checkOpen = this.checkIfIntentsResolverShouldBeOpened();
|
|
20445
|
+
if (!checkOpen.open) {
|
|
20446
|
+
return checkOpen;
|
|
20447
|
+
}
|
|
20448
|
+
const hasMoreThanOneHandler = this.checkIfIntentHasMoreThanOneHandler(intent, request);
|
|
20449
|
+
if (!hasMoreThanOneHandler) {
|
|
20450
|
+
return { open: false, reason: `Raised intent ${intent.name} has only one handler` };
|
|
20451
|
+
}
|
|
20452
|
+
return { open: true };
|
|
20453
|
+
}
|
|
20454
|
+
checkIfResolverShouldBeOpenedForFilterHandlers(handlers, filter) {
|
|
20455
|
+
if (handlers.length === 1) {
|
|
20456
|
+
return { open: false, reason: `There's only one valid intent handler for filter ${JSON.stringify(filter)}` };
|
|
20457
|
+
}
|
|
20458
|
+
if (typeof (filter === null || filter === void 0 ? void 0 : filter.openResolver) === "boolean" && !filter.openResolver) {
|
|
20459
|
+
return { open: false, reason: "Intents resolver is disabled by IntentHandler filter" };
|
|
20460
|
+
}
|
|
20461
|
+
return this.checkIfIntentsResolverShouldBeOpened();
|
|
20462
|
+
}
|
|
20463
|
+
checkIfIntentsResolverShouldBeOpened() {
|
|
20292
20464
|
if (!this.useIntentsResolverUI) {
|
|
20293
|
-
return { open: false, reason: `Intent Resolver is disabled.
|
|
20465
|
+
return { open: false, reason: `Intent Resolver is disabled. Resolving to first found handler` };
|
|
20294
20466
|
}
|
|
20295
20467
|
const intentsResolverApp = this.appManager.application(this.intentsResolverAppName);
|
|
20296
20468
|
if (!intentsResolverApp) {
|
|
20297
20469
|
return { open: false, reason: `Intent Resolver Application with name ${this.intentsResolverAppName} not found.` };
|
|
20298
20470
|
}
|
|
20299
|
-
const hasMoreThanOneHandler = this.checkIfIntentHasMoreThanOneHandler(intent, request);
|
|
20300
|
-
if (!hasMoreThanOneHandler) {
|
|
20301
|
-
return { open: false, reason: `Raised intent ${intent.name} has only one handler` };
|
|
20302
|
-
}
|
|
20303
20471
|
return { open: true };
|
|
20304
20472
|
}
|
|
20305
20473
|
checkIfIntentHasMoreThanOneHandler(intent, request) {
|
|
@@ -20343,67 +20511,6 @@
|
|
|
20343
20511
|
this.clearUnregistrationPromise(unregisterPromise);
|
|
20344
20512
|
});
|
|
20345
20513
|
}
|
|
20346
|
-
validateIntentRequest(request) {
|
|
20347
|
-
this.validateIntentRequestContext(request.context);
|
|
20348
|
-
this.validateIntentRequestTarget(request.target);
|
|
20349
|
-
this.validateIntentRequestTimeout(request.timeout);
|
|
20350
|
-
this.validateWaitUserResponseIndefinitely(request.waitUserResponseIndefinitely);
|
|
20351
|
-
if (request.handlers) {
|
|
20352
|
-
request.handlers.forEach((handler) => this.validateIntentRequestHandler(handler));
|
|
20353
|
-
}
|
|
20354
|
-
}
|
|
20355
|
-
validateIntentRequestTarget(target) {
|
|
20356
|
-
if (!target) {
|
|
20357
|
-
return;
|
|
20358
|
-
}
|
|
20359
|
-
if (typeof target !== "string" && typeof target !== "object") {
|
|
20360
|
-
throw new Error(`Please provide the intent target as one of the valid values: "reuse", "startNew", { app: string }, { instance: string } `);
|
|
20361
|
-
}
|
|
20362
|
-
}
|
|
20363
|
-
validateIntentRequestContext(context) {
|
|
20364
|
-
if (!context) {
|
|
20365
|
-
return;
|
|
20366
|
-
}
|
|
20367
|
-
if (typeof context !== "object") {
|
|
20368
|
-
throw new Error(`Please provide the intent context as an object`);
|
|
20369
|
-
}
|
|
20370
|
-
if (context.type && typeof context.type !== "string") {
|
|
20371
|
-
throw new Error(`Please provide the intent context as an object with 'type' property as string`);
|
|
20372
|
-
}
|
|
20373
|
-
if (context.data && typeof context.data !== "object") {
|
|
20374
|
-
throw new Error(`Please provide the intent context as an object with 'data' property as object`);
|
|
20375
|
-
}
|
|
20376
|
-
}
|
|
20377
|
-
validateIntentRequestHandler(handler) {
|
|
20378
|
-
if (!handler.applicationName) {
|
|
20379
|
-
throw new Error(`Please provide applicationName for handler ${JSON.stringify(handler)}`);
|
|
20380
|
-
}
|
|
20381
|
-
if (!handler.type) {
|
|
20382
|
-
throw new Error(`Please provide type for handler ${JSON.stringify(handler)}`);
|
|
20383
|
-
}
|
|
20384
|
-
if (handler.type === "instance" && !handler.instanceId) {
|
|
20385
|
-
throw new Error(`Please provide instanceId for handler ${JSON.stringify(handler)}`);
|
|
20386
|
-
}
|
|
20387
|
-
}
|
|
20388
|
-
validateIntentRequestTimeout(timeout) {
|
|
20389
|
-
if (!timeout) {
|
|
20390
|
-
return;
|
|
20391
|
-
}
|
|
20392
|
-
if (typeof timeout !== "number") {
|
|
20393
|
-
throw new Error(`Please provide the timeout as a number`);
|
|
20394
|
-
}
|
|
20395
|
-
if (timeout <= 0) {
|
|
20396
|
-
throw new Error(`Please provide the timeout as a positive number`);
|
|
20397
|
-
}
|
|
20398
|
-
}
|
|
20399
|
-
validateWaitUserResponseIndefinitely(waitUserResponseIndefinitely) {
|
|
20400
|
-
if (!waitUserResponseIndefinitely) {
|
|
20401
|
-
return;
|
|
20402
|
-
}
|
|
20403
|
-
if (typeof waitUserResponseIndefinitely !== "boolean") {
|
|
20404
|
-
throw new Error("Please provide waitUserResponseIndefinitely as a boolean");
|
|
20405
|
-
}
|
|
20406
|
-
}
|
|
20407
20514
|
findHandlerByFilter(handlers, filter) {
|
|
20408
20515
|
if (filter.type) {
|
|
20409
20516
|
return handlers.find((handler) => handler.type === filter.type);
|
|
@@ -20417,6 +20524,32 @@
|
|
|
20417
20524
|
return handlers.find((handler) => handler.applicationName === filter.app);
|
|
20418
20525
|
}
|
|
20419
20526
|
}
|
|
20527
|
+
extractIntentsWithInfoByHandler(intents, handler) {
|
|
20528
|
+
const intentsWithInfo = intents.reduce((validIntentsWithInfo, intent) => {
|
|
20529
|
+
intent.handlers.forEach((currentHandler) => {
|
|
20530
|
+
const isValid = Object.keys(handler).every((key) => {
|
|
20531
|
+
var _a;
|
|
20532
|
+
return key === "contextTypes"
|
|
20533
|
+
? (_a = handler.contextTypes) === null || _a === void 0 ? void 0 : _a.every((contextType) => { var _a; return (_a = currentHandler.contextTypes) === null || _a === void 0 ? void 0 : _a.includes(contextType); })
|
|
20534
|
+
: currentHandler[key] === handler[key];
|
|
20535
|
+
});
|
|
20536
|
+
if (!isValid) {
|
|
20537
|
+
return;
|
|
20538
|
+
}
|
|
20539
|
+
const intentWithInfo = {
|
|
20540
|
+
intent: intent.name,
|
|
20541
|
+
contextTypes: currentHandler.contextTypes,
|
|
20542
|
+
description: currentHandler.applicationDescription,
|
|
20543
|
+
displayName: currentHandler.displayName,
|
|
20544
|
+
icon: currentHandler.applicationIcon,
|
|
20545
|
+
resultType: currentHandler.resultType
|
|
20546
|
+
};
|
|
20547
|
+
validIntentsWithInfo.push(intentWithInfo);
|
|
20548
|
+
});
|
|
20549
|
+
return validIntentsWithInfo;
|
|
20550
|
+
}, []);
|
|
20551
|
+
return intentsWithInfo;
|
|
20552
|
+
}
|
|
20420
20553
|
}
|
|
20421
20554
|
|
|
20422
20555
|
class FactoryCallInfo {
|
|
@@ -20449,7 +20582,7 @@
|
|
|
20449
20582
|
constructor(appName, interop) {
|
|
20450
20583
|
this.appName = appName;
|
|
20451
20584
|
this.interop = interop;
|
|
20452
|
-
this.registry = lib
|
|
20585
|
+
this.registry = lib();
|
|
20453
20586
|
this.interopMethodRegistered = false;
|
|
20454
20587
|
}
|
|
20455
20588
|
async get(app) {
|