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