ncloudchat 1.0.18 → 1.0.21

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.
Files changed (40) hide show
  1. package/esm/CloudChat.d.ts +2 -0
  2. package/esm/CloudChat.js +52 -8
  3. package/esm/CloudChat.js.map +1 -1
  4. package/esm/CoreManager.js.map +1 -1
  5. package/esm/mutations/channel.d.ts +1 -1
  6. package/esm/mutations/channel.js +7 -8
  7. package/esm/mutations/channel.js.map +1 -1
  8. package/esm/mutations/friend.js +4 -4
  9. package/esm/mutations/friend.js.map +1 -1
  10. package/esm/mutations/index.d.ts +1 -1
  11. package/esm/mutations/index.js +1 -1
  12. package/esm/mutations/index.js.map +1 -1
  13. package/esm/mutations/member.d.ts +4 -0
  14. package/esm/mutations/member.js +176 -0
  15. package/esm/mutations/member.js.map +1 -0
  16. package/esm/mutations/message.js +4 -0
  17. package/esm/mutations/message.js.map +1 -1
  18. package/esm/mutations/subscription.d.ts +1 -0
  19. package/esm/mutations/subscription.js +4 -3
  20. package/esm/mutations/subscription.js.map +1 -1
  21. package/esm/queries/channel.js +2 -2
  22. package/esm/queries/channel.js.map +1 -1
  23. package/esm/queries/friend.js +1 -1
  24. package/esm/queries/friend.js.map +1 -1
  25. package/esm/queries/subscription.js +2 -2
  26. package/esm/queries/subscription.js.map +1 -1
  27. package/lib/CloudChat.js +83 -10
  28. package/lib/mutations/channel.js +7 -8
  29. package/lib/mutations/friend.js +4 -4
  30. package/lib/mutations/index.js +3 -3
  31. package/lib/mutations/{user.js → member.js} +106 -2
  32. package/lib/mutations/message.js +8 -0
  33. package/lib/mutations/subscription.js +7 -4
  34. package/lib/queries/channel.js +2 -2
  35. package/lib/queries/friend.js +1 -1
  36. package/lib/queries/subscription.js +2 -2
  37. package/package.json +1 -1
  38. package/esm/mutations/user.d.ts +0 -1
  39. package/esm/mutations/user.js +0 -87
  40. package/esm/mutations/user.js.map +0 -1
@@ -8,7 +8,7 @@ _Object$defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
10
 
11
- exports.updateSubscription = exports.deleteSubscription = exports.createSubscription = void 0;
11
+ exports.updateSubscription = exports.deleteSubscription = exports.createSubscription = exports.getSubscriptionSchema = void 0;
12
12
 
13
13
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
14
14
 
@@ -163,6 +163,9 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
163
163
  }
164
164
  };
165
165
 
166
+ var getSubscriptionSchema = "\n id\n channel_id\n user_id\n language\n push\n mute\n online\n channel {\n name\n type\n image_url\n push\n disabled\n }\n mark {\n user_id\n message_id\n sort_id\n unread\n }\n uniquekey\n created_at\n updated_at\n";
167
+ exports.getSubscriptionSchema = getSubscriptionSchema;
168
+
166
169
  var createSubscription = function createSubscription(channelId, option) {
167
170
  if (option === void 0) {
168
171
  option = "";
@@ -176,7 +179,7 @@ var createSubscription = function createSubscription(channelId, option) {
176
179
  token = _CoreManager["default"].get("TOKEN");
177
180
  endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
178
181
  projectId = _CoreManager["default"].get('PROJECT_ID');
179
- query = "\n mutation (\n $projectId: String!, \n $channelId: String!,\n $option: String,\n ) {\n createSubscription (\n input: {\n projectId: $projectId, \n channelId: $channelId,\n option: $option\n }\n ) {\n subscription {\n id\n channel_id\n user_id\n language\n push\n mute\n online\n uniquekey\n created_at\n updated_at\n }\n }\n }\n ";
182
+ query = "\n mutation (\n $projectId: String!, \n $channelId: String!,\n $option: String,\n ) {\n createSubscription (\n input: {\n projectId: $projectId, \n channelId: $channelId,\n option: $option\n }\n ) {\n subscription {\n " + getSubscriptionSchema + "\n }\n }\n }\n ";
180
183
  return [4
181
184
  /*yield*/
182
185
  , fetch(endpoint, {
@@ -225,7 +228,7 @@ var deleteSubscription = function deleteSubscription(channelId) {
225
228
  token = _CoreManager["default"].get("TOKEN");
226
229
  endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
227
230
  projectId = _CoreManager["default"].get('PROJECT_ID');
228
- query = "\n mutation (\n $projectId: String!, \n $channelId: String!\n ) {\n deleteSubscription (\n input: {\n projectId: $projectId, \n channelId: $channelId\n }\n ) {\n subscription {\n id\n channel_id\n user_id\n language\n push\n online\n uniquekey\n created_at\n updated_at\n }\n }\n }\n ";
231
+ query = "\n mutation (\n $projectId: String!, \n $channelId: String!\n ) {\n deleteSubscription (\n input: {\n projectId: $projectId, \n channelId: $channelId\n }\n ) {\n subscription {\n " + getSubscriptionSchema + "\n }\n }\n }\n ";
229
232
  return [4
230
233
  /*yield*/
231
234
  , fetch(endpoint, {
@@ -277,7 +280,7 @@ var updateSubscription = function updateSubscription(channelId, mark, option) {
277
280
  token = _CoreManager["default"].get("TOKEN");
278
281
  endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
279
282
  projectId = _CoreManager["default"].get('PROJECT_ID');
280
- query = "\n mutation ($projectId: String!, $channelId: String!, $mark: MarkInput, $option: String!) {\n updateSubscription(input: {projectId: $projectId,channelId: $channelId, mark: $mark, option: $option}) {\n subscription {\n id\n channel_id\n user_id\n language\n push\n online\n mute\n uniquekey\n mark {\n user_id\n message_id\n sort_id\n unread\n }\n created_at\n updated_at\n }\n }\n }\n ";
283
+ query = "\n mutation ($projectId: String!, $channelId: String!, $mark: MarkInput, $option: String!) {\n updateSubscription(input: {projectId: $projectId, channelId: $channelId, mark: $mark, option: $option}) {\n subscription {\n " + getSubscriptionSchema + "\n }\n }\n }\n ";
281
284
  return [4
282
285
  /*yield*/
283
286
  , fetch(endpoint, {
@@ -180,7 +180,7 @@ var getChannel = function getChannel(id) {
180
180
  /*return*/
181
181
  , null];
182
182
  endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
183
- query = "\n query channel ($projectId: String!, $id: String!) {\n channel(projectId: $projectId, id:$id) {\n id\n project_id\n name\n user_id { \n id\n name\n nickname\n profile\n device_type\n language\n }\n last_message {\n message_id\n sort_id\n project_id\n channel_id\n message_type\n mentions\n mentions_everyone\n has\n sender {\n id\n name\n profile\n }\n admin {\n id\n name\n profile\n }\n content\n created_at\n }\n unique_id\n type\n translation\n members\n push\n link_url\n image_url \n created_at\n updated_at\n }\n }\n ";
183
+ query = "\n query channel ($projectId: String!, $id: String!) {\n channel(projectId: $projectId, id:$id) {\n id\n project_id\n name\n user_id { \n id\n name\n profile\n device_type\n language\n }\n last_message {\n message_id\n sort_id\n project_id\n channel_id\n message_type\n mentions\n mentions_everyone\n has\n sender {\n id\n name\n profile\n }\n admin {\n id\n name\n profile\n }\n content\n created_at\n }\n unique_id\n type\n translation\n members\n push\n link_url\n image_url \n created_at\n updated_at\n }\n }\n ";
184
184
  return [4
185
185
  /*yield*/
186
186
  , fetch(endpoint, {
@@ -238,7 +238,7 @@ var getChannels = function getChannels(filter, sort, option) {
238
238
  /*return*/
239
239
  , null];
240
240
  endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
241
- query = "\n query channels ($projectId: String!, $filter: String!, $sort: String, $option:String) {\n channels(projectId: $projectId, filter:$filter, sort:$sort, option:$option) {\n totalCount\n edges {\n node {\n id\n project_id\n name\n user_id { \n id\n name\n nickname\n profile\n device_type\n language\n }\n last_message {\n message_id\n sort_id\n project_id\n channel_id\n message_type\n mentions\n mentions_everyone\n has\n sender {\n id\n name\n profile\n }\n admin {\n id\n name\n profile\n }\n content\n }\n unique_id\n type\n translation\n members\n push\n link_url\n image_url \n created_at\n updated_at\n }\n }\n }\n }\n ";
241
+ query = "\n query channels ($projectId: String!, $filter: String!, $sort: String, $option:String) {\n channels(projectId: $projectId, filter:$filter, sort:$sort, option:$option) {\n totalCount\n edges {\n node {\n id\n project_id\n name\n user_id { \n id\n name\n profile\n device_type\n language\n }\n last_message {\n message_id\n sort_id\n project_id\n channel_id\n message_type\n mentions\n mentions_everyone\n has\n sender {\n id\n name\n profile\n }\n admin {\n id\n name\n profile\n }\n content\n }\n unique_id\n type\n translation\n members\n push\n link_url\n image_url \n created_at\n updated_at\n }\n }\n }\n }\n ";
242
242
  return [4
243
243
  /*yield*/
244
244
  , fetch(endpoint, {
@@ -178,7 +178,7 @@ var getFriendships = function getFriendships(filter, sort, option) {
178
178
  /*return*/
179
179
  , null];
180
180
  endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
181
- lquery = "\n query friendships ($projectId: String!, $filter: String!, $sort: String, $option: String) {\n friendships(projectId: $projectId, filter:$filter, sort:$sort, option: $option) {\n totalCount\n edges {\n node {\n project_id\n id\n status\n user {\n id\n nickname\n profile\n }\n friend {\n id\n nickname\n profile\n }\n user_id\n friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n }\n ";
181
+ lquery = "\n query friendships ($projectId: String!, $filter: String!, $sort: String, $option: String) {\n friendships(projectId: $projectId, filter:$filter, sort:$sort, option: $option) {\n totalCount\n edges {\n node {\n project_id\n id\n status\n user {\n id\n name\n profile\n }\n friend {\n id\n name\n profile\n }\n user_id\n friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n }\n ";
182
182
  return [4
183
183
  /*yield*/
184
184
  , fetch(endpoint, {
@@ -180,7 +180,7 @@ var getSubscription = function getSubscription(channelId, id) {
180
180
  /*return*/
181
181
  , null];
182
182
  endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
183
- query = "\n query subscription ($projectId: String!,$channelId: String!, $id: String!) {\n subscription(projectId: $projectId, channelId: $channelId, id:$id) {\n id\n user {\n nickname\n profile\n country\n }\n mark {\n user_id\n message_id\n sort_id\n }\n channel_id\n user_id\n online\n push\n created_at\n }\n }\n ";
183
+ query = "\n query subscription ($projectId: String!,$channelId: String!, $id: String!) {\n subscription(projectId: $projectId, channelId: $channelId, id:$id) {\n id\n user {\n name\n profile\n country\n }\n mark {\n user_id\n message_id\n sort_id\n }\n channel_id\n user_id\n online\n push\n created_at\n }\n }\n ";
184
184
  return [4
185
185
  /*yield*/
186
186
  , fetch(endpoint, {
@@ -237,7 +237,7 @@ var getSubscriptions = function getSubscriptions(filter, sort, option) {
237
237
  /*return*/
238
238
  , null];
239
239
  endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
240
- query = "\n query subscriptions ($projectId: String!, $option: String!, $filter: String!, $sort: String ) {\n subscriptions (projectId: $projectId, option:$option, filter:$filter, sort:$sort) {\n totalCount\n edges {\n node {\n id\n user {\n nickname\n profile\n country\n }\n channel_id\n user_id\n online\n push\n created_at\n }\n }\n }\n }\n ";
240
+ query = "\n query subscriptions ($projectId: String!, $option: String!, $filter: String!, $sort: String ) {\n subscriptions (projectId: $projectId, option:$option, filter:$filter, sort:$sort) {\n totalCount\n edges {\n node {\n id\n user {\n name\n profile\n country\n }\n channel_id\n user_id\n online\n push\n created_at\n }\n }\n }\n }\n ";
241
241
  return [4
242
242
  /*yield*/
243
243
  , fetch(endpoint, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ncloudchat",
3
3
  "jsName": "ncloudchat",
4
- "version": "1.0.18",
4
+ "version": "1.0.21",
5
5
  "private": false,
6
6
  "description": "",
7
7
  "keywords": [
@@ -1 +0,0 @@
1
- export declare const login: (user_id: string, name?: string, profile?: string, token?: string) => Promise<any>;
@@ -1,87 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- import CoreManager from '../CoreManager';
38
- export var login = function (user_id, name, profile, token) {
39
- if (name === void 0) { name = ''; }
40
- if (profile === void 0) { profile = ''; }
41
- if (token === void 0) { token = ''; }
42
- return __awaiter(void 0, void 0, void 0, function () {
43
- var projectId, endpoint, mutation;
44
- return __generator(this, function (_a) {
45
- switch (_a.label) {
46
- case 0:
47
- CoreManager.set("TOKEN", token);
48
- projectId = CoreManager.get("PROJECT_ID");
49
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
50
- mutation = "mutation login ($projectId: String!, $userId: String!, $name: String, $profile: String) {\n login(input :{ projectId: $projectId, userId:$userId, name:$name, profile:$profile}) {\n token\n }\n }";
51
- return [4 /*yield*/, fetch(endpoint, {
52
- method: 'POST',
53
- headers: {
54
- 'Authorization': 'Bearer ' + token,
55
- 'X-PROJECT-ID': projectId,
56
- 'Content-Type': 'application/json',
57
- 'Accept': 'application/json'
58
- },
59
- body: JSON.stringify({
60
- query: mutation,
61
- variables: {
62
- projectId: projectId,
63
- userId: user_id,
64
- name: name,
65
- profile: profile,
66
- token: token
67
- }
68
- })
69
- })
70
- .then(function (res) { return res.json(); })
71
- .then(function (data) {
72
- if (data.errors)
73
- throw data.errors[0];
74
- if (data.code)
75
- throw data;
76
- else if (data.data.login.token) {
77
- return data.data.login.token;
78
- }
79
- else
80
- return false;
81
- })];
82
- case 1: return [2 /*return*/, _a.sent()];
83
- }
84
- });
85
- });
86
- };
87
- //# sourceMappingURL=user.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/mutations/user.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,IAAM,KAAK,GAAG,UAAO,OAAe,EAAE,IAAiB,EAAE,OAAmB,EAAE,KAAiB;IAAzD,qBAAA,EAAA,SAAiB;IAAE,wBAAA,EAAA,YAAmB;IAAE,sBAAA,EAAA,UAAiB;;;;;;oBAClG,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;oBAC1B,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;oBAC1C,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;oBACtD,QAAQ,GAAG,gOAIf,CAAC;oBACI,qBAAM,KAAK,CACd,QAAQ,EAAE;4BACV,MAAM,EAAE,MAAM;4BACd,OAAO,EAAE;gCACL,eAAe,EAAG,SAAS,GAAG,KAAK;gCACnC,cAAc,EAAG,SAAS;gCAC1B,cAAc,EAAE,kBAAkB;gCAClC,QAAQ,EAAE,kBAAkB;6BAC/B;4BACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gCACjB,KAAK,EAAE,QAAQ;gCACf,SAAS,EAAE;oCACP,SAAS,WAAA;oCACT,MAAM,EAAE,OAAO;oCACf,IAAI,MAAA;oCACJ,OAAO,SAAA;oCACP,KAAK,OAAA;iCACP;6BACH,CAAC;yBACP,CAAC;6BACD,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC;6BACvB,IAAI,CAAC,UAAA,IAAI;4BAEN,IAAG,IAAI,CAAC,MAAM;gCAAE,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;4BACrC,IAAG,IAAI,CAAC,IAAI;gCAAE,MAAM,IAAI,CAAC;iCACpB,IAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;gCAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;6BAChC;;gCAEG,OAAO,KAAK,CAAC;wBACrB,CAAC,CAAC,EAAA;wBA9BF,sBAAO,SA8BL,EAAC;;;;CACN,CAAA"}