ncloudchat 1.0.19 → 1.0.23
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/esm/CloudChat.d.ts +3 -0
- package/esm/CloudChat.js +136 -59
- package/esm/CloudChat.js.map +1 -1
- package/esm/CoreManager.js.map +1 -1
- package/esm/mutations/channel.d.ts +1 -1
- package/esm/mutations/channel.js +13 -3
- package/esm/mutations/channel.js.map +1 -1
- package/esm/mutations/index.d.ts +1 -1
- package/esm/mutations/index.js +1 -1
- package/esm/mutations/index.js.map +1 -1
- package/esm/mutations/member.d.ts +4 -0
- package/esm/mutations/member.js +176 -0
- package/esm/mutations/member.js.map +1 -0
- package/esm/mutations/message.js +4 -0
- package/esm/mutations/message.js.map +1 -1
- package/esm/mutations/subscription.d.ts +1 -0
- package/esm/mutations/subscription.js +4 -3
- package/esm/mutations/subscription.js.map +1 -1
- package/esm/queries/index.d.ts +1 -0
- package/esm/queries/index.js +1 -0
- package/esm/queries/index.js.map +1 -1
- package/esm/queries/memberblocks.d.ts +1 -0
- package/esm/{mutations/user.js → queries/memberblocks.js} +45 -48
- package/esm/queries/memberblocks.js.map +1 -0
- package/lib/CloudChat.js +194 -60
- package/lib/mutations/channel.js +9 -3
- package/lib/mutations/index.js +3 -3
- package/lib/mutations/member.js +331 -0
- package/lib/mutations/message.js +8 -0
- package/lib/mutations/subscription.js +7 -4
- package/lib/queries/index.js +13 -0
- package/lib/{mutations/user.js → queries/memberblocks.js} +26 -30
- package/package.json +1 -1
- package/esm/mutations/user.d.ts +0 -1
- package/esm/mutations/user.js.map +0 -1
package/lib/CloudChat.js
CHANGED
|
@@ -840,7 +840,7 @@ function () {
|
|
|
840
840
|
});
|
|
841
841
|
};
|
|
842
842
|
|
|
843
|
-
NCloudChat.prototype.
|
|
843
|
+
NCloudChat.prototype.getMemberBlocks = function (filter, sort, option) {
|
|
844
844
|
if (sort === void 0) {
|
|
845
845
|
sort = {};
|
|
846
846
|
}
|
|
@@ -868,7 +868,7 @@ function () {
|
|
|
868
868
|
|
|
869
869
|
return [4
|
|
870
870
|
/*yield*/
|
|
871
|
-
, (0, _queries.
|
|
871
|
+
, (0, _queries.getMemberBlocks)((0, _stringify["default"])(filter), (0, _stringify["default"])(sort), (0, _stringify["default"])(option))];
|
|
872
872
|
|
|
873
873
|
case 2:
|
|
874
874
|
entries = _a.sent();
|
|
@@ -901,7 +901,7 @@ function () {
|
|
|
901
901
|
});
|
|
902
902
|
};
|
|
903
903
|
|
|
904
|
-
NCloudChat.prototype.
|
|
904
|
+
NCloudChat.prototype.getMembers = function (filter, sort, option) {
|
|
905
905
|
if (sort === void 0) {
|
|
906
906
|
sort = {};
|
|
907
907
|
}
|
|
@@ -911,7 +911,7 @@ function () {
|
|
|
911
911
|
}
|
|
912
912
|
|
|
913
913
|
return __awaiter(this, void 0, void 0, function () {
|
|
914
|
-
var entries,
|
|
914
|
+
var entries, members, e_9;
|
|
915
915
|
|
|
916
916
|
var _this = this;
|
|
917
917
|
|
|
@@ -929,20 +929,20 @@ function () {
|
|
|
929
929
|
|
|
930
930
|
return [4
|
|
931
931
|
/*yield*/
|
|
932
|
-
, (0, _queries.
|
|
932
|
+
, (0, _queries.getMembers)((0, _stringify["default"])(filter), (0, _stringify["default"])(sort), (0, _stringify["default"])(option))];
|
|
933
933
|
|
|
934
934
|
case 2:
|
|
935
935
|
entries = _a.sent();
|
|
936
936
|
|
|
937
937
|
if (entries) {
|
|
938
|
-
|
|
938
|
+
members = entries.map(function (item) {
|
|
939
939
|
return __assign(__assign({}, item.node), {
|
|
940
940
|
id: _this.ObjectId(item.node.id)
|
|
941
941
|
});
|
|
942
942
|
});
|
|
943
943
|
return [2
|
|
944
944
|
/*return*/
|
|
945
|
-
,
|
|
945
|
+
, members];
|
|
946
946
|
}
|
|
947
947
|
|
|
948
948
|
return [2
|
|
@@ -962,9 +962,20 @@ function () {
|
|
|
962
962
|
});
|
|
963
963
|
};
|
|
964
964
|
|
|
965
|
-
NCloudChat.prototype.
|
|
965
|
+
NCloudChat.prototype.getChannels = function (filter, sort, option) {
|
|
966
|
+
if (sort === void 0) {
|
|
967
|
+
sort = {};
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
if (option === void 0) {
|
|
971
|
+
option = {};
|
|
972
|
+
}
|
|
973
|
+
|
|
966
974
|
return __awaiter(this, void 0, void 0, function () {
|
|
967
|
-
var e_10;
|
|
975
|
+
var entries, channels, e_10;
|
|
976
|
+
|
|
977
|
+
var _this = this;
|
|
978
|
+
|
|
968
979
|
return __generator(this, function (_a) {
|
|
969
980
|
switch (_a.label) {
|
|
970
981
|
case 0:
|
|
@@ -979,12 +990,25 @@ function () {
|
|
|
979
990
|
|
|
980
991
|
return [4
|
|
981
992
|
/*yield*/
|
|
982
|
-
, (0,
|
|
993
|
+
, (0, _queries.getChannels)((0, _stringify["default"])(filter), (0, _stringify["default"])(sort), (0, _stringify["default"])(option))];
|
|
983
994
|
|
|
984
995
|
case 2:
|
|
996
|
+
entries = _a.sent();
|
|
997
|
+
|
|
998
|
+
if (entries) {
|
|
999
|
+
channels = entries.map(function (item) {
|
|
1000
|
+
return __assign(__assign({}, item.node), {
|
|
1001
|
+
id: _this.ObjectId(item.node.id)
|
|
1002
|
+
});
|
|
1003
|
+
});
|
|
1004
|
+
return [2
|
|
1005
|
+
/*return*/
|
|
1006
|
+
, channels];
|
|
1007
|
+
}
|
|
1008
|
+
|
|
985
1009
|
return [2
|
|
986
1010
|
/*return*/
|
|
987
|
-
,
|
|
1011
|
+
, entries];
|
|
988
1012
|
|
|
989
1013
|
case 3:
|
|
990
1014
|
e_10 = _a.sent();
|
|
@@ -999,7 +1023,7 @@ function () {
|
|
|
999
1023
|
});
|
|
1000
1024
|
};
|
|
1001
1025
|
|
|
1002
|
-
NCloudChat.prototype.
|
|
1026
|
+
NCloudChat.prototype.requestFriend = function (friendId) {
|
|
1003
1027
|
return __awaiter(this, void 0, void 0, function () {
|
|
1004
1028
|
var e_11;
|
|
1005
1029
|
return __generator(this, function (_a) {
|
|
@@ -1016,7 +1040,7 @@ function () {
|
|
|
1016
1040
|
|
|
1017
1041
|
return [4
|
|
1018
1042
|
/*yield*/
|
|
1019
|
-
, (0, _mutations.
|
|
1043
|
+
, (0, _mutations.requestFriend)(friendId)];
|
|
1020
1044
|
|
|
1021
1045
|
case 2:
|
|
1022
1046
|
return [2
|
|
@@ -1036,7 +1060,7 @@ function () {
|
|
|
1036
1060
|
});
|
|
1037
1061
|
};
|
|
1038
1062
|
|
|
1039
|
-
NCloudChat.prototype.
|
|
1063
|
+
NCloudChat.prototype.acceptFriend = function (friendId) {
|
|
1040
1064
|
return __awaiter(this, void 0, void 0, function () {
|
|
1041
1065
|
var e_12;
|
|
1042
1066
|
return __generator(this, function (_a) {
|
|
@@ -1053,7 +1077,7 @@ function () {
|
|
|
1053
1077
|
|
|
1054
1078
|
return [4
|
|
1055
1079
|
/*yield*/
|
|
1056
|
-
, (0, _mutations.
|
|
1080
|
+
, (0, _mutations.acceptFriend)(friendId)];
|
|
1057
1081
|
|
|
1058
1082
|
case 2:
|
|
1059
1083
|
return [2
|
|
@@ -1073,7 +1097,7 @@ function () {
|
|
|
1073
1097
|
});
|
|
1074
1098
|
};
|
|
1075
1099
|
|
|
1076
|
-
NCloudChat.prototype.
|
|
1100
|
+
NCloudChat.prototype.rejectFriend = function (friendId) {
|
|
1077
1101
|
return __awaiter(this, void 0, void 0, function () {
|
|
1078
1102
|
var e_13;
|
|
1079
1103
|
return __generator(this, function (_a) {
|
|
@@ -1090,7 +1114,7 @@ function () {
|
|
|
1090
1114
|
|
|
1091
1115
|
return [4
|
|
1092
1116
|
/*yield*/
|
|
1093
|
-
, (0, _mutations.
|
|
1117
|
+
, (0, _mutations.rejectFriend)(friendId)];
|
|
1094
1118
|
|
|
1095
1119
|
case 2:
|
|
1096
1120
|
return [2
|
|
@@ -1110,7 +1134,7 @@ function () {
|
|
|
1110
1134
|
});
|
|
1111
1135
|
};
|
|
1112
1136
|
|
|
1113
|
-
NCloudChat.prototype.
|
|
1137
|
+
NCloudChat.prototype.removeFriend = function (friendId) {
|
|
1114
1138
|
return __awaiter(this, void 0, void 0, function () {
|
|
1115
1139
|
var e_14;
|
|
1116
1140
|
return __generator(this, function (_a) {
|
|
@@ -1127,7 +1151,7 @@ function () {
|
|
|
1127
1151
|
|
|
1128
1152
|
return [4
|
|
1129
1153
|
/*yield*/
|
|
1130
|
-
, (0,
|
|
1154
|
+
, (0, _mutations.removeFriend)(friendId)];
|
|
1131
1155
|
|
|
1132
1156
|
case 2:
|
|
1133
1157
|
return [2
|
|
@@ -1147,7 +1171,7 @@ function () {
|
|
|
1147
1171
|
});
|
|
1148
1172
|
};
|
|
1149
1173
|
|
|
1150
|
-
NCloudChat.prototype.
|
|
1174
|
+
NCloudChat.prototype.countUnread = function (channelId) {
|
|
1151
1175
|
return __awaiter(this, void 0, void 0, function () {
|
|
1152
1176
|
var e_15;
|
|
1153
1177
|
return __generator(this, function (_a) {
|
|
@@ -1164,7 +1188,7 @@ function () {
|
|
|
1164
1188
|
|
|
1165
1189
|
return [4
|
|
1166
1190
|
/*yield*/
|
|
1167
|
-
, (0, _queries.
|
|
1191
|
+
, (0, _queries.unreadCount)(channelId)];
|
|
1168
1192
|
|
|
1169
1193
|
case 2:
|
|
1170
1194
|
return [2
|
|
@@ -1178,13 +1202,13 @@ function () {
|
|
|
1178
1202
|
case 4:
|
|
1179
1203
|
return [2
|
|
1180
1204
|
/*return*/
|
|
1181
|
-
|
|
1205
|
+
];
|
|
1182
1206
|
}
|
|
1183
1207
|
});
|
|
1184
1208
|
});
|
|
1185
1209
|
};
|
|
1186
1210
|
|
|
1187
|
-
NCloudChat.prototype.
|
|
1211
|
+
NCloudChat.prototype.getSubscription = function (channelId, id) {
|
|
1188
1212
|
return __awaiter(this, void 0, void 0, function () {
|
|
1189
1213
|
var e_16;
|
|
1190
1214
|
return __generator(this, function (_a) {
|
|
@@ -1201,7 +1225,7 @@ function () {
|
|
|
1201
1225
|
|
|
1202
1226
|
return [4
|
|
1203
1227
|
/*yield*/
|
|
1204
|
-
, (0, _queries.
|
|
1228
|
+
, (0, _queries.getSubscription)(channelId, id)];
|
|
1205
1229
|
|
|
1206
1230
|
case 2:
|
|
1207
1231
|
return [2
|
|
@@ -1221,9 +1245,46 @@ function () {
|
|
|
1221
1245
|
});
|
|
1222
1246
|
};
|
|
1223
1247
|
|
|
1248
|
+
NCloudChat.prototype.getChannel = function (channelId) {
|
|
1249
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1250
|
+
var e_17;
|
|
1251
|
+
return __generator(this, function (_a) {
|
|
1252
|
+
switch (_a.label) {
|
|
1253
|
+
case 0:
|
|
1254
|
+
if (!this.isConnected()) {
|
|
1255
|
+
throw Error("You are not connected.");
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
_a.label = 1;
|
|
1259
|
+
|
|
1260
|
+
case 1:
|
|
1261
|
+
_a.trys.push([1, 3,, 4]);
|
|
1262
|
+
|
|
1263
|
+
return [4
|
|
1264
|
+
/*yield*/
|
|
1265
|
+
, (0, _queries.getChannel)(channelId)];
|
|
1266
|
+
|
|
1267
|
+
case 2:
|
|
1268
|
+
return [2
|
|
1269
|
+
/*return*/
|
|
1270
|
+
, _a.sent()];
|
|
1271
|
+
|
|
1272
|
+
case 3:
|
|
1273
|
+
e_17 = _a.sent();
|
|
1274
|
+
throw e_17;
|
|
1275
|
+
|
|
1276
|
+
case 4:
|
|
1277
|
+
return [2
|
|
1278
|
+
/*return*/
|
|
1279
|
+
, null];
|
|
1280
|
+
}
|
|
1281
|
+
});
|
|
1282
|
+
});
|
|
1283
|
+
};
|
|
1284
|
+
|
|
1224
1285
|
NCloudChat.prototype.getMessage = function (channelId, messageId) {
|
|
1225
1286
|
return __awaiter(this, void 0, void 0, function () {
|
|
1226
|
-
var entry,
|
|
1287
|
+
var entry, e_18;
|
|
1227
1288
|
return __generator(this, function (_a) {
|
|
1228
1289
|
switch (_a.label) {
|
|
1229
1290
|
case 0:
|
|
@@ -1255,8 +1316,8 @@ function () {
|
|
|
1255
1316
|
, null];
|
|
1256
1317
|
|
|
1257
1318
|
case 3:
|
|
1258
|
-
|
|
1259
|
-
throw
|
|
1319
|
+
e_18 = _a.sent();
|
|
1320
|
+
throw e_18;
|
|
1260
1321
|
|
|
1261
1322
|
case 4:
|
|
1262
1323
|
return [2
|
|
@@ -1269,7 +1330,7 @@ function () {
|
|
|
1269
1330
|
|
|
1270
1331
|
NCloudChat.prototype.getMessages = function (filter, sort, option) {
|
|
1271
1332
|
return __awaiter(this, void 0, void 0, function () {
|
|
1272
|
-
var entries, messages,
|
|
1333
|
+
var entries, messages, e_19;
|
|
1273
1334
|
|
|
1274
1335
|
var _this = this;
|
|
1275
1336
|
|
|
@@ -1308,8 +1369,8 @@ function () {
|
|
|
1308
1369
|
, entries];
|
|
1309
1370
|
|
|
1310
1371
|
case 3:
|
|
1311
|
-
|
|
1312
|
-
throw
|
|
1372
|
+
e_19 = _a.sent();
|
|
1373
|
+
throw e_19;
|
|
1313
1374
|
|
|
1314
1375
|
case 4:
|
|
1315
1376
|
return [2
|
|
@@ -1322,7 +1383,7 @@ function () {
|
|
|
1322
1383
|
|
|
1323
1384
|
NCloudChat.prototype.getSubscriptions = function (filter, sort, option) {
|
|
1324
1385
|
return __awaiter(this, void 0, void 0, function () {
|
|
1325
|
-
var entries, subscribes,
|
|
1386
|
+
var entries, subscribes, e_20;
|
|
1326
1387
|
|
|
1327
1388
|
var _this = this;
|
|
1328
1389
|
|
|
@@ -1361,8 +1422,8 @@ function () {
|
|
|
1361
1422
|
, entries];
|
|
1362
1423
|
|
|
1363
1424
|
case 3:
|
|
1364
|
-
|
|
1365
|
-
throw
|
|
1425
|
+
e_20 = _a.sent();
|
|
1426
|
+
throw e_20;
|
|
1366
1427
|
|
|
1367
1428
|
case 4:
|
|
1368
1429
|
return [2
|
|
@@ -1375,7 +1436,7 @@ function () {
|
|
|
1375
1436
|
|
|
1376
1437
|
NCloudChat.prototype.createChannel = function (channel) {
|
|
1377
1438
|
return __awaiter(this, void 0, void 0, function () {
|
|
1378
|
-
var
|
|
1439
|
+
var e_21;
|
|
1379
1440
|
return __generator(this, function (_a) {
|
|
1380
1441
|
switch (_a.label) {
|
|
1381
1442
|
case 0:
|
|
@@ -1398,8 +1459,8 @@ function () {
|
|
|
1398
1459
|
, _a.sent()];
|
|
1399
1460
|
|
|
1400
1461
|
case 3:
|
|
1401
|
-
|
|
1402
|
-
throw
|
|
1462
|
+
e_21 = _a.sent();
|
|
1463
|
+
throw e_21;
|
|
1403
1464
|
|
|
1404
1465
|
case 4:
|
|
1405
1466
|
return [2
|
|
@@ -1412,7 +1473,7 @@ function () {
|
|
|
1412
1473
|
|
|
1413
1474
|
NCloudChat.prototype.updateChannel = function (channelId, channel) {
|
|
1414
1475
|
return __awaiter(this, void 0, void 0, function () {
|
|
1415
|
-
var
|
|
1476
|
+
var e_22;
|
|
1416
1477
|
return __generator(this, function (_a) {
|
|
1417
1478
|
switch (_a.label) {
|
|
1418
1479
|
case 0:
|
|
@@ -1435,8 +1496,8 @@ function () {
|
|
|
1435
1496
|
, _a.sent()];
|
|
1436
1497
|
|
|
1437
1498
|
case 3:
|
|
1438
|
-
|
|
1439
|
-
throw
|
|
1499
|
+
e_22 = _a.sent();
|
|
1500
|
+
throw e_22;
|
|
1440
1501
|
|
|
1441
1502
|
case 4:
|
|
1442
1503
|
return [2
|
|
@@ -1449,7 +1510,7 @@ function () {
|
|
|
1449
1510
|
|
|
1450
1511
|
NCloudChat.prototype.deleteChannel = function (channelId) {
|
|
1451
1512
|
return __awaiter(this, void 0, void 0, function () {
|
|
1452
|
-
var
|
|
1513
|
+
var e_23;
|
|
1453
1514
|
return __generator(this, function (_a) {
|
|
1454
1515
|
switch (_a.label) {
|
|
1455
1516
|
case 0:
|
|
@@ -1472,8 +1533,8 @@ function () {
|
|
|
1472
1533
|
, _a.sent()];
|
|
1473
1534
|
|
|
1474
1535
|
case 3:
|
|
1475
|
-
|
|
1476
|
-
throw
|
|
1536
|
+
e_23 = _a.sent();
|
|
1537
|
+
throw e_23;
|
|
1477
1538
|
|
|
1478
1539
|
case 4:
|
|
1479
1540
|
return [2
|
|
@@ -1490,7 +1551,7 @@ function () {
|
|
|
1490
1551
|
}
|
|
1491
1552
|
|
|
1492
1553
|
return __awaiter(this, void 0, void 0, function () {
|
|
1493
|
-
var
|
|
1554
|
+
var e_24;
|
|
1494
1555
|
return __generator(this, function (_a) {
|
|
1495
1556
|
switch (_a.label) {
|
|
1496
1557
|
case 0:
|
|
@@ -1513,8 +1574,8 @@ function () {
|
|
|
1513
1574
|
, _a.sent()];
|
|
1514
1575
|
|
|
1515
1576
|
case 3:
|
|
1516
|
-
|
|
1517
|
-
throw
|
|
1577
|
+
e_24 = _a.sent();
|
|
1578
|
+
throw e_24;
|
|
1518
1579
|
|
|
1519
1580
|
case 4:
|
|
1520
1581
|
return [2
|
|
@@ -1527,7 +1588,7 @@ function () {
|
|
|
1527
1588
|
|
|
1528
1589
|
NCloudChat.prototype.addMembers = function (channelId, memberIds, options) {
|
|
1529
1590
|
return __awaiter(this, void 0, void 0, function () {
|
|
1530
|
-
var input,
|
|
1591
|
+
var input, e_25;
|
|
1531
1592
|
return __generator(this, function (_a) {
|
|
1532
1593
|
switch (_a.label) {
|
|
1533
1594
|
case 0:
|
|
@@ -1553,8 +1614,8 @@ function () {
|
|
|
1553
1614
|
, _a.sent()];
|
|
1554
1615
|
|
|
1555
1616
|
case 3:
|
|
1556
|
-
|
|
1557
|
-
throw
|
|
1617
|
+
e_25 = _a.sent();
|
|
1618
|
+
throw e_25;
|
|
1558
1619
|
|
|
1559
1620
|
case 4:
|
|
1560
1621
|
return [2
|
|
@@ -1567,7 +1628,7 @@ function () {
|
|
|
1567
1628
|
|
|
1568
1629
|
NCloudChat.prototype.removeMembers = function (channelId, memberIds, options) {
|
|
1569
1630
|
return __awaiter(this, void 0, void 0, function () {
|
|
1570
|
-
var
|
|
1631
|
+
var e_26;
|
|
1571
1632
|
return __generator(this, function (_a) {
|
|
1572
1633
|
switch (_a.label) {
|
|
1573
1634
|
case 0:
|
|
@@ -1578,27 +1639,22 @@ function () {
|
|
|
1578
1639
|
_a.label = 1;
|
|
1579
1640
|
|
|
1580
1641
|
case 1:
|
|
1581
|
-
_a.trys.push([1,
|
|
1642
|
+
_a.trys.push([1, 3,, 4]);
|
|
1582
1643
|
|
|
1583
1644
|
return [4
|
|
1584
1645
|
/*yield*/
|
|
1585
|
-
, (0, _mutations.removeChannelMembers)(channelId, memberIds
|
|
1646
|
+
, (0, _mutations.removeChannelMembers)(channelId, memberIds)];
|
|
1586
1647
|
|
|
1587
1648
|
case 2:
|
|
1588
|
-
return [4
|
|
1589
|
-
/*yield*/
|
|
1590
|
-
, _a.sent()];
|
|
1591
|
-
|
|
1592
|
-
case 3:
|
|
1593
1649
|
return [2
|
|
1594
1650
|
/*return*/
|
|
1595
1651
|
, _a.sent()];
|
|
1596
1652
|
|
|
1597
|
-
case
|
|
1598
|
-
|
|
1599
|
-
throw
|
|
1653
|
+
case 3:
|
|
1654
|
+
e_26 = _a.sent();
|
|
1655
|
+
throw e_26;
|
|
1600
1656
|
|
|
1601
|
-
case
|
|
1657
|
+
case 4:
|
|
1602
1658
|
return [2
|
|
1603
1659
|
/*return*/
|
|
1604
1660
|
];
|
|
@@ -1669,6 +1725,84 @@ function () {
|
|
|
1669
1725
|
});
|
|
1670
1726
|
};
|
|
1671
1727
|
|
|
1728
|
+
NCloudChat.prototype.banUser = function (channelId, memberId, options) {
|
|
1729
|
+
if (options === void 0) {
|
|
1730
|
+
options = {};
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1734
|
+
var e_27;
|
|
1735
|
+
return __generator(this, function (_a) {
|
|
1736
|
+
switch (_a.label) {
|
|
1737
|
+
case 0:
|
|
1738
|
+
if (!this.isConnected()) {
|
|
1739
|
+
throw Error("You are not connected.");
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
_a.label = 1;
|
|
1743
|
+
|
|
1744
|
+
case 1:
|
|
1745
|
+
_a.trys.push([1, 3,, 4]);
|
|
1746
|
+
|
|
1747
|
+
return [4
|
|
1748
|
+
/*yield*/
|
|
1749
|
+
, (0, _mutations.createMemberBlock)(channelId, memberId, (0, _stringify["default"])(options))];
|
|
1750
|
+
|
|
1751
|
+
case 2:
|
|
1752
|
+
return [2
|
|
1753
|
+
/*return*/
|
|
1754
|
+
, _a.sent()];
|
|
1755
|
+
|
|
1756
|
+
case 3:
|
|
1757
|
+
e_27 = _a.sent();
|
|
1758
|
+
throw e_27;
|
|
1759
|
+
|
|
1760
|
+
case 4:
|
|
1761
|
+
return [2
|
|
1762
|
+
/*return*/
|
|
1763
|
+
];
|
|
1764
|
+
}
|
|
1765
|
+
});
|
|
1766
|
+
});
|
|
1767
|
+
};
|
|
1768
|
+
|
|
1769
|
+
NCloudChat.prototype.unbanUser = function (channelId, memberId) {
|
|
1770
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1771
|
+
var e_28;
|
|
1772
|
+
return __generator(this, function (_a) {
|
|
1773
|
+
switch (_a.label) {
|
|
1774
|
+
case 0:
|
|
1775
|
+
if (!this.isConnected()) {
|
|
1776
|
+
throw Error("You are not connected.");
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
_a.label = 1;
|
|
1780
|
+
|
|
1781
|
+
case 1:
|
|
1782
|
+
_a.trys.push([1, 3,, 4]);
|
|
1783
|
+
|
|
1784
|
+
return [4
|
|
1785
|
+
/*yield*/
|
|
1786
|
+
, (0, _mutations.deleteMemberBlock)(channelId, memberId)];
|
|
1787
|
+
|
|
1788
|
+
case 2:
|
|
1789
|
+
return [2
|
|
1790
|
+
/*return*/
|
|
1791
|
+
, _a.sent()];
|
|
1792
|
+
|
|
1793
|
+
case 3:
|
|
1794
|
+
e_28 = _a.sent();
|
|
1795
|
+
throw e_28;
|
|
1796
|
+
|
|
1797
|
+
case 4:
|
|
1798
|
+
return [2
|
|
1799
|
+
/*return*/
|
|
1800
|
+
];
|
|
1801
|
+
}
|
|
1802
|
+
});
|
|
1803
|
+
});
|
|
1804
|
+
};
|
|
1805
|
+
|
|
1672
1806
|
return NCloudChat;
|
|
1673
1807
|
}();
|
|
1674
1808
|
|
package/lib/mutations/channel.js
CHANGED
|
@@ -22,6 +22,8 @@ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/pr
|
|
|
22
22
|
|
|
23
23
|
var _CoreManager = _interopRequireDefault(require("../CoreManager"));
|
|
24
24
|
|
|
25
|
+
var _Util = require("../Util");
|
|
26
|
+
|
|
25
27
|
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
26
28
|
function adopt(value) {
|
|
27
29
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -207,6 +209,7 @@ var createChannel = function createChannel(channel) {
|
|
|
207
209
|
}).then(function (data) {
|
|
208
210
|
if (data.errors) throw data.errors[0];
|
|
209
211
|
if (data.code) throw data;
|
|
212
|
+
if (data.data.createChannel.channel) data.data.createChannel.channel.id = (0, _Util.ObjectId)(data.data.createChannel.channel.id);
|
|
210
213
|
return data.data.createChannel.channel;
|
|
211
214
|
})];
|
|
212
215
|
|
|
@@ -264,6 +267,7 @@ var updateChannel = function updateChannel(channelId, channel) {
|
|
|
264
267
|
}).then(function (data) {
|
|
265
268
|
if (data.errors) throw data.errors[0];
|
|
266
269
|
if (data.code) throw data;
|
|
270
|
+
if (data.data.updateChannel.channel) data.data.updateChannel.channel.id = (0, _Util.ObjectId)(data.data.updateChannel.channel.id);
|
|
267
271
|
return data.data.updateChannel.channel;
|
|
268
272
|
})];
|
|
269
273
|
|
|
@@ -310,6 +314,7 @@ var deleteChannel = function deleteChannel(channelId) {
|
|
|
310
314
|
}).then(function (data) {
|
|
311
315
|
if (data.errors) throw data.errors[0];
|
|
312
316
|
if (data.code) throw data;
|
|
317
|
+
if (data.data.deleteChannel.channel) data.data.deleteChannel.channel.id = (0, _Util.ObjectId)(data.data.deleteChannel.channel.id);
|
|
313
318
|
return data.data.deleteChannel.channel;
|
|
314
319
|
})];
|
|
315
320
|
|
|
@@ -358,6 +363,7 @@ var addChannelMembers = function addChannelMembers(channelId, memberIds, options
|
|
|
358
363
|
}).then(function (data) {
|
|
359
364
|
if (data.errors) throw data.errors[0];
|
|
360
365
|
if (data.code) throw data;
|
|
366
|
+
if (data.data.addChannelMembers.channel) data.data.addChannelMembers.channel.id = (0, _Util.ObjectId)(data.data.addChannelMembers.channel.id);
|
|
361
367
|
return data.data.addChannelMembers.channel;
|
|
362
368
|
})];
|
|
363
369
|
|
|
@@ -372,7 +378,7 @@ var addChannelMembers = function addChannelMembers(channelId, memberIds, options
|
|
|
372
378
|
|
|
373
379
|
exports.addChannelMembers = addChannelMembers;
|
|
374
380
|
|
|
375
|
-
var removeChannelMembers = function removeChannelMembers(channelId, memberIds
|
|
381
|
+
var removeChannelMembers = function removeChannelMembers(channelId, memberIds) {
|
|
376
382
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
377
383
|
var token, projectId, endpoint, query;
|
|
378
384
|
return __generator(this, function (_a) {
|
|
@@ -397,8 +403,7 @@ var removeChannelMembers = function removeChannelMembers(channelId, memberIds, o
|
|
|
397
403
|
variables: {
|
|
398
404
|
projectId: projectId,
|
|
399
405
|
channelId: channelId,
|
|
400
|
-
memberIds: memberIds
|
|
401
|
-
options: options
|
|
406
|
+
memberIds: memberIds
|
|
402
407
|
}
|
|
403
408
|
})
|
|
404
409
|
}).then(function (res) {
|
|
@@ -406,6 +411,7 @@ var removeChannelMembers = function removeChannelMembers(channelId, memberIds, o
|
|
|
406
411
|
}).then(function (data) {
|
|
407
412
|
if (data.errors) throw data.errors[0];
|
|
408
413
|
if (data.code) throw data;
|
|
414
|
+
if (data.data.removeChannelMembers.channel) data.data.removeChannelMembers.channel.id = (0, _Util.ObjectId)(data.data.removeChannelMembers.channel.id);
|
|
409
415
|
return data.data.removeChannelMembers.channel;
|
|
410
416
|
})];
|
|
411
417
|
|
package/lib/mutations/index.js
CHANGED
|
@@ -10,15 +10,15 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
10
10
|
value: true
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _member = require("./member");
|
|
14
14
|
|
|
15
|
-
_Object$keys(
|
|
15
|
+
_Object$keys(_member).forEach(function (key) {
|
|
16
16
|
if (key === "default" || key === "__esModule") return;
|
|
17
17
|
|
|
18
18
|
_Object$defineProperty(exports, key, {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function get() {
|
|
21
|
-
return
|
|
21
|
+
return _member[key];
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
});
|