@expressms/smartapp-sdk 1.7.0 → 1.8.0-alpha.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/build/umd/index.js +20 -7
- package/package.json +2 -2
package/build/umd/index.js
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
HANDLER["EXPRESS"] = "express";
|
|
23
23
|
})(HANDLER || (HANDLER = {}));
|
|
24
24
|
const RESPONSE_TIMEOUT = 30000;
|
|
25
|
+
const SYNC_RESPONSE_TIMEOUT = 5000;
|
|
25
26
|
const WEB_COMMAND_TYPE = 'smartapp';
|
|
26
27
|
const WEB_COMMAND_TYPE_RPC = 'smartapp_rpc';
|
|
27
28
|
const WEB_COMMAND_TYPE_RPC_LOGS = 'smartAppLogs';
|
|
@@ -1395,7 +1396,7 @@
|
|
|
1395
1396
|
onReceive(callback) {
|
|
1396
1397
|
this.eventEmitter.on(EVENT_TYPE.RECEIVE, callback);
|
|
1397
1398
|
}
|
|
1398
|
-
sendEvent({ handler, method, params, files, timeout = RESPONSE_TIMEOUT, guaranteed_delivery_required = false, }) {
|
|
1399
|
+
sendEvent({ handler, method, params, files, timeout = RESPONSE_TIMEOUT, guaranteed_delivery_required = false, sync_request = false, sync_request_timeout = SYNC_RESPONSE_TIMEOUT, }) {
|
|
1399
1400
|
if (!this.hasCommunicationObject)
|
|
1400
1401
|
return Promise.reject();
|
|
1401
1402
|
const isRenameParamsEnabled = handler === HANDLER.BOTX ? this.isRenameParamsEnabledForBotx : true;
|
|
@@ -1407,6 +1408,8 @@
|
|
|
1407
1408
|
handler,
|
|
1408
1409
|
payload: isRenameParamsEnabled ? camelCaseToSnakeCase(params) : params,
|
|
1409
1410
|
guaranteed_delivery_required,
|
|
1411
|
+
sync_request,
|
|
1412
|
+
sync_request_timeout,
|
|
1410
1413
|
};
|
|
1411
1414
|
const eventFiles = isRenameParamsEnabled ?
|
|
1412
1415
|
files?.map((file) => camelCaseToSnakeCase(file)) : files;
|
|
@@ -1442,7 +1445,7 @@
|
|
|
1442
1445
|
* @param guaranteed_delivery_required - boolean.
|
|
1443
1446
|
* @returns Promise.
|
|
1444
1447
|
*/
|
|
1445
|
-
sendBotEvent({ method, params, files, timeout, guaranteed_delivery_required, }) {
|
|
1448
|
+
sendBotEvent({ method, params, files, timeout, guaranteed_delivery_required, sync_request, sync_request_timeout, }) {
|
|
1446
1449
|
return this.sendEvent({
|
|
1447
1450
|
handler: HANDLER.BOTX,
|
|
1448
1451
|
method,
|
|
@@ -1450,6 +1453,8 @@
|
|
|
1450
1453
|
files,
|
|
1451
1454
|
timeout,
|
|
1452
1455
|
guaranteed_delivery_required,
|
|
1456
|
+
sync_request,
|
|
1457
|
+
sync_request_timeout,
|
|
1453
1458
|
});
|
|
1454
1459
|
}
|
|
1455
1460
|
/**
|
|
@@ -1581,7 +1586,7 @@
|
|
|
1581
1586
|
onReceive(callback) {
|
|
1582
1587
|
this.eventEmitter.on(EVENT_TYPE.RECEIVE, callback);
|
|
1583
1588
|
}
|
|
1584
|
-
sendEvent({ handler, method, params, files, timeout = RESPONSE_TIMEOUT, guaranteed_delivery_required = false, }) {
|
|
1589
|
+
sendEvent({ handler, method, params, files, timeout = RESPONSE_TIMEOUT, guaranteed_delivery_required = false, sync_request = false, sync_request_timeout = SYNC_RESPONSE_TIMEOUT, }) {
|
|
1585
1590
|
if (!this.hasCommunicationObject)
|
|
1586
1591
|
return Promise.reject();
|
|
1587
1592
|
const ref = v4(); // UUID to detect express response.
|
|
@@ -1593,6 +1598,8 @@
|
|
|
1593
1598
|
handler,
|
|
1594
1599
|
payload: isRenameParamsEnabled ? camelCaseToSnakeCase(params) : params,
|
|
1595
1600
|
guaranteed_delivery_required,
|
|
1601
|
+
sync_request,
|
|
1602
|
+
sync_request_timeout,
|
|
1596
1603
|
};
|
|
1597
1604
|
const eventFiles = isRenameParamsEnabled ?
|
|
1598
1605
|
files?.map((file) => camelCaseToSnakeCase(file)) : files;
|
|
@@ -1622,7 +1629,7 @@
|
|
|
1622
1629
|
* })
|
|
1623
1630
|
* ```
|
|
1624
1631
|
*/
|
|
1625
|
-
sendBotEvent({ method, params, files, timeout = RESPONSE_TIMEOUT, guaranteed_delivery_required, }) {
|
|
1632
|
+
sendBotEvent({ method, params, files, timeout = RESPONSE_TIMEOUT, guaranteed_delivery_required, sync_request, sync_request_timeout, }) {
|
|
1626
1633
|
return this.sendEvent({
|
|
1627
1634
|
handler: HANDLER.BOTX,
|
|
1628
1635
|
method,
|
|
@@ -1630,6 +1637,8 @@
|
|
|
1630
1637
|
files,
|
|
1631
1638
|
timeout,
|
|
1632
1639
|
guaranteed_delivery_required,
|
|
1640
|
+
sync_request,
|
|
1641
|
+
sync_request_timeout,
|
|
1633
1642
|
});
|
|
1634
1643
|
}
|
|
1635
1644
|
/**
|
|
@@ -1765,7 +1774,7 @@
|
|
|
1765
1774
|
onReceive(callback) {
|
|
1766
1775
|
this.eventEmitter.on(EVENT_TYPE.RECEIVE, callback);
|
|
1767
1776
|
}
|
|
1768
|
-
sendEvent({ handler, method, params, files, timeout = RESPONSE_TIMEOUT, guaranteed_delivery_required = false, }) {
|
|
1777
|
+
sendEvent({ handler, method, params, files, timeout = RESPONSE_TIMEOUT, guaranteed_delivery_required = false, sync_request = false, sync_request_timeout = SYNC_RESPONSE_TIMEOUT, }) {
|
|
1769
1778
|
const isRenameParamsEnabled = handler === HANDLER.BOTX ? this.isRenameParamsEnabledForBotx : false;
|
|
1770
1779
|
const ref = v4(); // UUID to detect express response.
|
|
1771
1780
|
const payload = {
|
|
@@ -1775,6 +1784,8 @@
|
|
|
1775
1784
|
handler,
|
|
1776
1785
|
payload: isRenameParamsEnabled ? camelCaseToSnakeCase(params) : params,
|
|
1777
1786
|
guaranteed_delivery_required,
|
|
1787
|
+
sync_request,
|
|
1788
|
+
sync_request_timeout,
|
|
1778
1789
|
};
|
|
1779
1790
|
const eventFiles = isRenameParamsEnabled ?
|
|
1780
1791
|
files?.map((file) => camelCaseToSnakeCase(file)) : files;
|
|
@@ -1806,7 +1817,7 @@
|
|
|
1806
1817
|
* })
|
|
1807
1818
|
* ```
|
|
1808
1819
|
*/
|
|
1809
|
-
sendBotEvent({ method, params, files, timeout, guaranteed_delivery_required, }) {
|
|
1820
|
+
sendBotEvent({ method, params, files, timeout, guaranteed_delivery_required, sync_request, sync_request_timeout, }) {
|
|
1810
1821
|
return this.sendEvent({
|
|
1811
1822
|
handler: HANDLER.BOTX,
|
|
1812
1823
|
method,
|
|
@@ -1814,6 +1825,8 @@
|
|
|
1814
1825
|
files,
|
|
1815
1826
|
timeout,
|
|
1816
1827
|
guaranteed_delivery_required,
|
|
1828
|
+
sync_request,
|
|
1829
|
+
sync_request_timeout,
|
|
1817
1830
|
});
|
|
1818
1831
|
}
|
|
1819
1832
|
/**
|
|
@@ -1897,7 +1910,7 @@
|
|
|
1897
1910
|
}
|
|
1898
1911
|
}
|
|
1899
1912
|
|
|
1900
|
-
const LIB_VERSION = "1.
|
|
1913
|
+
const LIB_VERSION = "1.3.0-alpha.0";
|
|
1901
1914
|
|
|
1902
1915
|
const getBridge = () => {
|
|
1903
1916
|
if (process.env.NODE_ENV === 'test')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressms/smartapp-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-alpha.0",
|
|
4
4
|
"description": "Smartapp SDK",
|
|
5
5
|
"main": "build/main/index.js",
|
|
6
6
|
"typings": "build/main/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"typescript": "^4.9.5"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@expressms/smartapp-bridge": "1.
|
|
41
|
+
"@expressms/smartapp-bridge": "1.3.0-alpha.0"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|
|
44
44
|
"build/main",
|