@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
|
@@ -9379,19 +9379,19 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9379
9379
|
return block;
|
|
9380
9380
|
}()
|
|
9381
9381
|
}, {
|
|
9382
|
-
key: "
|
|
9382
|
+
key: "unblock",
|
|
9383
9383
|
value: function () {
|
|
9384
|
-
var
|
|
9384
|
+
var _unblock = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(requestParameters) {
|
|
9385
9385
|
return regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
9386
9386
|
while (1) {
|
|
9387
9387
|
switch (_context17.prev = _context17.next) {
|
|
9388
9388
|
case 0:
|
|
9389
|
-
this.assertNotNullOrUndefined(requestParameters.
|
|
9389
|
+
this.assertNotNullOrUndefined(requestParameters.userId, 'requestParameters.userId', 'unblock');
|
|
9390
9390
|
_context17.next = 3;
|
|
9391
9391
|
return this.sendRpc({
|
|
9392
|
-
method: 'chat.
|
|
9392
|
+
method: 'chat.unblock',
|
|
9393
9393
|
params: {
|
|
9394
|
-
|
|
9394
|
+
user_id: requestParameters.userId
|
|
9395
9395
|
}
|
|
9396
9396
|
});
|
|
9397
9397
|
|
|
@@ -9406,26 +9406,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9406
9406
|
}, _callee17, this);
|
|
9407
9407
|
}));
|
|
9408
9408
|
|
|
9409
|
-
function
|
|
9410
|
-
return
|
|
9409
|
+
function unblock(_x14) {
|
|
9410
|
+
return _unblock.apply(this, arguments);
|
|
9411
9411
|
}
|
|
9412
9412
|
|
|
9413
|
-
return
|
|
9413
|
+
return unblock;
|
|
9414
9414
|
}()
|
|
9415
9415
|
}, {
|
|
9416
|
-
key: "
|
|
9416
|
+
key: "delete",
|
|
9417
9417
|
value: function () {
|
|
9418
|
-
var
|
|
9418
|
+
var _delete2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(requestParameters) {
|
|
9419
9419
|
return regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
9420
9420
|
while (1) {
|
|
9421
9421
|
switch (_context18.prev = _context18.next) {
|
|
9422
9422
|
case 0:
|
|
9423
|
-
this.assertNotNullOrUndefined(requestParameters.
|
|
9423
|
+
this.assertNotNullOrUndefined(requestParameters.chatId, 'requestParameters.chatId', 'delete');
|
|
9424
9424
|
_context18.next = 3;
|
|
9425
9425
|
return this.sendRpc({
|
|
9426
|
-
method: 'chat.
|
|
9426
|
+
method: 'chat.delete',
|
|
9427
9427
|
params: {
|
|
9428
|
-
|
|
9428
|
+
chat_id: requestParameters.chatId
|
|
9429
9429
|
}
|
|
9430
9430
|
});
|
|
9431
9431
|
|
|
@@ -9440,7 +9440,41 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9440
9440
|
}, _callee18, this);
|
|
9441
9441
|
}));
|
|
9442
9442
|
|
|
9443
|
-
function
|
|
9443
|
+
function _delete(_x15) {
|
|
9444
|
+
return _delete2.apply(this, arguments);
|
|
9445
|
+
}
|
|
9446
|
+
|
|
9447
|
+
return _delete;
|
|
9448
|
+
}()
|
|
9449
|
+
}, {
|
|
9450
|
+
key: "permit",
|
|
9451
|
+
value: function () {
|
|
9452
|
+
var _permit = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(requestParameters) {
|
|
9453
|
+
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
9454
|
+
while (1) {
|
|
9455
|
+
switch (_context19.prev = _context19.next) {
|
|
9456
|
+
case 0:
|
|
9457
|
+
this.assertNotNullOrUndefined(requestParameters.permit, 'requestParameters.permit', 'permit');
|
|
9458
|
+
_context19.next = 3;
|
|
9459
|
+
return this.sendRpc({
|
|
9460
|
+
method: 'chat.permit',
|
|
9461
|
+
params: {
|
|
9462
|
+
permit: requestParameters.permit
|
|
9463
|
+
}
|
|
9464
|
+
});
|
|
9465
|
+
|
|
9466
|
+
case 3:
|
|
9467
|
+
return _context19.abrupt("return", _context19.sent);
|
|
9468
|
+
|
|
9469
|
+
case 4:
|
|
9470
|
+
case "end":
|
|
9471
|
+
return _context19.stop();
|
|
9472
|
+
}
|
|
9473
|
+
}
|
|
9474
|
+
}, _callee19, this);
|
|
9475
|
+
}));
|
|
9476
|
+
|
|
9477
|
+
function permit(_x16) {
|
|
9444
9478
|
return _permit.apply(this, arguments);
|
|
9445
9479
|
}
|
|
9446
9480
|
|
|
@@ -9474,67 +9508,67 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9474
9508
|
}, {
|
|
9475
9509
|
key: "createInvites",
|
|
9476
9510
|
value: function () {
|
|
9477
|
-
var _createInvites = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9511
|
+
var _createInvites = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(userId, invitedUserIds, chatSecret) {
|
|
9478
9512
|
var _this4 = this;
|
|
9479
9513
|
|
|
9480
9514
|
var userPublicKey;
|
|
9481
|
-
return regeneratorRuntime.wrap(function
|
|
9515
|
+
return regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
9482
9516
|
while (1) {
|
|
9483
|
-
switch (
|
|
9517
|
+
switch (_context21.prev = _context21.next) {
|
|
9484
9518
|
case 0:
|
|
9485
|
-
|
|
9519
|
+
_context21.next = 2;
|
|
9486
9520
|
return this.getPublicKey(userId);
|
|
9487
9521
|
|
|
9488
9522
|
case 2:
|
|
9489
|
-
userPublicKey =
|
|
9490
|
-
|
|
9523
|
+
userPublicKey = _context21.sent;
|
|
9524
|
+
_context21.next = 5;
|
|
9491
9525
|
return Promise.all([userId].concat(_toConsumableArray(invitedUserIds)).map( /*#__PURE__*/function () {
|
|
9492
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9526
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId) {
|
|
9493
9527
|
var inviteePublicKey, inviteCode;
|
|
9494
|
-
return regeneratorRuntime.wrap(function
|
|
9528
|
+
return regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
9495
9529
|
while (1) {
|
|
9496
|
-
switch (
|
|
9530
|
+
switch (_context20.prev = _context20.next) {
|
|
9497
9531
|
case 0:
|
|
9498
|
-
|
|
9532
|
+
_context20.next = 2;
|
|
9499
9533
|
return _this4.getPublicKey(userId);
|
|
9500
9534
|
|
|
9501
9535
|
case 2:
|
|
9502
|
-
inviteePublicKey =
|
|
9503
|
-
|
|
9536
|
+
inviteePublicKey = _context20.sent;
|
|
9537
|
+
_context20.next = 5;
|
|
9504
9538
|
return _this4.createInviteCode(userPublicKey, inviteePublicKey, chatSecret);
|
|
9505
9539
|
|
|
9506
9540
|
case 5:
|
|
9507
|
-
inviteCode =
|
|
9508
|
-
return
|
|
9541
|
+
inviteCode = _context20.sent;
|
|
9542
|
+
return _context20.abrupt("return", {
|
|
9509
9543
|
user_id: userId,
|
|
9510
9544
|
invite_code: base.base64.encode(inviteCode)
|
|
9511
9545
|
});
|
|
9512
9546
|
|
|
9513
9547
|
case 7:
|
|
9514
9548
|
case "end":
|
|
9515
|
-
return
|
|
9549
|
+
return _context20.stop();
|
|
9516
9550
|
}
|
|
9517
9551
|
}
|
|
9518
|
-
},
|
|
9552
|
+
}, _callee20);
|
|
9519
9553
|
}));
|
|
9520
9554
|
|
|
9521
|
-
return function (
|
|
9555
|
+
return function (_x20) {
|
|
9522
9556
|
return _ref3.apply(this, arguments);
|
|
9523
9557
|
};
|
|
9524
9558
|
}()));
|
|
9525
9559
|
|
|
9526
9560
|
case 5:
|
|
9527
|
-
return
|
|
9561
|
+
return _context21.abrupt("return", _context21.sent);
|
|
9528
9562
|
|
|
9529
9563
|
case 6:
|
|
9530
9564
|
case "end":
|
|
9531
|
-
return
|
|
9565
|
+
return _context21.stop();
|
|
9532
9566
|
}
|
|
9533
9567
|
}
|
|
9534
|
-
},
|
|
9568
|
+
}, _callee21, this);
|
|
9535
9569
|
}));
|
|
9536
9570
|
|
|
9537
|
-
function createInvites(
|
|
9571
|
+
function createInvites(_x17, _x18, _x19) {
|
|
9538
9572
|
return _createInvites.apply(this, arguments);
|
|
9539
9573
|
}
|
|
9540
9574
|
|
|
@@ -9543,36 +9577,36 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9543
9577
|
}, {
|
|
9544
9578
|
key: "createInviteCode",
|
|
9545
9579
|
value: function () {
|
|
9546
|
-
var _createInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9580
|
+
var _createInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(userPublicKey, inviteePublicKey, chatSecret) {
|
|
9547
9581
|
var sharedSecret, encryptedChatSecret, inviteCode;
|
|
9548
|
-
return regeneratorRuntime.wrap(function
|
|
9582
|
+
return regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
9549
9583
|
while (1) {
|
|
9550
|
-
switch (
|
|
9584
|
+
switch (_context22.prev = _context22.next) {
|
|
9551
9585
|
case 0:
|
|
9552
|
-
|
|
9586
|
+
_context22.next = 2;
|
|
9553
9587
|
return this.walletService.getSharedSecret(inviteePublicKey);
|
|
9554
9588
|
|
|
9555
9589
|
case 2:
|
|
9556
|
-
sharedSecret =
|
|
9557
|
-
|
|
9590
|
+
sharedSecret = _context22.sent;
|
|
9591
|
+
_context22.next = 5;
|
|
9558
9592
|
return this.encrypt(sharedSecret, chatSecret);
|
|
9559
9593
|
|
|
9560
9594
|
case 5:
|
|
9561
|
-
encryptedChatSecret =
|
|
9595
|
+
encryptedChatSecret = _context22.sent;
|
|
9562
9596
|
inviteCode = new Uint8Array(65 + encryptedChatSecret.length);
|
|
9563
9597
|
inviteCode.set(userPublicKey);
|
|
9564
9598
|
inviteCode.set(encryptedChatSecret, 65);
|
|
9565
|
-
return
|
|
9599
|
+
return _context22.abrupt("return", inviteCode);
|
|
9566
9600
|
|
|
9567
9601
|
case 10:
|
|
9568
9602
|
case "end":
|
|
9569
|
-
return
|
|
9603
|
+
return _context22.stop();
|
|
9570
9604
|
}
|
|
9571
9605
|
}
|
|
9572
|
-
},
|
|
9606
|
+
}, _callee22, this);
|
|
9573
9607
|
}));
|
|
9574
9608
|
|
|
9575
|
-
function createInviteCode(
|
|
9609
|
+
function createInviteCode(_x21, _x22, _x23) {
|
|
9576
9610
|
return _createInviteCode.apply(this, arguments);
|
|
9577
9611
|
}
|
|
9578
9612
|
|
|
@@ -9581,34 +9615,34 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9581
9615
|
}, {
|
|
9582
9616
|
key: "readInviteCode",
|
|
9583
9617
|
value: function () {
|
|
9584
|
-
var _readInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9618
|
+
var _readInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee23(inviteCode) {
|
|
9585
9619
|
var friendPublicKey, chatSecretEncrypted, sharedSecret;
|
|
9586
|
-
return regeneratorRuntime.wrap(function
|
|
9620
|
+
return regeneratorRuntime.wrap(function _callee23$(_context23) {
|
|
9587
9621
|
while (1) {
|
|
9588
|
-
switch (
|
|
9622
|
+
switch (_context23.prev = _context23.next) {
|
|
9589
9623
|
case 0:
|
|
9590
9624
|
friendPublicKey = inviteCode.slice(0, 65);
|
|
9591
9625
|
chatSecretEncrypted = inviteCode.slice(65);
|
|
9592
|
-
|
|
9626
|
+
_context23.next = 4;
|
|
9593
9627
|
return this.walletService.getSharedSecret(friendPublicKey);
|
|
9594
9628
|
|
|
9595
9629
|
case 4:
|
|
9596
|
-
sharedSecret =
|
|
9597
|
-
|
|
9630
|
+
sharedSecret = _context23.sent;
|
|
9631
|
+
_context23.next = 7;
|
|
9598
9632
|
return this.decrypt(sharedSecret, chatSecretEncrypted);
|
|
9599
9633
|
|
|
9600
9634
|
case 7:
|
|
9601
|
-
return
|
|
9635
|
+
return _context23.abrupt("return", _context23.sent);
|
|
9602
9636
|
|
|
9603
9637
|
case 8:
|
|
9604
9638
|
case "end":
|
|
9605
|
-
return
|
|
9639
|
+
return _context23.stop();
|
|
9606
9640
|
}
|
|
9607
9641
|
}
|
|
9608
|
-
},
|
|
9642
|
+
}, _callee23, this);
|
|
9609
9643
|
}));
|
|
9610
9644
|
|
|
9611
|
-
function readInviteCode(
|
|
9645
|
+
function readInviteCode(_x24) {
|
|
9612
9646
|
return _readInviteCode.apply(this, arguments);
|
|
9613
9647
|
}
|
|
9614
9648
|
|
|
@@ -9617,26 +9651,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9617
9651
|
}, {
|
|
9618
9652
|
key: "encrypt",
|
|
9619
9653
|
value: function () {
|
|
9620
|
-
var _encrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9621
|
-
return regeneratorRuntime.wrap(function
|
|
9654
|
+
var _encrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(secret, payload) {
|
|
9655
|
+
return regeneratorRuntime.wrap(function _callee24$(_context24) {
|
|
9622
9656
|
while (1) {
|
|
9623
|
-
switch (
|
|
9657
|
+
switch (_context24.prev = _context24.next) {
|
|
9624
9658
|
case 0:
|
|
9625
|
-
|
|
9659
|
+
_context24.next = 2;
|
|
9626
9660
|
return encrypt(secret.slice(secret.length - 32), payload);
|
|
9627
9661
|
|
|
9628
9662
|
case 2:
|
|
9629
|
-
return
|
|
9663
|
+
return _context24.abrupt("return", _context24.sent);
|
|
9630
9664
|
|
|
9631
9665
|
case 3:
|
|
9632
9666
|
case "end":
|
|
9633
|
-
return
|
|
9667
|
+
return _context24.stop();
|
|
9634
9668
|
}
|
|
9635
9669
|
}
|
|
9636
|
-
},
|
|
9670
|
+
}, _callee24);
|
|
9637
9671
|
}));
|
|
9638
9672
|
|
|
9639
|
-
function encrypt$1(
|
|
9673
|
+
function encrypt$1(_x25, _x26) {
|
|
9640
9674
|
return _encrypt.apply(this, arguments);
|
|
9641
9675
|
}
|
|
9642
9676
|
|
|
@@ -9645,26 +9679,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9645
9679
|
}, {
|
|
9646
9680
|
key: "encryptString",
|
|
9647
9681
|
value: function () {
|
|
9648
|
-
var _encryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9649
|
-
return regeneratorRuntime.wrap(function
|
|
9682
|
+
var _encryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(secret, payload) {
|
|
9683
|
+
return regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
9650
9684
|
while (1) {
|
|
9651
|
-
switch (
|
|
9685
|
+
switch (_context25.prev = _context25.next) {
|
|
9652
9686
|
case 0:
|
|
9653
|
-
|
|
9687
|
+
_context25.next = 2;
|
|
9654
9688
|
return this.encrypt(secret, new TextEncoder().encode(payload));
|
|
9655
9689
|
|
|
9656
9690
|
case 2:
|
|
9657
|
-
return
|
|
9691
|
+
return _context25.abrupt("return", _context25.sent);
|
|
9658
9692
|
|
|
9659
9693
|
case 3:
|
|
9660
9694
|
case "end":
|
|
9661
|
-
return
|
|
9695
|
+
return _context25.stop();
|
|
9662
9696
|
}
|
|
9663
9697
|
}
|
|
9664
|
-
},
|
|
9698
|
+
}, _callee25, this);
|
|
9665
9699
|
}));
|
|
9666
9700
|
|
|
9667
|
-
function encryptString(
|
|
9701
|
+
function encryptString(_x27, _x28) {
|
|
9668
9702
|
return _encryptString.apply(this, arguments);
|
|
9669
9703
|
}
|
|
9670
9704
|
|
|
@@ -9673,26 +9707,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9673
9707
|
}, {
|
|
9674
9708
|
key: "decrypt",
|
|
9675
9709
|
value: function () {
|
|
9676
|
-
var _decrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9677
|
-
return regeneratorRuntime.wrap(function
|
|
9710
|
+
var _decrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee26(secret, payload) {
|
|
9711
|
+
return regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
9678
9712
|
while (1) {
|
|
9679
|
-
switch (
|
|
9713
|
+
switch (_context26.prev = _context26.next) {
|
|
9680
9714
|
case 0:
|
|
9681
|
-
|
|
9715
|
+
_context26.next = 2;
|
|
9682
9716
|
return decrypt(secret.slice(secret.length - 32), payload);
|
|
9683
9717
|
|
|
9684
9718
|
case 2:
|
|
9685
|
-
return
|
|
9719
|
+
return _context26.abrupt("return", _context26.sent);
|
|
9686
9720
|
|
|
9687
9721
|
case 3:
|
|
9688
9722
|
case "end":
|
|
9689
|
-
return
|
|
9723
|
+
return _context26.stop();
|
|
9690
9724
|
}
|
|
9691
9725
|
}
|
|
9692
|
-
},
|
|
9726
|
+
}, _callee26);
|
|
9693
9727
|
}));
|
|
9694
9728
|
|
|
9695
|
-
function decrypt$1(
|
|
9729
|
+
function decrypt$1(_x29, _x30) {
|
|
9696
9730
|
return _decrypt.apply(this, arguments);
|
|
9697
9731
|
}
|
|
9698
9732
|
|
|
@@ -9701,28 +9735,28 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9701
9735
|
}, {
|
|
9702
9736
|
key: "decryptString",
|
|
9703
9737
|
value: function () {
|
|
9704
|
-
var _decryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9705
|
-
return regeneratorRuntime.wrap(function
|
|
9738
|
+
var _decryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee27(secret, payload) {
|
|
9739
|
+
return regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
9706
9740
|
while (1) {
|
|
9707
|
-
switch (
|
|
9741
|
+
switch (_context27.prev = _context27.next) {
|
|
9708
9742
|
case 0:
|
|
9709
|
-
|
|
9710
|
-
|
|
9743
|
+
_context27.t0 = new TextDecoder();
|
|
9744
|
+
_context27.next = 3;
|
|
9711
9745
|
return this.decrypt(secret, payload);
|
|
9712
9746
|
|
|
9713
9747
|
case 3:
|
|
9714
|
-
|
|
9715
|
-
return
|
|
9748
|
+
_context27.t1 = _context27.sent;
|
|
9749
|
+
return _context27.abrupt("return", _context27.t0.decode.call(_context27.t0, _context27.t1));
|
|
9716
9750
|
|
|
9717
9751
|
case 5:
|
|
9718
9752
|
case "end":
|
|
9719
|
-
return
|
|
9753
|
+
return _context27.stop();
|
|
9720
9754
|
}
|
|
9721
9755
|
}
|
|
9722
|
-
},
|
|
9756
|
+
}, _callee27, this);
|
|
9723
9757
|
}));
|
|
9724
9758
|
|
|
9725
|
-
function decryptString(
|
|
9759
|
+
function decryptString(_x31, _x32) {
|
|
9726
9760
|
return _decryptString.apply(this, arguments);
|
|
9727
9761
|
}
|
|
9728
9762
|
|
|
@@ -9731,53 +9765,53 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9731
9765
|
}, {
|
|
9732
9766
|
key: "decryptLastChatMessage",
|
|
9733
9767
|
value: function () {
|
|
9734
|
-
var _decryptLastChatMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9768
|
+
var _decryptLastChatMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee28(c) {
|
|
9735
9769
|
var sharedSecret, lastMessage;
|
|
9736
|
-
return regeneratorRuntime.wrap(function
|
|
9770
|
+
return regeneratorRuntime.wrap(function _callee28$(_context28) {
|
|
9737
9771
|
while (1) {
|
|
9738
|
-
switch (
|
|
9772
|
+
switch (_context28.prev = _context28.next) {
|
|
9739
9773
|
case 0:
|
|
9740
|
-
|
|
9774
|
+
_context28.next = 2;
|
|
9741
9775
|
return this.getChatSecret(c.chat_id);
|
|
9742
9776
|
|
|
9743
9777
|
case 2:
|
|
9744
|
-
sharedSecret =
|
|
9778
|
+
sharedSecret = _context28.sent;
|
|
9745
9779
|
lastMessage = '';
|
|
9746
9780
|
|
|
9747
9781
|
if (!(c.last_message && c.last_message.length > 0)) {
|
|
9748
|
-
|
|
9782
|
+
_context28.next = 15;
|
|
9749
9783
|
break;
|
|
9750
9784
|
}
|
|
9751
9785
|
|
|
9752
|
-
|
|
9753
|
-
|
|
9786
|
+
_context28.prev = 5;
|
|
9787
|
+
_context28.next = 8;
|
|
9754
9788
|
return this.decryptString(sharedSecret, base.base64.decode(c.last_message));
|
|
9755
9789
|
|
|
9756
9790
|
case 8:
|
|
9757
|
-
lastMessage =
|
|
9758
|
-
|
|
9791
|
+
lastMessage = _context28.sent;
|
|
9792
|
+
_context28.next = 15;
|
|
9759
9793
|
break;
|
|
9760
9794
|
|
|
9761
9795
|
case 11:
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
console.error("[audius-sdk]: Error: Couldn't decrypt last chat message", c,
|
|
9796
|
+
_context28.prev = 11;
|
|
9797
|
+
_context28.t0 = _context28["catch"](5);
|
|
9798
|
+
console.error("[audius-sdk]: Error: Couldn't decrypt last chat message", c, _context28.t0);
|
|
9765
9799
|
lastMessage = "Error: Couldn't decrypt message";
|
|
9766
9800
|
|
|
9767
9801
|
case 15:
|
|
9768
|
-
return
|
|
9802
|
+
return _context28.abrupt("return", _objectSpread2(_objectSpread2({}, c), {}, {
|
|
9769
9803
|
last_message: lastMessage
|
|
9770
9804
|
}));
|
|
9771
9805
|
|
|
9772
9806
|
case 16:
|
|
9773
9807
|
case "end":
|
|
9774
|
-
return
|
|
9808
|
+
return _context28.stop();
|
|
9775
9809
|
}
|
|
9776
9810
|
}
|
|
9777
|
-
},
|
|
9811
|
+
}, _callee28, this, [[5, 11]]);
|
|
9778
9812
|
}));
|
|
9779
9813
|
|
|
9780
|
-
function decryptLastChatMessage(
|
|
9814
|
+
function decryptLastChatMessage(_x33) {
|
|
9781
9815
|
return _decryptLastChatMessage.apply(this, arguments);
|
|
9782
9816
|
}
|
|
9783
9817
|
|
|
@@ -9786,17 +9820,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9786
9820
|
}, {
|
|
9787
9821
|
key: "getRaw",
|
|
9788
9822
|
value: function () {
|
|
9789
|
-
var _getRaw = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9823
|
+
var _getRaw = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee29(chatId) {
|
|
9790
9824
|
var path, queryParameters, response;
|
|
9791
|
-
return regeneratorRuntime.wrap(function
|
|
9825
|
+
return regeneratorRuntime.wrap(function _callee29$(_context29) {
|
|
9792
9826
|
while (1) {
|
|
9793
|
-
switch (
|
|
9827
|
+
switch (_context29.prev = _context29.next) {
|
|
9794
9828
|
case 0:
|
|
9795
9829
|
path = "/comms/chats/".concat(chatId);
|
|
9796
9830
|
queryParameters = {
|
|
9797
9831
|
timestamp: new Date().getTime()
|
|
9798
9832
|
};
|
|
9799
|
-
|
|
9833
|
+
_context29.next = 4;
|
|
9800
9834
|
return this.signAndSendRequest({
|
|
9801
9835
|
method: 'GET',
|
|
9802
9836
|
headers: {},
|
|
@@ -9805,22 +9839,22 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9805
9839
|
});
|
|
9806
9840
|
|
|
9807
9841
|
case 4:
|
|
9808
|
-
response =
|
|
9809
|
-
|
|
9842
|
+
response = _context29.sent;
|
|
9843
|
+
_context29.next = 7;
|
|
9810
9844
|
return response.json();
|
|
9811
9845
|
|
|
9812
9846
|
case 7:
|
|
9813
|
-
return
|
|
9847
|
+
return _context29.abrupt("return", _context29.sent);
|
|
9814
9848
|
|
|
9815
9849
|
case 8:
|
|
9816
9850
|
case "end":
|
|
9817
|
-
return
|
|
9851
|
+
return _context29.stop();
|
|
9818
9852
|
}
|
|
9819
9853
|
}
|
|
9820
|
-
},
|
|
9854
|
+
}, _callee29, this);
|
|
9821
9855
|
}));
|
|
9822
9856
|
|
|
9823
|
-
function getRaw(
|
|
9857
|
+
function getRaw(_x34) {
|
|
9824
9858
|
return _getRaw.apply(this, arguments);
|
|
9825
9859
|
}
|
|
9826
9860
|
|
|
@@ -9829,44 +9863,44 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9829
9863
|
}, {
|
|
9830
9864
|
key: "getChatSecret",
|
|
9831
9865
|
value: function () {
|
|
9832
|
-
var _getChatSecret = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9866
|
+
var _getChatSecret = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee30(chatId) {
|
|
9833
9867
|
var existingChatSecret, response, chatSecret;
|
|
9834
|
-
return regeneratorRuntime.wrap(function
|
|
9868
|
+
return regeneratorRuntime.wrap(function _callee30$(_context30) {
|
|
9835
9869
|
while (1) {
|
|
9836
|
-
switch (
|
|
9870
|
+
switch (_context30.prev = _context30.next) {
|
|
9837
9871
|
case 0:
|
|
9838
9872
|
existingChatSecret = this.chatSecrets[chatId];
|
|
9839
9873
|
|
|
9840
9874
|
if (existingChatSecret) {
|
|
9841
|
-
|
|
9875
|
+
_context30.next = 10;
|
|
9842
9876
|
break;
|
|
9843
9877
|
}
|
|
9844
9878
|
|
|
9845
|
-
|
|
9879
|
+
_context30.next = 4;
|
|
9846
9880
|
return this.getRaw(chatId);
|
|
9847
9881
|
|
|
9848
9882
|
case 4:
|
|
9849
|
-
response =
|
|
9850
|
-
|
|
9883
|
+
response = _context30.sent;
|
|
9884
|
+
_context30.next = 7;
|
|
9851
9885
|
return this.readInviteCode(base.base64.decode(response.data.invite_code));
|
|
9852
9886
|
|
|
9853
9887
|
case 7:
|
|
9854
|
-
chatSecret =
|
|
9888
|
+
chatSecret = _context30.sent;
|
|
9855
9889
|
this.chatSecrets[chatId] = chatSecret;
|
|
9856
|
-
return
|
|
9890
|
+
return _context30.abrupt("return", chatSecret);
|
|
9857
9891
|
|
|
9858
9892
|
case 10:
|
|
9859
|
-
return
|
|
9893
|
+
return _context30.abrupt("return", existingChatSecret);
|
|
9860
9894
|
|
|
9861
9895
|
case 11:
|
|
9862
9896
|
case "end":
|
|
9863
|
-
return
|
|
9897
|
+
return _context30.stop();
|
|
9864
9898
|
}
|
|
9865
9899
|
}
|
|
9866
|
-
},
|
|
9900
|
+
}, _callee30, this);
|
|
9867
9901
|
}));
|
|
9868
9902
|
|
|
9869
|
-
function getChatSecret(
|
|
9903
|
+
function getChatSecret(_x35) {
|
|
9870
9904
|
return _getChatSecret.apply(this, arguments);
|
|
9871
9905
|
}
|
|
9872
9906
|
|
|
@@ -9875,13 +9909,13 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9875
9909
|
}, {
|
|
9876
9910
|
key: "getPublicKey",
|
|
9877
9911
|
value: function () {
|
|
9878
|
-
var _getPublicKey = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9912
|
+
var _getPublicKey = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(userId) {
|
|
9879
9913
|
var response, json;
|
|
9880
|
-
return regeneratorRuntime.wrap(function
|
|
9914
|
+
return regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
9881
9915
|
while (1) {
|
|
9882
|
-
switch (
|
|
9916
|
+
switch (_context31.prev = _context31.next) {
|
|
9883
9917
|
case 0:
|
|
9884
|
-
|
|
9918
|
+
_context31.next = 2;
|
|
9885
9919
|
return this.request({
|
|
9886
9920
|
path: "/comms/pubkey/".concat(userId),
|
|
9887
9921
|
method: 'GET',
|
|
@@ -9889,23 +9923,23 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9889
9923
|
});
|
|
9890
9924
|
|
|
9891
9925
|
case 2:
|
|
9892
|
-
response =
|
|
9893
|
-
|
|
9926
|
+
response = _context31.sent;
|
|
9927
|
+
_context31.next = 5;
|
|
9894
9928
|
return response.json();
|
|
9895
9929
|
|
|
9896
9930
|
case 5:
|
|
9897
|
-
json =
|
|
9898
|
-
return
|
|
9931
|
+
json = _context31.sent;
|
|
9932
|
+
return _context31.abrupt("return", base.base64.decode(json.data));
|
|
9899
9933
|
|
|
9900
9934
|
case 7:
|
|
9901
9935
|
case "end":
|
|
9902
|
-
return
|
|
9936
|
+
return _context31.stop();
|
|
9903
9937
|
}
|
|
9904
9938
|
}
|
|
9905
|
-
},
|
|
9939
|
+
}, _callee31, this);
|
|
9906
9940
|
}));
|
|
9907
9941
|
|
|
9908
|
-
function getPublicKey(
|
|
9942
|
+
function getPublicKey(_x36) {
|
|
9909
9943
|
return _getPublicKey.apply(this, arguments);
|
|
9910
9944
|
}
|
|
9911
9945
|
|
|
@@ -9914,37 +9948,37 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9914
9948
|
}, {
|
|
9915
9949
|
key: "getSignatureHeader",
|
|
9916
9950
|
value: function () {
|
|
9917
|
-
var _getSignatureHeader = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9951
|
+
var _getSignatureHeader = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee32(payload) {
|
|
9918
9952
|
var _yield$this$walletSer, _yield$this$walletSer2, allSignatureBytes, recoveryByte, signatureBytes;
|
|
9919
9953
|
|
|
9920
|
-
return regeneratorRuntime.wrap(function
|
|
9954
|
+
return regeneratorRuntime.wrap(function _callee32$(_context32) {
|
|
9921
9955
|
while (1) {
|
|
9922
|
-
switch (
|
|
9956
|
+
switch (_context32.prev = _context32.next) {
|
|
9923
9957
|
case 0:
|
|
9924
|
-
|
|
9958
|
+
_context32.next = 2;
|
|
9925
9959
|
return this.walletService.sign(payload);
|
|
9926
9960
|
|
|
9927
9961
|
case 2:
|
|
9928
|
-
_yield$this$walletSer =
|
|
9962
|
+
_yield$this$walletSer = _context32.sent;
|
|
9929
9963
|
_yield$this$walletSer2 = _slicedToArray(_yield$this$walletSer, 2);
|
|
9930
9964
|
allSignatureBytes = _yield$this$walletSer2[0];
|
|
9931
9965
|
recoveryByte = _yield$this$walletSer2[1];
|
|
9932
9966
|
signatureBytes = new Uint8Array(65);
|
|
9933
9967
|
signatureBytes.set(allSignatureBytes, 0);
|
|
9934
9968
|
signatureBytes[64] = recoveryByte;
|
|
9935
|
-
return
|
|
9969
|
+
return _context32.abrupt("return", {
|
|
9936
9970
|
'x-sig': base.base64.encode(signatureBytes)
|
|
9937
9971
|
});
|
|
9938
9972
|
|
|
9939
9973
|
case 10:
|
|
9940
9974
|
case "end":
|
|
9941
|
-
return
|
|
9975
|
+
return _context32.stop();
|
|
9942
9976
|
}
|
|
9943
9977
|
}
|
|
9944
|
-
},
|
|
9978
|
+
}, _callee32, this);
|
|
9945
9979
|
}));
|
|
9946
9980
|
|
|
9947
|
-
function getSignatureHeader(
|
|
9981
|
+
function getSignatureHeader(_x37) {
|
|
9948
9982
|
return _getSignatureHeader.apply(this, arguments);
|
|
9949
9983
|
}
|
|
9950
9984
|
|
|
@@ -9953,44 +9987,44 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9953
9987
|
}, {
|
|
9954
9988
|
key: "signAndSendRequest",
|
|
9955
9989
|
value: function () {
|
|
9956
|
-
var _signAndSendRequest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9990
|
+
var _signAndSendRequest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee33(request) {
|
|
9957
9991
|
var payload;
|
|
9958
|
-
return regeneratorRuntime.wrap(function
|
|
9992
|
+
return regeneratorRuntime.wrap(function _callee33$(_context33) {
|
|
9959
9993
|
while (1) {
|
|
9960
|
-
switch (
|
|
9994
|
+
switch (_context33.prev = _context33.next) {
|
|
9961
9995
|
case 0:
|
|
9962
9996
|
payload = request.method === 'GET' ? request.query ? "".concat(request.path, "?").concat(this.configuration.queryParamsStringify(request.query)) : request.path : request.body;
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9997
|
+
_context33.t0 = this;
|
|
9998
|
+
_context33.t1 = _objectSpread2;
|
|
9999
|
+
_context33.t2 = _objectSpread2({}, request);
|
|
10000
|
+
_context33.t3 = {};
|
|
10001
|
+
_context33.t4 = _objectSpread2;
|
|
10002
|
+
_context33.t5 = _objectSpread2({}, request.headers);
|
|
10003
|
+
_context33.next = 9;
|
|
9970
10004
|
return this.getSignatureHeader(payload);
|
|
9971
10005
|
|
|
9972
10006
|
case 9:
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
9976
|
-
headers:
|
|
10007
|
+
_context33.t6 = _context33.sent;
|
|
10008
|
+
_context33.t7 = (0, _context33.t4)(_context33.t5, _context33.t6);
|
|
10009
|
+
_context33.t8 = {
|
|
10010
|
+
headers: _context33.t7
|
|
9977
10011
|
};
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
return
|
|
10012
|
+
_context33.t9 = (0, _context33.t1)(_context33.t2, _context33.t3, _context33.t8);
|
|
10013
|
+
_context33.next = 15;
|
|
10014
|
+
return _context33.t0.request.call(_context33.t0, _context33.t9);
|
|
9981
10015
|
|
|
9982
10016
|
case 15:
|
|
9983
|
-
return
|
|
10017
|
+
return _context33.abrupt("return", _context33.sent);
|
|
9984
10018
|
|
|
9985
10019
|
case 16:
|
|
9986
10020
|
case "end":
|
|
9987
|
-
return
|
|
10021
|
+
return _context33.stop();
|
|
9988
10022
|
}
|
|
9989
10023
|
}
|
|
9990
|
-
},
|
|
10024
|
+
}, _callee33, this);
|
|
9991
10025
|
}));
|
|
9992
10026
|
|
|
9993
|
-
function signAndSendRequest(
|
|
10027
|
+
function signAndSendRequest(_x38) {
|
|
9994
10028
|
return _signAndSendRequest.apply(this, arguments);
|
|
9995
10029
|
}
|
|
9996
10030
|
|
|
@@ -9999,16 +10033,16 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9999
10033
|
}, {
|
|
10000
10034
|
key: "sendRpc",
|
|
10001
10035
|
value: function () {
|
|
10002
|
-
var _sendRpc = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
10036
|
+
var _sendRpc = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34(args) {
|
|
10003
10037
|
var payload;
|
|
10004
|
-
return regeneratorRuntime.wrap(function
|
|
10038
|
+
return regeneratorRuntime.wrap(function _callee34$(_context34) {
|
|
10005
10039
|
while (1) {
|
|
10006
|
-
switch (
|
|
10040
|
+
switch (_context34.prev = _context34.next) {
|
|
10007
10041
|
case 0:
|
|
10008
10042
|
payload = JSON.stringify(_objectSpread2(_objectSpread2({}, args), {}, {
|
|
10009
10043
|
timestamp: new Date().getTime()
|
|
10010
10044
|
}));
|
|
10011
|
-
|
|
10045
|
+
_context34.next = 3;
|
|
10012
10046
|
return this.signAndSendRequest({
|
|
10013
10047
|
method: 'POST',
|
|
10014
10048
|
headers: {
|
|
@@ -10019,17 +10053,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
10019
10053
|
});
|
|
10020
10054
|
|
|
10021
10055
|
case 3:
|
|
10022
|
-
return
|
|
10056
|
+
return _context34.abrupt("return", args);
|
|
10023
10057
|
|
|
10024
10058
|
case 4:
|
|
10025
10059
|
case "end":
|
|
10026
|
-
return
|
|
10060
|
+
return _context34.stop();
|
|
10027
10061
|
}
|
|
10028
10062
|
}
|
|
10029
|
-
},
|
|
10063
|
+
}, _callee34, this);
|
|
10030
10064
|
}));
|
|
10031
10065
|
|
|
10032
|
-
function sendRpc(
|
|
10066
|
+
function sendRpc(_x39) {
|
|
10033
10067
|
return _sendRpc.apply(this, arguments);
|
|
10034
10068
|
}
|
|
10035
10069
|
|
|
@@ -10038,73 +10072,73 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
10038
10072
|
}, {
|
|
10039
10073
|
key: "createWebsocket",
|
|
10040
10074
|
value: function () {
|
|
10041
|
-
var _createWebsocket = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
10075
|
+
var _createWebsocket = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee36(endpoint) {
|
|
10042
10076
|
var _this5 = this;
|
|
10043
10077
|
|
|
10044
10078
|
var timestamp, originalUrl, signatureHeader, host, url, ws;
|
|
10045
|
-
return regeneratorRuntime.wrap(function
|
|
10079
|
+
return regeneratorRuntime.wrap(function _callee36$(_context36) {
|
|
10046
10080
|
while (1) {
|
|
10047
|
-
switch (
|
|
10081
|
+
switch (_context36.prev = _context36.next) {
|
|
10048
10082
|
case 0:
|
|
10049
10083
|
timestamp = new Date().getTime();
|
|
10050
10084
|
originalUrl = "/comms/chats/ws?timestamp=".concat(timestamp);
|
|
10051
|
-
|
|
10085
|
+
_context36.next = 4;
|
|
10052
10086
|
return this.getSignatureHeader(originalUrl);
|
|
10053
10087
|
|
|
10054
10088
|
case 4:
|
|
10055
|
-
signatureHeader =
|
|
10089
|
+
signatureHeader = _context36.sent;
|
|
10056
10090
|
host = endpoint.replace(/http(s?)/g, 'ws$1');
|
|
10057
10091
|
url = "".concat(host).concat(originalUrl, "&signature=").concat(encodeURIComponent(signatureHeader['x-sig']));
|
|
10058
10092
|
ws = new WebSocket__default["default"](url);
|
|
10059
10093
|
ws.addEventListener('message', function (messageEvent) {
|
|
10060
10094
|
var handleAsync = /*#__PURE__*/function () {
|
|
10061
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
10095
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee35() {
|
|
10062
10096
|
var data, sharedSecret;
|
|
10063
|
-
return regeneratorRuntime.wrap(function
|
|
10097
|
+
return regeneratorRuntime.wrap(function _callee35$(_context35) {
|
|
10064
10098
|
while (1) {
|
|
10065
|
-
switch (
|
|
10099
|
+
switch (_context35.prev = _context35.next) {
|
|
10066
10100
|
case 0:
|
|
10067
10101
|
data = JSON.parse(messageEvent.data);
|
|
10068
10102
|
|
|
10069
10103
|
if (!(data.rpc.method === 'chat.message')) {
|
|
10070
|
-
|
|
10104
|
+
_context35.next = 19;
|
|
10071
10105
|
break;
|
|
10072
10106
|
}
|
|
10073
10107
|
|
|
10074
|
-
|
|
10108
|
+
_context35.next = 4;
|
|
10075
10109
|
return _this5.getChatSecret(data.rpc.params.chat_id);
|
|
10076
10110
|
|
|
10077
10111
|
case 4:
|
|
10078
|
-
sharedSecret =
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10112
|
+
sharedSecret = _context35.sent;
|
|
10113
|
+
_context35.t0 = _this5.eventEmitter;
|
|
10114
|
+
_context35.t1 = data.rpc.params.chat_id;
|
|
10115
|
+
_context35.t2 = data.rpc.params.message_id;
|
|
10116
|
+
_context35.next = 10;
|
|
10083
10117
|
return _this5.decryptString(sharedSecret, base.base64.decode(data.rpc.params.message))["catch"](function (e) {
|
|
10084
10118
|
console.error("[audius-sdk]: Error: Couldn't decrypt websocket chat message", data, e);
|
|
10085
10119
|
return "Error: Couldn't decrypt message";
|
|
10086
10120
|
});
|
|
10087
10121
|
|
|
10088
10122
|
case 10:
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
message_id:
|
|
10095
|
-
message:
|
|
10096
|
-
sender_user_id:
|
|
10097
|
-
created_at:
|
|
10098
|
-
reactions:
|
|
10123
|
+
_context35.t3 = _context35.sent;
|
|
10124
|
+
_context35.t4 = data.metadata.userId;
|
|
10125
|
+
_context35.t5 = data.metadata.timestamp;
|
|
10126
|
+
_context35.t6 = [];
|
|
10127
|
+
_context35.t7 = {
|
|
10128
|
+
message_id: _context35.t2,
|
|
10129
|
+
message: _context35.t3,
|
|
10130
|
+
sender_user_id: _context35.t4,
|
|
10131
|
+
created_at: _context35.t5,
|
|
10132
|
+
reactions: _context35.t6
|
|
10099
10133
|
};
|
|
10100
|
-
|
|
10101
|
-
chatId:
|
|
10102
|
-
message:
|
|
10134
|
+
_context35.t8 = {
|
|
10135
|
+
chatId: _context35.t1,
|
|
10136
|
+
message: _context35.t7
|
|
10103
10137
|
};
|
|
10104
10138
|
|
|
10105
|
-
|
|
10139
|
+
_context35.t0.emit.call(_context35.t0, 'message', _context35.t8);
|
|
10106
10140
|
|
|
10107
|
-
|
|
10141
|
+
_context35.next = 20;
|
|
10108
10142
|
break;
|
|
10109
10143
|
|
|
10110
10144
|
case 19:
|
|
@@ -10122,10 +10156,10 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
10122
10156
|
|
|
10123
10157
|
case 20:
|
|
10124
10158
|
case "end":
|
|
10125
|
-
return
|
|
10159
|
+
return _context35.stop();
|
|
10126
10160
|
}
|
|
10127
10161
|
}
|
|
10128
|
-
},
|
|
10162
|
+
}, _callee35);
|
|
10129
10163
|
}));
|
|
10130
10164
|
|
|
10131
10165
|
return function handleAsync() {
|
|
@@ -10144,17 +10178,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
10144
10178
|
ws.addEventListener('error', function (e) {
|
|
10145
10179
|
_this5.eventEmitter.emit('error', e);
|
|
10146
10180
|
});
|
|
10147
|
-
return
|
|
10181
|
+
return _context36.abrupt("return", ws);
|
|
10148
10182
|
|
|
10149
10183
|
case 13:
|
|
10150
10184
|
case "end":
|
|
10151
|
-
return
|
|
10185
|
+
return _context36.stop();
|
|
10152
10186
|
}
|
|
10153
10187
|
}
|
|
10154
|
-
},
|
|
10188
|
+
}, _callee36, this);
|
|
10155
10189
|
}));
|
|
10156
10190
|
|
|
10157
|
-
function createWebsocket(
|
|
10191
|
+
function createWebsocket(_x40) {
|
|
10158
10192
|
return _createWebsocket.apply(this, arguments);
|
|
10159
10193
|
}
|
|
10160
10194
|
|