@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
|
@@ -9151,19 +9151,19 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9151
9151
|
return block;
|
|
9152
9152
|
}()
|
|
9153
9153
|
}, {
|
|
9154
|
-
key: "
|
|
9154
|
+
key: "unblock",
|
|
9155
9155
|
value: function () {
|
|
9156
|
-
var
|
|
9156
|
+
var _unblock = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(requestParameters) {
|
|
9157
9157
|
return regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
9158
9158
|
while (1) {
|
|
9159
9159
|
switch (_context17.prev = _context17.next) {
|
|
9160
9160
|
case 0:
|
|
9161
|
-
this.assertNotNullOrUndefined(requestParameters.
|
|
9161
|
+
this.assertNotNullOrUndefined(requestParameters.userId, 'requestParameters.userId', 'unblock');
|
|
9162
9162
|
_context17.next = 3;
|
|
9163
9163
|
return this.sendRpc({
|
|
9164
|
-
method: 'chat.
|
|
9164
|
+
method: 'chat.unblock',
|
|
9165
9165
|
params: {
|
|
9166
|
-
|
|
9166
|
+
user_id: requestParameters.userId
|
|
9167
9167
|
}
|
|
9168
9168
|
});
|
|
9169
9169
|
|
|
@@ -9178,26 +9178,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9178
9178
|
}, _callee17, this);
|
|
9179
9179
|
}));
|
|
9180
9180
|
|
|
9181
|
-
function
|
|
9182
|
-
return
|
|
9181
|
+
function unblock(_x14) {
|
|
9182
|
+
return _unblock.apply(this, arguments);
|
|
9183
9183
|
}
|
|
9184
9184
|
|
|
9185
|
-
return
|
|
9185
|
+
return unblock;
|
|
9186
9186
|
}()
|
|
9187
9187
|
}, {
|
|
9188
|
-
key: "
|
|
9188
|
+
key: "delete",
|
|
9189
9189
|
value: function () {
|
|
9190
|
-
var
|
|
9190
|
+
var _delete2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(requestParameters) {
|
|
9191
9191
|
return regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
9192
9192
|
while (1) {
|
|
9193
9193
|
switch (_context18.prev = _context18.next) {
|
|
9194
9194
|
case 0:
|
|
9195
|
-
this.assertNotNullOrUndefined(requestParameters.
|
|
9195
|
+
this.assertNotNullOrUndefined(requestParameters.chatId, 'requestParameters.chatId', 'delete');
|
|
9196
9196
|
_context18.next = 3;
|
|
9197
9197
|
return this.sendRpc({
|
|
9198
|
-
method: 'chat.
|
|
9198
|
+
method: 'chat.delete',
|
|
9199
9199
|
params: {
|
|
9200
|
-
|
|
9200
|
+
chat_id: requestParameters.chatId
|
|
9201
9201
|
}
|
|
9202
9202
|
});
|
|
9203
9203
|
|
|
@@ -9212,7 +9212,41 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9212
9212
|
}, _callee18, this);
|
|
9213
9213
|
}));
|
|
9214
9214
|
|
|
9215
|
-
function
|
|
9215
|
+
function _delete(_x15) {
|
|
9216
|
+
return _delete2.apply(this, arguments);
|
|
9217
|
+
}
|
|
9218
|
+
|
|
9219
|
+
return _delete;
|
|
9220
|
+
}()
|
|
9221
|
+
}, {
|
|
9222
|
+
key: "permit",
|
|
9223
|
+
value: function () {
|
|
9224
|
+
var _permit = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(requestParameters) {
|
|
9225
|
+
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
9226
|
+
while (1) {
|
|
9227
|
+
switch (_context19.prev = _context19.next) {
|
|
9228
|
+
case 0:
|
|
9229
|
+
this.assertNotNullOrUndefined(requestParameters.permit, 'requestParameters.permit', 'permit');
|
|
9230
|
+
_context19.next = 3;
|
|
9231
|
+
return this.sendRpc({
|
|
9232
|
+
method: 'chat.permit',
|
|
9233
|
+
params: {
|
|
9234
|
+
permit: requestParameters.permit
|
|
9235
|
+
}
|
|
9236
|
+
});
|
|
9237
|
+
|
|
9238
|
+
case 3:
|
|
9239
|
+
return _context19.abrupt("return", _context19.sent);
|
|
9240
|
+
|
|
9241
|
+
case 4:
|
|
9242
|
+
case "end":
|
|
9243
|
+
return _context19.stop();
|
|
9244
|
+
}
|
|
9245
|
+
}
|
|
9246
|
+
}, _callee19, this);
|
|
9247
|
+
}));
|
|
9248
|
+
|
|
9249
|
+
function permit(_x16) {
|
|
9216
9250
|
return _permit.apply(this, arguments);
|
|
9217
9251
|
}
|
|
9218
9252
|
|
|
@@ -9246,67 +9280,67 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9246
9280
|
}, {
|
|
9247
9281
|
key: "createInvites",
|
|
9248
9282
|
value: function () {
|
|
9249
|
-
var _createInvites = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9283
|
+
var _createInvites = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(userId, invitedUserIds, chatSecret) {
|
|
9250
9284
|
var _this4 = this;
|
|
9251
9285
|
|
|
9252
9286
|
var userPublicKey;
|
|
9253
|
-
return regeneratorRuntime.wrap(function
|
|
9287
|
+
return regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
9254
9288
|
while (1) {
|
|
9255
|
-
switch (
|
|
9289
|
+
switch (_context21.prev = _context21.next) {
|
|
9256
9290
|
case 0:
|
|
9257
|
-
|
|
9291
|
+
_context21.next = 2;
|
|
9258
9292
|
return this.getPublicKey(userId);
|
|
9259
9293
|
|
|
9260
9294
|
case 2:
|
|
9261
|
-
userPublicKey =
|
|
9262
|
-
|
|
9295
|
+
userPublicKey = _context21.sent;
|
|
9296
|
+
_context21.next = 5;
|
|
9263
9297
|
return Promise.all([userId].concat(_toConsumableArray(invitedUserIds)).map( /*#__PURE__*/function () {
|
|
9264
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9298
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(userId) {
|
|
9265
9299
|
var inviteePublicKey, inviteCode;
|
|
9266
|
-
return regeneratorRuntime.wrap(function
|
|
9300
|
+
return regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
9267
9301
|
while (1) {
|
|
9268
|
-
switch (
|
|
9302
|
+
switch (_context20.prev = _context20.next) {
|
|
9269
9303
|
case 0:
|
|
9270
|
-
|
|
9304
|
+
_context20.next = 2;
|
|
9271
9305
|
return _this4.getPublicKey(userId);
|
|
9272
9306
|
|
|
9273
9307
|
case 2:
|
|
9274
|
-
inviteePublicKey =
|
|
9275
|
-
|
|
9308
|
+
inviteePublicKey = _context20.sent;
|
|
9309
|
+
_context20.next = 5;
|
|
9276
9310
|
return _this4.createInviteCode(userPublicKey, inviteePublicKey, chatSecret);
|
|
9277
9311
|
|
|
9278
9312
|
case 5:
|
|
9279
|
-
inviteCode =
|
|
9280
|
-
return
|
|
9313
|
+
inviteCode = _context20.sent;
|
|
9314
|
+
return _context20.abrupt("return", {
|
|
9281
9315
|
user_id: userId,
|
|
9282
9316
|
invite_code: base64.encode(inviteCode)
|
|
9283
9317
|
});
|
|
9284
9318
|
|
|
9285
9319
|
case 7:
|
|
9286
9320
|
case "end":
|
|
9287
|
-
return
|
|
9321
|
+
return _context20.stop();
|
|
9288
9322
|
}
|
|
9289
9323
|
}
|
|
9290
|
-
},
|
|
9324
|
+
}, _callee20);
|
|
9291
9325
|
}));
|
|
9292
9326
|
|
|
9293
|
-
return function (
|
|
9327
|
+
return function (_x20) {
|
|
9294
9328
|
return _ref3.apply(this, arguments);
|
|
9295
9329
|
};
|
|
9296
9330
|
}()));
|
|
9297
9331
|
|
|
9298
9332
|
case 5:
|
|
9299
|
-
return
|
|
9333
|
+
return _context21.abrupt("return", _context21.sent);
|
|
9300
9334
|
|
|
9301
9335
|
case 6:
|
|
9302
9336
|
case "end":
|
|
9303
|
-
return
|
|
9337
|
+
return _context21.stop();
|
|
9304
9338
|
}
|
|
9305
9339
|
}
|
|
9306
|
-
},
|
|
9340
|
+
}, _callee21, this);
|
|
9307
9341
|
}));
|
|
9308
9342
|
|
|
9309
|
-
function createInvites(
|
|
9343
|
+
function createInvites(_x17, _x18, _x19) {
|
|
9310
9344
|
return _createInvites.apply(this, arguments);
|
|
9311
9345
|
}
|
|
9312
9346
|
|
|
@@ -9315,36 +9349,36 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9315
9349
|
}, {
|
|
9316
9350
|
key: "createInviteCode",
|
|
9317
9351
|
value: function () {
|
|
9318
|
-
var _createInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9352
|
+
var _createInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(userPublicKey, inviteePublicKey, chatSecret) {
|
|
9319
9353
|
var sharedSecret, encryptedChatSecret, inviteCode;
|
|
9320
|
-
return regeneratorRuntime.wrap(function
|
|
9354
|
+
return regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
9321
9355
|
while (1) {
|
|
9322
|
-
switch (
|
|
9356
|
+
switch (_context22.prev = _context22.next) {
|
|
9323
9357
|
case 0:
|
|
9324
|
-
|
|
9358
|
+
_context22.next = 2;
|
|
9325
9359
|
return this.walletService.getSharedSecret(inviteePublicKey);
|
|
9326
9360
|
|
|
9327
9361
|
case 2:
|
|
9328
|
-
sharedSecret =
|
|
9329
|
-
|
|
9362
|
+
sharedSecret = _context22.sent;
|
|
9363
|
+
_context22.next = 5;
|
|
9330
9364
|
return this.encrypt(sharedSecret, chatSecret);
|
|
9331
9365
|
|
|
9332
9366
|
case 5:
|
|
9333
|
-
encryptedChatSecret =
|
|
9367
|
+
encryptedChatSecret = _context22.sent;
|
|
9334
9368
|
inviteCode = new Uint8Array(65 + encryptedChatSecret.length);
|
|
9335
9369
|
inviteCode.set(userPublicKey);
|
|
9336
9370
|
inviteCode.set(encryptedChatSecret, 65);
|
|
9337
|
-
return
|
|
9371
|
+
return _context22.abrupt("return", inviteCode);
|
|
9338
9372
|
|
|
9339
9373
|
case 10:
|
|
9340
9374
|
case "end":
|
|
9341
|
-
return
|
|
9375
|
+
return _context22.stop();
|
|
9342
9376
|
}
|
|
9343
9377
|
}
|
|
9344
|
-
},
|
|
9378
|
+
}, _callee22, this);
|
|
9345
9379
|
}));
|
|
9346
9380
|
|
|
9347
|
-
function createInviteCode(
|
|
9381
|
+
function createInviteCode(_x21, _x22, _x23) {
|
|
9348
9382
|
return _createInviteCode.apply(this, arguments);
|
|
9349
9383
|
}
|
|
9350
9384
|
|
|
@@ -9353,34 +9387,34 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9353
9387
|
}, {
|
|
9354
9388
|
key: "readInviteCode",
|
|
9355
9389
|
value: function () {
|
|
9356
|
-
var _readInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9390
|
+
var _readInviteCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee23(inviteCode) {
|
|
9357
9391
|
var friendPublicKey, chatSecretEncrypted, sharedSecret;
|
|
9358
|
-
return regeneratorRuntime.wrap(function
|
|
9392
|
+
return regeneratorRuntime.wrap(function _callee23$(_context23) {
|
|
9359
9393
|
while (1) {
|
|
9360
|
-
switch (
|
|
9394
|
+
switch (_context23.prev = _context23.next) {
|
|
9361
9395
|
case 0:
|
|
9362
9396
|
friendPublicKey = inviteCode.slice(0, 65);
|
|
9363
9397
|
chatSecretEncrypted = inviteCode.slice(65);
|
|
9364
|
-
|
|
9398
|
+
_context23.next = 4;
|
|
9365
9399
|
return this.walletService.getSharedSecret(friendPublicKey);
|
|
9366
9400
|
|
|
9367
9401
|
case 4:
|
|
9368
|
-
sharedSecret =
|
|
9369
|
-
|
|
9402
|
+
sharedSecret = _context23.sent;
|
|
9403
|
+
_context23.next = 7;
|
|
9370
9404
|
return this.decrypt(sharedSecret, chatSecretEncrypted);
|
|
9371
9405
|
|
|
9372
9406
|
case 7:
|
|
9373
|
-
return
|
|
9407
|
+
return _context23.abrupt("return", _context23.sent);
|
|
9374
9408
|
|
|
9375
9409
|
case 8:
|
|
9376
9410
|
case "end":
|
|
9377
|
-
return
|
|
9411
|
+
return _context23.stop();
|
|
9378
9412
|
}
|
|
9379
9413
|
}
|
|
9380
|
-
},
|
|
9414
|
+
}, _callee23, this);
|
|
9381
9415
|
}));
|
|
9382
9416
|
|
|
9383
|
-
function readInviteCode(
|
|
9417
|
+
function readInviteCode(_x24) {
|
|
9384
9418
|
return _readInviteCode.apply(this, arguments);
|
|
9385
9419
|
}
|
|
9386
9420
|
|
|
@@ -9389,26 +9423,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9389
9423
|
}, {
|
|
9390
9424
|
key: "encrypt",
|
|
9391
9425
|
value: function () {
|
|
9392
|
-
var _encrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9393
|
-
return regeneratorRuntime.wrap(function
|
|
9426
|
+
var _encrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(secret, payload) {
|
|
9427
|
+
return regeneratorRuntime.wrap(function _callee24$(_context24) {
|
|
9394
9428
|
while (1) {
|
|
9395
|
-
switch (
|
|
9429
|
+
switch (_context24.prev = _context24.next) {
|
|
9396
9430
|
case 0:
|
|
9397
|
-
|
|
9431
|
+
_context24.next = 2;
|
|
9398
9432
|
return aes.encrypt(secret.slice(secret.length - 32), payload);
|
|
9399
9433
|
|
|
9400
9434
|
case 2:
|
|
9401
|
-
return
|
|
9435
|
+
return _context24.abrupt("return", _context24.sent);
|
|
9402
9436
|
|
|
9403
9437
|
case 3:
|
|
9404
9438
|
case "end":
|
|
9405
|
-
return
|
|
9439
|
+
return _context24.stop();
|
|
9406
9440
|
}
|
|
9407
9441
|
}
|
|
9408
|
-
},
|
|
9442
|
+
}, _callee24);
|
|
9409
9443
|
}));
|
|
9410
9444
|
|
|
9411
|
-
function encrypt(
|
|
9445
|
+
function encrypt(_x25, _x26) {
|
|
9412
9446
|
return _encrypt.apply(this, arguments);
|
|
9413
9447
|
}
|
|
9414
9448
|
|
|
@@ -9417,26 +9451,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9417
9451
|
}, {
|
|
9418
9452
|
key: "encryptString",
|
|
9419
9453
|
value: function () {
|
|
9420
|
-
var _encryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9421
|
-
return regeneratorRuntime.wrap(function
|
|
9454
|
+
var _encryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(secret, payload) {
|
|
9455
|
+
return regeneratorRuntime.wrap(function _callee25$(_context25) {
|
|
9422
9456
|
while (1) {
|
|
9423
|
-
switch (
|
|
9457
|
+
switch (_context25.prev = _context25.next) {
|
|
9424
9458
|
case 0:
|
|
9425
|
-
|
|
9459
|
+
_context25.next = 2;
|
|
9426
9460
|
return this.encrypt(secret, new TextEncoder().encode(payload));
|
|
9427
9461
|
|
|
9428
9462
|
case 2:
|
|
9429
|
-
return
|
|
9463
|
+
return _context25.abrupt("return", _context25.sent);
|
|
9430
9464
|
|
|
9431
9465
|
case 3:
|
|
9432
9466
|
case "end":
|
|
9433
|
-
return
|
|
9467
|
+
return _context25.stop();
|
|
9434
9468
|
}
|
|
9435
9469
|
}
|
|
9436
|
-
},
|
|
9470
|
+
}, _callee25, this);
|
|
9437
9471
|
}));
|
|
9438
9472
|
|
|
9439
|
-
function encryptString(
|
|
9473
|
+
function encryptString(_x27, _x28) {
|
|
9440
9474
|
return _encryptString.apply(this, arguments);
|
|
9441
9475
|
}
|
|
9442
9476
|
|
|
@@ -9445,26 +9479,26 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9445
9479
|
}, {
|
|
9446
9480
|
key: "decrypt",
|
|
9447
9481
|
value: function () {
|
|
9448
|
-
var _decrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9449
|
-
return regeneratorRuntime.wrap(function
|
|
9482
|
+
var _decrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee26(secret, payload) {
|
|
9483
|
+
return regeneratorRuntime.wrap(function _callee26$(_context26) {
|
|
9450
9484
|
while (1) {
|
|
9451
|
-
switch (
|
|
9485
|
+
switch (_context26.prev = _context26.next) {
|
|
9452
9486
|
case 0:
|
|
9453
|
-
|
|
9487
|
+
_context26.next = 2;
|
|
9454
9488
|
return aes.decrypt(secret.slice(secret.length - 32), payload);
|
|
9455
9489
|
|
|
9456
9490
|
case 2:
|
|
9457
|
-
return
|
|
9491
|
+
return _context26.abrupt("return", _context26.sent);
|
|
9458
9492
|
|
|
9459
9493
|
case 3:
|
|
9460
9494
|
case "end":
|
|
9461
|
-
return
|
|
9495
|
+
return _context26.stop();
|
|
9462
9496
|
}
|
|
9463
9497
|
}
|
|
9464
|
-
},
|
|
9498
|
+
}, _callee26);
|
|
9465
9499
|
}));
|
|
9466
9500
|
|
|
9467
|
-
function decrypt(
|
|
9501
|
+
function decrypt(_x29, _x30) {
|
|
9468
9502
|
return _decrypt.apply(this, arguments);
|
|
9469
9503
|
}
|
|
9470
9504
|
|
|
@@ -9473,28 +9507,28 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9473
9507
|
}, {
|
|
9474
9508
|
key: "decryptString",
|
|
9475
9509
|
value: function () {
|
|
9476
|
-
var _decryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9477
|
-
return regeneratorRuntime.wrap(function
|
|
9510
|
+
var _decryptString = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee27(secret, payload) {
|
|
9511
|
+
return regeneratorRuntime.wrap(function _callee27$(_context27) {
|
|
9478
9512
|
while (1) {
|
|
9479
|
-
switch (
|
|
9513
|
+
switch (_context27.prev = _context27.next) {
|
|
9480
9514
|
case 0:
|
|
9481
|
-
|
|
9482
|
-
|
|
9515
|
+
_context27.t0 = new TextDecoder();
|
|
9516
|
+
_context27.next = 3;
|
|
9483
9517
|
return this.decrypt(secret, payload);
|
|
9484
9518
|
|
|
9485
9519
|
case 3:
|
|
9486
|
-
|
|
9487
|
-
return
|
|
9520
|
+
_context27.t1 = _context27.sent;
|
|
9521
|
+
return _context27.abrupt("return", _context27.t0.decode.call(_context27.t0, _context27.t1));
|
|
9488
9522
|
|
|
9489
9523
|
case 5:
|
|
9490
9524
|
case "end":
|
|
9491
|
-
return
|
|
9525
|
+
return _context27.stop();
|
|
9492
9526
|
}
|
|
9493
9527
|
}
|
|
9494
|
-
},
|
|
9528
|
+
}, _callee27, this);
|
|
9495
9529
|
}));
|
|
9496
9530
|
|
|
9497
|
-
function decryptString(
|
|
9531
|
+
function decryptString(_x31, _x32) {
|
|
9498
9532
|
return _decryptString.apply(this, arguments);
|
|
9499
9533
|
}
|
|
9500
9534
|
|
|
@@ -9503,53 +9537,53 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9503
9537
|
}, {
|
|
9504
9538
|
key: "decryptLastChatMessage",
|
|
9505
9539
|
value: function () {
|
|
9506
|
-
var _decryptLastChatMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9540
|
+
var _decryptLastChatMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee28(c) {
|
|
9507
9541
|
var sharedSecret, lastMessage;
|
|
9508
|
-
return regeneratorRuntime.wrap(function
|
|
9542
|
+
return regeneratorRuntime.wrap(function _callee28$(_context28) {
|
|
9509
9543
|
while (1) {
|
|
9510
|
-
switch (
|
|
9544
|
+
switch (_context28.prev = _context28.next) {
|
|
9511
9545
|
case 0:
|
|
9512
|
-
|
|
9546
|
+
_context28.next = 2;
|
|
9513
9547
|
return this.getChatSecret(c.chat_id);
|
|
9514
9548
|
|
|
9515
9549
|
case 2:
|
|
9516
|
-
sharedSecret =
|
|
9550
|
+
sharedSecret = _context28.sent;
|
|
9517
9551
|
lastMessage = '';
|
|
9518
9552
|
|
|
9519
9553
|
if (!(c.last_message && c.last_message.length > 0)) {
|
|
9520
|
-
|
|
9554
|
+
_context28.next = 15;
|
|
9521
9555
|
break;
|
|
9522
9556
|
}
|
|
9523
9557
|
|
|
9524
|
-
|
|
9525
|
-
|
|
9558
|
+
_context28.prev = 5;
|
|
9559
|
+
_context28.next = 8;
|
|
9526
9560
|
return this.decryptString(sharedSecret, base64.decode(c.last_message));
|
|
9527
9561
|
|
|
9528
9562
|
case 8:
|
|
9529
|
-
lastMessage =
|
|
9530
|
-
|
|
9563
|
+
lastMessage = _context28.sent;
|
|
9564
|
+
_context28.next = 15;
|
|
9531
9565
|
break;
|
|
9532
9566
|
|
|
9533
9567
|
case 11:
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
console.error("[audius-sdk]: Error: Couldn't decrypt last chat message", c,
|
|
9568
|
+
_context28.prev = 11;
|
|
9569
|
+
_context28.t0 = _context28["catch"](5);
|
|
9570
|
+
console.error("[audius-sdk]: Error: Couldn't decrypt last chat message", c, _context28.t0);
|
|
9537
9571
|
lastMessage = "Error: Couldn't decrypt message";
|
|
9538
9572
|
|
|
9539
9573
|
case 15:
|
|
9540
|
-
return
|
|
9574
|
+
return _context28.abrupt("return", _objectSpread2(_objectSpread2({}, c), {}, {
|
|
9541
9575
|
last_message: lastMessage
|
|
9542
9576
|
}));
|
|
9543
9577
|
|
|
9544
9578
|
case 16:
|
|
9545
9579
|
case "end":
|
|
9546
|
-
return
|
|
9580
|
+
return _context28.stop();
|
|
9547
9581
|
}
|
|
9548
9582
|
}
|
|
9549
|
-
},
|
|
9583
|
+
}, _callee28, this, [[5, 11]]);
|
|
9550
9584
|
}));
|
|
9551
9585
|
|
|
9552
|
-
function decryptLastChatMessage(
|
|
9586
|
+
function decryptLastChatMessage(_x33) {
|
|
9553
9587
|
return _decryptLastChatMessage.apply(this, arguments);
|
|
9554
9588
|
}
|
|
9555
9589
|
|
|
@@ -9558,17 +9592,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9558
9592
|
}, {
|
|
9559
9593
|
key: "getRaw",
|
|
9560
9594
|
value: function () {
|
|
9561
|
-
var _getRaw = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9595
|
+
var _getRaw = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee29(chatId) {
|
|
9562
9596
|
var path, queryParameters, response;
|
|
9563
|
-
return regeneratorRuntime.wrap(function
|
|
9597
|
+
return regeneratorRuntime.wrap(function _callee29$(_context29) {
|
|
9564
9598
|
while (1) {
|
|
9565
|
-
switch (
|
|
9599
|
+
switch (_context29.prev = _context29.next) {
|
|
9566
9600
|
case 0:
|
|
9567
9601
|
path = "/comms/chats/".concat(chatId);
|
|
9568
9602
|
queryParameters = {
|
|
9569
9603
|
timestamp: new Date().getTime()
|
|
9570
9604
|
};
|
|
9571
|
-
|
|
9605
|
+
_context29.next = 4;
|
|
9572
9606
|
return this.signAndSendRequest({
|
|
9573
9607
|
method: 'GET',
|
|
9574
9608
|
headers: {},
|
|
@@ -9577,22 +9611,22 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9577
9611
|
});
|
|
9578
9612
|
|
|
9579
9613
|
case 4:
|
|
9580
|
-
response =
|
|
9581
|
-
|
|
9614
|
+
response = _context29.sent;
|
|
9615
|
+
_context29.next = 7;
|
|
9582
9616
|
return response.json();
|
|
9583
9617
|
|
|
9584
9618
|
case 7:
|
|
9585
|
-
return
|
|
9619
|
+
return _context29.abrupt("return", _context29.sent);
|
|
9586
9620
|
|
|
9587
9621
|
case 8:
|
|
9588
9622
|
case "end":
|
|
9589
|
-
return
|
|
9623
|
+
return _context29.stop();
|
|
9590
9624
|
}
|
|
9591
9625
|
}
|
|
9592
|
-
},
|
|
9626
|
+
}, _callee29, this);
|
|
9593
9627
|
}));
|
|
9594
9628
|
|
|
9595
|
-
function getRaw(
|
|
9629
|
+
function getRaw(_x34) {
|
|
9596
9630
|
return _getRaw.apply(this, arguments);
|
|
9597
9631
|
}
|
|
9598
9632
|
|
|
@@ -9601,44 +9635,44 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9601
9635
|
}, {
|
|
9602
9636
|
key: "getChatSecret",
|
|
9603
9637
|
value: function () {
|
|
9604
|
-
var _getChatSecret = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9638
|
+
var _getChatSecret = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee30(chatId) {
|
|
9605
9639
|
var existingChatSecret, response, chatSecret;
|
|
9606
|
-
return regeneratorRuntime.wrap(function
|
|
9640
|
+
return regeneratorRuntime.wrap(function _callee30$(_context30) {
|
|
9607
9641
|
while (1) {
|
|
9608
|
-
switch (
|
|
9642
|
+
switch (_context30.prev = _context30.next) {
|
|
9609
9643
|
case 0:
|
|
9610
9644
|
existingChatSecret = this.chatSecrets[chatId];
|
|
9611
9645
|
|
|
9612
9646
|
if (existingChatSecret) {
|
|
9613
|
-
|
|
9647
|
+
_context30.next = 10;
|
|
9614
9648
|
break;
|
|
9615
9649
|
}
|
|
9616
9650
|
|
|
9617
|
-
|
|
9651
|
+
_context30.next = 4;
|
|
9618
9652
|
return this.getRaw(chatId);
|
|
9619
9653
|
|
|
9620
9654
|
case 4:
|
|
9621
|
-
response =
|
|
9622
|
-
|
|
9655
|
+
response = _context30.sent;
|
|
9656
|
+
_context30.next = 7;
|
|
9623
9657
|
return this.readInviteCode(base64.decode(response.data.invite_code));
|
|
9624
9658
|
|
|
9625
9659
|
case 7:
|
|
9626
|
-
chatSecret =
|
|
9660
|
+
chatSecret = _context30.sent;
|
|
9627
9661
|
this.chatSecrets[chatId] = chatSecret;
|
|
9628
|
-
return
|
|
9662
|
+
return _context30.abrupt("return", chatSecret);
|
|
9629
9663
|
|
|
9630
9664
|
case 10:
|
|
9631
|
-
return
|
|
9665
|
+
return _context30.abrupt("return", existingChatSecret);
|
|
9632
9666
|
|
|
9633
9667
|
case 11:
|
|
9634
9668
|
case "end":
|
|
9635
|
-
return
|
|
9669
|
+
return _context30.stop();
|
|
9636
9670
|
}
|
|
9637
9671
|
}
|
|
9638
|
-
},
|
|
9672
|
+
}, _callee30, this);
|
|
9639
9673
|
}));
|
|
9640
9674
|
|
|
9641
|
-
function getChatSecret(
|
|
9675
|
+
function getChatSecret(_x35) {
|
|
9642
9676
|
return _getChatSecret.apply(this, arguments);
|
|
9643
9677
|
}
|
|
9644
9678
|
|
|
@@ -9647,13 +9681,13 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9647
9681
|
}, {
|
|
9648
9682
|
key: "getPublicKey",
|
|
9649
9683
|
value: function () {
|
|
9650
|
-
var _getPublicKey = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9684
|
+
var _getPublicKey = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(userId) {
|
|
9651
9685
|
var response, json;
|
|
9652
|
-
return regeneratorRuntime.wrap(function
|
|
9686
|
+
return regeneratorRuntime.wrap(function _callee31$(_context31) {
|
|
9653
9687
|
while (1) {
|
|
9654
|
-
switch (
|
|
9688
|
+
switch (_context31.prev = _context31.next) {
|
|
9655
9689
|
case 0:
|
|
9656
|
-
|
|
9690
|
+
_context31.next = 2;
|
|
9657
9691
|
return this.request({
|
|
9658
9692
|
path: "/comms/pubkey/".concat(userId),
|
|
9659
9693
|
method: 'GET',
|
|
@@ -9661,23 +9695,23 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9661
9695
|
});
|
|
9662
9696
|
|
|
9663
9697
|
case 2:
|
|
9664
|
-
response =
|
|
9665
|
-
|
|
9698
|
+
response = _context31.sent;
|
|
9699
|
+
_context31.next = 5;
|
|
9666
9700
|
return response.json();
|
|
9667
9701
|
|
|
9668
9702
|
case 5:
|
|
9669
|
-
json =
|
|
9670
|
-
return
|
|
9703
|
+
json = _context31.sent;
|
|
9704
|
+
return _context31.abrupt("return", base64.decode(json.data));
|
|
9671
9705
|
|
|
9672
9706
|
case 7:
|
|
9673
9707
|
case "end":
|
|
9674
|
-
return
|
|
9708
|
+
return _context31.stop();
|
|
9675
9709
|
}
|
|
9676
9710
|
}
|
|
9677
|
-
},
|
|
9711
|
+
}, _callee31, this);
|
|
9678
9712
|
}));
|
|
9679
9713
|
|
|
9680
|
-
function getPublicKey(
|
|
9714
|
+
function getPublicKey(_x36) {
|
|
9681
9715
|
return _getPublicKey.apply(this, arguments);
|
|
9682
9716
|
}
|
|
9683
9717
|
|
|
@@ -9686,37 +9720,37 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9686
9720
|
}, {
|
|
9687
9721
|
key: "getSignatureHeader",
|
|
9688
9722
|
value: function () {
|
|
9689
|
-
var _getSignatureHeader = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9723
|
+
var _getSignatureHeader = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee32(payload) {
|
|
9690
9724
|
var _yield$this$walletSer, _yield$this$walletSer2, allSignatureBytes, recoveryByte, signatureBytes;
|
|
9691
9725
|
|
|
9692
|
-
return regeneratorRuntime.wrap(function
|
|
9726
|
+
return regeneratorRuntime.wrap(function _callee32$(_context32) {
|
|
9693
9727
|
while (1) {
|
|
9694
|
-
switch (
|
|
9728
|
+
switch (_context32.prev = _context32.next) {
|
|
9695
9729
|
case 0:
|
|
9696
|
-
|
|
9730
|
+
_context32.next = 2;
|
|
9697
9731
|
return this.walletService.sign(payload);
|
|
9698
9732
|
|
|
9699
9733
|
case 2:
|
|
9700
|
-
_yield$this$walletSer =
|
|
9734
|
+
_yield$this$walletSer = _context32.sent;
|
|
9701
9735
|
_yield$this$walletSer2 = _slicedToArray(_yield$this$walletSer, 2);
|
|
9702
9736
|
allSignatureBytes = _yield$this$walletSer2[0];
|
|
9703
9737
|
recoveryByte = _yield$this$walletSer2[1];
|
|
9704
9738
|
signatureBytes = new Uint8Array(65);
|
|
9705
9739
|
signatureBytes.set(allSignatureBytes, 0);
|
|
9706
9740
|
signatureBytes[64] = recoveryByte;
|
|
9707
|
-
return
|
|
9741
|
+
return _context32.abrupt("return", {
|
|
9708
9742
|
'x-sig': base64.encode(signatureBytes)
|
|
9709
9743
|
});
|
|
9710
9744
|
|
|
9711
9745
|
case 10:
|
|
9712
9746
|
case "end":
|
|
9713
|
-
return
|
|
9747
|
+
return _context32.stop();
|
|
9714
9748
|
}
|
|
9715
9749
|
}
|
|
9716
|
-
},
|
|
9750
|
+
}, _callee32, this);
|
|
9717
9751
|
}));
|
|
9718
9752
|
|
|
9719
|
-
function getSignatureHeader(
|
|
9753
|
+
function getSignatureHeader(_x37) {
|
|
9720
9754
|
return _getSignatureHeader.apply(this, arguments);
|
|
9721
9755
|
}
|
|
9722
9756
|
|
|
@@ -9725,44 +9759,44 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9725
9759
|
}, {
|
|
9726
9760
|
key: "signAndSendRequest",
|
|
9727
9761
|
value: function () {
|
|
9728
|
-
var _signAndSendRequest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9762
|
+
var _signAndSendRequest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee33(request) {
|
|
9729
9763
|
var payload;
|
|
9730
|
-
return regeneratorRuntime.wrap(function
|
|
9764
|
+
return regeneratorRuntime.wrap(function _callee33$(_context33) {
|
|
9731
9765
|
while (1) {
|
|
9732
|
-
switch (
|
|
9766
|
+
switch (_context33.prev = _context33.next) {
|
|
9733
9767
|
case 0:
|
|
9734
9768
|
payload = request.method === 'GET' ? request.query ? "".concat(request.path, "?").concat(this.configuration.queryParamsStringify(request.query)) : request.path : request.body;
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9769
|
+
_context33.t0 = this;
|
|
9770
|
+
_context33.t1 = _objectSpread2;
|
|
9771
|
+
_context33.t2 = _objectSpread2({}, request);
|
|
9772
|
+
_context33.t3 = {};
|
|
9773
|
+
_context33.t4 = _objectSpread2;
|
|
9774
|
+
_context33.t5 = _objectSpread2({}, request.headers);
|
|
9775
|
+
_context33.next = 9;
|
|
9742
9776
|
return this.getSignatureHeader(payload);
|
|
9743
9777
|
|
|
9744
9778
|
case 9:
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
headers:
|
|
9779
|
+
_context33.t6 = _context33.sent;
|
|
9780
|
+
_context33.t7 = (0, _context33.t4)(_context33.t5, _context33.t6);
|
|
9781
|
+
_context33.t8 = {
|
|
9782
|
+
headers: _context33.t7
|
|
9749
9783
|
};
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
return
|
|
9784
|
+
_context33.t9 = (0, _context33.t1)(_context33.t2, _context33.t3, _context33.t8);
|
|
9785
|
+
_context33.next = 15;
|
|
9786
|
+
return _context33.t0.request.call(_context33.t0, _context33.t9);
|
|
9753
9787
|
|
|
9754
9788
|
case 15:
|
|
9755
|
-
return
|
|
9789
|
+
return _context33.abrupt("return", _context33.sent);
|
|
9756
9790
|
|
|
9757
9791
|
case 16:
|
|
9758
9792
|
case "end":
|
|
9759
|
-
return
|
|
9793
|
+
return _context33.stop();
|
|
9760
9794
|
}
|
|
9761
9795
|
}
|
|
9762
|
-
},
|
|
9796
|
+
}, _callee33, this);
|
|
9763
9797
|
}));
|
|
9764
9798
|
|
|
9765
|
-
function signAndSendRequest(
|
|
9799
|
+
function signAndSendRequest(_x38) {
|
|
9766
9800
|
return _signAndSendRequest.apply(this, arguments);
|
|
9767
9801
|
}
|
|
9768
9802
|
|
|
@@ -9771,16 +9805,16 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9771
9805
|
}, {
|
|
9772
9806
|
key: "sendRpc",
|
|
9773
9807
|
value: function () {
|
|
9774
|
-
var _sendRpc = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9808
|
+
var _sendRpc = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34(args) {
|
|
9775
9809
|
var payload;
|
|
9776
|
-
return regeneratorRuntime.wrap(function
|
|
9810
|
+
return regeneratorRuntime.wrap(function _callee34$(_context34) {
|
|
9777
9811
|
while (1) {
|
|
9778
|
-
switch (
|
|
9812
|
+
switch (_context34.prev = _context34.next) {
|
|
9779
9813
|
case 0:
|
|
9780
9814
|
payload = JSON.stringify(_objectSpread2(_objectSpread2({}, args), {}, {
|
|
9781
9815
|
timestamp: new Date().getTime()
|
|
9782
9816
|
}));
|
|
9783
|
-
|
|
9817
|
+
_context34.next = 3;
|
|
9784
9818
|
return this.signAndSendRequest({
|
|
9785
9819
|
method: 'POST',
|
|
9786
9820
|
headers: {
|
|
@@ -9791,17 +9825,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9791
9825
|
});
|
|
9792
9826
|
|
|
9793
9827
|
case 3:
|
|
9794
|
-
return
|
|
9828
|
+
return _context34.abrupt("return", args);
|
|
9795
9829
|
|
|
9796
9830
|
case 4:
|
|
9797
9831
|
case "end":
|
|
9798
|
-
return
|
|
9832
|
+
return _context34.stop();
|
|
9799
9833
|
}
|
|
9800
9834
|
}
|
|
9801
|
-
},
|
|
9835
|
+
}, _callee34, this);
|
|
9802
9836
|
}));
|
|
9803
9837
|
|
|
9804
|
-
function sendRpc(
|
|
9838
|
+
function sendRpc(_x39) {
|
|
9805
9839
|
return _sendRpc.apply(this, arguments);
|
|
9806
9840
|
}
|
|
9807
9841
|
|
|
@@ -9810,73 +9844,73 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9810
9844
|
}, {
|
|
9811
9845
|
key: "createWebsocket",
|
|
9812
9846
|
value: function () {
|
|
9813
|
-
var _createWebsocket = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9847
|
+
var _createWebsocket = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee36(endpoint) {
|
|
9814
9848
|
var _this5 = this;
|
|
9815
9849
|
|
|
9816
9850
|
var timestamp, originalUrl, signatureHeader, host, url, ws;
|
|
9817
|
-
return regeneratorRuntime.wrap(function
|
|
9851
|
+
return regeneratorRuntime.wrap(function _callee36$(_context36) {
|
|
9818
9852
|
while (1) {
|
|
9819
|
-
switch (
|
|
9853
|
+
switch (_context36.prev = _context36.next) {
|
|
9820
9854
|
case 0:
|
|
9821
9855
|
timestamp = new Date().getTime();
|
|
9822
9856
|
originalUrl = "/comms/chats/ws?timestamp=".concat(timestamp);
|
|
9823
|
-
|
|
9857
|
+
_context36.next = 4;
|
|
9824
9858
|
return this.getSignatureHeader(originalUrl);
|
|
9825
9859
|
|
|
9826
9860
|
case 4:
|
|
9827
|
-
signatureHeader =
|
|
9861
|
+
signatureHeader = _context36.sent;
|
|
9828
9862
|
host = endpoint.replace(/http(s?)/g, 'ws$1');
|
|
9829
9863
|
url = "".concat(host).concat(originalUrl, "&signature=").concat(encodeURIComponent(signatureHeader['x-sig']));
|
|
9830
9864
|
ws = new WebSocket(url);
|
|
9831
9865
|
ws.addEventListener('message', function (messageEvent) {
|
|
9832
9866
|
var handleAsync = /*#__PURE__*/function () {
|
|
9833
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
9867
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee35() {
|
|
9834
9868
|
var data, sharedSecret;
|
|
9835
|
-
return regeneratorRuntime.wrap(function
|
|
9869
|
+
return regeneratorRuntime.wrap(function _callee35$(_context35) {
|
|
9836
9870
|
while (1) {
|
|
9837
|
-
switch (
|
|
9871
|
+
switch (_context35.prev = _context35.next) {
|
|
9838
9872
|
case 0:
|
|
9839
9873
|
data = JSON.parse(messageEvent.data);
|
|
9840
9874
|
|
|
9841
9875
|
if (!(data.rpc.method === 'chat.message')) {
|
|
9842
|
-
|
|
9876
|
+
_context35.next = 19;
|
|
9843
9877
|
break;
|
|
9844
9878
|
}
|
|
9845
9879
|
|
|
9846
|
-
|
|
9880
|
+
_context35.next = 4;
|
|
9847
9881
|
return _this5.getChatSecret(data.rpc.params.chat_id);
|
|
9848
9882
|
|
|
9849
9883
|
case 4:
|
|
9850
|
-
sharedSecret =
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9884
|
+
sharedSecret = _context35.sent;
|
|
9885
|
+
_context35.t0 = _this5.eventEmitter;
|
|
9886
|
+
_context35.t1 = data.rpc.params.chat_id;
|
|
9887
|
+
_context35.t2 = data.rpc.params.message_id;
|
|
9888
|
+
_context35.next = 10;
|
|
9855
9889
|
return _this5.decryptString(sharedSecret, base64.decode(data.rpc.params.message))["catch"](function (e) {
|
|
9856
9890
|
console.error("[audius-sdk]: Error: Couldn't decrypt websocket chat message", data, e);
|
|
9857
9891
|
return "Error: Couldn't decrypt message";
|
|
9858
9892
|
});
|
|
9859
9893
|
|
|
9860
9894
|
case 10:
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
message_id:
|
|
9867
|
-
message:
|
|
9868
|
-
sender_user_id:
|
|
9869
|
-
created_at:
|
|
9870
|
-
reactions:
|
|
9895
|
+
_context35.t3 = _context35.sent;
|
|
9896
|
+
_context35.t4 = data.metadata.userId;
|
|
9897
|
+
_context35.t5 = data.metadata.timestamp;
|
|
9898
|
+
_context35.t6 = [];
|
|
9899
|
+
_context35.t7 = {
|
|
9900
|
+
message_id: _context35.t2,
|
|
9901
|
+
message: _context35.t3,
|
|
9902
|
+
sender_user_id: _context35.t4,
|
|
9903
|
+
created_at: _context35.t5,
|
|
9904
|
+
reactions: _context35.t6
|
|
9871
9905
|
};
|
|
9872
|
-
|
|
9873
|
-
chatId:
|
|
9874
|
-
message:
|
|
9906
|
+
_context35.t8 = {
|
|
9907
|
+
chatId: _context35.t1,
|
|
9908
|
+
message: _context35.t7
|
|
9875
9909
|
};
|
|
9876
9910
|
|
|
9877
|
-
|
|
9911
|
+
_context35.t0.emit.call(_context35.t0, 'message', _context35.t8);
|
|
9878
9912
|
|
|
9879
|
-
|
|
9913
|
+
_context35.next = 20;
|
|
9880
9914
|
break;
|
|
9881
9915
|
|
|
9882
9916
|
case 19:
|
|
@@ -9894,10 +9928,10 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9894
9928
|
|
|
9895
9929
|
case 20:
|
|
9896
9930
|
case "end":
|
|
9897
|
-
return
|
|
9931
|
+
return _context35.stop();
|
|
9898
9932
|
}
|
|
9899
9933
|
}
|
|
9900
|
-
},
|
|
9934
|
+
}, _callee35);
|
|
9901
9935
|
}));
|
|
9902
9936
|
|
|
9903
9937
|
return function handleAsync() {
|
|
@@ -9916,17 +9950,17 @@ var ChatsApi = /*#__PURE__*/function (_BaseAPI) {
|
|
|
9916
9950
|
ws.addEventListener('error', function (e) {
|
|
9917
9951
|
_this5.eventEmitter.emit('error', e);
|
|
9918
9952
|
});
|
|
9919
|
-
return
|
|
9953
|
+
return _context36.abrupt("return", ws);
|
|
9920
9954
|
|
|
9921
9955
|
case 13:
|
|
9922
9956
|
case "end":
|
|
9923
|
-
return
|
|
9957
|
+
return _context36.stop();
|
|
9924
9958
|
}
|
|
9925
9959
|
}
|
|
9926
|
-
},
|
|
9960
|
+
}, _callee36, this);
|
|
9927
9961
|
}));
|
|
9928
9962
|
|
|
9929
|
-
function createWebsocket(
|
|
9963
|
+
function createWebsocket(_x40) {
|
|
9930
9964
|
return _createWebsocket.apply(this, arguments);
|
|
9931
9965
|
}
|
|
9932
9966
|
|