ncloudchat 1.0.8 → 1.0.11

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.
@@ -8,7 +8,7 @@ _Object$defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
10
 
11
- exports.createInviteMember = exports.deleteChannel = exports.updateChannel = exports.createChannel = void 0;
11
+ exports.removeChannelMembers = exports.addChannelMembers = exports.deleteChannel = exports.updateChannel = exports.createChannel = void 0;
12
12
 
13
13
  require("core-js/modules/es6.function.name");
14
14
 
@@ -175,7 +175,7 @@ var createChannel = function createChannel(channel) {
175
175
  projectId = _CoreManager["default"].get("PROJECT_ID");
176
176
  endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
177
177
  if (!channel.members) channel.members = [];
178
- query = "\n mutation (\n $projectId: String!, \n $name: String!, \n $type: String!,\n $uniqueId: String,\n $translation: Boolean,\n $push: Boolean,\n $linkUrl: String,\n $imageUrl: String,\n $id: String,\n $members: [String]\n ) {\n createChannel(\n input: { \n projectId: $projectId, \n name: $name, \n type: $type,\n id: $id,\n members: $members,\n uniqueId: $uniqueId,\n translation:$translation,\n push:$push,\n linkUrl:$linkUrl,\n imageUrl:$imageUrl\n }\n ) {\n channel {\n id\n project_id\n name\n user_id\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 ";
178
+ query = "\n mutation (\n $projectId: String!, \n $name: String!, \n $type: String!,\n $uniqueId: String,\n $translation: Boolean,\n $push: Boolean,\n $linkUrl: String,\n $imageUrl: String,\n $id: String,\n $members: [String]\n ) {\n createChannel(\n input: { \n projectId: $projectId, \n name: $name, \n type: $type,\n id: $id,\n members: $members,\n uniqueId: $uniqueId,\n translation:$translation,\n push:$push,\n linkUrl:$linkUrl,\n imageUrl:$imageUrl\n }\n ) {\n channel {\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 ";
179
179
  return [4
180
180
  /*yield*/
181
181
  , fetch(endpoint, {
@@ -316,7 +316,7 @@ var deleteChannel = function deleteChannel(channelId) {
316
316
 
317
317
  exports.deleteChannel = deleteChannel;
318
318
 
319
- var createInviteMember = function createInviteMember(channelId, memberIds) {
319
+ var addChannelMembers = function addChannelMembers(channelId, memberIds, options) {
320
320
  return __awaiter(void 0, void 0, void 0, function () {
321
321
  var token, projectId, endpoint, query;
322
322
  return __generator(this, function (_a) {
@@ -325,7 +325,7 @@ var createInviteMember = function createInviteMember(channelId, memberIds) {
325
325
  token = _CoreManager["default"].get("TOKEN");
326
326
  projectId = _CoreManager["default"].get("PROJECT_ID");
327
327
  endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
328
- query = "\n mutation ($projectId: String!, $channelId: String!, $memberIds: [String]!) {\n createInviteMember(input: {projectId: $projectId, channelId: $channelId, memberIds:$memberIds }) {\n channel {\n id\n project_id\n name\n user_id\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 ";
328
+ query = "\n mutation ($projectId: String!, $channelId: String!, $memberIds: [String]!) {\n addChannelMembers(input: {projectId: $projectId, channelId: $channelId, memberIds:$memberIds }) {\n channel {\n id\n project_id\n name\n user_id\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 ";
329
329
  return [4
330
330
  /*yield*/
331
331
  , fetch(endpoint, {
@@ -341,7 +341,8 @@ var createInviteMember = function createInviteMember(channelId, memberIds) {
341
341
  variables: {
342
342
  projectId: projectId,
343
343
  channelId: channelId,
344
- memberIds: memberIds
344
+ memberIds: memberIds,
345
+ options: options
345
346
  }
346
347
  })
347
348
  }).then(function (res) {
@@ -349,7 +350,7 @@ var createInviteMember = function createInviteMember(channelId, memberIds) {
349
350
  }).then(function (data) {
350
351
  if (data.errors) throw data.errors[0];
351
352
  if (data.code) throw data;
352
- return data.data.createInviteMember.channel;
353
+ return data.data.addChannelMembers.channel;
353
354
  })];
354
355
 
355
356
  case 1:
@@ -361,4 +362,52 @@ var createInviteMember = function createInviteMember(channelId, memberIds) {
361
362
  });
362
363
  };
363
364
 
364
- exports.createInviteMember = createInviteMember;
365
+ exports.addChannelMembers = addChannelMembers;
366
+
367
+ var removeChannelMembers = function removeChannelMembers(channelId, memberIds, options) {
368
+ return __awaiter(void 0, void 0, void 0, function () {
369
+ var token, projectId, endpoint, query;
370
+ return __generator(this, function (_a) {
371
+ switch (_a.label) {
372
+ case 0:
373
+ token = _CoreManager["default"].get("TOKEN");
374
+ projectId = _CoreManager["default"].get("PROJECT_ID");
375
+ endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
376
+ query = "\n mutation ($projectId: String!, $channelId: String!, $memberIds: [String]!) {\n removeChannelMembers(input: {projectId: $projectId, channelId: $channelId, memberIds:$memberIds }) {\n channel {\n id\n project_id\n name\n user_id\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 ";
377
+ return [4
378
+ /*yield*/
379
+ , fetch(endpoint, {
380
+ method: 'POST',
381
+ headers: {
382
+ 'Authorization': 'Bearer ' + token,
383
+ 'X-PROJECT-ID': projectId,
384
+ 'Content-Type': 'application/json',
385
+ 'Accept': 'application/json'
386
+ },
387
+ body: (0, _stringify["default"])({
388
+ query: query,
389
+ variables: {
390
+ projectId: projectId,
391
+ channelId: channelId,
392
+ memberIds: memberIds,
393
+ options: options
394
+ }
395
+ })
396
+ }).then(function (res) {
397
+ return res.json();
398
+ }).then(function (data) {
399
+ if (data.errors) throw data.errors[0];
400
+ if (data.code) throw data;
401
+ return data.data.removeChannelMembers.channel;
402
+ })];
403
+
404
+ case 1:
405
+ return [2
406
+ /*return*/
407
+ , _a.sent()];
408
+ }
409
+ });
410
+ });
411
+ };
412
+
413
+ exports.removeChannelMembers = removeChannelMembers;
@@ -163,7 +163,11 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
163
163
  }
164
164
  };
165
165
 
166
- var createSubscription = function createSubscription(channelId, language) {
166
+ var createSubscription = function createSubscription(channelId, option) {
167
+ if (option === void 0) {
168
+ option = "";
169
+ }
170
+
167
171
  return __awaiter(void 0, void 0, void 0, function () {
168
172
  var token, endpoint, projectId, query;
169
173
  return __generator(this, function (_a) {
@@ -172,7 +176,7 @@ var createSubscription = function createSubscription(channelId, language) {
172
176
  token = _CoreManager["default"].get("TOKEN");
173
177
  endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
174
178
  projectId = _CoreManager["default"].get('PROJECT_ID');
175
- query = "\n mutation (\n $projectId: String!, \n $channelId: String!,\n $language: String!,\n ) {\n createSubscription (\n input: {\n projectId: $projectId, \n channelId: $channelId,\n language: $language\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 ";
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 ";
176
180
  return [4
177
181
  /*yield*/
178
182
  , fetch(endpoint, {
@@ -188,7 +192,7 @@ var createSubscription = function createSubscription(channelId, language) {
188
192
  variables: {
189
193
  projectId: projectId,
190
194
  channelId: channelId,
191
- language: language
195
+ option: option
192
196
  }
193
197
  })
194
198
  }).then(function (res) {
@@ -260,7 +264,11 @@ var deleteSubscription = function deleteSubscription(channelId) {
260
264
 
261
265
  exports.deleteSubscription = deleteSubscription;
262
266
 
263
- var updateSubscription = function updateSubscription(channelId, mark) {
267
+ var updateSubscription = function updateSubscription(channelId, mark, option) {
268
+ if (option === void 0) {
269
+ option = "";
270
+ }
271
+
264
272
  return __awaiter(void 0, void 0, void 0, function () {
265
273
  var token, endpoint, projectId, query;
266
274
  return __generator(this, function (_a) {
@@ -269,7 +277,7 @@ var updateSubscription = function updateSubscription(channelId, mark) {
269
277
  token = _CoreManager["default"].get("TOKEN");
270
278
  endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
271
279
  projectId = _CoreManager["default"].get('PROJECT_ID');
272
- query = "\n mutation ($projectId: String!, $channelId: String!, $mark: MarkInput) {\n updateSubscription(input: {projectId: $projectId,channelId: $channelId, mark: $mark}) {\n subscription {\n id\n channel_id\n user_id\n language\n push\n online\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 ";
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 ";
273
281
  return [4
274
282
  /*yield*/
275
283
  , fetch(endpoint, {
@@ -285,7 +293,8 @@ var updateSubscription = function updateSubscription(channelId, mark) {
285
293
  variables: {
286
294
  projectId: projectId,
287
295
  channelId: channelId,
288
- mark: mark
296
+ mark: mark,
297
+ option: option
289
298
  }
290
299
  })
291
300
  }).then(function (res) {
@@ -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 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 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 ";
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 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 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 ";
242
242
  return [4
243
243
  /*yield*/
244
244
  , fetch(endpoint, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ncloudchat",
3
3
  "jsName": "ncloudchat",
4
- "version": "1.0.8",
4
+ "version": "1.0.11",
5
5
  "private": false,
6
6
  "description": "",
7
7
  "keywords": [
@@ -22,8 +22,8 @@
22
22
  "start": "npm run lint && webpack-dev-server --open --config webpack.dev.js",
23
23
  "lint": "tsc --noEmit && eslint --ext .ts",
24
24
  "server": "node test/server.js",
25
- "publish-dev": "aws --endpoint-url=https://kr.object.ncloudstorage.com s3 cp dist/ncloudchat.min.js s3://ncloudchat/dev/ --acl public-read",
26
- "publish": "aws --endpoint-url=https://kr.object.ncloudstorage.com s3 cp dist/ncloudchat.min.js s3://ncloudchat/ --acl public-read"
25
+ "deploy": "./deploy.sh dev",
26
+ "deploy-release": "./deploy.sh release"
27
27
  },
28
28
  "repository": {
29
29
  "type": "git"