@audius/sdk 2.0.3-beta.3 → 2.0.3-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.cjs.js +249 -215
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.browser.esm.js +249 -215
- package/dist/index.browser.esm.js.map +1 -1
- package/dist/index.cjs.js +251 -217
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +251 -217
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.js +249 -215
- package/dist/index.native.js.map +1 -1
- package/dist/legacy.js +251 -217
- package/dist/legacy.js.map +1 -1
- package/dist/native-libs.js +2 -2
- package/dist/sdk/api/chats/ChatsApi.d.ts +1 -0
- package/dist/sdk.js +2 -2
- package/dist/sdk.js.map +1 -1
- package/package.json +2 -2
- package/src/sdk/api/chats/ChatsApi.ts +14 -0
package/dist/index.native.js
CHANGED
|
@@ -8695,19 +8695,19 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
8695
8695
|
return block;
|
|
8696
8696
|
}()
|
|
8697
8697
|
}, {
|
|
8698
|
-
key: "
|
|
8698
|
+
key: "unblock",
|
|
8699
8699
|
value: function () {
|
|
8700
|
-
var
|
|
8700
|
+
var _unblock = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(requestParameters) {
|
|
8701
8701
|
return regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
8702
8702
|
while (1) {
|
|
8703
8703
|
switch (_context17.prev = _context17.next) {
|
|
8704
8704
|
case 0:
|
|
8705
|
-
this.assertNotNullOrUndefined(requestParameters.
|
|
8705
|
+
this.assertNotNullOrUndefined(requestParameters.userId, 'requestParameters.userId', 'unblock');
|
|
8706
8706
|
_context17.next = 3;
|
|
8707
8707
|
return this.sendRpc({
|
|
8708
|
-
method: 'chat.
|
|
8708
|
+
method: 'chat.unblock',
|
|
8709
8709
|
params: {
|
|
8710
|
-
|
|
8710
|
+
user_id: requestParameters.userId
|
|
8711
8711
|
}
|
|
8712
8712
|
});
|
|
8713
8713
|
|
|
@@ -8722,26 +8722,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
8722
8722
|
}, _callee17, this);
|
|
8723
8723
|
}));
|
|
8724
8724
|
|
|
8725
|
-
function
|
|
8726
|
-
return
|
|
8725
|
+
function unblock(_x14) {
|
|
8726
|
+
return _unblock.apply(this, arguments);
|
|
8727
8727
|
}
|
|
8728
8728
|
|
|
8729
|
-
return
|
|
8729
|
+
return unblock;
|
|
8730
8730
|
}()
|
|
8731
8731
|
}, {
|
|
8732
|
-
key: "
|
|
8732
|
+
key: "delete",
|
|
8733
8733
|
value: function () {
|
|
8734
|
-
var
|
|
8734
|
+
var _delete2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(requestParameters) {
|
|
8735
8735
|
return regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
8736
8736
|
while (1) {
|
|
8737
8737
|
switch (_context18.prev = _context18.next) {
|
|
8738
8738
|
case 0:
|
|
8739
|
-
this.assertNotNullOrUndefined(requestParameters.
|
|
8739
|
+
this.assertNotNullOrUndefined(requestParameters.chatId, 'requestParameters.chatId', 'delete');
|
|
8740
8740
|
_context18.next = 3;
|
|
8741
8741
|
return this.sendRpc({
|
|
8742
|
-
method: 'chat.
|
|
8742
|
+
method: 'chat.delete',
|
|
8743
8743
|
params: {
|
|
8744
|
-
|
|
8744
|
+
chat_id: requestParameters.chatId
|
|
8745
8745
|
}
|
|
8746
8746
|
});
|
|
8747
8747
|
|
|
@@ -8756,7 +8756,41 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
8756
8756
|
}, _callee18, this);
|
|
8757
8757
|
}));
|
|
8758
8758
|
|
|
8759
|
-
function
|
|
8759
|
+
function _delete(_x15) {
|
|
8760
|
+
return _delete2.apply(this, arguments);
|
|
8761
|
+
}
|
|
8762
|
+
|
|
8763
|
+
return _delete;
|
|
8764
|
+
}()
|
|
8765
|
+
}, {
|
|
8766
|
+
key: "permit",
|
|
8767
|
+
value: function () {
|
|
8768
|
+
var _permit = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(requestParameters) {
|
|
8769
|
+
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
8770
|
+
while (1) {
|
|
8771
|
+
switch (_context19.prev = _context19.next) {
|
|
8772
|
+
case 0:
|
|
8773
|
+
this.assertNotNullOrUndefined(requestParameters.permit, 'requestParameters.permit', 'permit');
|
|
8774
|
+
_context19.next = 3;
|
|
8775
|
+
return this.sendRpc({
|
|
8776
|
+
method: 'chat.permit',
|
|
8777
|
+
params: {
|
|
8778
|
+
permit: requestParameters.permit
|
|
8779
|
+
}
|
|
8780
|
+
});
|
|
8781
|
+
|
|
8782
|
+
case 3:
|
|
8783
|
+
return _context19.abrupt("return", _context19.sent);
|
|
8784
|
+
|
|
8785
|
+
case 4:
|
|
8786
|
+
case "end":
|
|
8787
|
+
return _context19.stop();
|
|
8788
|
+
}
|
|
8789
|
+
}
|
|
8790
|
+
}, _callee19, this);
|
|
8791
|
+
}));
|
|
8792
|
+
|
|
8793
|
+
function permit(_x16) {
|
|
8760
8794
|
return _permit.apply(this, arguments);
|
|
8761
8795
|
}
|
|
8762
8796
|
|
|
@@ -8790,67 +8824,67 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
8790
8824
|
}, {
|
|
8791
8825
|
key: "createInvites",
|
|
8792
8826
|
value: function () {
|
|
8793
|
-
var _createInvites = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
8827
|
+
var _createInvites = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(userId, invitedUserIds, chatSecret) {
|
|
8794
8828
|
var _this4 = this;
|
|
8795
8829
|
|
|
8796
8830
|
var userPublicKey;
|
|
8797
|
-
return regeneratorRuntime.wrap(function
|
|
8831
|
+
return regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
8798
8832
|
while (1) {
|
|
8799
|
-
switch (
|
|
8833
|
+
switch (_context21.prev = _context21.next) {
|
|
8800
8834
|
case 0:
|
|
8801
|
-
|
|
8835
|
+
_context21.next = 2;
|
|
8802
8836
|
return this.getPublicKey(userId);
|
|
8803
8837
|
|
|
8804
8838
|
case 2:
|
|
8805
|
-
userPublicKey =
|
|
8806
|
-
|
|
8839
|
+
userPublicKey = _context21.sent;
|
|
8840
|
+
_context21.next = 5;
|
|
8807
8841
|
return Promise.all([userId].concat(_toConsumableArray(invitedUserIds)).map( /*#__PURE__*/function () {
|
|
8808
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
8842
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId) {
|
|
8809
8843
|
var inviteePublicKey, inviteCode;
|
|
8810
|
-
return regeneratorRuntime.wrap(function
|
|
8844
|
+
return regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
8811
8845
|
while (1) {
|
|
8812
|
-
switch (
|
|
8846
|
+
switch (_context20.prev = _context20.next) {
|
|
8813
8847
|
case 0:
|
|
8814
|
-
|
|
8848
|
+
_context20.next = 2;
|
|
8815
8849
|
return _this4.getPublicKey(userId);
|
|
8816
8850
|
|
|
8817
8851
|
case 2:
|
|
8818
|
-
inviteePublicKey =
|
|
8819
|
-
|
|
8852
|
+
inviteePublicKey = _context20.sent;
|
|
8853
|
+
_context20.next = 5;
|
|
8820
8854
|
return _this4.createInviteCode(userPublicKey, inviteePublicKey, chatSecret);
|
|
8821
8855
|
|
|
8822
8856
|
case 5:
|
|
8823
|
-
inviteCode =
|
|
8824
|
-
return
|
|
8857
|
+
inviteCode = _context20.sent;
|
|
8858
|
+
return _context20.abrupt("return", {
|
|
8825
8859
|
user_id: userId,
|
|
8826
8860
|
invite_code: base64.encode(inviteCode)
|
|
8827
8861
|
});
|
|
8828
8862
|
|
|
8829
8863
|
case 7:
|
|
8830
8864
|
case "end":
|
|
8831
|
-
return
|
|
8865
|
+
return _context20.stop();
|
|
8832
8866
|
}
|
|
8833
8867
|
}
|
|
8834
|
-
},
|
|
8868
|
+
}, _callee20);
|
|
8835
8869
|
}));
|
|
8836
8870
|
|
|
8837
|
-
return function (
|
|
8871
|
+
return function (_x20) {
|
|
8838
8872
|
return _ref3.apply(this, arguments);
|
|
8839
8873
|
};
|
|
8840
8874
|
}()));
|
|
8841
8875
|
|
|
8842
8876
|
case 5:
|
|
8843
|
-
return
|
|
8877
|
+
return _context21.abrupt("return", _context21.sent);
|
|
8844
8878
|
|
|
8845
8879
|
case 6:
|
|
8846
8880
|
case "end":
|
|
8847
|
-
return
|
|
8881
|
+
return _context21.stop();
|
|
8848
8882
|
}
|
|
8849
8883
|
}
|
|
8850
|
-
},
|
|
8884
|
+
}, _callee21, this);
|
|
8851
8885
|
}));
|
|
8852
8886
|
|
|
8853
|
-
function createInvites(
|
|
8887
|
+
function createInvites(_x17, _x18, _x19) {
|
|
8854
8888
|
return _createInvites.apply(this, arguments);
|
|
8855
8889
|
}
|
|
8856
8890
|
|
|
@@ -8859,36 +8893,36 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
8859
8893
|
}, {
|
|
8860
8894
|
key: "createInviteCode",
|
|
8861
8895
|
value: function () {
|
|
8862
|
-
var _createInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
8896
|
+
var _createInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(userPublicKey, inviteePublicKey, chatSecret) {
|
|
8863
8897
|
var sharedSecret, encryptedChatSecret, inviteCode;
|
|
8864
|
-
return regeneratorRuntime.wrap(function
|
|
8898
|
+
return regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
8865
8899
|
while (1) {
|
|
8866
|
-
switch (
|
|
8900
|
+
switch (_context22.prev = _context22.next) {
|
|
8867
8901
|
case 0:
|
|
8868
|
-
|
|
8902
|
+
_context22.next = 2;
|
|
8869
8903
|
return this.walletService.getSharedSecret(inviteePublicKey);
|
|
8870
8904
|
|
|
8871
8905
|
case 2:
|
|
8872
|
-
sharedSecret =
|
|
8873
|
-
|
|
8906
|
+
sharedSecret = _context22.sent;
|
|
8907
|
+
_context22.next = 5;
|
|
8874
8908
|
return this.encrypt(sharedSecret, chatSecret);
|
|
8875
8909
|
|
|
8876
8910
|
case 5:
|
|
8877
|
-
encryptedChatSecret =
|
|
8911
|
+
encryptedChatSecret = _context22.sent;
|
|
8878
8912
|
inviteCode = new Uint8Array(65 + encryptedChatSecret.length);
|
|
8879
8913
|
inviteCode.set(userPublicKey);
|
|
8880
8914
|
inviteCode.set(encryptedChatSecret, 65);
|
|
8881
|
-
return
|
|
8915
|
+
return _context22.abrupt("return", inviteCode);
|
|
8882
8916
|
|
|
8883
8917
|
case 10:
|
|
8884
8918
|
case "end":
|
|
8885
|
-
return
|
|
8919
|
+
return _context22.stop();
|
|
8886
8920
|
}
|
|
8887
8921
|
}
|
|
8888
|
-
},
|
|
8922
|
+
}, _callee22, this);
|
|
8889
8923
|
}));
|
|
8890
8924
|
|
|
8891
|
-
function createInviteCode(
|
|
8925
|
+
function createInviteCode(_x21, _x22, _x23) {
|
|
8892
8926
|
return _createInviteCode.apply(this, arguments);
|
|
8893
8927
|
}
|
|
8894
8928
|
|
|
@@ -8897,34 +8931,34 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
8897
8931
|
}, {
|
|
8898
8932
|
key: "readInviteCode",
|
|
8899
8933
|
value: function () {
|
|
8900
|
-
var _readInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
8934
|
+
var _readInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee23(inviteCode) {
|
|
8901
8935
|
var friendPublicKey, chatSecretEncrypted, sharedSecret;
|
|
8902
|
-
return regeneratorRuntime.wrap(function
|
|
8936
|
+
return regeneratorRuntime.wrap(function _callee23$(_context23) {
|
|
8903
8937
|
while (1) {
|
|
8904
|
-
switch (
|
|
8938
|
+
switch (_context23.prev = _context23.next) {
|
|
8905
8939
|
case 0:
|
|
8906
8940
|
friendPublicKey = inviteCode.slice(0, 65);
|
|
8907
8941
|
chatSecretEncrypted = inviteCode.slice(65);
|
|
8908
|
-
|
|
8942
|
+
_context23.next = 4;
|
|
8909
8943
|
return this.walletService.getSharedSecret(friendPublicKey);
|
|
8910
8944
|
|
|
8911
8945
|
case 4:
|
|
8912
|
-
sharedSecret =
|
|
8913
|
-
|
|
8946
|
+
sharedSecret = _context23.sent;
|
|
8947
|
+
_context23.next = 7;
|
|
8914
8948
|
return this.decrypt(sharedSecret, chatSecretEncrypted);
|
|
8915
8949
|
|
|
8916
8950
|
case 7:
|
|
8917
|
-
return
|
|
8951
|
+
return _context23.abrupt("return", _context23.sent);
|
|
8918
8952
|
|
|
8919
8953
|
case 8:
|
|
8920
8954
|
case "end":
|
|
8921
|
-
return
|
|
8955
|
+
return _context23.stop();
|
|
8922
8956
|
}
|
|
8923
8957
|
}
|
|
8924
|
-
},
|
|
8958
|
+
}, _callee23, this);
|
|
8925
8959
|
}));
|
|
8926
8960
|
|
|
8927
|
-
function readInviteCode(
|
|
8961
|
+
function readInviteCode(_x24) {
|
|
8928
8962
|
return _readInviteCode.apply(this, arguments);
|
|
8929
8963
|
}
|
|
8930
8964
|
|
|
@@ -8933,26 +8967,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
8933
8967
|
}, {
|
|
8934
8968
|
key: "encrypt",
|
|
8935
8969
|
value: function () {
|
|
8936
|
-
var _encrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
8937
|
-
return regeneratorRuntime.wrap(function
|
|
8970
|
+
var _encrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(secret, payload) {
|
|
8971
|
+
return regeneratorRuntime.wrap(function _callee24$(_context24) {
|
|
8938
8972
|
while (1) {
|
|
8939
|
-
switch (
|
|
8973
|
+
switch (_context24.prev = _context24.next) {
|
|
8940
8974
|
case 0:
|
|
8941
|
-
|
|
8975
|
+
_context24.next = 2;
|
|
8942
8976
|
return aes.encrypt(secret.slice(secret.length - 32), payload);
|
|
8943
8977
|
|
|
8944
8978
|
case 2:
|
|
8945
|
-
return
|
|
8979
|
+
return _context24.abrupt("return", _context24.sent);
|
|
8946
8980
|
|
|
8947
8981
|
case 3:
|
|
8948
8982
|
case "end":
|
|
8949
|
-
return
|
|
8983
|
+
return _context24.stop();
|
|
8950
8984
|
}
|
|
8951
8985
|
}
|
|
8952
|
-
},
|
|
8986
|
+
}, _callee24);
|
|
8953
8987
|
}));
|
|
8954
8988
|
|
|
8955
|
-
function encrypt(
|
|
8989
|
+
function encrypt(_x25, _x26) {
|
|
8956
8990
|
return _encrypt.apply(this, arguments);
|
|
8957
8991
|
}
|
|
8958
8992
|
|
|
@@ -8961,26 +8995,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
8961
8995
|
}, {
|
|
8962
8996
|
key: "encryptString",
|
|
8963
8997
|
value: function () {
|
|
8964
|
-
var _encryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
8965
|
-
return regeneratorRuntime.wrap(function
|
|
8998
|
+
var _encryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(secret, payload) {
|
|
8999
|
+
return regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
8966
9000
|
while (1) {
|
|
8967
|
-
switch (
|
|
9001
|
+
switch (_context25.prev = _context25.next) {
|
|
8968
9002
|
case 0:
|
|
8969
|
-
|
|
9003
|
+
_context25.next = 2;
|
|
8970
9004
|
return this.encrypt(secret, new TextEncoder().encode(payload));
|
|
8971
9005
|
|
|
8972
9006
|
case 2:
|
|
8973
|
-
return
|
|
9007
|
+
return _context25.abrupt("return", _context25.sent);
|
|
8974
9008
|
|
|
8975
9009
|
case 3:
|
|
8976
9010
|
case "end":
|
|
8977
|
-
return
|
|
9011
|
+
return _context25.stop();
|
|
8978
9012
|
}
|
|
8979
9013
|
}
|
|
8980
|
-
},
|
|
9014
|
+
}, _callee25, this);
|
|
8981
9015
|
}));
|
|
8982
9016
|
|
|
8983
|
-
function encryptString(
|
|
9017
|
+
function encryptString(_x27, _x28) {
|
|
8984
9018
|
return _encryptString.apply(this, arguments);
|
|
8985
9019
|
}
|
|
8986
9020
|
|
|
@@ -8989,26 +9023,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
8989
9023
|
}, {
|
|
8990
9024
|
key: "decrypt",
|
|
8991
9025
|
value: function () {
|
|
8992
|
-
var _decrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
8993
|
-
return regeneratorRuntime.wrap(function
|
|
9026
|
+
var _decrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee26(secret, payload) {
|
|
9027
|
+
return regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
8994
9028
|
while (1) {
|
|
8995
|
-
switch (
|
|
9029
|
+
switch (_context26.prev = _context26.next) {
|
|
8996
9030
|
case 0:
|
|
8997
|
-
|
|
9031
|
+
_context26.next = 2;
|
|
8998
9032
|
return aes.decrypt(secret.slice(secret.length - 32), payload);
|
|
8999
9033
|
|
|
9000
9034
|
case 2:
|
|
9001
|
-
return
|
|
9035
|
+
return _context26.abrupt("return", _context26.sent);
|
|
9002
9036
|
|
|
9003
9037
|
case 3:
|
|
9004
9038
|
case "end":
|
|
9005
|
-
return
|
|
9039
|
+
return _context26.stop();
|
|
9006
9040
|
}
|
|
9007
9041
|
}
|
|
9008
|
-
},
|
|
9042
|
+
}, _callee26);
|
|
9009
9043
|
}));
|
|
9010
9044
|
|
|
9011
|
-
function decrypt(
|
|
9045
|
+
function decrypt(_x29, _x30) {
|
|
9012
9046
|
return _decrypt.apply(this, arguments);
|
|
9013
9047
|
}
|
|
9014
9048
|
|
|
@@ -9017,28 +9051,28 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9017
9051
|
}, {
|
|
9018
9052
|
key: "decryptString",
|
|
9019
9053
|
value: function () {
|
|
9020
|
-
var _decryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9021
|
-
return regeneratorRuntime.wrap(function
|
|
9054
|
+
var _decryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee27(secret, payload) {
|
|
9055
|
+
return regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
9022
9056
|
while (1) {
|
|
9023
|
-
switch (
|
|
9057
|
+
switch (_context27.prev = _context27.next) {
|
|
9024
9058
|
case 0:
|
|
9025
|
-
|
|
9026
|
-
|
|
9059
|
+
_context27.t0 = new TextDecoder();
|
|
9060
|
+
_context27.next = 3;
|
|
9027
9061
|
return this.decrypt(secret, payload);
|
|
9028
9062
|
|
|
9029
9063
|
case 3:
|
|
9030
|
-
|
|
9031
|
-
return
|
|
9064
|
+
_context27.t1 = _context27.sent;
|
|
9065
|
+
return _context27.abrupt("return", _context27.t0.decode.call(_context27.t0, _context27.t1));
|
|
9032
9066
|
|
|
9033
9067
|
case 5:
|
|
9034
9068
|
case "end":
|
|
9035
|
-
return
|
|
9069
|
+
return _context27.stop();
|
|
9036
9070
|
}
|
|
9037
9071
|
}
|
|
9038
|
-
},
|
|
9072
|
+
}, _callee27, this);
|
|
9039
9073
|
}));
|
|
9040
9074
|
|
|
9041
|
-
function decryptString(
|
|
9075
|
+
function decryptString(_x31, _x32) {
|
|
9042
9076
|
return _decryptString.apply(this, arguments);
|
|
9043
9077
|
}
|
|
9044
9078
|
|
|
@@ -9047,53 +9081,53 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9047
9081
|
}, {
|
|
9048
9082
|
key: "decryptLastChatMessage",
|
|
9049
9083
|
value: function () {
|
|
9050
|
-
var _decryptLastChatMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9084
|
+
var _decryptLastChatMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee28(c) {
|
|
9051
9085
|
var sharedSecret, lastMessage;
|
|
9052
|
-
return regeneratorRuntime.wrap(function
|
|
9086
|
+
return regeneratorRuntime.wrap(function _callee28$(_context28) {
|
|
9053
9087
|
while (1) {
|
|
9054
|
-
switch (
|
|
9088
|
+
switch (_context28.prev = _context28.next) {
|
|
9055
9089
|
case 0:
|
|
9056
|
-
|
|
9090
|
+
_context28.next = 2;
|
|
9057
9091
|
return this.getChatSecret(c.chat_id);
|
|
9058
9092
|
|
|
9059
9093
|
case 2:
|
|
9060
|
-
sharedSecret =
|
|
9094
|
+
sharedSecret = _context28.sent;
|
|
9061
9095
|
lastMessage = '';
|
|
9062
9096
|
|
|
9063
9097
|
if (!(c.last_message && c.last_message.length > 0)) {
|
|
9064
|
-
|
|
9098
|
+
_context28.next = 15;
|
|
9065
9099
|
break;
|
|
9066
9100
|
}
|
|
9067
9101
|
|
|
9068
|
-
|
|
9069
|
-
|
|
9102
|
+
_context28.prev = 5;
|
|
9103
|
+
_context28.next = 8;
|
|
9070
9104
|
return this.decryptString(sharedSecret, base64.decode(c.last_message));
|
|
9071
9105
|
|
|
9072
9106
|
case 8:
|
|
9073
|
-
lastMessage =
|
|
9074
|
-
|
|
9107
|
+
lastMessage = _context28.sent;
|
|
9108
|
+
_context28.next = 15;
|
|
9075
9109
|
break;
|
|
9076
9110
|
|
|
9077
9111
|
case 11:
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
console.error("[audius-sdk]: Error: Couldn't decrypt last chat message", c,
|
|
9112
|
+
_context28.prev = 11;
|
|
9113
|
+
_context28.t0 = _context28["catch"](5);
|
|
9114
|
+
console.error("[audius-sdk]: Error: Couldn't decrypt last chat message", c, _context28.t0);
|
|
9081
9115
|
lastMessage = "Error: Couldn't decrypt message";
|
|
9082
9116
|
|
|
9083
9117
|
case 15:
|
|
9084
|
-
return
|
|
9118
|
+
return _context28.abrupt("return", _objectSpread2(_objectSpread2({}, c), {}, {
|
|
9085
9119
|
last_message: lastMessage
|
|
9086
9120
|
}));
|
|
9087
9121
|
|
|
9088
9122
|
case 16:
|
|
9089
9123
|
case "end":
|
|
9090
|
-
return
|
|
9124
|
+
return _context28.stop();
|
|
9091
9125
|
}
|
|
9092
9126
|
}
|
|
9093
|
-
},
|
|
9127
|
+
}, _callee28, this, [[5, 11]]);
|
|
9094
9128
|
}));
|
|
9095
9129
|
|
|
9096
|
-
function decryptLastChatMessage(
|
|
9130
|
+
function decryptLastChatMessage(_x33) {
|
|
9097
9131
|
return _decryptLastChatMessage.apply(this, arguments);
|
|
9098
9132
|
}
|
|
9099
9133
|
|
|
@@ -9102,17 +9136,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9102
9136
|
}, {
|
|
9103
9137
|
key: "getRaw",
|
|
9104
9138
|
value: function () {
|
|
9105
|
-
var _getRaw = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9139
|
+
var _getRaw = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee29(chatId) {
|
|
9106
9140
|
var path, queryParameters, response;
|
|
9107
|
-
return regeneratorRuntime.wrap(function
|
|
9141
|
+
return regeneratorRuntime.wrap(function _callee29$(_context29) {
|
|
9108
9142
|
while (1) {
|
|
9109
|
-
switch (
|
|
9143
|
+
switch (_context29.prev = _context29.next) {
|
|
9110
9144
|
case 0:
|
|
9111
9145
|
path = "/comms/chats/".concat(chatId);
|
|
9112
9146
|
queryParameters = {
|
|
9113
9147
|
timestamp: new Date().getTime()
|
|
9114
9148
|
};
|
|
9115
|
-
|
|
9149
|
+
_context29.next = 4;
|
|
9116
9150
|
return this.signAndSendRequest({
|
|
9117
9151
|
method: 'GET',
|
|
9118
9152
|
headers: {},
|
|
@@ -9121,22 +9155,22 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9121
9155
|
});
|
|
9122
9156
|
|
|
9123
9157
|
case 4:
|
|
9124
|
-
response =
|
|
9125
|
-
|
|
9158
|
+
response = _context29.sent;
|
|
9159
|
+
_context29.next = 7;
|
|
9126
9160
|
return response.json();
|
|
9127
9161
|
|
|
9128
9162
|
case 7:
|
|
9129
|
-
return
|
|
9163
|
+
return _context29.abrupt("return", _context29.sent);
|
|
9130
9164
|
|
|
9131
9165
|
case 8:
|
|
9132
9166
|
case "end":
|
|
9133
|
-
return
|
|
9167
|
+
return _context29.stop();
|
|
9134
9168
|
}
|
|
9135
9169
|
}
|
|
9136
|
-
},
|
|
9170
|
+
}, _callee29, this);
|
|
9137
9171
|
}));
|
|
9138
9172
|
|
|
9139
|
-
function getRaw(
|
|
9173
|
+
function getRaw(_x34) {
|
|
9140
9174
|
return _getRaw.apply(this, arguments);
|
|
9141
9175
|
}
|
|
9142
9176
|
|
|
@@ -9145,44 +9179,44 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9145
9179
|
}, {
|
|
9146
9180
|
key: "getChatSecret",
|
|
9147
9181
|
value: function () {
|
|
9148
|
-
var _getChatSecret = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9182
|
+
var _getChatSecret = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee30(chatId) {
|
|
9149
9183
|
var existingChatSecret, response, chatSecret;
|
|
9150
|
-
return regeneratorRuntime.wrap(function
|
|
9184
|
+
return regeneratorRuntime.wrap(function _callee30$(_context30) {
|
|
9151
9185
|
while (1) {
|
|
9152
|
-
switch (
|
|
9186
|
+
switch (_context30.prev = _context30.next) {
|
|
9153
9187
|
case 0:
|
|
9154
9188
|
existingChatSecret = this.chatSecrets[chatId];
|
|
9155
9189
|
|
|
9156
9190
|
if (existingChatSecret) {
|
|
9157
|
-
|
|
9191
|
+
_context30.next = 10;
|
|
9158
9192
|
break;
|
|
9159
9193
|
}
|
|
9160
9194
|
|
|
9161
|
-
|
|
9195
|
+
_context30.next = 4;
|
|
9162
9196
|
return this.getRaw(chatId);
|
|
9163
9197
|
|
|
9164
9198
|
case 4:
|
|
9165
|
-
response =
|
|
9166
|
-
|
|
9199
|
+
response = _context30.sent;
|
|
9200
|
+
_context30.next = 7;
|
|
9167
9201
|
return this.readInviteCode(base64.decode(response.data.invite_code));
|
|
9168
9202
|
|
|
9169
9203
|
case 7:
|
|
9170
|
-
chatSecret =
|
|
9204
|
+
chatSecret = _context30.sent;
|
|
9171
9205
|
this.chatSecrets[chatId] = chatSecret;
|
|
9172
|
-
return
|
|
9206
|
+
return _context30.abrupt("return", chatSecret);
|
|
9173
9207
|
|
|
9174
9208
|
case 10:
|
|
9175
|
-
return
|
|
9209
|
+
return _context30.abrupt("return", existingChatSecret);
|
|
9176
9210
|
|
|
9177
9211
|
case 11:
|
|
9178
9212
|
case "end":
|
|
9179
|
-
return
|
|
9213
|
+
return _context30.stop();
|
|
9180
9214
|
}
|
|
9181
9215
|
}
|
|
9182
|
-
},
|
|
9216
|
+
}, _callee30, this);
|
|
9183
9217
|
}));
|
|
9184
9218
|
|
|
9185
|
-
function getChatSecret(
|
|
9219
|
+
function getChatSecret(_x35) {
|
|
9186
9220
|
return _getChatSecret.apply(this, arguments);
|
|
9187
9221
|
}
|
|
9188
9222
|
|
|
@@ -9191,13 +9225,13 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9191
9225
|
}, {
|
|
9192
9226
|
key: "getPublicKey",
|
|
9193
9227
|
value: function () {
|
|
9194
|
-
var _getPublicKey = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9228
|
+
var _getPublicKey = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(userId) {
|
|
9195
9229
|
var response, json;
|
|
9196
|
-
return regeneratorRuntime.wrap(function
|
|
9230
|
+
return regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
9197
9231
|
while (1) {
|
|
9198
|
-
switch (
|
|
9232
|
+
switch (_context31.prev = _context31.next) {
|
|
9199
9233
|
case 0:
|
|
9200
|
-
|
|
9234
|
+
_context31.next = 2;
|
|
9201
9235
|
return this.request({
|
|
9202
9236
|
path: "/comms/pubkey/".concat(userId),
|
|
9203
9237
|
method: 'GET',
|
|
@@ -9205,23 +9239,23 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9205
9239
|
});
|
|
9206
9240
|
|
|
9207
9241
|
case 2:
|
|
9208
|
-
response =
|
|
9209
|
-
|
|
9242
|
+
response = _context31.sent;
|
|
9243
|
+
_context31.next = 5;
|
|
9210
9244
|
return response.json();
|
|
9211
9245
|
|
|
9212
9246
|
case 5:
|
|
9213
|
-
json =
|
|
9214
|
-
return
|
|
9247
|
+
json = _context31.sent;
|
|
9248
|
+
return _context31.abrupt("return", base64.decode(json.data));
|
|
9215
9249
|
|
|
9216
9250
|
case 7:
|
|
9217
9251
|
case "end":
|
|
9218
|
-
return
|
|
9252
|
+
return _context31.stop();
|
|
9219
9253
|
}
|
|
9220
9254
|
}
|
|
9221
|
-
},
|
|
9255
|
+
}, _callee31, this);
|
|
9222
9256
|
}));
|
|
9223
9257
|
|
|
9224
|
-
function getPublicKey(
|
|
9258
|
+
function getPublicKey(_x36) {
|
|
9225
9259
|
return _getPublicKey.apply(this, arguments);
|
|
9226
9260
|
}
|
|
9227
9261
|
|
|
@@ -9230,37 +9264,37 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9230
9264
|
}, {
|
|
9231
9265
|
key: "getSignatureHeader",
|
|
9232
9266
|
value: function () {
|
|
9233
|
-
var _getSignatureHeader = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9267
|
+
var _getSignatureHeader = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee32(payload) {
|
|
9234
9268
|
var _yield$this$walletSer, _yield$this$walletSer2, allSignatureBytes, recoveryByte, signatureBytes;
|
|
9235
9269
|
|
|
9236
|
-
return regeneratorRuntime.wrap(function
|
|
9270
|
+
return regeneratorRuntime.wrap(function _callee32$(_context32) {
|
|
9237
9271
|
while (1) {
|
|
9238
|
-
switch (
|
|
9272
|
+
switch (_context32.prev = _context32.next) {
|
|
9239
9273
|
case 0:
|
|
9240
|
-
|
|
9274
|
+
_context32.next = 2;
|
|
9241
9275
|
return this.walletService.sign(payload);
|
|
9242
9276
|
|
|
9243
9277
|
case 2:
|
|
9244
|
-
_yield$this$walletSer =
|
|
9278
|
+
_yield$this$walletSer = _context32.sent;
|
|
9245
9279
|
_yield$this$walletSer2 = _slicedToArray(_yield$this$walletSer, 2);
|
|
9246
9280
|
allSignatureBytes = _yield$this$walletSer2[0];
|
|
9247
9281
|
recoveryByte = _yield$this$walletSer2[1];
|
|
9248
9282
|
signatureBytes = new Uint8Array(65);
|
|
9249
9283
|
signatureBytes.set(allSignatureBytes, 0);
|
|
9250
9284
|
signatureBytes[64] = recoveryByte;
|
|
9251
|
-
return
|
|
9285
|
+
return _context32.abrupt("return", {
|
|
9252
9286
|
'x-sig': base64.encode(signatureBytes)
|
|
9253
9287
|
});
|
|
9254
9288
|
|
|
9255
9289
|
case 10:
|
|
9256
9290
|
case "end":
|
|
9257
|
-
return
|
|
9291
|
+
return _context32.stop();
|
|
9258
9292
|
}
|
|
9259
9293
|
}
|
|
9260
|
-
},
|
|
9294
|
+
}, _callee32, this);
|
|
9261
9295
|
}));
|
|
9262
9296
|
|
|
9263
|
-
function getSignatureHeader(
|
|
9297
|
+
function getSignatureHeader(_x37) {
|
|
9264
9298
|
return _getSignatureHeader.apply(this, arguments);
|
|
9265
9299
|
}
|
|
9266
9300
|
|
|
@@ -9269,44 +9303,44 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9269
9303
|
}, {
|
|
9270
9304
|
key: "signAndSendRequest",
|
|
9271
9305
|
value: function () {
|
|
9272
|
-
var _signAndSendRequest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9306
|
+
var _signAndSendRequest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee33(request) {
|
|
9273
9307
|
var payload;
|
|
9274
|
-
return regeneratorRuntime.wrap(function
|
|
9308
|
+
return regeneratorRuntime.wrap(function _callee33$(_context33) {
|
|
9275
9309
|
while (1) {
|
|
9276
|
-
switch (
|
|
9310
|
+
switch (_context33.prev = _context33.next) {
|
|
9277
9311
|
case 0:
|
|
9278
9312
|
payload = request.method === 'GET' ? request.query ? "".concat(request.path, "?").concat(this.configuration.queryParamsStringify(request.query)) : request.path : request.body;
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9313
|
+
_context33.t0 = this;
|
|
9314
|
+
_context33.t1 = _objectSpread2;
|
|
9315
|
+
_context33.t2 = _objectSpread2({}, request);
|
|
9316
|
+
_context33.t3 = {};
|
|
9317
|
+
_context33.t4 = _objectSpread2;
|
|
9318
|
+
_context33.t5 = _objectSpread2({}, request.headers);
|
|
9319
|
+
_context33.next = 9;
|
|
9286
9320
|
return this.getSignatureHeader(payload);
|
|
9287
9321
|
|
|
9288
9322
|
case 9:
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
headers:
|
|
9323
|
+
_context33.t6 = _context33.sent;
|
|
9324
|
+
_context33.t7 = (0, _context33.t4)(_context33.t5, _context33.t6);
|
|
9325
|
+
_context33.t8 = {
|
|
9326
|
+
headers: _context33.t7
|
|
9293
9327
|
};
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
return
|
|
9328
|
+
_context33.t9 = (0, _context33.t1)(_context33.t2, _context33.t3, _context33.t8);
|
|
9329
|
+
_context33.next = 15;
|
|
9330
|
+
return _context33.t0.request.call(_context33.t0, _context33.t9);
|
|
9297
9331
|
|
|
9298
9332
|
case 15:
|
|
9299
|
-
return
|
|
9333
|
+
return _context33.abrupt("return", _context33.sent);
|
|
9300
9334
|
|
|
9301
9335
|
case 16:
|
|
9302
9336
|
case "end":
|
|
9303
|
-
return
|
|
9337
|
+
return _context33.stop();
|
|
9304
9338
|
}
|
|
9305
9339
|
}
|
|
9306
|
-
},
|
|
9340
|
+
}, _callee33, this);
|
|
9307
9341
|
}));
|
|
9308
9342
|
|
|
9309
|
-
function signAndSendRequest(
|
|
9343
|
+
function signAndSendRequest(_x38) {
|
|
9310
9344
|
return _signAndSendRequest.apply(this, arguments);
|
|
9311
9345
|
}
|
|
9312
9346
|
|
|
@@ -9315,16 +9349,16 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9315
9349
|
}, {
|
|
9316
9350
|
key: "sendRpc",
|
|
9317
9351
|
value: function () {
|
|
9318
|
-
var _sendRpc = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9352
|
+
var _sendRpc = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34(args) {
|
|
9319
9353
|
var payload;
|
|
9320
|
-
return regeneratorRuntime.wrap(function
|
|
9354
|
+
return regeneratorRuntime.wrap(function _callee34$(_context34) {
|
|
9321
9355
|
while (1) {
|
|
9322
|
-
switch (
|
|
9356
|
+
switch (_context34.prev = _context34.next) {
|
|
9323
9357
|
case 0:
|
|
9324
9358
|
payload = JSON.stringify(_objectSpread2(_objectSpread2({}, args), {}, {
|
|
9325
9359
|
timestamp: new Date().getTime()
|
|
9326
9360
|
}));
|
|
9327
|
-
|
|
9361
|
+
_context34.next = 3;
|
|
9328
9362
|
return this.signAndSendRequest({
|
|
9329
9363
|
method: 'POST',
|
|
9330
9364
|
headers: {
|
|
@@ -9335,17 +9369,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9335
9369
|
});
|
|
9336
9370
|
|
|
9337
9371
|
case 3:
|
|
9338
|
-
return
|
|
9372
|
+
return _context34.abrupt("return", args);
|
|
9339
9373
|
|
|
9340
9374
|
case 4:
|
|
9341
9375
|
case "end":
|
|
9342
|
-
return
|
|
9376
|
+
return _context34.stop();
|
|
9343
9377
|
}
|
|
9344
9378
|
}
|
|
9345
|
-
},
|
|
9379
|
+
}, _callee34, this);
|
|
9346
9380
|
}));
|
|
9347
9381
|
|
|
9348
|
-
function sendRpc(
|
|
9382
|
+
function sendRpc(_x39) {
|
|
9349
9383
|
return _sendRpc.apply(this, arguments);
|
|
9350
9384
|
}
|
|
9351
9385
|
|
|
@@ -9354,73 +9388,73 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9354
9388
|
}, {
|
|
9355
9389
|
key: "createWebsocket",
|
|
9356
9390
|
value: function () {
|
|
9357
|
-
var _createWebsocket = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9391
|
+
var _createWebsocket = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee36(endpoint) {
|
|
9358
9392
|
var _this5 = this;
|
|
9359
9393
|
|
|
9360
9394
|
var timestamp, originalUrl, signatureHeader, host, url, ws;
|
|
9361
|
-
return regeneratorRuntime.wrap(function
|
|
9395
|
+
return regeneratorRuntime.wrap(function _callee36$(_context36) {
|
|
9362
9396
|
while (1) {
|
|
9363
|
-
switch (
|
|
9397
|
+
switch (_context36.prev = _context36.next) {
|
|
9364
9398
|
case 0:
|
|
9365
9399
|
timestamp = new Date().getTime();
|
|
9366
9400
|
originalUrl = "/comms/chats/ws?timestamp=".concat(timestamp);
|
|
9367
|
-
|
|
9401
|
+
_context36.next = 4;
|
|
9368
9402
|
return this.getSignatureHeader(originalUrl);
|
|
9369
9403
|
|
|
9370
9404
|
case 4:
|
|
9371
|
-
signatureHeader =
|
|
9405
|
+
signatureHeader = _context36.sent;
|
|
9372
9406
|
host = endpoint.replace(/http(s?)/g, 'ws$1');
|
|
9373
9407
|
url = "".concat(host).concat(originalUrl, "&signature=").concat(encodeURIComponent(signatureHeader['x-sig']));
|
|
9374
9408
|
ws = new WebSocket(url);
|
|
9375
9409
|
ws.addEventListener('message', function (messageEvent) {
|
|
9376
9410
|
var handleAsync = /*#__PURE__*/function () {
|
|
9377
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9411
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee35() {
|
|
9378
9412
|
var data, sharedSecret;
|
|
9379
|
-
return regeneratorRuntime.wrap(function
|
|
9413
|
+
return regeneratorRuntime.wrap(function _callee35$(_context35) {
|
|
9380
9414
|
while (1) {
|
|
9381
|
-
switch (
|
|
9415
|
+
switch (_context35.prev = _context35.next) {
|
|
9382
9416
|
case 0:
|
|
9383
9417
|
data = JSON.parse(messageEvent.data);
|
|
9384
9418
|
|
|
9385
9419
|
if (!(data.rpc.method === 'chat.message')) {
|
|
9386
|
-
|
|
9420
|
+
_context35.next = 19;
|
|
9387
9421
|
break;
|
|
9388
9422
|
}
|
|
9389
9423
|
|
|
9390
|
-
|
|
9424
|
+
_context35.next = 4;
|
|
9391
9425
|
return _this5.getChatSecret(data.rpc.params.chat_id);
|
|
9392
9426
|
|
|
9393
9427
|
case 4:
|
|
9394
|
-
sharedSecret =
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9428
|
+
sharedSecret = _context35.sent;
|
|
9429
|
+
_context35.t0 = _this5.eventEmitter;
|
|
9430
|
+
_context35.t1 = data.rpc.params.chat_id;
|
|
9431
|
+
_context35.t2 = data.rpc.params.message_id;
|
|
9432
|
+
_context35.next = 10;
|
|
9399
9433
|
return _this5.decryptString(sharedSecret, base64.decode(data.rpc.params.message))["catch"](function (e) {
|
|
9400
9434
|
console.error("[audius-sdk]: Error: Couldn't decrypt websocket chat message", data, e);
|
|
9401
9435
|
return "Error: Couldn't decrypt message";
|
|
9402
9436
|
});
|
|
9403
9437
|
|
|
9404
9438
|
case 10:
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
message_id:
|
|
9411
|
-
message:
|
|
9412
|
-
sender_user_id:
|
|
9413
|
-
created_at:
|
|
9414
|
-
reactions:
|
|
9439
|
+
_context35.t3 = _context35.sent;
|
|
9440
|
+
_context35.t4 = data.metadata.userId;
|
|
9441
|
+
_context35.t5 = data.metadata.timestamp;
|
|
9442
|
+
_context35.t6 = [];
|
|
9443
|
+
_context35.t7 = {
|
|
9444
|
+
message_id: _context35.t2,
|
|
9445
|
+
message: _context35.t3,
|
|
9446
|
+
sender_user_id: _context35.t4,
|
|
9447
|
+
created_at: _context35.t5,
|
|
9448
|
+
reactions: _context35.t6
|
|
9415
9449
|
};
|
|
9416
|
-
|
|
9417
|
-
chatId:
|
|
9418
|
-
message:
|
|
9450
|
+
_context35.t8 = {
|
|
9451
|
+
chatId: _context35.t1,
|
|
9452
|
+
message: _context35.t7
|
|
9419
9453
|
};
|
|
9420
9454
|
|
|
9421
|
-
|
|
9455
|
+
_context35.t0.emit.call(_context35.t0, 'message', _context35.t8);
|
|
9422
9456
|
|
|
9423
|
-
|
|
9457
|
+
_context35.next = 20;
|
|
9424
9458
|
break;
|
|
9425
9459
|
|
|
9426
9460
|
case 19:
|
|
@@ -9438,10 +9472,10 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9438
9472
|
|
|
9439
9473
|
case 20:
|
|
9440
9474
|
case "end":
|
|
9441
|
-
return
|
|
9475
|
+
return _context35.stop();
|
|
9442
9476
|
}
|
|
9443
9477
|
}
|
|
9444
|
-
},
|
|
9478
|
+
}, _callee35);
|
|
9445
9479
|
}));
|
|
9446
9480
|
|
|
9447
9481
|
return function handleAsync() {
|
|
@@ -9460,17 +9494,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9460
9494
|
ws.addEventListener('error', function (e) {
|
|
9461
9495
|
_this5.eventEmitter.emit('error', e);
|
|
9462
9496
|
});
|
|
9463
|
-
return
|
|
9497
|
+
return _context36.abrupt("return", ws);
|
|
9464
9498
|
|
|
9465
9499
|
case 13:
|
|
9466
9500
|
case "end":
|
|
9467
|
-
return
|
|
9501
|
+
return _context36.stop();
|
|
9468
9502
|
}
|
|
9469
9503
|
}
|
|
9470
|
-
},
|
|
9504
|
+
}, _callee36, this);
|
|
9471
9505
|
}));
|
|
9472
9506
|
|
|
9473
|
-
function createWebsocket(
|
|
9507
|
+
function createWebsocket(_x40) {
|
|
9474
9508
|
return _createWebsocket.apply(this, arguments);
|
|
9475
9509
|
}
|
|
9476
9510
|
|