ncloudchat 1.0.23 → 1.0.31
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/LICENSE.md +1 -1
- package/deploy.sh +1 -1
- package/esm/CloudChat.d.ts +434 -10
- package/esm/CloudChat.js +975 -302
- package/esm/CloudChat.js.map +1 -1
- package/esm/CoreManager.d.ts +6 -0
- package/esm/CoreManager.js +13 -4
- package/esm/CoreManager.js.map +1 -1
- package/esm/Dispatcher.d.ts +16 -0
- package/esm/Dispatcher.js +19 -4
- package/esm/Dispatcher.js.map +1 -1
- package/esm/Network.d.ts +7 -0
- package/esm/Network.js +93 -0
- package/esm/Network.js.map +1 -0
- package/esm/Type.d.ts +43 -0
- package/esm/Type.js +16 -0
- package/esm/Type.js.map +1 -1
- package/esm/Util.d.ts +13 -0
- package/esm/Util.js +13 -0
- package/esm/Util.js.map +1 -1
- package/esm/graphql/channel.d.ts +13 -0
- package/esm/graphql/channel.js +16 -0
- package/esm/graphql/channel.js.map +1 -0
- package/esm/graphql/friend.d.ts +11 -0
- package/esm/graphql/friend.js +13 -0
- package/esm/graphql/friend.js.map +1 -0
- package/esm/graphql/invite.d.ts +7 -0
- package/esm/graphql/invite.js +8 -0
- package/esm/graphql/invite.js.map +1 -0
- package/esm/graphql/member.d.ts +11 -0
- package/esm/graphql/member.js +13 -0
- package/esm/graphql/member.js.map +1 -0
- package/esm/graphql/message.d.ts +11 -0
- package/esm/graphql/message.js +13 -0
- package/esm/graphql/message.js.map +1 -0
- package/esm/graphql/pin.d.ts +10 -0
- package/esm/graphql/pin.js +12 -0
- package/esm/graphql/pin.js.map +1 -0
- package/esm/graphql/project.d.ts +7 -0
- package/esm/graphql/project.js +8 -0
- package/esm/graphql/project.js.map +1 -0
- package/esm/graphql/subscription.d.ts +11 -0
- package/esm/graphql/subscription.js +13 -0
- package/esm/graphql/subscription.js.map +1 -0
- package/esm/index.d.ts +6 -0
- package/esm/index.js +6 -0
- package/esm/index.js.map +1 -1
- package/esm/logger.d.ts +9 -3
- package/esm/logger.js +6 -0
- package/esm/logger.js.map +1 -1
- package/esm/mutations/channel.d.ts +50 -0
- package/esm/mutations/channel.js +97 -187
- package/esm/mutations/channel.js.map +1 -1
- package/esm/mutations/friend.d.ts +38 -0
- package/esm/mutations/friend.js +57 -119
- package/esm/mutations/friend.js.map +1 -1
- package/esm/mutations/index.d.ts +5 -3
- package/esm/mutations/index.js +5 -3
- package/esm/mutations/index.js.map +1 -1
- package/esm/mutations/invite.d.ts +15 -0
- package/esm/mutations/invite.js +23 -32
- package/esm/mutations/invite.js.map +1 -1
- package/esm/mutations/member.d.ts +39 -2
- package/esm/mutations/member.js +64 -111
- package/esm/mutations/member.js.map +1 -1
- package/esm/mutations/message.d.ts +35 -0
- package/esm/mutations/message.js +66 -45
- package/esm/mutations/message.js.map +1 -1
- package/esm/mutations/pin.d.ts +28 -0
- package/esm/mutations/pin.js +88 -0
- package/esm/mutations/pin.js.map +1 -0
- package/esm/mutations/subscription.d.ts +33 -1
- package/esm/mutations/subscription.js +51 -93
- package/esm/mutations/subscription.js.map +1 -1
- package/esm/queries/channel.d.ts +24 -0
- package/esm/queries/channel.js +37 -79
- package/esm/queries/channel.js.map +1 -1
- package/esm/queries/friend.d.ts +16 -0
- package/esm/queries/friend.js +25 -40
- package/esm/queries/friend.js.map +1 -1
- package/esm/queries/index.d.ts +7 -0
- package/esm/queries/index.js +7 -0
- package/esm/queries/index.js.map +1 -1
- package/esm/queries/member.d.ts +16 -0
- package/esm/queries/member.js +25 -40
- package/esm/queries/member.js.map +1 -1
- package/esm/queries/memberblocks.d.ts +16 -0
- package/esm/queries/memberblocks.js +25 -40
- package/esm/queries/memberblocks.js.map +1 -1
- package/esm/queries/message.d.ts +33 -0
- package/esm/queries/message.js +50 -111
- package/esm/queries/message.js.map +1 -1
- package/esm/queries/pin.d.ts +28 -0
- package/esm/queries/pin.js +92 -0
- package/esm/queries/pin.js.map +1 -0
- package/esm/queries/project.d.ts +13 -0
- package/esm/queries/project.js +20 -32
- package/esm/queries/project.js.map +1 -1
- package/esm/queries/subscription.d.ts +25 -0
- package/esm/queries/subscription.js +39 -76
- package/esm/queries/subscription.js.map +1 -1
- package/lib/CloudChat.js +1211 -363
- package/lib/CoreManager.js +13 -3
- package/lib/Dispatcher.js +25 -9
- package/lib/Network.js +226 -0
- package/lib/Type.js +19 -0
- package/lib/Util.js +15 -1
- package/lib/graphql/channel.js +32 -0
- package/lib/graphql/friend.js +27 -0
- package/lib/graphql/invite.js +18 -0
- package/lib/graphql/member.js +27 -0
- package/lib/graphql/message.js +27 -0
- package/lib/graphql/pin.js +25 -0
- package/lib/graphql/project.js +18 -0
- package/lib/graphql/subscription.js +27 -0
- package/lib/index.js +2 -2
- package/lib/logger.js +6 -0
- package/lib/mutations/channel.js +105 -178
- package/lib/mutations/friend.js +62 -115
- package/lib/mutations/index.js +23 -3
- package/lib/mutations/invite.js +27 -33
- package/lib/mutations/member.js +73 -100
- package/lib/mutations/message.js +86 -48
- package/lib/mutations/pin.js +229 -0
- package/lib/mutations/subscription.js +56 -95
- package/lib/queries/channel.js +40 -84
- package/lib/queries/friend.js +29 -45
- package/lib/queries/index.js +24 -3
- package/lib/queries/member.js +29 -45
- package/lib/queries/memberblocks.js +28 -44
- package/lib/queries/message.js +56 -109
- package/lib/queries/pin.js +243 -0
- package/lib/queries/project.js +24 -41
- package/lib/queries/subscription.js +42 -78
- package/package.json +19 -45
- package/tsconfig.json +1 -0
- package//353/260/260/355/217/254/354/210/234/354/204/234.md +8 -0
- package/package copy.json +0 -74
package/lib/CloudChat.js
CHANGED
|
@@ -1,32 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
6
4
|
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
exports["default"] = void 0;
|
|
12
12
|
|
|
13
|
-
require("core-js/modules/es6.
|
|
13
|
+
require("core-js/modules/es6.regexp.replace.js");
|
|
14
14
|
|
|
15
|
-
require("core-js/modules/es6.
|
|
15
|
+
require("core-js/modules/es6.array.slice.js");
|
|
16
16
|
|
|
17
|
-
require("core-js/modules/es6.function.
|
|
17
|
+
require("core-js/modules/es6.function.name.js");
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
require("core-js/modules/es6.function.bind.js");
|
|
20
20
|
|
|
21
|
-
require("core-js/modules/es6.
|
|
21
|
+
require("core-js/modules/es6.regexp.split.js");
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
require("core-js/modules/es6.array.map.js");
|
|
24
24
|
|
|
25
|
-
var
|
|
25
|
+
var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
|
|
26
26
|
|
|
27
27
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _symbol = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/symbol"));
|
|
30
|
+
|
|
31
|
+
var _iterator = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/symbol/iterator"));
|
|
32
|
+
|
|
33
|
+
var _entries = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/entries"));
|
|
34
|
+
|
|
35
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
30
36
|
|
|
31
37
|
var _socket = require("socket.io-client");
|
|
32
38
|
|
|
@@ -40,6 +46,12 @@ var _queries = require("./queries");
|
|
|
40
46
|
|
|
41
47
|
var _mutations = require("./mutations");
|
|
42
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Copyright (c) NBASE CORP. and its affiliates.
|
|
51
|
+
*
|
|
52
|
+
* This source code is licensed under the MIT license found in the
|
|
53
|
+
* LICENSE file in the root directory of this source tree.
|
|
54
|
+
*/
|
|
43
55
|
var __assign = void 0 && (void 0).__assign || function () {
|
|
44
56
|
__assign = _assign["default"] || function (t) {
|
|
45
57
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -199,26 +211,86 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
|
|
199
211
|
}
|
|
200
212
|
};
|
|
201
213
|
|
|
214
|
+
var __values = void 0 && (void 0).__values || function (o) {
|
|
215
|
+
var s = typeof _symbol["default"] === "function" && _iterator["default"],
|
|
216
|
+
m = s && o[s],
|
|
217
|
+
i = 0;
|
|
218
|
+
if (m) return m.call(o);
|
|
219
|
+
if (o && typeof o.length === "number") return {
|
|
220
|
+
next: function next() {
|
|
221
|
+
if (o && i >= o.length) o = void 0;
|
|
222
|
+
return {
|
|
223
|
+
value: o && o[i++],
|
|
224
|
+
done: !o
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
var __read = void 0 && (void 0).__read || function (o, n) {
|
|
232
|
+
var m = typeof _symbol["default"] === "function" && o[_iterator["default"]];
|
|
233
|
+
if (!m) return o;
|
|
234
|
+
var i = m.call(o),
|
|
235
|
+
r,
|
|
236
|
+
ar = [],
|
|
237
|
+
e;
|
|
238
|
+
|
|
239
|
+
try {
|
|
240
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
241
|
+
ar.push(r.value);
|
|
242
|
+
}
|
|
243
|
+
} catch (error) {
|
|
244
|
+
e = {
|
|
245
|
+
error: error
|
|
246
|
+
};
|
|
247
|
+
} finally {
|
|
248
|
+
try {
|
|
249
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
250
|
+
} finally {
|
|
251
|
+
if (e) throw e.error;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return ar;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Class NCloudChat holds all the NCloudChat functionalities.
|
|
260
|
+
*
|
|
261
|
+
* @class
|
|
262
|
+
*/
|
|
202
263
|
var NCloudChat =
|
|
203
264
|
/** @class */
|
|
204
265
|
function () {
|
|
205
|
-
|
|
266
|
+
/**
|
|
267
|
+
* Create a `NCloudChat` instance and a Dispatcher.
|
|
268
|
+
*
|
|
269
|
+
* @constructs
|
|
270
|
+
*/
|
|
271
|
+
function NCloudChat(debug) {
|
|
272
|
+
if (debug === void 0) {
|
|
273
|
+
debug = false;
|
|
274
|
+
}
|
|
275
|
+
|
|
206
276
|
this.socket = null;
|
|
207
277
|
this.connected = false;
|
|
208
278
|
this.connectedCount = 0;
|
|
209
279
|
this.dp = new _Dispatcher["default"]();
|
|
280
|
+
if (!debug) console.log = function () {};
|
|
210
281
|
}
|
|
211
282
|
|
|
212
283
|
NCloudChat.prototype.clear = function () {};
|
|
284
|
+
/**
|
|
285
|
+
* Initialize a new `NCloudChat` instance of project and user.
|
|
286
|
+
*
|
|
287
|
+
* @function initialize
|
|
288
|
+
* @param {string} projectId - The id of a project.
|
|
289
|
+
*/
|
|
213
290
|
|
|
214
|
-
NCloudChat.prototype.initialize = function (projectId) {
|
|
215
|
-
_CoreManager["default"].set("PROJECT_ID", projectId);
|
|
216
291
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
name: "",
|
|
220
|
-
image: ""
|
|
221
|
-
});
|
|
292
|
+
NCloudChat.prototype.initialize = function (projectId) {
|
|
293
|
+
this.setProjectId(projectId);
|
|
222
294
|
};
|
|
223
295
|
|
|
224
296
|
NCloudChat.prototype.getLang = function () {
|
|
@@ -229,13 +301,17 @@ function () {
|
|
|
229
301
|
return _CoreManager["default"].get("USER");
|
|
230
302
|
};
|
|
231
303
|
|
|
304
|
+
NCloudChat.prototype.getProjectId = function () {
|
|
305
|
+
return _CoreManager["default"].get("PROJECT_ID");
|
|
306
|
+
};
|
|
307
|
+
|
|
232
308
|
NCloudChat.prototype.setServerUrl = function (url) {
|
|
233
309
|
if (!/^[hHtTpP]{4}(s)?(:\/\/)[a-zA-Z0-9\.\/-:]+/.test(url)) {
|
|
234
310
|
throw Error("invalied url : (ex)http://domain.com, https://domain.com");
|
|
235
311
|
return;
|
|
236
312
|
}
|
|
237
313
|
|
|
238
|
-
if (url.length > 1 && url.substring(url.length - 1) ===
|
|
314
|
+
if (url.length > 1 && url.substring(url.length - 1) === "/") {
|
|
239
315
|
url = url.substring(0, url.length - 1);
|
|
240
316
|
}
|
|
241
317
|
|
|
@@ -258,13 +334,52 @@ function () {
|
|
|
258
334
|
_CoreManager["default"].set("USER", user);
|
|
259
335
|
};
|
|
260
336
|
|
|
337
|
+
NCloudChat.prototype.inputValidation = function (inputs) {
|
|
338
|
+
var e_1, _a;
|
|
339
|
+
|
|
340
|
+
if (!this.isConnected()) throw Error("You are not connected.");
|
|
341
|
+
|
|
342
|
+
try {
|
|
343
|
+
for (var _b = __values((0, _entries["default"])(inputs)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
344
|
+
var _d = __read(_c.value, 2),
|
|
345
|
+
key = _d[0],
|
|
346
|
+
value = _d[1];
|
|
347
|
+
|
|
348
|
+
if (!value) {
|
|
349
|
+
var result = key.replace(/([A-Z])/g, " $1");
|
|
350
|
+
var word = result.charAt(0).toUpperCase() + result.slice(1);
|
|
351
|
+
throw Error("You need a(n) ".concat(word, "."));
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
} catch (e_1_1) {
|
|
355
|
+
e_1 = {
|
|
356
|
+
error: e_1_1
|
|
357
|
+
};
|
|
358
|
+
} finally {
|
|
359
|
+
try {
|
|
360
|
+
if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
|
|
361
|
+
} finally {
|
|
362
|
+
if (e_1) throw e_1.error;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* Create a connection between a socket and a client.
|
|
368
|
+
*
|
|
369
|
+
* @async connect
|
|
370
|
+
* @param {any} user
|
|
371
|
+
* @param {string} userToken
|
|
372
|
+
* @returns
|
|
373
|
+
*/
|
|
374
|
+
|
|
375
|
+
|
|
261
376
|
NCloudChat.prototype.connect = function (user, userToken) {
|
|
262
377
|
if (userToken === void 0) {
|
|
263
378
|
userToken = "";
|
|
264
379
|
}
|
|
265
380
|
|
|
266
381
|
return __awaiter(this, void 0, void 0, function () {
|
|
267
|
-
var url,
|
|
382
|
+
var url, image, name, lang, customField, response, e_2, options;
|
|
268
383
|
|
|
269
384
|
var _this = this;
|
|
270
385
|
|
|
@@ -284,22 +399,13 @@ function () {
|
|
|
284
399
|
_a.label = 2;
|
|
285
400
|
|
|
286
401
|
case 2:
|
|
287
|
-
url = _CoreManager["default"].get("SOCKET_URL") +
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
if (!project_id) {
|
|
291
|
-
throw Error("Project ID not found");
|
|
292
|
-
} // const user = CoreManager.get("USER");
|
|
293
|
-
// if (!user.id && user.id) user_id = user.id;
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
if (!user.id) {
|
|
297
|
-
throw Error("UserID not found");
|
|
298
|
-
}
|
|
299
|
-
|
|
402
|
+
url = _CoreManager["default"].get("SOCKET_URL") + "/cloudchat";
|
|
403
|
+
if (!this.getProjectId()) throw Error("Project ID not found");
|
|
404
|
+
if (!user.id) throw Error("UserID not found");
|
|
300
405
|
image = user.profile;
|
|
301
406
|
name = user.name;
|
|
302
407
|
lang = this.getLang();
|
|
408
|
+
customField = user.customField;
|
|
303
409
|
_a.label = 3;
|
|
304
410
|
|
|
305
411
|
case 3:
|
|
@@ -307,23 +413,27 @@ function () {
|
|
|
307
413
|
|
|
308
414
|
return [4
|
|
309
415
|
/*yield*/
|
|
310
|
-
, (0, _mutations.login)(user.id, name, image, userToken)];
|
|
416
|
+
, (0, _mutations.login)(user.id, name, image, userToken, customField)];
|
|
311
417
|
|
|
312
418
|
case 4:
|
|
313
|
-
|
|
419
|
+
response = _a.sent();
|
|
420
|
+
this.setUser({
|
|
421
|
+
id: user.id,
|
|
422
|
+
name: name,
|
|
423
|
+
image: image,
|
|
424
|
+
customField: customField
|
|
425
|
+
});
|
|
426
|
+
userToken = response["token"]; // parse token object
|
|
427
|
+
|
|
314
428
|
return [3
|
|
315
429
|
/*break*/
|
|
316
430
|
, 6];
|
|
317
431
|
|
|
318
432
|
case 5:
|
|
319
|
-
|
|
320
|
-
throw
|
|
433
|
+
e_2 = _a.sent();
|
|
434
|
+
throw e_2;
|
|
321
435
|
|
|
322
436
|
case 6:
|
|
323
|
-
if (!userToken) {
|
|
324
|
-
throw Error("Token is not found");
|
|
325
|
-
}
|
|
326
|
-
|
|
327
437
|
_CoreManager["default"].set("TOKEN", userToken);
|
|
328
438
|
|
|
329
439
|
options = {
|
|
@@ -334,11 +444,12 @@ function () {
|
|
|
334
444
|
reconnectionDelayMax: 2000 * 100,
|
|
335
445
|
randomizationFactor: 0.5,
|
|
336
446
|
query: {
|
|
337
|
-
project_id:
|
|
447
|
+
project_id: this.getProjectId(),
|
|
338
448
|
user_id: user.id,
|
|
339
449
|
lang: lang,
|
|
340
450
|
image: image,
|
|
341
451
|
name: name,
|
|
452
|
+
customField: customField,
|
|
342
453
|
token: userToken
|
|
343
454
|
}
|
|
344
455
|
};
|
|
@@ -346,14 +457,14 @@ function () {
|
|
|
346
457
|
this.socket.on("connect", function (data) {
|
|
347
458
|
_this.connectedCount++;
|
|
348
459
|
_this.connected = true;
|
|
349
|
-
(0, _logger.info)("Connected to "
|
|
460
|
+
(0, _logger.info)("Connected to ".concat(url, " with id: ").concat(_this.socket.id));
|
|
350
461
|
|
|
351
462
|
_this.dp.dispatch("onConnected", data);
|
|
352
463
|
});
|
|
353
464
|
this.socket.on("unauthorized", function (data) {});
|
|
354
465
|
this.socket.on("disconnect", function (reason) {
|
|
355
466
|
_this.connected = false;
|
|
356
|
-
(0, _logger.info)("Disconnected to "
|
|
467
|
+
(0, _logger.info)("Disconnected to ".concat(url, " with id: ").concat(_this.socket.id));
|
|
357
468
|
|
|
358
469
|
_this.dp.dispatch("onDisconnected", reason);
|
|
359
470
|
});
|
|
@@ -377,15 +488,15 @@ function () {
|
|
|
377
488
|
|
|
378
489
|
_this.dp.dispatch("onStopTyping", data);
|
|
379
490
|
});
|
|
380
|
-
this.socket.on("member
|
|
491
|
+
this.socket.on("member joined", function (payload) {
|
|
381
492
|
var data = JSON.parse(payload);
|
|
382
493
|
|
|
383
|
-
_this.dp.dispatch("
|
|
494
|
+
_this.dp.dispatch("onMemberJoined", data);
|
|
384
495
|
});
|
|
385
|
-
this.socket.on("member
|
|
496
|
+
this.socket.on("member leaved", function (payload) {
|
|
386
497
|
var data = JSON.parse(payload);
|
|
387
498
|
|
|
388
|
-
_this.dp.dispatch("
|
|
499
|
+
_this.dp.dispatch("onMemberLeaved", data);
|
|
389
500
|
});
|
|
390
501
|
this.socket.on("member updated", function (payload) {
|
|
391
502
|
var data = JSON.parse(payload);
|
|
@@ -434,17 +545,25 @@ function () {
|
|
|
434
545
|
});
|
|
435
546
|
});
|
|
436
547
|
};
|
|
548
|
+
/**
|
|
549
|
+
* Mute channel notifications.
|
|
550
|
+
*
|
|
551
|
+
* @async
|
|
552
|
+
* @function mute
|
|
553
|
+
* @param {string} channel
|
|
554
|
+
* @returns {Promise<any>}
|
|
555
|
+
*/
|
|
556
|
+
|
|
437
557
|
|
|
438
558
|
NCloudChat.prototype.mute = function (channel) {
|
|
439
559
|
return __awaiter(this, void 0, void 0, function () {
|
|
440
|
-
var subscription,
|
|
560
|
+
var subscription, e_3;
|
|
441
561
|
return __generator(this, function (_a) {
|
|
442
562
|
switch (_a.label) {
|
|
443
563
|
case 0:
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
|
|
564
|
+
this.inputValidation({
|
|
565
|
+
channelId: channel
|
|
566
|
+
});
|
|
448
567
|
_a.label = 1;
|
|
449
568
|
|
|
450
569
|
case 1:
|
|
@@ -458,34 +577,42 @@ function () {
|
|
|
458
577
|
|
|
459
578
|
case 2:
|
|
460
579
|
subscription = _a.sent();
|
|
461
|
-
if (subscription) subscription
|
|
580
|
+
if (subscription["subscription"]) subscription["subscription"]["id"] = this.ObjectId(subscription["subscription"]["id"]);
|
|
462
581
|
return [2
|
|
463
582
|
/*return*/
|
|
464
|
-
, subscription];
|
|
583
|
+
, subscription["subscription"]];
|
|
465
584
|
|
|
466
585
|
case 3:
|
|
467
|
-
|
|
468
|
-
throw
|
|
586
|
+
e_3 = _a.sent();
|
|
587
|
+
throw e_3;
|
|
469
588
|
|
|
470
589
|
case 4:
|
|
471
590
|
return [2
|
|
472
591
|
/*return*/
|
|
473
|
-
|
|
592
|
+
];
|
|
474
593
|
}
|
|
475
594
|
});
|
|
476
595
|
});
|
|
477
596
|
};
|
|
597
|
+
/**
|
|
598
|
+
* Unmute channel notifications.
|
|
599
|
+
*
|
|
600
|
+
* @async
|
|
601
|
+
* @function unmute
|
|
602
|
+
* @param {string} channel
|
|
603
|
+
* @returns {Promise<any>}
|
|
604
|
+
*/
|
|
605
|
+
|
|
478
606
|
|
|
479
607
|
NCloudChat.prototype.unmute = function (channel) {
|
|
480
608
|
return __awaiter(this, void 0, void 0, function () {
|
|
481
|
-
var subscription,
|
|
609
|
+
var subscription, e_4;
|
|
482
610
|
return __generator(this, function (_a) {
|
|
483
611
|
switch (_a.label) {
|
|
484
612
|
case 0:
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}
|
|
488
|
-
|
|
613
|
+
this.inputValidation({
|
|
614
|
+
channelId: channel
|
|
615
|
+
});
|
|
489
616
|
_a.label = 1;
|
|
490
617
|
|
|
491
618
|
case 1:
|
|
@@ -499,23 +626,33 @@ function () {
|
|
|
499
626
|
|
|
500
627
|
case 2:
|
|
501
628
|
subscription = _a.sent();
|
|
502
|
-
if (subscription) subscription
|
|
629
|
+
if (subscription["subscription"]) subscription["subscription"]["id"] = this.ObjectId(subscription["subscription"]["id"]);
|
|
503
630
|
return [2
|
|
504
631
|
/*return*/
|
|
505
|
-
, subscription];
|
|
632
|
+
, subscription["subscription"]];
|
|
506
633
|
|
|
507
634
|
case 3:
|
|
508
|
-
|
|
509
|
-
throw
|
|
635
|
+
e_4 = _a.sent();
|
|
636
|
+
throw e_4;
|
|
510
637
|
|
|
511
638
|
case 4:
|
|
512
639
|
return [2
|
|
513
640
|
/*return*/
|
|
514
|
-
|
|
641
|
+
];
|
|
515
642
|
}
|
|
516
643
|
});
|
|
517
644
|
});
|
|
518
645
|
};
|
|
646
|
+
/**
|
|
647
|
+
* Subscribe a channel.
|
|
648
|
+
*
|
|
649
|
+
* @async
|
|
650
|
+
* @function subscibe
|
|
651
|
+
* @param {string} channel - The id of a channel.
|
|
652
|
+
* @param {any} option
|
|
653
|
+
* @returns
|
|
654
|
+
*/
|
|
655
|
+
|
|
519
656
|
|
|
520
657
|
NCloudChat.prototype.subscribe = function (channel, option) {
|
|
521
658
|
if (option === void 0) {
|
|
@@ -523,14 +660,13 @@ function () {
|
|
|
523
660
|
}
|
|
524
661
|
|
|
525
662
|
return __awaiter(this, void 0, void 0, function () {
|
|
526
|
-
var subscription,
|
|
663
|
+
var subscription, e_5;
|
|
527
664
|
return __generator(this, function (_a) {
|
|
528
665
|
switch (_a.label) {
|
|
529
666
|
case 0:
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}
|
|
533
|
-
|
|
667
|
+
this.inputValidation({
|
|
668
|
+
channelId: channel
|
|
669
|
+
});
|
|
534
670
|
_a.label = 1;
|
|
535
671
|
|
|
536
672
|
case 1:
|
|
@@ -542,34 +678,42 @@ function () {
|
|
|
542
678
|
|
|
543
679
|
case 2:
|
|
544
680
|
subscription = _a.sent();
|
|
545
|
-
if (subscription) subscription
|
|
681
|
+
if (subscription["subscription"]) subscription["subscription"]["id"] = this.ObjectId(subscription["subscription"]["id"]);
|
|
546
682
|
return [2
|
|
547
683
|
/*return*/
|
|
548
|
-
, subscription];
|
|
684
|
+
, subscription["subscription"]];
|
|
549
685
|
|
|
550
686
|
case 3:
|
|
551
|
-
|
|
552
|
-
throw
|
|
687
|
+
e_5 = _a.sent();
|
|
688
|
+
throw e_5;
|
|
553
689
|
|
|
554
690
|
case 4:
|
|
555
691
|
return [2
|
|
556
692
|
/*return*/
|
|
557
|
-
|
|
693
|
+
];
|
|
558
694
|
}
|
|
559
695
|
});
|
|
560
696
|
});
|
|
561
697
|
};
|
|
698
|
+
/**
|
|
699
|
+
* Unsubscribe from a channel.
|
|
700
|
+
*
|
|
701
|
+
* @async
|
|
702
|
+
* @function unsubscribe
|
|
703
|
+
* @param {string} channel - The id of a chennel
|
|
704
|
+
* @returns {Promise<any>}
|
|
705
|
+
*/
|
|
706
|
+
|
|
562
707
|
|
|
563
708
|
NCloudChat.prototype.unsubscribe = function (channel) {
|
|
564
709
|
return __awaiter(this, void 0, void 0, function () {
|
|
565
|
-
var subscription,
|
|
710
|
+
var subscription, e_6;
|
|
566
711
|
return __generator(this, function (_a) {
|
|
567
712
|
switch (_a.label) {
|
|
568
713
|
case 0:
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}
|
|
572
|
-
|
|
714
|
+
this.inputValidation({
|
|
715
|
+
channelId: channel
|
|
716
|
+
});
|
|
573
717
|
_a.label = 1;
|
|
574
718
|
|
|
575
719
|
case 1:
|
|
@@ -581,39 +725,52 @@ function () {
|
|
|
581
725
|
|
|
582
726
|
case 2:
|
|
583
727
|
subscription = _a.sent();
|
|
728
|
+
if (subscription["subscription"]) subscription["subscription"]["id"] = this.ObjectId(subscription["subscription"]["id"]);
|
|
584
729
|
return [2
|
|
585
730
|
/*return*/
|
|
586
|
-
, subscription];
|
|
731
|
+
, subscription["subscription"]];
|
|
587
732
|
|
|
588
733
|
case 3:
|
|
589
|
-
|
|
590
|
-
throw
|
|
734
|
+
e_6 = _a.sent();
|
|
735
|
+
throw e_6;
|
|
591
736
|
|
|
592
737
|
case 4:
|
|
593
738
|
return [2
|
|
594
739
|
/*return*/
|
|
595
|
-
|
|
740
|
+
];
|
|
596
741
|
}
|
|
597
742
|
});
|
|
598
743
|
});
|
|
599
744
|
};
|
|
745
|
+
/**
|
|
746
|
+
* Translate a message from a souce language to a target language.
|
|
747
|
+
*
|
|
748
|
+
* @async
|
|
749
|
+
* @function translateMessage
|
|
750
|
+
* @param {string} channelId - The id of a channel.
|
|
751
|
+
* @param {string} source - A source language.
|
|
752
|
+
* @param {string} target - A target language.
|
|
753
|
+
* @param {string} message - An message to be translated.
|
|
754
|
+
* @returns {Promise<any>}
|
|
755
|
+
*/
|
|
756
|
+
|
|
600
757
|
|
|
601
758
|
NCloudChat.prototype.translateMessage = function (channelId, source, target, message) {
|
|
602
759
|
return __awaiter(this, void 0, void 0, function () {
|
|
603
|
-
var
|
|
760
|
+
var result, e_7;
|
|
604
761
|
return __generator(this, function (_a) {
|
|
605
762
|
switch (_a.label) {
|
|
606
763
|
case 0:
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
764
|
+
this.inputValidation({
|
|
765
|
+
channelId: channelId,
|
|
766
|
+
sourceLanguage: source,
|
|
767
|
+
targetLanguage: target
|
|
768
|
+
});
|
|
611
769
|
_a.label = 1;
|
|
612
770
|
|
|
613
771
|
case 1:
|
|
614
772
|
_a.trys.push([1, 3,, 4]);
|
|
615
773
|
|
|
616
|
-
user = _CoreManager["default"].get("USER");
|
|
617
774
|
return [4
|
|
618
775
|
/*yield*/
|
|
619
776
|
, (0, _mutations.translate)(channelId, source, target, message)];
|
|
@@ -622,55 +779,114 @@ function () {
|
|
|
622
779
|
result = _a.sent();
|
|
623
780
|
return [2
|
|
624
781
|
/*return*/
|
|
625
|
-
, result];
|
|
782
|
+
, result["translation"]];
|
|
626
783
|
|
|
627
784
|
case 3:
|
|
628
|
-
|
|
629
|
-
|
|
785
|
+
e_7 = _a.sent();
|
|
786
|
+
|
|
787
|
+
if (e_7 instanceof Error) {
|
|
788
|
+
throw Error(e_7.message);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
return [3
|
|
792
|
+
/*break*/
|
|
793
|
+
, 4];
|
|
630
794
|
|
|
631
795
|
case 4:
|
|
632
796
|
return [2
|
|
633
797
|
/*return*/
|
|
634
|
-
|
|
798
|
+
];
|
|
635
799
|
}
|
|
636
800
|
});
|
|
637
801
|
});
|
|
638
802
|
};
|
|
803
|
+
/**
|
|
804
|
+
* Send a message to a channel.
|
|
805
|
+
*
|
|
806
|
+
* @async
|
|
807
|
+
* @function sendMessage
|
|
808
|
+
* @param {string} channel - The id of a channel.
|
|
809
|
+
* @param {any} opt
|
|
810
|
+
* @returns {Promise<any>}
|
|
811
|
+
*/
|
|
812
|
+
|
|
639
813
|
|
|
640
814
|
NCloudChat.prototype.sendMessage = function (channel, opt) {
|
|
641
815
|
return __awaiter(this, void 0, void 0, function () {
|
|
642
|
-
var
|
|
816
|
+
var data, result, e_8;
|
|
643
817
|
return __generator(this, function (_a) {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
818
|
+
switch (_a.label) {
|
|
819
|
+
case 0:
|
|
820
|
+
this.inputValidation({
|
|
821
|
+
channelId: channel,
|
|
822
|
+
message: opt.message
|
|
823
|
+
});
|
|
824
|
+
if (!opt.type) opt.type = "text";
|
|
825
|
+
_a.label = 1;
|
|
647
826
|
|
|
827
|
+
case 1:
|
|
828
|
+
_a.trys.push([1, 3,, 4]);
|
|
648
829
|
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
830
|
+
data = __assign({
|
|
831
|
+
channelId: channel
|
|
832
|
+
}, opt);
|
|
833
|
+
return [4
|
|
834
|
+
/*yield*/
|
|
835
|
+
, (0, _mutations.message)(data)];
|
|
652
836
|
|
|
653
|
-
|
|
837
|
+
case 2:
|
|
838
|
+
result = _a.sent();
|
|
839
|
+
return [2
|
|
840
|
+
/*return*/
|
|
841
|
+
, result["message"]];
|
|
654
842
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
843
|
+
case 3:
|
|
844
|
+
e_8 = _a.sent();
|
|
845
|
+
throw e_8;
|
|
658
846
|
|
|
847
|
+
case 4:
|
|
848
|
+
return [2
|
|
849
|
+
/*return*/
|
|
850
|
+
];
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
});
|
|
854
|
+
};
|
|
855
|
+
/**
|
|
856
|
+
* Send an express message to a channel.
|
|
857
|
+
*
|
|
858
|
+
* @async
|
|
859
|
+
* @function sendExpressMessage
|
|
860
|
+
* @param {string} channel - The id of a channel.
|
|
861
|
+
* @param {any} opt
|
|
862
|
+
* @returns {Promise<any>}
|
|
863
|
+
*/
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
NCloudChat.prototype.sendExpressMessage = function (channel, opt) {
|
|
867
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
868
|
+
var user, data;
|
|
869
|
+
return __generator(this, function (_a) {
|
|
870
|
+
if (!this.isConnected()) throw Error("You are not connected.");
|
|
871
|
+
this.inputValidation({
|
|
872
|
+
channelId: channel,
|
|
873
|
+
message: opt.message
|
|
874
|
+
});
|
|
875
|
+
if (!opt.type) opt.type = "text";
|
|
659
876
|
user = _CoreManager["default"].get("USER");
|
|
877
|
+
if (!user) throw Error('user is null');
|
|
660
878
|
|
|
661
879
|
try {
|
|
662
880
|
data = __assign({
|
|
663
881
|
channelId: channel,
|
|
664
882
|
user: user
|
|
665
883
|
}, opt);
|
|
666
|
-
this.socket.emit("message", data);
|
|
884
|
+
this.socket.emit("express message", data);
|
|
667
885
|
return [2
|
|
668
886
|
/*return*/
|
|
669
887
|
, data];
|
|
670
888
|
} catch (e) {
|
|
671
|
-
|
|
672
|
-
/*return*/
|
|
673
|
-
, false];
|
|
889
|
+
throw e;
|
|
674
890
|
}
|
|
675
891
|
|
|
676
892
|
return [2
|
|
@@ -679,18 +895,26 @@ function () {
|
|
|
679
895
|
});
|
|
680
896
|
});
|
|
681
897
|
};
|
|
898
|
+
/**
|
|
899
|
+
* Send an image to a channel. Only supports png, jpg, jpeg file types.
|
|
900
|
+
*
|
|
901
|
+
* @async
|
|
902
|
+
* @function sendImage
|
|
903
|
+
* @param {string} channelId - The id of a channel.
|
|
904
|
+
* @param {any} file - An image file.
|
|
905
|
+
* @returns {Promise<any>}
|
|
906
|
+
*/
|
|
907
|
+
|
|
682
908
|
|
|
683
909
|
NCloudChat.prototype.sendImage = function (channelId, file) {
|
|
684
910
|
return __awaiter(this, void 0, void 0, function () {
|
|
685
|
-
var
|
|
911
|
+
var result;
|
|
686
912
|
return __generator(this, function (_a) {
|
|
687
913
|
switch (_a.label) {
|
|
688
914
|
case 0:
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
user = _CoreManager["default"].get("USER");
|
|
915
|
+
this.inputValidation({
|
|
916
|
+
channelId: channelId
|
|
917
|
+
});
|
|
694
918
|
return [4
|
|
695
919
|
/*yield*/
|
|
696
920
|
, (0, _mutations.upload)(channelId, file)];
|
|
@@ -705,6 +929,17 @@ function () {
|
|
|
705
929
|
});
|
|
706
930
|
});
|
|
707
931
|
};
|
|
932
|
+
/**
|
|
933
|
+
* Update a message.
|
|
934
|
+
*
|
|
935
|
+
* @todo
|
|
936
|
+
* @async
|
|
937
|
+
* @function updateMessage
|
|
938
|
+
* @param {string} channel
|
|
939
|
+
* @param {string} message_id
|
|
940
|
+
* @param {string} message
|
|
941
|
+
*/
|
|
942
|
+
|
|
708
943
|
|
|
709
944
|
NCloudChat.prototype.updateMessage = function (channel, message_id, message) {
|
|
710
945
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -715,6 +950,14 @@ function () {
|
|
|
715
950
|
});
|
|
716
951
|
});
|
|
717
952
|
};
|
|
953
|
+
/**
|
|
954
|
+
* Delete a message.
|
|
955
|
+
* @async
|
|
956
|
+
* @function deleteMessage
|
|
957
|
+
* @param {string} channel
|
|
958
|
+
* @param {string} message_id
|
|
959
|
+
*/
|
|
960
|
+
|
|
718
961
|
|
|
719
962
|
NCloudChat.prototype.deleteMessage = function (channel, message_id) {
|
|
720
963
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -725,6 +968,14 @@ function () {
|
|
|
725
968
|
});
|
|
726
969
|
});
|
|
727
970
|
};
|
|
971
|
+
/**
|
|
972
|
+
* Disconnect from a socket.
|
|
973
|
+
*
|
|
974
|
+
* @async
|
|
975
|
+
* @function disconnect
|
|
976
|
+
* @returns
|
|
977
|
+
*/
|
|
978
|
+
|
|
728
979
|
|
|
729
980
|
NCloudChat.prototype.disconnect = function () {
|
|
730
981
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -733,20 +984,47 @@ function () {
|
|
|
733
984
|
/*return*/
|
|
734
985
|
];
|
|
735
986
|
this.socket.disconnect();
|
|
987
|
+
|
|
988
|
+
_CoreManager["default"].set("TOKEN", "");
|
|
989
|
+
|
|
736
990
|
return [2
|
|
737
991
|
/*return*/
|
|
738
992
|
];
|
|
739
993
|
});
|
|
740
994
|
});
|
|
741
995
|
};
|
|
996
|
+
/**
|
|
997
|
+
* Check if a client is connected to a socket.
|
|
998
|
+
*
|
|
999
|
+
* @function isConnected
|
|
1000
|
+
* @returns {boolean}
|
|
1001
|
+
*/
|
|
1002
|
+
|
|
742
1003
|
|
|
743
1004
|
NCloudChat.prototype.isConnected = function () {
|
|
1005
|
+
var token = _CoreManager["default"].get("TOKEN");
|
|
1006
|
+
|
|
1007
|
+
if (token) return true;
|
|
1008
|
+
return false;
|
|
1009
|
+
};
|
|
1010
|
+
|
|
1011
|
+
NCloudChat.prototype.isSocketConnected = function () {
|
|
744
1012
|
return this.connected ? true : false;
|
|
745
1013
|
};
|
|
1014
|
+
/**
|
|
1015
|
+
* Bind fn event handlers.
|
|
1016
|
+
*
|
|
1017
|
+
* @async
|
|
1018
|
+
* @function bind
|
|
1019
|
+
* @param {string} id
|
|
1020
|
+
* @param {any} fn
|
|
1021
|
+
*/
|
|
1022
|
+
|
|
746
1023
|
|
|
747
1024
|
NCloudChat.prototype.bind = function (id, fn) {
|
|
748
1025
|
return __awaiter(this, void 0, void 0, function () {
|
|
749
1026
|
return __generator(this, function (_a) {
|
|
1027
|
+
this.dp.off(id);
|
|
750
1028
|
this.dp.on(id, fn);
|
|
751
1029
|
return [2
|
|
752
1030
|
/*return*/
|
|
@@ -754,17 +1032,31 @@ function () {
|
|
|
754
1032
|
});
|
|
755
1033
|
});
|
|
756
1034
|
};
|
|
1035
|
+
/**
|
|
1036
|
+
* Unbind fn event handlers.
|
|
1037
|
+
*
|
|
1038
|
+
* @async
|
|
1039
|
+
* @function unbind
|
|
1040
|
+
* @param {string} id
|
|
1041
|
+
* @param {any} fn
|
|
1042
|
+
*/
|
|
1043
|
+
|
|
757
1044
|
|
|
758
|
-
NCloudChat.prototype.unbind = function (id
|
|
1045
|
+
NCloudChat.prototype.unbind = function (id) {
|
|
759
1046
|
return __awaiter(this, void 0, void 0, function () {
|
|
760
1047
|
return __generator(this, function (_a) {
|
|
761
|
-
this.dp.off(id
|
|
1048
|
+
this.dp.off(id);
|
|
762
1049
|
return [2
|
|
763
1050
|
/*return*/
|
|
764
1051
|
];
|
|
765
1052
|
});
|
|
766
1053
|
});
|
|
767
1054
|
};
|
|
1055
|
+
/**
|
|
1056
|
+
* Unbind all event handlers.
|
|
1057
|
+
* @param id
|
|
1058
|
+
*/
|
|
1059
|
+
|
|
768
1060
|
|
|
769
1061
|
NCloudChat.prototype.unbindall = function (id) {
|
|
770
1062
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -776,11 +1068,30 @@ function () {
|
|
|
776
1068
|
});
|
|
777
1069
|
});
|
|
778
1070
|
};
|
|
1071
|
+
/**
|
|
1072
|
+
* Decodes a base-64 encoded string.
|
|
1073
|
+
*
|
|
1074
|
+
* @function ObjectId
|
|
1075
|
+
* @param {string} id - An encoded string to be decoded.
|
|
1076
|
+
* @returns {string} decoded string.
|
|
1077
|
+
*/
|
|
1078
|
+
|
|
779
1079
|
|
|
780
1080
|
NCloudChat.prototype.ObjectId = function (id) {
|
|
781
1081
|
if (!id) return "";
|
|
782
1082
|
return atob(id).split(":")[1];
|
|
783
1083
|
};
|
|
1084
|
+
/**
|
|
1085
|
+
* Get current friends list of all status.
|
|
1086
|
+
*
|
|
1087
|
+
* @async
|
|
1088
|
+
* @function getFriendships
|
|
1089
|
+
* @param {string} filter - Field value for filter.
|
|
1090
|
+
* @param {string} sort - Field value for sorting.
|
|
1091
|
+
* @param {string} option - Optional option: ex) offset, per_page.
|
|
1092
|
+
* @returns {Promise<any>}
|
|
1093
|
+
*/
|
|
1094
|
+
|
|
784
1095
|
|
|
785
1096
|
NCloudChat.prototype.getFriendships = function (filter, sort, option) {
|
|
786
1097
|
if (sort === void 0) {
|
|
@@ -792,14 +1103,14 @@ function () {
|
|
|
792
1103
|
}
|
|
793
1104
|
|
|
794
1105
|
return __awaiter(this, void 0, void 0, function () {
|
|
795
|
-
var entries, friends,
|
|
1106
|
+
var entries, friends, e_9;
|
|
1107
|
+
|
|
1108
|
+
var _this = this;
|
|
1109
|
+
|
|
796
1110
|
return __generator(this, function (_a) {
|
|
797
1111
|
switch (_a.label) {
|
|
798
1112
|
case 0:
|
|
799
|
-
|
|
800
|
-
throw Error("You are not connected.");
|
|
801
|
-
}
|
|
802
|
-
|
|
1113
|
+
this.inputValidation({});
|
|
803
1114
|
_a.label = 1;
|
|
804
1115
|
|
|
805
1116
|
case 1:
|
|
@@ -813,7 +1124,9 @@ function () {
|
|
|
813
1124
|
entries = _a.sent();
|
|
814
1125
|
|
|
815
1126
|
if (entries) {
|
|
816
|
-
friends = entries.map(function (item) {
|
|
1127
|
+
friends = entries["edges"].map(function (item) {
|
|
1128
|
+
item.node.friend.id = _this.ObjectId(item.node.friend.id);
|
|
1129
|
+
item.node.user.id = _this.ObjectId(item.node.user.id);
|
|
817
1130
|
return __assign(__assign({}, item.node), {
|
|
818
1131
|
id: item.node.id
|
|
819
1132
|
});
|
|
@@ -825,11 +1138,11 @@ function () {
|
|
|
825
1138
|
|
|
826
1139
|
return [2
|
|
827
1140
|
/*return*/
|
|
828
|
-
, entries];
|
|
1141
|
+
, entries["edges"]];
|
|
829
1142
|
|
|
830
1143
|
case 3:
|
|
831
|
-
|
|
832
|
-
throw
|
|
1144
|
+
e_9 = _a.sent();
|
|
1145
|
+
throw e_9;
|
|
833
1146
|
|
|
834
1147
|
case 4:
|
|
835
1148
|
return [2
|
|
@@ -839,8 +1152,19 @@ function () {
|
|
|
839
1152
|
});
|
|
840
1153
|
});
|
|
841
1154
|
};
|
|
842
|
-
|
|
843
|
-
|
|
1155
|
+
/**
|
|
1156
|
+
* Get member blocks.
|
|
1157
|
+
*
|
|
1158
|
+
* @async
|
|
1159
|
+
* @function getBannedUsers
|
|
1160
|
+
* @param {string} filter - Field value for filter.
|
|
1161
|
+
* @param {string} sort - Field value for sorting.
|
|
1162
|
+
* @param {string} option - Optional option: ex) offset, per_page.
|
|
1163
|
+
* @returns {Promise<any>}
|
|
1164
|
+
*/
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
NCloudChat.prototype.getBannedUsers = function (filter, sort, option) {
|
|
844
1168
|
if (sort === void 0) {
|
|
845
1169
|
sort = {};
|
|
846
1170
|
}
|
|
@@ -850,17 +1174,14 @@ function () {
|
|
|
850
1174
|
}
|
|
851
1175
|
|
|
852
1176
|
return __awaiter(this, void 0, void 0, function () {
|
|
853
|
-
var entries, members,
|
|
1177
|
+
var entries, members, e_10;
|
|
854
1178
|
|
|
855
1179
|
var _this = this;
|
|
856
1180
|
|
|
857
1181
|
return __generator(this, function (_a) {
|
|
858
1182
|
switch (_a.label) {
|
|
859
1183
|
case 0:
|
|
860
|
-
|
|
861
|
-
throw Error("You are not connected.");
|
|
862
|
-
}
|
|
863
|
-
|
|
1184
|
+
this.inputValidation({});
|
|
864
1185
|
_a.label = 1;
|
|
865
1186
|
|
|
866
1187
|
case 1:
|
|
@@ -873,8 +1194,8 @@ function () {
|
|
|
873
1194
|
case 2:
|
|
874
1195
|
entries = _a.sent();
|
|
875
1196
|
|
|
876
|
-
if (entries) {
|
|
877
|
-
members = entries.map(function (item) {
|
|
1197
|
+
if (entries["edges"]) {
|
|
1198
|
+
members = entries["edges"].map(function (item) {
|
|
878
1199
|
return __assign(__assign({}, item.node), {
|
|
879
1200
|
id: _this.ObjectId(item.node.id)
|
|
880
1201
|
});
|
|
@@ -886,11 +1207,11 @@ function () {
|
|
|
886
1207
|
|
|
887
1208
|
return [2
|
|
888
1209
|
/*return*/
|
|
889
|
-
, entries];
|
|
1210
|
+
, entries["edges"]];
|
|
890
1211
|
|
|
891
1212
|
case 3:
|
|
892
|
-
|
|
893
|
-
throw
|
|
1213
|
+
e_10 = _a.sent();
|
|
1214
|
+
throw e_10;
|
|
894
1215
|
|
|
895
1216
|
case 4:
|
|
896
1217
|
return [2
|
|
@@ -900,8 +1221,19 @@ function () {
|
|
|
900
1221
|
});
|
|
901
1222
|
});
|
|
902
1223
|
};
|
|
903
|
-
|
|
904
|
-
|
|
1224
|
+
/**
|
|
1225
|
+
* Get information data of the member.
|
|
1226
|
+
*
|
|
1227
|
+
* @async
|
|
1228
|
+
* @function getUsers
|
|
1229
|
+
* @param {string} filter - Field value for filter.
|
|
1230
|
+
* @param {string} sort - Field value for sorting.
|
|
1231
|
+
* @param {string} option - Optional option: ex) offset, per_page.
|
|
1232
|
+
* @returns {Promise<any>}
|
|
1233
|
+
*/
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
NCloudChat.prototype.getUsers = function (filter, sort, option) {
|
|
905
1237
|
if (sort === void 0) {
|
|
906
1238
|
sort = {};
|
|
907
1239
|
}
|
|
@@ -911,17 +1243,14 @@ function () {
|
|
|
911
1243
|
}
|
|
912
1244
|
|
|
913
1245
|
return __awaiter(this, void 0, void 0, function () {
|
|
914
|
-
var entries, members,
|
|
1246
|
+
var entries, members, e_11;
|
|
915
1247
|
|
|
916
1248
|
var _this = this;
|
|
917
1249
|
|
|
918
1250
|
return __generator(this, function (_a) {
|
|
919
1251
|
switch (_a.label) {
|
|
920
1252
|
case 0:
|
|
921
|
-
|
|
922
|
-
throw Error("You are not connected.");
|
|
923
|
-
}
|
|
924
|
-
|
|
1253
|
+
this.inputValidation({});
|
|
925
1254
|
_a.label = 1;
|
|
926
1255
|
|
|
927
1256
|
case 1:
|
|
@@ -935,7 +1264,7 @@ function () {
|
|
|
935
1264
|
entries = _a.sent();
|
|
936
1265
|
|
|
937
1266
|
if (entries) {
|
|
938
|
-
members = entries.map(function (item) {
|
|
1267
|
+
members = entries['edges'].map(function (item) {
|
|
939
1268
|
return __assign(__assign({}, item.node), {
|
|
940
1269
|
id: _this.ObjectId(item.node.id)
|
|
941
1270
|
});
|
|
@@ -945,13 +1274,13 @@ function () {
|
|
|
945
1274
|
, members];
|
|
946
1275
|
}
|
|
947
1276
|
|
|
948
|
-
return [
|
|
949
|
-
/*
|
|
950
|
-
,
|
|
1277
|
+
return [3
|
|
1278
|
+
/*break*/
|
|
1279
|
+
, 4];
|
|
951
1280
|
|
|
952
1281
|
case 3:
|
|
953
|
-
|
|
954
|
-
throw
|
|
1282
|
+
e_11 = _a.sent();
|
|
1283
|
+
throw e_11;
|
|
955
1284
|
|
|
956
1285
|
case 4:
|
|
957
1286
|
return [2
|
|
@@ -961,28 +1290,25 @@ function () {
|
|
|
961
1290
|
});
|
|
962
1291
|
});
|
|
963
1292
|
};
|
|
1293
|
+
/**
|
|
1294
|
+
* Request a friendship to a user.
|
|
1295
|
+
*
|
|
1296
|
+
* @async
|
|
1297
|
+
* @function requestFriend
|
|
1298
|
+
* @param {string} friendId - An id of the friend to request.
|
|
1299
|
+
* @returns {Promise<any>}
|
|
1300
|
+
*/
|
|
964
1301
|
|
|
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
1302
|
|
|
1303
|
+
NCloudChat.prototype.requestFriend = function (friendId) {
|
|
974
1304
|
return __awaiter(this, void 0, void 0, function () {
|
|
975
|
-
var
|
|
976
|
-
|
|
977
|
-
var _this = this;
|
|
978
|
-
|
|
1305
|
+
var result, e_12;
|
|
979
1306
|
return __generator(this, function (_a) {
|
|
980
1307
|
switch (_a.label) {
|
|
981
1308
|
case 0:
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
}
|
|
985
|
-
|
|
1309
|
+
this.inputValidation({
|
|
1310
|
+
friendId: friendId
|
|
1311
|
+
});
|
|
986
1312
|
_a.label = 1;
|
|
987
1313
|
|
|
988
1314
|
case 1:
|
|
@@ -990,29 +1316,23 @@ function () {
|
|
|
990
1316
|
|
|
991
1317
|
return [4
|
|
992
1318
|
/*yield*/
|
|
993
|
-
, (0,
|
|
1319
|
+
, (0, _mutations.requestFriend)(friendId)];
|
|
994
1320
|
|
|
995
1321
|
case 2:
|
|
996
|
-
|
|
1322
|
+
result = _a.sent();
|
|
997
1323
|
|
|
998
|
-
if (
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
id: _this.ObjectId(item.node.id)
|
|
1002
|
-
});
|
|
1003
|
-
});
|
|
1004
|
-
return [2
|
|
1005
|
-
/*return*/
|
|
1006
|
-
, channels];
|
|
1324
|
+
if (result["friendship"]) {
|
|
1325
|
+
result["friendship"]["user"]["id"] = this.ObjectId(result["friendship"]["user"]["id"]);
|
|
1326
|
+
result["friendship"]["friend"]["id"] = this.ObjectId(result["friendship"]["friend"]["id"]);
|
|
1007
1327
|
}
|
|
1008
1328
|
|
|
1009
1329
|
return [2
|
|
1010
1330
|
/*return*/
|
|
1011
|
-
,
|
|
1331
|
+
, result["friendship"]];
|
|
1012
1332
|
|
|
1013
1333
|
case 3:
|
|
1014
|
-
|
|
1015
|
-
throw
|
|
1334
|
+
e_12 = _a.sent();
|
|
1335
|
+
throw e_12;
|
|
1016
1336
|
|
|
1017
1337
|
case 4:
|
|
1018
1338
|
return [2
|
|
@@ -1022,17 +1342,25 @@ function () {
|
|
|
1022
1342
|
});
|
|
1023
1343
|
});
|
|
1024
1344
|
};
|
|
1345
|
+
/**
|
|
1346
|
+
* Accept a friends request.
|
|
1347
|
+
*
|
|
1348
|
+
* @async
|
|
1349
|
+
* @function acceptFriend
|
|
1350
|
+
* @param {string} friendId - The id of the friend to accept the request.
|
|
1351
|
+
* @returns {Promise<any>}
|
|
1352
|
+
*/
|
|
1025
1353
|
|
|
1026
|
-
|
|
1354
|
+
|
|
1355
|
+
NCloudChat.prototype.acceptFriend = function (friendId) {
|
|
1027
1356
|
return __awaiter(this, void 0, void 0, function () {
|
|
1028
|
-
var
|
|
1357
|
+
var result, e_13;
|
|
1029
1358
|
return __generator(this, function (_a) {
|
|
1030
1359
|
switch (_a.label) {
|
|
1031
1360
|
case 0:
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1361
|
+
this.inputValidation({
|
|
1362
|
+
friendId: friendId
|
|
1363
|
+
});
|
|
1036
1364
|
_a.label = 1;
|
|
1037
1365
|
|
|
1038
1366
|
case 1:
|
|
@@ -1040,16 +1368,23 @@ function () {
|
|
|
1040
1368
|
|
|
1041
1369
|
return [4
|
|
1042
1370
|
/*yield*/
|
|
1043
|
-
, (0, _mutations.
|
|
1371
|
+
, (0, _mutations.acceptFriend)(friendId)];
|
|
1044
1372
|
|
|
1045
1373
|
case 2:
|
|
1374
|
+
result = _a.sent();
|
|
1375
|
+
|
|
1376
|
+
if (result["friendship"]) {
|
|
1377
|
+
result["friendship"]["user"]["id"] = this.ObjectId(result["friendship"]["user"]["id"]);
|
|
1378
|
+
result["friendship"]["friend"]["id"] = this.ObjectId(result["friendship"]["friend"]["id"]);
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1046
1381
|
return [2
|
|
1047
1382
|
/*return*/
|
|
1048
|
-
,
|
|
1383
|
+
, result["friendship"]];
|
|
1049
1384
|
|
|
1050
1385
|
case 3:
|
|
1051
|
-
|
|
1052
|
-
throw
|
|
1386
|
+
e_13 = _a.sent();
|
|
1387
|
+
throw e_13;
|
|
1053
1388
|
|
|
1054
1389
|
case 4:
|
|
1055
1390
|
return [2
|
|
@@ -1059,17 +1394,25 @@ function () {
|
|
|
1059
1394
|
});
|
|
1060
1395
|
});
|
|
1061
1396
|
};
|
|
1397
|
+
/**
|
|
1398
|
+
* Reject a friend request.
|
|
1399
|
+
*
|
|
1400
|
+
* @async
|
|
1401
|
+
* @function rejectFriend
|
|
1402
|
+
* @param {string} friendId - An id of the friend to be rejected.
|
|
1403
|
+
* @returns {Promise<any>}
|
|
1404
|
+
*/
|
|
1062
1405
|
|
|
1063
|
-
|
|
1406
|
+
|
|
1407
|
+
NCloudChat.prototype.rejectFriend = function (friendId) {
|
|
1064
1408
|
return __awaiter(this, void 0, void 0, function () {
|
|
1065
|
-
var
|
|
1409
|
+
var result, e_14;
|
|
1066
1410
|
return __generator(this, function (_a) {
|
|
1067
1411
|
switch (_a.label) {
|
|
1068
1412
|
case 0:
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1413
|
+
this.inputValidation({
|
|
1414
|
+
friendId: friendId
|
|
1415
|
+
});
|
|
1073
1416
|
_a.label = 1;
|
|
1074
1417
|
|
|
1075
1418
|
case 1:
|
|
@@ -1077,16 +1420,23 @@ function () {
|
|
|
1077
1420
|
|
|
1078
1421
|
return [4
|
|
1079
1422
|
/*yield*/
|
|
1080
|
-
, (0, _mutations.
|
|
1423
|
+
, (0, _mutations.rejectFriend)(friendId)];
|
|
1081
1424
|
|
|
1082
1425
|
case 2:
|
|
1426
|
+
result = _a.sent();
|
|
1427
|
+
|
|
1428
|
+
if (result["friendship"]) {
|
|
1429
|
+
result["friendship"]["user"]["id"] = this.ObjectId(result["friendship"]["user"]["id"]);
|
|
1430
|
+
result["friendship"]["friend"]["id"] = this.ObjectId(result["friendship"]["friend"]["id"]);
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1083
1433
|
return [2
|
|
1084
1434
|
/*return*/
|
|
1085
|
-
,
|
|
1435
|
+
, result["friendship"]];
|
|
1086
1436
|
|
|
1087
1437
|
case 3:
|
|
1088
|
-
|
|
1089
|
-
throw
|
|
1438
|
+
e_14 = _a.sent();
|
|
1439
|
+
throw e_14;
|
|
1090
1440
|
|
|
1091
1441
|
case 4:
|
|
1092
1442
|
return [2
|
|
@@ -1096,17 +1446,25 @@ function () {
|
|
|
1096
1446
|
});
|
|
1097
1447
|
});
|
|
1098
1448
|
};
|
|
1449
|
+
/**
|
|
1450
|
+
* Remove a friend.
|
|
1451
|
+
*
|
|
1452
|
+
* @async
|
|
1453
|
+
* @function removeFriend
|
|
1454
|
+
* @param {string} friendId - An id of the friend to be removed.
|
|
1455
|
+
* @returns {Promise<any>}
|
|
1456
|
+
*/
|
|
1099
1457
|
|
|
1100
|
-
|
|
1458
|
+
|
|
1459
|
+
NCloudChat.prototype.removeFriend = function (friendId) {
|
|
1101
1460
|
return __awaiter(this, void 0, void 0, function () {
|
|
1102
|
-
var
|
|
1461
|
+
var result, e_15;
|
|
1103
1462
|
return __generator(this, function (_a) {
|
|
1104
1463
|
switch (_a.label) {
|
|
1105
1464
|
case 0:
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1465
|
+
this.inputValidation({
|
|
1466
|
+
friendId: friendId
|
|
1467
|
+
});
|
|
1110
1468
|
_a.label = 1;
|
|
1111
1469
|
|
|
1112
1470
|
case 1:
|
|
@@ -1114,16 +1472,23 @@ function () {
|
|
|
1114
1472
|
|
|
1115
1473
|
return [4
|
|
1116
1474
|
/*yield*/
|
|
1117
|
-
, (0, _mutations.
|
|
1475
|
+
, (0, _mutations.removeFriend)(friendId)];
|
|
1118
1476
|
|
|
1119
1477
|
case 2:
|
|
1478
|
+
result = _a.sent();
|
|
1479
|
+
|
|
1480
|
+
if (result["friendship"]) {
|
|
1481
|
+
result["friendship"]["user"]["id"] = this.ObjectId(result["friendship"]["user"]["id"]);
|
|
1482
|
+
result["friendship"]["friend"]["id"] = this.ObjectId(result["friendship"]["friend"]["id"]);
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1120
1485
|
return [2
|
|
1121
1486
|
/*return*/
|
|
1122
|
-
,
|
|
1487
|
+
, result["friendship"]];
|
|
1123
1488
|
|
|
1124
1489
|
case 3:
|
|
1125
|
-
|
|
1126
|
-
throw
|
|
1490
|
+
e_15 = _a.sent();
|
|
1491
|
+
throw e_15;
|
|
1127
1492
|
|
|
1128
1493
|
case 4:
|
|
1129
1494
|
return [2
|
|
@@ -1133,17 +1498,25 @@ function () {
|
|
|
1133
1498
|
});
|
|
1134
1499
|
});
|
|
1135
1500
|
};
|
|
1501
|
+
/**
|
|
1502
|
+
* Get a count of unread messages of a channel.
|
|
1503
|
+
*
|
|
1504
|
+
* @async
|
|
1505
|
+
* @function countUnread
|
|
1506
|
+
* @param {string} channelId - The id of a channel.
|
|
1507
|
+
* @returns {Promise<any>}
|
|
1508
|
+
*/
|
|
1136
1509
|
|
|
1137
|
-
|
|
1510
|
+
|
|
1511
|
+
NCloudChat.prototype.countUnread = function (channelId) {
|
|
1138
1512
|
return __awaiter(this, void 0, void 0, function () {
|
|
1139
|
-
var
|
|
1513
|
+
var e_16;
|
|
1140
1514
|
return __generator(this, function (_a) {
|
|
1141
1515
|
switch (_a.label) {
|
|
1142
1516
|
case 0:
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1517
|
+
this.inputValidation({
|
|
1518
|
+
channelId: channelId
|
|
1519
|
+
});
|
|
1147
1520
|
_a.label = 1;
|
|
1148
1521
|
|
|
1149
1522
|
case 1:
|
|
@@ -1151,7 +1524,7 @@ function () {
|
|
|
1151
1524
|
|
|
1152
1525
|
return [4
|
|
1153
1526
|
/*yield*/
|
|
1154
|
-
, (0,
|
|
1527
|
+
, (0, _queries.unreadCount)(channelId)];
|
|
1155
1528
|
|
|
1156
1529
|
case 2:
|
|
1157
1530
|
return [2
|
|
@@ -1159,8 +1532,8 @@ function () {
|
|
|
1159
1532
|
, _a.sent()];
|
|
1160
1533
|
|
|
1161
1534
|
case 3:
|
|
1162
|
-
|
|
1163
|
-
throw
|
|
1535
|
+
e_16 = _a.sent();
|
|
1536
|
+
throw e_16;
|
|
1164
1537
|
|
|
1165
1538
|
case 4:
|
|
1166
1539
|
return [2
|
|
@@ -1170,17 +1543,27 @@ function () {
|
|
|
1170
1543
|
});
|
|
1171
1544
|
});
|
|
1172
1545
|
};
|
|
1546
|
+
/**
|
|
1547
|
+
* Get subscription data of the user.
|
|
1548
|
+
*
|
|
1549
|
+
* @async
|
|
1550
|
+
* @function getSubscription
|
|
1551
|
+
* @param {string} channelId - The id of a channel.
|
|
1552
|
+
* @param {string} id
|
|
1553
|
+
* @returns {Promise<any>}
|
|
1554
|
+
*/
|
|
1173
1555
|
|
|
1174
|
-
|
|
1556
|
+
|
|
1557
|
+
NCloudChat.prototype.getSubscription = function (channelId, id) {
|
|
1175
1558
|
return __awaiter(this, void 0, void 0, function () {
|
|
1176
|
-
var
|
|
1559
|
+
var subscription, e_17;
|
|
1177
1560
|
return __generator(this, function (_a) {
|
|
1178
1561
|
switch (_a.label) {
|
|
1179
1562
|
case 0:
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1563
|
+
this.inputValidation({
|
|
1564
|
+
channelId: channelId,
|
|
1565
|
+
subscriptionId: id
|
|
1566
|
+
});
|
|
1184
1567
|
_a.label = 1;
|
|
1185
1568
|
|
|
1186
1569
|
case 1:
|
|
@@ -1188,16 +1571,18 @@ function () {
|
|
|
1188
1571
|
|
|
1189
1572
|
return [4
|
|
1190
1573
|
/*yield*/
|
|
1191
|
-
, (0, _queries.
|
|
1574
|
+
, (0, _queries.getSubscription)(channelId, id)];
|
|
1192
1575
|
|
|
1193
1576
|
case 2:
|
|
1577
|
+
subscription = _a.sent();
|
|
1578
|
+
if (subscription) subscription["id"] = this.ObjectId(subscription["id"]);
|
|
1194
1579
|
return [2
|
|
1195
1580
|
/*return*/
|
|
1196
|
-
,
|
|
1581
|
+
, subscription];
|
|
1197
1582
|
|
|
1198
1583
|
case 3:
|
|
1199
|
-
|
|
1200
|
-
throw
|
|
1584
|
+
e_17 = _a.sent();
|
|
1585
|
+
throw e_17;
|
|
1201
1586
|
|
|
1202
1587
|
case 4:
|
|
1203
1588
|
return [2
|
|
@@ -1207,17 +1592,25 @@ function () {
|
|
|
1207
1592
|
});
|
|
1208
1593
|
});
|
|
1209
1594
|
};
|
|
1595
|
+
/**
|
|
1596
|
+
* Get data of a single channel from the endpoint.
|
|
1597
|
+
*
|
|
1598
|
+
* @async
|
|
1599
|
+
* @function getChannel
|
|
1600
|
+
* @param {string} channelId - An id of the channel.
|
|
1601
|
+
* @returns {Promise<any>} The data of the channel.
|
|
1602
|
+
*/
|
|
1210
1603
|
|
|
1211
|
-
|
|
1604
|
+
|
|
1605
|
+
NCloudChat.prototype.getChannel = function (channelId) {
|
|
1212
1606
|
return __awaiter(this, void 0, void 0, function () {
|
|
1213
|
-
var
|
|
1607
|
+
var result, e_18;
|
|
1214
1608
|
return __generator(this, function (_a) {
|
|
1215
1609
|
switch (_a.label) {
|
|
1216
1610
|
case 0:
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1611
|
+
this.inputValidation({
|
|
1612
|
+
channelId: channelId
|
|
1613
|
+
});
|
|
1221
1614
|
_a.label = 1;
|
|
1222
1615
|
|
|
1223
1616
|
case 1:
|
|
@@ -1225,36 +1618,62 @@ function () {
|
|
|
1225
1618
|
|
|
1226
1619
|
return [4
|
|
1227
1620
|
/*yield*/
|
|
1228
|
-
, (0, _queries.
|
|
1621
|
+
, (0, _queries.getChannel)(channelId)];
|
|
1229
1622
|
|
|
1230
1623
|
case 2:
|
|
1624
|
+
result = _a.sent();
|
|
1625
|
+
|
|
1626
|
+
if (result) {
|
|
1627
|
+
result.id = this.ObjectId(result.id);
|
|
1628
|
+
result["user_id"]["id"] = this.ObjectId(result["user_id"]["id"]);
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1231
1631
|
return [2
|
|
1232
1632
|
/*return*/
|
|
1233
|
-
,
|
|
1633
|
+
, result];
|
|
1234
1634
|
|
|
1235
1635
|
case 3:
|
|
1236
|
-
|
|
1237
|
-
throw
|
|
1636
|
+
e_18 = _a.sent();
|
|
1637
|
+
throw e_18;
|
|
1238
1638
|
|
|
1239
1639
|
case 4:
|
|
1240
1640
|
return [2
|
|
1241
1641
|
/*return*/
|
|
1242
|
-
|
|
1642
|
+
];
|
|
1243
1643
|
}
|
|
1244
1644
|
});
|
|
1245
1645
|
});
|
|
1246
1646
|
};
|
|
1647
|
+
/**
|
|
1648
|
+
* Get data of multiple channels.
|
|
1649
|
+
*
|
|
1650
|
+
* @async
|
|
1651
|
+
* @function getChannels
|
|
1652
|
+
* @param {string} filter - Field value for filter.
|
|
1653
|
+
* @param {string} sort - Field value for sorting.
|
|
1654
|
+
* @param {string} option - Optional option: ex) offset, per_page.
|
|
1655
|
+
* @returns {Promise<any[]>} An array of data of all channels.
|
|
1656
|
+
*/
|
|
1657
|
+
|
|
1658
|
+
|
|
1659
|
+
NCloudChat.prototype.getChannels = function (filter, sort, option) {
|
|
1660
|
+
if (sort === void 0) {
|
|
1661
|
+
sort = {};
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
if (option === void 0) {
|
|
1665
|
+
option = {};
|
|
1666
|
+
}
|
|
1247
1667
|
|
|
1248
|
-
NCloudChat.prototype.getChannel = function (channelId) {
|
|
1249
1668
|
return __awaiter(this, void 0, void 0, function () {
|
|
1250
|
-
var
|
|
1669
|
+
var entries, channels, e_19;
|
|
1670
|
+
|
|
1671
|
+
var _this = this;
|
|
1672
|
+
|
|
1251
1673
|
return __generator(this, function (_a) {
|
|
1252
1674
|
switch (_a.label) {
|
|
1253
1675
|
case 0:
|
|
1254
|
-
|
|
1255
|
-
throw Error("You are not connected.");
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1676
|
+
this.inputValidation({});
|
|
1258
1677
|
_a.label = 1;
|
|
1259
1678
|
|
|
1260
1679
|
case 1:
|
|
@@ -1262,36 +1681,58 @@ function () {
|
|
|
1262
1681
|
|
|
1263
1682
|
return [4
|
|
1264
1683
|
/*yield*/
|
|
1265
|
-
, (0, _queries.
|
|
1684
|
+
, (0, _queries.getChannels)((0, _stringify["default"])(filter), (0, _stringify["default"])(sort), (0, _stringify["default"])(option))];
|
|
1266
1685
|
|
|
1267
1686
|
case 2:
|
|
1687
|
+
entries = _a.sent();
|
|
1688
|
+
|
|
1689
|
+
if (entries["edges"]) {
|
|
1690
|
+
channels = entries["edges"].map(function (item) {
|
|
1691
|
+
item.node.user_id.id = _this.ObjectId(item.node.user_id.id);
|
|
1692
|
+
return __assign(__assign({}, item.node), {
|
|
1693
|
+
id: _this.ObjectId(item.node.id)
|
|
1694
|
+
});
|
|
1695
|
+
});
|
|
1696
|
+
return [2
|
|
1697
|
+
/*return*/
|
|
1698
|
+
, channels];
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1268
1701
|
return [2
|
|
1269
1702
|
/*return*/
|
|
1270
|
-
,
|
|
1703
|
+
, entries["edges"]];
|
|
1271
1704
|
|
|
1272
1705
|
case 3:
|
|
1273
|
-
|
|
1274
|
-
throw
|
|
1706
|
+
e_19 = _a.sent();
|
|
1707
|
+
throw e_19;
|
|
1275
1708
|
|
|
1276
1709
|
case 4:
|
|
1277
1710
|
return [2
|
|
1278
1711
|
/*return*/
|
|
1279
|
-
|
|
1712
|
+
];
|
|
1280
1713
|
}
|
|
1281
1714
|
});
|
|
1282
1715
|
});
|
|
1283
1716
|
};
|
|
1717
|
+
/**
|
|
1718
|
+
* @async
|
|
1719
|
+
* @function getMessage
|
|
1720
|
+
* @param {string} channelId - The id of a channel.
|
|
1721
|
+
* @param {string} messageId - The id of a message.
|
|
1722
|
+
* @returns {Promise<any>}
|
|
1723
|
+
*/
|
|
1724
|
+
|
|
1284
1725
|
|
|
1285
1726
|
NCloudChat.prototype.getMessage = function (channelId, messageId) {
|
|
1286
1727
|
return __awaiter(this, void 0, void 0, function () {
|
|
1287
|
-
var entry,
|
|
1728
|
+
var entry, e_20;
|
|
1288
1729
|
return __generator(this, function (_a) {
|
|
1289
1730
|
switch (_a.label) {
|
|
1290
1731
|
case 0:
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1732
|
+
this.inputValidation({
|
|
1733
|
+
channelId: channelId,
|
|
1734
|
+
messageId: messageId
|
|
1735
|
+
});
|
|
1295
1736
|
_a.label = 1;
|
|
1296
1737
|
|
|
1297
1738
|
case 1:
|
|
@@ -1313,11 +1754,11 @@ function () {
|
|
|
1313
1754
|
|
|
1314
1755
|
return [2
|
|
1315
1756
|
/*return*/
|
|
1316
|
-
,
|
|
1757
|
+
, entry];
|
|
1317
1758
|
|
|
1318
1759
|
case 3:
|
|
1319
|
-
|
|
1320
|
-
throw
|
|
1760
|
+
e_20 = _a.sent();
|
|
1761
|
+
throw e_20;
|
|
1321
1762
|
|
|
1322
1763
|
case 4:
|
|
1323
1764
|
return [2
|
|
@@ -1327,20 +1768,28 @@ function () {
|
|
|
1327
1768
|
});
|
|
1328
1769
|
});
|
|
1329
1770
|
};
|
|
1771
|
+
/**
|
|
1772
|
+
* Get data of the all messages.
|
|
1773
|
+
*
|
|
1774
|
+
* @async
|
|
1775
|
+
* @function getMessages
|
|
1776
|
+
* @param {string} filter - Field value for filter.
|
|
1777
|
+
* @param {string} sort - Field value for sorting.
|
|
1778
|
+
* @param {string} option - Optional option: ex) offset, per_page.
|
|
1779
|
+
* @returns {Promise<any>}
|
|
1780
|
+
*/
|
|
1781
|
+
|
|
1330
1782
|
|
|
1331
1783
|
NCloudChat.prototype.getMessages = function (filter, sort, option) {
|
|
1332
1784
|
return __awaiter(this, void 0, void 0, function () {
|
|
1333
|
-
var entries, messages,
|
|
1785
|
+
var entries, messages, e_21;
|
|
1334
1786
|
|
|
1335
1787
|
var _this = this;
|
|
1336
1788
|
|
|
1337
1789
|
return __generator(this, function (_a) {
|
|
1338
1790
|
switch (_a.label) {
|
|
1339
1791
|
case 0:
|
|
1340
|
-
|
|
1341
|
-
throw Error("You are not connected.");
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1792
|
+
this.inputValidation({});
|
|
1344
1793
|
_a.label = 1;
|
|
1345
1794
|
|
|
1346
1795
|
case 1:
|
|
@@ -1353,8 +1802,8 @@ function () {
|
|
|
1353
1802
|
case 2:
|
|
1354
1803
|
entries = _a.sent();
|
|
1355
1804
|
|
|
1356
|
-
if (entries) {
|
|
1357
|
-
messages = entries.map(function (item) {
|
|
1805
|
+
if (entries["edges"]) {
|
|
1806
|
+
messages = entries["edges"].map(function (item) {
|
|
1358
1807
|
return __assign(__assign({}, item.node), {
|
|
1359
1808
|
id: _this.ObjectId(item.node.id)
|
|
1360
1809
|
});
|
|
@@ -1366,11 +1815,11 @@ function () {
|
|
|
1366
1815
|
|
|
1367
1816
|
return [2
|
|
1368
1817
|
/*return*/
|
|
1369
|
-
, entries];
|
|
1818
|
+
, entries["edges"]];
|
|
1370
1819
|
|
|
1371
1820
|
case 3:
|
|
1372
|
-
|
|
1373
|
-
throw
|
|
1821
|
+
e_21 = _a.sent();
|
|
1822
|
+
throw e_21;
|
|
1374
1823
|
|
|
1375
1824
|
case 4:
|
|
1376
1825
|
return [2
|
|
@@ -1380,20 +1829,25 @@ function () {
|
|
|
1380
1829
|
});
|
|
1381
1830
|
});
|
|
1382
1831
|
};
|
|
1832
|
+
/**
|
|
1833
|
+
* Get a list of subscibed member of the channel.
|
|
1834
|
+
* @param {string} filter - Field value for filter.
|
|
1835
|
+
* @param {string} sort - Field value for sorting.
|
|
1836
|
+
* @param {string} option - Optional option: ex) offset, per_page.
|
|
1837
|
+
* @returns {Promise<any>}
|
|
1838
|
+
*/
|
|
1839
|
+
|
|
1383
1840
|
|
|
1384
1841
|
NCloudChat.prototype.getSubscriptions = function (filter, sort, option) {
|
|
1385
1842
|
return __awaiter(this, void 0, void 0, function () {
|
|
1386
|
-
var entries, subscribes,
|
|
1843
|
+
var entries, subscribes, e_22;
|
|
1387
1844
|
|
|
1388
1845
|
var _this = this;
|
|
1389
1846
|
|
|
1390
1847
|
return __generator(this, function (_a) {
|
|
1391
1848
|
switch (_a.label) {
|
|
1392
1849
|
case 0:
|
|
1393
|
-
|
|
1394
|
-
throw Error("You are not connected.");
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1850
|
+
this.inputValidation({});
|
|
1397
1851
|
_a.label = 1;
|
|
1398
1852
|
|
|
1399
1853
|
case 1:
|
|
@@ -1406,8 +1860,8 @@ function () {
|
|
|
1406
1860
|
case 2:
|
|
1407
1861
|
entries = _a.sent();
|
|
1408
1862
|
|
|
1409
|
-
if (entries) {
|
|
1410
|
-
subscribes = entries.map(function (item) {
|
|
1863
|
+
if (entries["edges"]) {
|
|
1864
|
+
subscribes = entries["edges"].map(function (item) {
|
|
1411
1865
|
return __assign(__assign({}, item.node), {
|
|
1412
1866
|
id: _this.ObjectId(item.node.id)
|
|
1413
1867
|
});
|
|
@@ -1419,11 +1873,11 @@ function () {
|
|
|
1419
1873
|
|
|
1420
1874
|
return [2
|
|
1421
1875
|
/*return*/
|
|
1422
|
-
, entries];
|
|
1876
|
+
, entries["edges"]];
|
|
1423
1877
|
|
|
1424
1878
|
case 3:
|
|
1425
|
-
|
|
1426
|
-
throw
|
|
1879
|
+
e_22 = _a.sent();
|
|
1880
|
+
throw e_22;
|
|
1427
1881
|
|
|
1428
1882
|
case 4:
|
|
1429
1883
|
return [2
|
|
@@ -1433,17 +1887,26 @@ function () {
|
|
|
1433
1887
|
});
|
|
1434
1888
|
});
|
|
1435
1889
|
};
|
|
1890
|
+
/**
|
|
1891
|
+
* Create a new channel.
|
|
1892
|
+
*
|
|
1893
|
+
* @async
|
|
1894
|
+
* @function createChannel
|
|
1895
|
+
* @param {ChannelInput} channel - Configuration options of the new channel.
|
|
1896
|
+
* @returns {Promise<any>} The data of the newly created channel.
|
|
1897
|
+
*/
|
|
1898
|
+
|
|
1436
1899
|
|
|
1437
1900
|
NCloudChat.prototype.createChannel = function (channel) {
|
|
1438
1901
|
return __awaiter(this, void 0, void 0, function () {
|
|
1439
|
-
var
|
|
1902
|
+
var result, e_23;
|
|
1440
1903
|
return __generator(this, function (_a) {
|
|
1441
1904
|
switch (_a.label) {
|
|
1442
1905
|
case 0:
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1906
|
+
this.inputValidation({
|
|
1907
|
+
channelType: channel.type,
|
|
1908
|
+
channelName: channel.name
|
|
1909
|
+
});
|
|
1447
1910
|
_a.label = 1;
|
|
1448
1911
|
|
|
1449
1912
|
case 1:
|
|
@@ -1454,13 +1917,20 @@ function () {
|
|
|
1454
1917
|
, (0, _mutations.createChannel)(channel)];
|
|
1455
1918
|
|
|
1456
1919
|
case 2:
|
|
1920
|
+
result = _a.sent();
|
|
1921
|
+
|
|
1922
|
+
if (result["channel"]) {
|
|
1923
|
+
result["channel"]["id"] = this.ObjectId(result["channel"]["id"]);
|
|
1924
|
+
result["channel"]["user_id"]["id"] = this.ObjectId(result["channel"]["user_id"]["id"]);
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1457
1927
|
return [2
|
|
1458
1928
|
/*return*/
|
|
1459
|
-
,
|
|
1929
|
+
, result["channel"]];
|
|
1460
1930
|
|
|
1461
1931
|
case 3:
|
|
1462
|
-
|
|
1463
|
-
throw
|
|
1932
|
+
e_23 = _a.sent();
|
|
1933
|
+
throw e_23;
|
|
1464
1934
|
|
|
1465
1935
|
case 4:
|
|
1466
1936
|
return [2
|
|
@@ -1470,17 +1940,27 @@ function () {
|
|
|
1470
1940
|
});
|
|
1471
1941
|
});
|
|
1472
1942
|
};
|
|
1943
|
+
/**
|
|
1944
|
+
* Update channel options.
|
|
1945
|
+
*
|
|
1946
|
+
* @async
|
|
1947
|
+
* @function updateChannel
|
|
1948
|
+
* @param {string} channelId - An id of the channel.
|
|
1949
|
+
* @param {ChannelInput} channel - New options of the channel.
|
|
1950
|
+
* @returns {Promise<any>} The data of the updated channel.
|
|
1951
|
+
*/
|
|
1952
|
+
|
|
1473
1953
|
|
|
1474
1954
|
NCloudChat.prototype.updateChannel = function (channelId, channel) {
|
|
1475
1955
|
return __awaiter(this, void 0, void 0, function () {
|
|
1476
|
-
var
|
|
1956
|
+
var result, e_24;
|
|
1477
1957
|
return __generator(this, function (_a) {
|
|
1478
1958
|
switch (_a.label) {
|
|
1479
1959
|
case 0:
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1960
|
+
this.inputValidation({
|
|
1961
|
+
channelId: channelId
|
|
1962
|
+
});
|
|
1963
|
+
if (!channel.name) throw Error("You need at least a channel name or a type.");
|
|
1484
1964
|
_a.label = 1;
|
|
1485
1965
|
|
|
1486
1966
|
case 1:
|
|
@@ -1491,13 +1971,20 @@ function () {
|
|
|
1491
1971
|
, (0, _mutations.updateChannel)(channelId, channel)];
|
|
1492
1972
|
|
|
1493
1973
|
case 2:
|
|
1974
|
+
result = _a.sent();
|
|
1975
|
+
|
|
1976
|
+
if (result["channel"]) {
|
|
1977
|
+
result["channel"]["id"] = this.ObjectId(result["channel"]["id"]);
|
|
1978
|
+
result["channel"]["user_id"]["id"] = this.ObjectId(result["channel"]["user_id"]["id"]);
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1494
1981
|
return [2
|
|
1495
1982
|
/*return*/
|
|
1496
|
-
,
|
|
1983
|
+
, result["channel"]];
|
|
1497
1984
|
|
|
1498
1985
|
case 3:
|
|
1499
|
-
|
|
1500
|
-
throw
|
|
1986
|
+
e_24 = _a.sent();
|
|
1987
|
+
throw e_24;
|
|
1501
1988
|
|
|
1502
1989
|
case 4:
|
|
1503
1990
|
return [2
|
|
@@ -1507,17 +1994,25 @@ function () {
|
|
|
1507
1994
|
});
|
|
1508
1995
|
});
|
|
1509
1996
|
};
|
|
1997
|
+
/**
|
|
1998
|
+
* Delete a channel.
|
|
1999
|
+
*
|
|
2000
|
+
* @async
|
|
2001
|
+
* @function deleteChannel
|
|
2002
|
+
* @param {string} channelId - An channel id.
|
|
2003
|
+
* @returns {Promise<any>}
|
|
2004
|
+
*/
|
|
2005
|
+
|
|
1510
2006
|
|
|
1511
2007
|
NCloudChat.prototype.deleteChannel = function (channelId) {
|
|
1512
2008
|
return __awaiter(this, void 0, void 0, function () {
|
|
1513
|
-
var
|
|
2009
|
+
var result, e_25;
|
|
1514
2010
|
return __generator(this, function (_a) {
|
|
1515
2011
|
switch (_a.label) {
|
|
1516
2012
|
case 0:
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
}
|
|
1520
|
-
|
|
2013
|
+
this.inputValidation({
|
|
2014
|
+
channelId: channelId
|
|
2015
|
+
});
|
|
1521
2016
|
_a.label = 1;
|
|
1522
2017
|
|
|
1523
2018
|
case 1:
|
|
@@ -1528,13 +2023,20 @@ function () {
|
|
|
1528
2023
|
, (0, _mutations.deleteChannel)(channelId)];
|
|
1529
2024
|
|
|
1530
2025
|
case 2:
|
|
2026
|
+
result = _a.sent();
|
|
2027
|
+
|
|
2028
|
+
if (result["channel"]) {
|
|
2029
|
+
result["channel"]["id"] = this.ObjectId(result["channel"]["id"]);
|
|
2030
|
+
result["channel"]["user_id"]["id"] = this.ObjectId(result["channel"]["user_id"]["id"]);
|
|
2031
|
+
}
|
|
2032
|
+
|
|
1531
2033
|
return [2
|
|
1532
2034
|
/*return*/
|
|
1533
|
-
,
|
|
2035
|
+
, result["channel"]];
|
|
1534
2036
|
|
|
1535
2037
|
case 3:
|
|
1536
|
-
|
|
1537
|
-
throw
|
|
2038
|
+
e_25 = _a.sent();
|
|
2039
|
+
throw e_25;
|
|
1538
2040
|
|
|
1539
2041
|
case 4:
|
|
1540
2042
|
return [2
|
|
@@ -1544,6 +2046,17 @@ function () {
|
|
|
1544
2046
|
});
|
|
1545
2047
|
});
|
|
1546
2048
|
};
|
|
2049
|
+
/**
|
|
2050
|
+
* Update a subscription information, such as marking message read.
|
|
2051
|
+
*
|
|
2052
|
+
* @async
|
|
2053
|
+
* @function markRead
|
|
2054
|
+
* @param {string} channelId - The id of a channel.
|
|
2055
|
+
* @param {MarkInput} mark
|
|
2056
|
+
* @param {string} option
|
|
2057
|
+
* @returns {Promise<any>}
|
|
2058
|
+
*/
|
|
2059
|
+
|
|
1547
2060
|
|
|
1548
2061
|
NCloudChat.prototype.markRead = function (channelId, mark, option) {
|
|
1549
2062
|
if (option === void 0) {
|
|
@@ -1551,14 +2064,16 @@ function () {
|
|
|
1551
2064
|
}
|
|
1552
2065
|
|
|
1553
2066
|
return __awaiter(this, void 0, void 0, function () {
|
|
1554
|
-
var
|
|
2067
|
+
var result, e_26;
|
|
1555
2068
|
return __generator(this, function (_a) {
|
|
1556
2069
|
switch (_a.label) {
|
|
1557
2070
|
case 0:
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
2071
|
+
this.inputValidation({
|
|
2072
|
+
channelId: channelId,
|
|
2073
|
+
userId: mark.userId,
|
|
2074
|
+
messageId: mark.messageId,
|
|
2075
|
+
sortId: mark.sortId
|
|
2076
|
+
});
|
|
1562
2077
|
_a.label = 1;
|
|
1563
2078
|
|
|
1564
2079
|
case 1:
|
|
@@ -1569,13 +2084,14 @@ function () {
|
|
|
1569
2084
|
, (0, _mutations.updateSubscription)(channelId, mark, (0, _stringify["default"])(option))];
|
|
1570
2085
|
|
|
1571
2086
|
case 2:
|
|
2087
|
+
result = _a.sent();
|
|
1572
2088
|
return [2
|
|
1573
2089
|
/*return*/
|
|
1574
|
-
,
|
|
2090
|
+
, result["subscription"]];
|
|
1575
2091
|
|
|
1576
2092
|
case 3:
|
|
1577
|
-
|
|
1578
|
-
throw
|
|
2093
|
+
e_26 = _a.sent();
|
|
2094
|
+
throw e_26;
|
|
1579
2095
|
|
|
1580
2096
|
case 4:
|
|
1581
2097
|
return [2
|
|
@@ -1585,37 +2101,52 @@ function () {
|
|
|
1585
2101
|
});
|
|
1586
2102
|
});
|
|
1587
2103
|
};
|
|
1588
|
-
|
|
1589
|
-
|
|
2104
|
+
/**
|
|
2105
|
+
* Add members to the private channel.
|
|
2106
|
+
*
|
|
2107
|
+
* @async
|
|
2108
|
+
* @function addUsers
|
|
2109
|
+
* @param {string} channelId - An private channel id.
|
|
2110
|
+
* @param {string[]} userIds - An array of member ids to be added.
|
|
2111
|
+
* @param {any} options
|
|
2112
|
+
* @returns {Promise<any>}
|
|
2113
|
+
*/
|
|
2114
|
+
|
|
2115
|
+
|
|
2116
|
+
NCloudChat.prototype.addUsers = function (channelId, userIds, options) {
|
|
1590
2117
|
return __awaiter(this, void 0, void 0, function () {
|
|
1591
|
-
var
|
|
2118
|
+
var result, e_27;
|
|
1592
2119
|
return __generator(this, function (_a) {
|
|
1593
2120
|
switch (_a.label) {
|
|
1594
2121
|
case 0:
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
2122
|
+
this.inputValidation({
|
|
2123
|
+
channelId: channelId,
|
|
2124
|
+
userIds: userIds
|
|
2125
|
+
});
|
|
1599
2126
|
_a.label = 1;
|
|
1600
2127
|
|
|
1601
2128
|
case 1:
|
|
1602
2129
|
_a.trys.push([1, 3,, 4]);
|
|
1603
2130
|
|
|
1604
|
-
input = {
|
|
1605
|
-
members: memberIds
|
|
1606
|
-
};
|
|
1607
2131
|
return [4
|
|
1608
2132
|
/*yield*/
|
|
1609
|
-
, (0, _mutations.addChannelMembers)(channelId,
|
|
2133
|
+
, (0, _mutations.addChannelMembers)(channelId, userIds, options)];
|
|
1610
2134
|
|
|
1611
2135
|
case 2:
|
|
2136
|
+
result = _a.sent();
|
|
2137
|
+
|
|
2138
|
+
if (result["channel"]) {
|
|
2139
|
+
result["channel"]["id"] = this.ObjectId(result["channel"]["id"]);
|
|
2140
|
+
result["channel"]["user_id"]["id"] = this.ObjectId(result["channel"]["user_id"]["id"]);
|
|
2141
|
+
}
|
|
2142
|
+
|
|
1612
2143
|
return [2
|
|
1613
2144
|
/*return*/
|
|
1614
|
-
,
|
|
2145
|
+
, result["channel"]];
|
|
1615
2146
|
|
|
1616
2147
|
case 3:
|
|
1617
|
-
|
|
1618
|
-
throw
|
|
2148
|
+
e_27 = _a.sent();
|
|
2149
|
+
throw e_27;
|
|
1619
2150
|
|
|
1620
2151
|
case 4:
|
|
1621
2152
|
return [2
|
|
@@ -1625,17 +2156,28 @@ function () {
|
|
|
1625
2156
|
});
|
|
1626
2157
|
});
|
|
1627
2158
|
};
|
|
1628
|
-
|
|
1629
|
-
|
|
2159
|
+
/**
|
|
2160
|
+
* Remove members from the private channel.
|
|
2161
|
+
*
|
|
2162
|
+
* @async
|
|
2163
|
+
* @function removeUsers
|
|
2164
|
+
* @param {string} channelId - An private channel id.
|
|
2165
|
+
* @param {string[]} userIds - An array of the member ids to be deleted.
|
|
2166
|
+
* @param {any} options
|
|
2167
|
+
* @returns {Promise<any>}
|
|
2168
|
+
*/
|
|
2169
|
+
|
|
2170
|
+
|
|
2171
|
+
NCloudChat.prototype.removeUsers = function (channelId, userIds, options) {
|
|
1630
2172
|
return __awaiter(this, void 0, void 0, function () {
|
|
1631
|
-
var
|
|
2173
|
+
var result, e_28;
|
|
1632
2174
|
return __generator(this, function (_a) {
|
|
1633
2175
|
switch (_a.label) {
|
|
1634
2176
|
case 0:
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
2177
|
+
this.inputValidation({
|
|
2178
|
+
channelId: channelId,
|
|
2179
|
+
userIds: userIds
|
|
2180
|
+
});
|
|
1639
2181
|
_a.label = 1;
|
|
1640
2182
|
|
|
1641
2183
|
case 1:
|
|
@@ -1643,16 +2185,23 @@ function () {
|
|
|
1643
2185
|
|
|
1644
2186
|
return [4
|
|
1645
2187
|
/*yield*/
|
|
1646
|
-
, (0, _mutations.removeChannelMembers)(channelId,
|
|
2188
|
+
, (0, _mutations.removeChannelMembers)(channelId, userIds)];
|
|
1647
2189
|
|
|
1648
2190
|
case 2:
|
|
2191
|
+
result = _a.sent();
|
|
2192
|
+
|
|
2193
|
+
if (result["channel"]) {
|
|
2194
|
+
result["channel"]["id"] = this.ObjectId(result["channel"]["id"]);
|
|
2195
|
+
result["channel"]["user_id"]["id"] = this.ObjectId(result["channel"]["user_id"]["id"]);
|
|
2196
|
+
}
|
|
2197
|
+
|
|
1649
2198
|
return [2
|
|
1650
2199
|
/*return*/
|
|
1651
|
-
,
|
|
2200
|
+
, result["channel"]];
|
|
1652
2201
|
|
|
1653
2202
|
case 3:
|
|
1654
|
-
|
|
1655
|
-
throw
|
|
2203
|
+
e_28 = _a.sent();
|
|
2204
|
+
throw e_28;
|
|
1656
2205
|
|
|
1657
2206
|
case 4:
|
|
1658
2207
|
return [2
|
|
@@ -1662,6 +2211,16 @@ function () {
|
|
|
1662
2211
|
});
|
|
1663
2212
|
});
|
|
1664
2213
|
};
|
|
2214
|
+
/**
|
|
2215
|
+
* Emit "start typing" to a conneted socket.
|
|
2216
|
+
*
|
|
2217
|
+
* @async
|
|
2218
|
+
* @function startTyping
|
|
2219
|
+
* @param {string} channelId - The id of a channel that the typing is happening.
|
|
2220
|
+
* @param {string} threadId - The id of a thread that the typing is happening.
|
|
2221
|
+
* @returns {Promise<any>}
|
|
2222
|
+
*/
|
|
2223
|
+
|
|
1665
2224
|
|
|
1666
2225
|
NCloudChat.prototype.startTyping = function (channelId, threadId) {
|
|
1667
2226
|
if (threadId === void 0) {
|
|
@@ -1671,18 +2230,21 @@ function () {
|
|
|
1671
2230
|
return __awaiter(this, void 0, void 0, function () {
|
|
1672
2231
|
var data;
|
|
1673
2232
|
return __generator(this, function (_a) {
|
|
1674
|
-
if (!this.isConnected())
|
|
1675
|
-
|
|
1676
|
-
|
|
2233
|
+
if (!this.isConnected()) throw Error("You are not connected.");
|
|
2234
|
+
this.inputValidation({
|
|
2235
|
+
channelId: channelId,
|
|
2236
|
+
threadId: threadId
|
|
2237
|
+
});
|
|
1677
2238
|
|
|
1678
2239
|
try {
|
|
1679
2240
|
data = {
|
|
1680
2241
|
channelId: channelId,
|
|
1681
2242
|
threadId: threadId
|
|
1682
2243
|
};
|
|
2244
|
+
this.socket.emit("start typing", data);
|
|
1683
2245
|
return [2
|
|
1684
2246
|
/*return*/
|
|
1685
|
-
,
|
|
2247
|
+
, data];
|
|
1686
2248
|
} catch (e) {
|
|
1687
2249
|
throw e;
|
|
1688
2250
|
}
|
|
@@ -1693,6 +2255,16 @@ function () {
|
|
|
1693
2255
|
});
|
|
1694
2256
|
});
|
|
1695
2257
|
};
|
|
2258
|
+
/**
|
|
2259
|
+
* Emit "stop typing" to a connected socket.
|
|
2260
|
+
*
|
|
2261
|
+
* @async
|
|
2262
|
+
* @function
|
|
2263
|
+
* @param {string} channelId - The id of a channel that the typing is stopped.
|
|
2264
|
+
* @param {string} threadId - The id of a thread that the typing is stopped.
|
|
2265
|
+
* @returns {Promise<any>}
|
|
2266
|
+
*/
|
|
2267
|
+
|
|
1696
2268
|
|
|
1697
2269
|
NCloudChat.prototype.stopTyping = function (channelId, threadId) {
|
|
1698
2270
|
if (threadId === void 0) {
|
|
@@ -1702,18 +2274,21 @@ function () {
|
|
|
1702
2274
|
return __awaiter(this, void 0, void 0, function () {
|
|
1703
2275
|
var data;
|
|
1704
2276
|
return __generator(this, function (_a) {
|
|
1705
|
-
if (!this.isConnected())
|
|
1706
|
-
|
|
1707
|
-
|
|
2277
|
+
if (!this.isConnected()) throw Error("You are not connected.");
|
|
2278
|
+
this.inputValidation({
|
|
2279
|
+
channelId: channelId,
|
|
2280
|
+
threadId: threadId
|
|
2281
|
+
});
|
|
1708
2282
|
|
|
1709
2283
|
try {
|
|
1710
2284
|
data = {
|
|
1711
2285
|
channelId: channelId,
|
|
1712
2286
|
threadId: threadId
|
|
1713
2287
|
};
|
|
2288
|
+
this.socket.emit("stop typing", data);
|
|
1714
2289
|
return [2
|
|
1715
2290
|
/*return*/
|
|
1716
|
-
,
|
|
2291
|
+
, data];
|
|
1717
2292
|
} catch (e) {
|
|
1718
2293
|
throw e;
|
|
1719
2294
|
}
|
|
@@ -1724,6 +2299,17 @@ function () {
|
|
|
1724
2299
|
});
|
|
1725
2300
|
});
|
|
1726
2301
|
};
|
|
2302
|
+
/**
|
|
2303
|
+
* Ban a member from a channel.
|
|
2304
|
+
*
|
|
2305
|
+
* @async
|
|
2306
|
+
* @function banUser
|
|
2307
|
+
* @param {string} channelId - The id of a channel.
|
|
2308
|
+
* @param {string} memberId - The id of a member.
|
|
2309
|
+
* @param {any} options
|
|
2310
|
+
* @returns {Promise<any>}
|
|
2311
|
+
*/
|
|
2312
|
+
|
|
1727
2313
|
|
|
1728
2314
|
NCloudChat.prototype.banUser = function (channelId, memberId, options) {
|
|
1729
2315
|
if (options === void 0) {
|
|
@@ -1731,14 +2317,14 @@ function () {
|
|
|
1731
2317
|
}
|
|
1732
2318
|
|
|
1733
2319
|
return __awaiter(this, void 0, void 0, function () {
|
|
1734
|
-
var
|
|
2320
|
+
var memberBlock, e_29;
|
|
1735
2321
|
return __generator(this, function (_a) {
|
|
1736
2322
|
switch (_a.label) {
|
|
1737
2323
|
case 0:
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
2324
|
+
this.inputValidation({
|
|
2325
|
+
channelId: channelId,
|
|
2326
|
+
memberId: memberId
|
|
2327
|
+
});
|
|
1742
2328
|
_a.label = 1;
|
|
1743
2329
|
|
|
1744
2330
|
case 1:
|
|
@@ -1749,13 +2335,15 @@ function () {
|
|
|
1749
2335
|
, (0, _mutations.createMemberBlock)(channelId, memberId, (0, _stringify["default"])(options))];
|
|
1750
2336
|
|
|
1751
2337
|
case 2:
|
|
2338
|
+
memberBlock = _a.sent();
|
|
2339
|
+
if (memberBlock["memberBlock"]) memberBlock["memberBlock"]["id"] = this.ObjectId(memberBlock["memberBlock"]["id"]);
|
|
1752
2340
|
return [2
|
|
1753
2341
|
/*return*/
|
|
1754
|
-
,
|
|
2342
|
+
, memberBlock["memberBlock"]];
|
|
1755
2343
|
|
|
1756
2344
|
case 3:
|
|
1757
|
-
|
|
1758
|
-
throw
|
|
2345
|
+
e_29 = _a.sent();
|
|
2346
|
+
throw e_29;
|
|
1759
2347
|
|
|
1760
2348
|
case 4:
|
|
1761
2349
|
return [2
|
|
@@ -1765,17 +2353,143 @@ function () {
|
|
|
1765
2353
|
});
|
|
1766
2354
|
});
|
|
1767
2355
|
};
|
|
2356
|
+
/**
|
|
2357
|
+
* Unban a member from a channel.
|
|
2358
|
+
*
|
|
2359
|
+
* @async
|
|
2360
|
+
* @function unbanUser
|
|
2361
|
+
* @param {string} channelId - The id of a channel.
|
|
2362
|
+
* @param {string} memberId - The id of a member.
|
|
2363
|
+
* @returns {Promise<any>}
|
|
2364
|
+
*/
|
|
2365
|
+
|
|
1768
2366
|
|
|
1769
2367
|
NCloudChat.prototype.unbanUser = function (channelId, memberId) {
|
|
1770
2368
|
return __awaiter(this, void 0, void 0, function () {
|
|
1771
|
-
var
|
|
2369
|
+
var memberBlock, e_30;
|
|
2370
|
+
return __generator(this, function (_a) {
|
|
2371
|
+
switch (_a.label) {
|
|
2372
|
+
case 0:
|
|
2373
|
+
this.inputValidation({
|
|
2374
|
+
channelId: channelId,
|
|
2375
|
+
memberId: memberId
|
|
2376
|
+
});
|
|
2377
|
+
_a.label = 1;
|
|
2378
|
+
|
|
2379
|
+
case 1:
|
|
2380
|
+
_a.trys.push([1, 3,, 4]);
|
|
2381
|
+
|
|
2382
|
+
return [4
|
|
2383
|
+
/*yield*/
|
|
2384
|
+
, (0, _mutations.deleteMemberBlock)(channelId, memberId)];
|
|
2385
|
+
|
|
2386
|
+
case 2:
|
|
2387
|
+
memberBlock = _a.sent();
|
|
2388
|
+
if (memberBlock["memberBlock"]) memberBlock["memberBlock"]["id"] = this.ObjectId(memberBlock["memberBlock"]["id"]);
|
|
2389
|
+
return [2
|
|
2390
|
+
/*return*/
|
|
2391
|
+
, memberBlock["memberBlock"]];
|
|
2392
|
+
|
|
2393
|
+
case 3:
|
|
2394
|
+
e_30 = _a.sent();
|
|
2395
|
+
throw e_30;
|
|
2396
|
+
|
|
2397
|
+
case 4:
|
|
2398
|
+
return [2
|
|
2399
|
+
/*return*/
|
|
2400
|
+
];
|
|
2401
|
+
}
|
|
2402
|
+
});
|
|
2403
|
+
});
|
|
2404
|
+
};
|
|
2405
|
+
/**
|
|
2406
|
+
* Get data of a single pin from the endpoint.
|
|
2407
|
+
*
|
|
2408
|
+
* @async
|
|
2409
|
+
* @function getPin
|
|
2410
|
+
* @param {string} channelId - An id of the channel.
|
|
2411
|
+
* @param {string} id - An id of the pin.
|
|
2412
|
+
* @returns {Promise<any>} The data of the pin.
|
|
2413
|
+
*/
|
|
2414
|
+
|
|
2415
|
+
|
|
2416
|
+
NCloudChat.prototype.getPin = function (channelId, id) {
|
|
2417
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2418
|
+
var result, e_31;
|
|
1772
2419
|
return __generator(this, function (_a) {
|
|
1773
2420
|
switch (_a.label) {
|
|
1774
2421
|
case 0:
|
|
1775
|
-
|
|
1776
|
-
|
|
2422
|
+
this.inputValidation({
|
|
2423
|
+
channelId: channelId,
|
|
2424
|
+
pinId: id
|
|
2425
|
+
});
|
|
2426
|
+
_a.label = 1;
|
|
2427
|
+
|
|
2428
|
+
case 1:
|
|
2429
|
+
_a.trys.push([1, 3,, 4]);
|
|
2430
|
+
|
|
2431
|
+
return [4
|
|
2432
|
+
/*yield*/
|
|
2433
|
+
, (0, _queries.getPin)(channelId, id)];
|
|
2434
|
+
|
|
2435
|
+
case 2:
|
|
2436
|
+
result = _a.sent();
|
|
2437
|
+
|
|
2438
|
+
if (result) {
|
|
2439
|
+
result.id = this.ObjectId(result.id);
|
|
2440
|
+
|
|
2441
|
+
if (result["user_id"]) {
|
|
2442
|
+
result["user_id"]["id"] = this.ObjectId(result["user_id"]["id"]);
|
|
2443
|
+
}
|
|
1777
2444
|
}
|
|
1778
2445
|
|
|
2446
|
+
return [2
|
|
2447
|
+
/*return*/
|
|
2448
|
+
, result];
|
|
2449
|
+
|
|
2450
|
+
case 3:
|
|
2451
|
+
e_31 = _a.sent();
|
|
2452
|
+
throw e_31;
|
|
2453
|
+
|
|
2454
|
+
case 4:
|
|
2455
|
+
return [2
|
|
2456
|
+
/*return*/
|
|
2457
|
+
];
|
|
2458
|
+
}
|
|
2459
|
+
});
|
|
2460
|
+
});
|
|
2461
|
+
};
|
|
2462
|
+
/**
|
|
2463
|
+
* Get data of multiple pins.
|
|
2464
|
+
*
|
|
2465
|
+
* @async
|
|
2466
|
+
* @function getPins
|
|
2467
|
+
* @param {string} channelId - An id of the channel.
|
|
2468
|
+
* @param {string} filter - Field value for filter.
|
|
2469
|
+
* @param {string} sort - Field value for sorting.
|
|
2470
|
+
* @param {string} option - Optional option: ex) offset, per_page.
|
|
2471
|
+
* @returns {Promise<any[]>} An array of data of all channels.
|
|
2472
|
+
*/
|
|
2473
|
+
|
|
2474
|
+
|
|
2475
|
+
NCloudChat.prototype.getPins = function (channelId, filter, sort, option) {
|
|
2476
|
+
if (sort === void 0) {
|
|
2477
|
+
sort = {};
|
|
2478
|
+
}
|
|
2479
|
+
|
|
2480
|
+
if (option === void 0) {
|
|
2481
|
+
option = {};
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2485
|
+
var entries, channels, e_32;
|
|
2486
|
+
|
|
2487
|
+
var _this = this;
|
|
2488
|
+
|
|
2489
|
+
return __generator(this, function (_a) {
|
|
2490
|
+
switch (_a.label) {
|
|
2491
|
+
case 0:
|
|
2492
|
+
this.inputValidation({});
|
|
1779
2493
|
_a.label = 1;
|
|
1780
2494
|
|
|
1781
2495
|
case 1:
|
|
@@ -1783,16 +2497,32 @@ function () {
|
|
|
1783
2497
|
|
|
1784
2498
|
return [4
|
|
1785
2499
|
/*yield*/
|
|
1786
|
-
, (0,
|
|
2500
|
+
, (0, _queries.getPins)(channelId, (0, _stringify["default"])(filter), (0, _stringify["default"])(sort), (0, _stringify["default"])(option))];
|
|
1787
2501
|
|
|
1788
2502
|
case 2:
|
|
2503
|
+
entries = _a.sent();
|
|
2504
|
+
|
|
2505
|
+
if (entries["edges"]) {
|
|
2506
|
+
channels = entries["edges"].map(function (item) {
|
|
2507
|
+
var _a, _b;
|
|
2508
|
+
|
|
2509
|
+
if (item.node.user_id) item.node.user_id.id = _this.ObjectId((_b = (_a = item.node) === null || _a === void 0 ? void 0 : _a.user_id) === null || _b === void 0 ? void 0 : _b.id);
|
|
2510
|
+
return __assign(__assign({}, item.node), {
|
|
2511
|
+
id: _this.ObjectId(item.node.id)
|
|
2512
|
+
});
|
|
2513
|
+
});
|
|
2514
|
+
return [2
|
|
2515
|
+
/*return*/
|
|
2516
|
+
, channels];
|
|
2517
|
+
}
|
|
2518
|
+
|
|
1789
2519
|
return [2
|
|
1790
2520
|
/*return*/
|
|
1791
|
-
,
|
|
2521
|
+
, entries["edges"]];
|
|
1792
2522
|
|
|
1793
2523
|
case 3:
|
|
1794
|
-
|
|
1795
|
-
throw
|
|
2524
|
+
e_32 = _a.sent();
|
|
2525
|
+
throw e_32;
|
|
1796
2526
|
|
|
1797
2527
|
case 4:
|
|
1798
2528
|
return [2
|
|
@@ -1802,6 +2532,124 @@ function () {
|
|
|
1802
2532
|
});
|
|
1803
2533
|
});
|
|
1804
2534
|
};
|
|
2535
|
+
/**
|
|
2536
|
+
* Create a new pin.
|
|
2537
|
+
*
|
|
2538
|
+
* @async
|
|
2539
|
+
* @function createPin
|
|
2540
|
+
* @param {string} channelId - An id of the channel.
|
|
2541
|
+
* @param {PinInput} pin - Configuration options of the new pin.
|
|
2542
|
+
* @returns {Promise<any>} The data of the newly created pin.
|
|
2543
|
+
*/
|
|
2544
|
+
|
|
2545
|
+
|
|
2546
|
+
NCloudChat.prototype.createPin = function (channelId, pin) {
|
|
2547
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2548
|
+
var result, e_33;
|
|
2549
|
+
return __generator(this, function (_a) {
|
|
2550
|
+
switch (_a.label) {
|
|
2551
|
+
case 0:
|
|
2552
|
+
this.inputValidation({
|
|
2553
|
+
channelId: channelId,
|
|
2554
|
+
pinned: pin.pinned
|
|
2555
|
+
});
|
|
2556
|
+
_a.label = 1;
|
|
2557
|
+
|
|
2558
|
+
case 1:
|
|
2559
|
+
_a.trys.push([1, 3,, 4]);
|
|
2560
|
+
|
|
2561
|
+
return [4
|
|
2562
|
+
/*yield*/
|
|
2563
|
+
, (0, _mutations.createPin)(channelId, pin)];
|
|
2564
|
+
|
|
2565
|
+
case 2:
|
|
2566
|
+
result = _a.sent();
|
|
2567
|
+
|
|
2568
|
+
if (result["pin"]) {
|
|
2569
|
+
result["pin"]["id"] = this.ObjectId(result["pin"]["id"]);
|
|
2570
|
+
result["pin"]["user_id"]["id"] = this.ObjectId(result["pin"]["user_id"]["id"]);
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
return [2
|
|
2574
|
+
/*return*/
|
|
2575
|
+
, result["pin"]];
|
|
2576
|
+
|
|
2577
|
+
case 3:
|
|
2578
|
+
e_33 = _a.sent();
|
|
2579
|
+
throw e_33;
|
|
2580
|
+
|
|
2581
|
+
case 4:
|
|
2582
|
+
return [2
|
|
2583
|
+
/*return*/
|
|
2584
|
+
];
|
|
2585
|
+
}
|
|
2586
|
+
});
|
|
2587
|
+
});
|
|
2588
|
+
};
|
|
2589
|
+
/**
|
|
2590
|
+
* Update pin options.
|
|
2591
|
+
*
|
|
2592
|
+
* @async
|
|
2593
|
+
* @function updatePin
|
|
2594
|
+
* @param {string} channelId - An id of the channel.
|
|
2595
|
+
* @param {PinInput} pin - New options of the pin.
|
|
2596
|
+
* @returns {Promise<any>} The data of the updated pin.
|
|
2597
|
+
*/
|
|
2598
|
+
|
|
2599
|
+
|
|
2600
|
+
NCloudChat.prototype.updatePin = function (pinId, channelId, pin) {
|
|
2601
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2602
|
+
var result, e_34;
|
|
2603
|
+
return __generator(this, function (_a) {
|
|
2604
|
+
switch (_a.label) {
|
|
2605
|
+
case 0:
|
|
2606
|
+
this.inputValidation({
|
|
2607
|
+
channelId: channelId,
|
|
2608
|
+
pinned: pin.pinned
|
|
2609
|
+
});
|
|
2610
|
+
_a.label = 1;
|
|
2611
|
+
|
|
2612
|
+
case 1:
|
|
2613
|
+
_a.trys.push([1, 3,, 4]);
|
|
2614
|
+
|
|
2615
|
+
return [4
|
|
2616
|
+
/*yield*/
|
|
2617
|
+
, (0, _mutations.updatePin)(pinId, channelId, pin)];
|
|
2618
|
+
|
|
2619
|
+
case 2:
|
|
2620
|
+
result = _a.sent();
|
|
2621
|
+
|
|
2622
|
+
if (result["pin"]) {
|
|
2623
|
+
result["pin"]["id"] = this.ObjectId(result["pin"]["id"]);
|
|
2624
|
+
result["pin"]["user_id"]["id"] = this.ObjectId(result["pin"]["user_id"]["id"]);
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
return [2
|
|
2628
|
+
/*return*/
|
|
2629
|
+
, result["pin"]];
|
|
2630
|
+
|
|
2631
|
+
case 3:
|
|
2632
|
+
e_34 = _a.sent();
|
|
2633
|
+
throw e_34;
|
|
2634
|
+
|
|
2635
|
+
case 4:
|
|
2636
|
+
return [2
|
|
2637
|
+
/*return*/
|
|
2638
|
+
];
|
|
2639
|
+
}
|
|
2640
|
+
});
|
|
2641
|
+
});
|
|
2642
|
+
};
|
|
2643
|
+
|
|
2644
|
+
NCloudChat.prototype.getServerUrl = function () {
|
|
2645
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2646
|
+
return __generator(this, function (_a) {
|
|
2647
|
+
return [2
|
|
2648
|
+
/*return*/
|
|
2649
|
+
, _CoreManager["default"].get("SERVER_URL")];
|
|
2650
|
+
});
|
|
2651
|
+
});
|
|
2652
|
+
};
|
|
1805
2653
|
|
|
1806
2654
|
return NCloudChat;
|
|
1807
2655
|
}();
|