ncloudchat 0.0.26-beta → 0.0.29-beta

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 (65) hide show
  1. package/esm/mutations/channel.js +16 -8
  2. package/esm/mutations/channel.js.map +1 -1
  3. package/esm/mutations/friend.js +10 -4
  4. package/esm/mutations/friend.js.map +1 -1
  5. package/esm/mutations/index.d.ts +0 -3
  6. package/esm/mutations/index.js +0 -3
  7. package/esm/mutations/index.js.map +1 -1
  8. package/esm/mutations/invite.js +5 -0
  9. package/esm/mutations/invite.js.map +1 -1
  10. package/esm/mutations/message.js +5 -2
  11. package/esm/mutations/message.js.map +1 -1
  12. package/esm/mutations/subscription.js +6 -3
  13. package/esm/mutations/subscription.js.map +1 -1
  14. package/esm/mutations/user.js +5 -2
  15. package/esm/mutations/user.js.map +1 -1
  16. package/esm/queries/channel.js +9 -0
  17. package/esm/queries/channel.js.map +1 -1
  18. package/esm/queries/friend.js +5 -0
  19. package/esm/queries/friend.js.map +1 -1
  20. package/esm/queries/index.d.ts +0 -2
  21. package/esm/queries/index.js +0 -2
  22. package/esm/queries/index.js.map +1 -1
  23. package/esm/queries/member.js +5 -0
  24. package/esm/queries/member.js.map +1 -1
  25. package/esm/queries/message.js +13 -0
  26. package/esm/queries/message.js.map +1 -1
  27. package/esm/queries/project.js +1 -0
  28. package/esm/queries/project.js.map +1 -1
  29. package/esm/queries/subscription.js +10 -0
  30. package/esm/queries/subscription.js.map +1 -1
  31. package/lib/mutations/channel.js +12 -16
  32. package/lib/mutations/friend.js +8 -8
  33. package/lib/mutations/index.js +0 -39
  34. package/lib/mutations/invite.js +3 -0
  35. package/lib/mutations/message.js +4 -4
  36. package/lib/mutations/subscription.js +5 -6
  37. package/lib/mutations/user.js +7 -1
  38. package/lib/queries/channel.js +7 -0
  39. package/lib/queries/friend.js +4 -0
  40. package/lib/queries/index.js +0 -26
  41. package/lib/queries/member.js +4 -0
  42. package/lib/queries/message.js +7 -0
  43. package/lib/queries/project.js +1 -0
  44. package/lib/queries/subscription.js +6 -0
  45. package/package.json +1 -1
  46. package/esm/mutations/memberinvitation.d.ts +0 -2
  47. package/esm/mutations/memberinvitation.js +0 -103
  48. package/esm/mutations/memberinvitation.js.map +0 -1
  49. package/esm/mutations/memberreport.d.ts +0 -10
  50. package/esm/mutations/memberreport.js +0 -110
  51. package/esm/mutations/memberreport.js.map +0 -1
  52. package/esm/mutations/messageread.d.ts +0 -1
  53. package/esm/mutations/messageread.js +0 -69
  54. package/esm/mutations/messageread.js.map +0 -1
  55. package/esm/queries/memberinvitation.d.ts +0 -2
  56. package/esm/queries/memberinvitation.js +0 -110
  57. package/esm/queries/memberinvitation.js.map +0 -1
  58. package/esm/queries/messageread.d.ts +0 -1
  59. package/esm/queries/messageread.js +0 -74
  60. package/esm/queries/messageread.js.map +0 -1
  61. package/lib/mutations/memberinvitation.js +0 -271
  62. package/lib/mutations/memberreport.js +0 -272
  63. package/lib/mutations/messageread.js +0 -215
  64. package/lib/queries/memberinvitation.js +0 -273
  65. package/lib/queries/messageread.js +0 -219
@@ -1 +1 @@
1
- {"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/queries/subscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAQ,EAAC,QAAQ,EAAC,MAAO,SAAS,CAAC;AACnC,MAAM,CAAC,IAAO,eAAe,GAAG,UAAO,SAAiB,EAAE,EAAU;;;;;gBAC1D,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACvC,IAAG,CAAC,KAAK;oBAAE,sBAAO,IAAI,EAAC;gBACjB,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAChD,IAAG,CAAC,SAAS;oBAAE,sBAAO,IAAI,EAAC;gBACrB,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,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AAE;wBACV,MAAM,EAAE,MAAM;wBACd,OAAO,EAAE;4BACL,eAAe,EAAG,SAAS,GAAG,KAAK;4BACnC,cAAc,EAAG,SAAS;4BAC1B,cAAc,EAAE,kBAAkB;4BAClC,QAAQ,EAAE,kBAAkB;yBAC/B;wBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACjB,KAAK,OAAA;4BACL,SAAS,EAAE;gCACP,SAAS,WAAA;gCACT,MAAM,QAAA;gCACN,MAAM,QAAA;gCACN,IAAI,MAAA;6BACN;yBACH,CAAC;qBACP,CAAC;yBACD,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC;yBACvB,IAAI,CAAC,UAAA,IAAI;wBACN,IAAG,IAAI,CAAC,MAAM;4BAAE,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;wBACrC,IAAG,IAAI,CAAC,IAAI;4BAAE,MAAM,IAAI,CAAC;wBACzB,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;oBACzC,CAAC,CAAC,EAAA;oBAxBF,sBAAO,SAwBL,EAAC;;;KACN,CAAA"}
@@ -182,6 +182,7 @@ var createChannel = function createChannel(channel) {
182
182
  method: 'POST',
183
183
  headers: {
184
184
  'Authorization': 'Bearer ' + token,
185
+ 'X-PROJECT-ID': projectId,
185
186
  'Content-Type': 'application/json',
186
187
  'Accept': 'application/json'
187
188
  },
@@ -202,10 +203,8 @@ var createChannel = function createChannel(channel) {
202
203
  }).then(function (res) {
203
204
  return res.json();
204
205
  }).then(function (data) {
205
- if (data.errors) {
206
- throw data.errors[0];
207
- }
208
-
206
+ if (data.errors) throw data.errors[0];
207
+ if (data.code) throw data;
209
208
  return data.data.createChannel.channel;
210
209
  })];
211
210
 
@@ -238,6 +237,7 @@ var updateChannel = function updateChannel(channelId, channel) {
238
237
  method: 'POST',
239
238
  headers: {
240
239
  'Authorization': 'Bearer ' + token,
240
+ 'X-PROJECT-ID': projectId,
241
241
  'Content-Type': 'application/json',
242
242
  'Accept': 'application/json'
243
243
  },
@@ -254,10 +254,8 @@ var updateChannel = function updateChannel(channelId, channel) {
254
254
  }).then(function (res) {
255
255
  return res.json();
256
256
  }).then(function (data) {
257
- if (data.errors) {
258
- throw data.errors[0];
259
- }
260
-
257
+ if (data.errors) throw data.errors[0];
258
+ if (data.code) throw data;
261
259
  return data.data.updateChannel.channel;
262
260
  })];
263
261
 
@@ -288,6 +286,7 @@ var deleteChannel = function deleteChannel(channelId) {
288
286
  method: 'POST',
289
287
  headers: {
290
288
  'Authorization': 'Bearer ' + token,
289
+ 'X-PROJECT-ID': projectId,
291
290
  'Content-Type': 'application/json',
292
291
  'Accept': 'application/json'
293
292
  },
@@ -301,10 +300,8 @@ var deleteChannel = function deleteChannel(channelId) {
301
300
  }).then(function (res) {
302
301
  return res.json();
303
302
  }).then(function (data) {
304
- if (data.errors) {
305
- throw data.errors[0];
306
- }
307
-
303
+ if (data.errors) throw data.errors[0];
304
+ if (data.code) throw data;
308
305
  return data.data.deleteChannel.channel;
309
306
  })];
310
307
 
@@ -335,6 +332,7 @@ var createInviteMember = function createInviteMember(channelId, memberIds) {
335
332
  method: 'POST',
336
333
  headers: {
337
334
  'Authorization': 'Bearer ' + token,
335
+ 'X-PROJECT-ID': projectId,
338
336
  'Content-Type': 'application/json',
339
337
  'Accept': 'application/json'
340
338
  },
@@ -349,10 +347,8 @@ var createInviteMember = function createInviteMember(channelId, memberIds) {
349
347
  }).then(function (res) {
350
348
  return res.json();
351
349
  }).then(function (data) {
352
- if (data.errors) {
353
- throw data.errors[0];
354
- }
355
-
350
+ if (data.errors) throw data.errors[0];
351
+ if (data.code) throw data;
356
352
  return data.data.createInviteMember.channel;
357
353
  })];
358
354
 
@@ -179,6 +179,7 @@ var requestFriend = function requestFriend(friendId) {
179
179
  method: 'POST',
180
180
  headers: {
181
181
  'Authorization': 'Bearer ' + token,
182
+ 'X-PROJECT-ID': projectId,
182
183
  'Content-Type': 'application/json',
183
184
  'Accept': 'application/json'
184
185
  },
@@ -226,6 +227,7 @@ var acceptFriend = function acceptFriend(friendId) {
226
227
  method: 'POST',
227
228
  headers: {
228
229
  'Authorization': 'Bearer ' + token,
230
+ 'X-PROJECT-ID': projectId,
229
231
  'Content-Type': 'application/json',
230
232
  'Accept': 'application/json'
231
233
  },
@@ -273,6 +275,7 @@ var rejectFriend = function rejectFriend(friendId) {
273
275
  method: 'POST',
274
276
  headers: {
275
277
  'Authorization': 'Bearer ' + token,
278
+ 'X-PROJECT-ID': projectId,
276
279
  'Content-Type': 'application/json',
277
280
  'Accept': 'application/json'
278
281
  },
@@ -286,10 +289,8 @@ var rejectFriend = function rejectFriend(friendId) {
286
289
  }).then(function (res) {
287
290
  return res.json();
288
291
  }).then(function (data) {
289
- if (data.errors) {
290
- throw data.errors[0];
291
- }
292
-
292
+ if (data.errors) throw data.errors[0];
293
+ if (data.code) throw data;
293
294
  return data.data.rejectFriend.friendship;
294
295
  })];
295
296
 
@@ -320,6 +321,7 @@ var removeFriend = function removeFriend(friendId) {
320
321
  method: 'POST',
321
322
  headers: {
322
323
  'Authorization': 'Bearer ' + token,
324
+ 'X-PROJECT-ID': projectId,
323
325
  'Content-Type': 'application/json',
324
326
  'Accept': 'application/json'
325
327
  },
@@ -333,10 +335,8 @@ var removeFriend = function removeFriend(friendId) {
333
335
  }).then(function (res) {
334
336
  return res.json();
335
337
  }).then(function (data) {
336
- if (data.errors) {
337
- throw data.errors[0];
338
- }
339
-
338
+ if (data.errors) throw data.errors[0];
339
+ if (data.code) throw data;
340
340
  return data.data.removeFriend.friendship;
341
341
  })];
342
342
 
@@ -86,43 +86,4 @@ _Object$keys(_subscription).forEach(function (key) {
86
86
  return _subscription[key];
87
87
  }
88
88
  });
89
- });
90
-
91
- var _messageread = require("./messageread");
92
-
93
- _Object$keys(_messageread).forEach(function (key) {
94
- if (key === "default" || key === "__esModule") return;
95
-
96
- _Object$defineProperty(exports, key, {
97
- enumerable: true,
98
- get: function get() {
99
- return _messageread[key];
100
- }
101
- });
102
- });
103
-
104
- var _memberinvitation = require("./memberinvitation");
105
-
106
- _Object$keys(_memberinvitation).forEach(function (key) {
107
- if (key === "default" || key === "__esModule") return;
108
-
109
- _Object$defineProperty(exports, key, {
110
- enumerable: true,
111
- get: function get() {
112
- return _memberinvitation[key];
113
- }
114
- });
115
- });
116
-
117
- var _memberreport = require("./memberreport");
118
-
119
- _Object$keys(_memberreport).forEach(function (key) {
120
- if (key === "default" || key === "__esModule") return;
121
-
122
- _Object$defineProperty(exports, key, {
123
- enumerable: true,
124
- get: function get() {
125
- return _memberreport[key];
126
- }
127
- });
128
89
  });
@@ -179,6 +179,7 @@ var createInvite = function createInvite(channelId, friendIds) {
179
179
  method: 'POST',
180
180
  headers: {
181
181
  'Authorization': 'Bearer ' + token,
182
+ 'X-PROJECT-ID': projectId,
182
183
  'Content-Type': 'application/json',
183
184
  'Accept': 'application/json'
184
185
  },
@@ -193,6 +194,8 @@ var createInvite = function createInvite(channelId, friendIds) {
193
194
  }).then(function (res) {
194
195
  return res.json();
195
196
  }).then(function (data) {
197
+ if (data.errors) throw data.errors[0];
198
+ if (data.code) throw data;
196
199
  return data.data.createFriend.friendship;
197
200
  })];
198
201
 
@@ -179,6 +179,7 @@ var translate = function translate(channelId, srcLang, targetLang, text) {
179
179
  method: 'POST',
180
180
  headers: {
181
181
  'Authorization': 'Bearer ' + token,
182
+ 'X-PROJECT-ID': projectId,
182
183
  'Content-Type': 'application/json',
183
184
  'Accept': 'application/json'
184
185
  },
@@ -195,10 +196,8 @@ var translate = function translate(channelId, srcLang, targetLang, text) {
195
196
  }).then(function (res) {
196
197
  return res.json();
197
198
  }).then(function (data) {
198
- if (data.errors) {
199
- throw data.errors[0];
200
- }
201
-
199
+ if (data.errors) throw data.errors[0];
200
+ if (data.code) throw data;
202
201
  return data;
203
202
  })];
204
203
 
@@ -232,6 +231,7 @@ var upload = function upload(channelId, file) {
232
231
  method: 'POST',
233
232
  headers: {
234
233
  'Authorization': 'Bearer ' + token,
234
+ 'X-PROJECT-ID': projectId,
235
235
  'projectid': projectId
236
236
  },
237
237
  body: form
@@ -179,6 +179,7 @@ var createSubscription = function createSubscription(channelId, language) {
179
179
  method: 'POST',
180
180
  headers: {
181
181
  'Authorization': 'Bearer ' + token,
182
+ 'X-PROJECT-ID': projectId,
182
183
  'Content-Type': 'application/json',
183
184
  'Accept': 'application/json'
184
185
  },
@@ -227,6 +228,7 @@ var deleteSubscription = function deleteSubscription(channelId) {
227
228
  method: 'POST',
228
229
  headers: {
229
230
  'Authorization': 'Bearer ' + token,
231
+ 'X-PROJECT-ID': projectId,
230
232
  'Content-Type': 'application/json',
231
233
  'Accept': 'application/json'
232
234
  },
@@ -274,6 +276,7 @@ var updateSubscription = function updateSubscription(channelId, mark) {
274
276
  method: 'POST',
275
277
  headers: {
276
278
  'Authorization': 'Bearer ' + token,
279
+ 'X-PROJECT-ID': projectId,
277
280
  'Content-Type': 'application/json',
278
281
  'Accept': 'application/json'
279
282
  },
@@ -288,12 +291,8 @@ var updateSubscription = function updateSubscription(channelId, mark) {
288
291
  }).then(function (res) {
289
292
  return res.json();
290
293
  }).then(function (data) {
291
- console.log(data);
292
-
293
- if (data.errors) {
294
- throw data.errors[0];
295
- }
296
-
294
+ if (data.errors) throw data.errors[0];
295
+ if (data.code) throw data;
297
296
  return data.data.updateSubscription.subscription;
298
297
  })];
299
298
 
@@ -181,6 +181,8 @@ var login = function login(user_id, name, profile, token) {
181
181
  return __generator(this, function (_a) {
182
182
  switch (_a.label) {
183
183
  case 0:
184
+ _CoreManager["default"].set("TOKEN", token);
185
+
184
186
  projectId = _CoreManager["default"].get("PROJECT_ID");
185
187
  endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
186
188
  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 }";
@@ -190,6 +192,7 @@ var login = function login(user_id, name, profile, token) {
190
192
  method: 'POST',
191
193
  headers: {
192
194
  'Authorization': 'Bearer ' + token,
195
+ 'X-PROJECT-ID': projectId,
193
196
  'Content-Type': 'application/json',
194
197
  'Accept': 'application/json'
195
198
  },
@@ -206,7 +209,10 @@ var login = function login(user_id, name, profile, token) {
206
209
  }).then(function (res) {
207
210
  return res.json();
208
211
  }).then(function (data) {
209
- if (data.errors) throw data.errors[0];else if (data.message) throw data;else if (data.data.login.token) return data.data.login.token;else return false;
212
+ if (data.errors) throw data.errors[0];
213
+ if (data.code) throw data;else if (data.data.login.token) {
214
+ return data.data.login.token;
215
+ } else return false;
210
216
  })];
211
217
 
212
218
  case 1:
@@ -200,6 +200,9 @@ var getChannel = function getChannel(id) {
200
200
  }).then(function (res) {
201
201
  return res.json();
202
202
  }).then(function (data) {
203
+ if (data.errors) throw data.errors[0];
204
+ if (data.code) throw data;
205
+
203
206
  if (data.data.channel) {
204
207
  data.data.channel.id = (0, _Util.ObjectId)(data.data.channel.id);
205
208
  return data.data.channel;
@@ -241,6 +244,7 @@ var getChannels = function getChannels(filter, sort, option) {
241
244
  method: 'POST',
242
245
  headers: {
243
246
  Authorization: 'Bearer ' + token,
247
+ 'X-PROJECT-ID': projectId,
244
248
  'Content-Type': 'application/json',
245
249
  Accept: 'application/json'
246
250
  },
@@ -256,6 +260,9 @@ var getChannels = function getChannels(filter, sort, option) {
256
260
  }).then(function (res) {
257
261
  return res.json();
258
262
  }).then(function (data) {
263
+ if (data.errors) throw data.errors[0];
264
+ if (data.code) throw data;
265
+
259
266
  if (data.data.channels) {
260
267
  return data.data.channels.edges;
261
268
  }
@@ -185,6 +185,7 @@ var getFriendships = function getFriendships(filter, sort, option) {
185
185
  method: 'POST',
186
186
  headers: {
187
187
  Authorization: 'Bearer ' + token,
188
+ 'X-PROJECT-ID': projectId,
188
189
  'Content-Type': 'application/json',
189
190
  Accept: 'application/json'
190
191
  },
@@ -200,6 +201,9 @@ var getFriendships = function getFriendships(filter, sort, option) {
200
201
  }).then(function (res) {
201
202
  return res.json();
202
203
  }).then(function (data) {
204
+ if (data.errors) throw data.errors[0];
205
+ if (data.code) throw data;
206
+
203
207
  if (data.data.friendships) {
204
208
  return data.data.friendships.edges;
205
209
  }
@@ -86,30 +86,4 @@ _Object$keys(_member).forEach(function (key) {
86
86
  return _member[key];
87
87
  }
88
88
  });
89
- });
90
-
91
- var _messageread = require("./messageread");
92
-
93
- _Object$keys(_messageread).forEach(function (key) {
94
- if (key === "default" || key === "__esModule") return;
95
-
96
- _Object$defineProperty(exports, key, {
97
- enumerable: true,
98
- get: function get() {
99
- return _messageread[key];
100
- }
101
- });
102
- });
103
-
104
- var _memberinvitation = require("./memberinvitation");
105
-
106
- _Object$keys(_memberinvitation).forEach(function (key) {
107
- if (key === "default" || key === "__esModule") return;
108
-
109
- _Object$defineProperty(exports, key, {
110
- enumerable: true,
111
- get: function get() {
112
- return _memberinvitation[key];
113
- }
114
- });
115
89
  });
@@ -185,6 +185,7 @@ var getMembers = function getMembers(filter, sort, option) {
185
185
  method: 'POST',
186
186
  headers: {
187
187
  Authorization: 'Bearer ' + token,
188
+ 'X-PROJECT-ID': projectId,
188
189
  'Content-Type': 'application/json',
189
190
  Accept: 'application/json'
190
191
  },
@@ -200,6 +201,9 @@ var getMembers = function getMembers(filter, sort, option) {
200
201
  }).then(function (res) {
201
202
  return res.json();
202
203
  }).then(function (data) {
204
+ if (data.errors) throw data.errors[0];
205
+ if (data.code) throw data;
206
+
203
207
  if (data.data.membersForQuery) {
204
208
  return data.data.membersForQuery.edges;
205
209
  }
@@ -200,6 +200,8 @@ var getMessages = function getMessages(filter, sort, option) {
200
200
  }).then(function (res) {
201
201
  return res.json();
202
202
  }).then(function (data) {
203
+ if (data.errors) throw data.errors[0];
204
+ if (data.code) throw data;
203
205
  if (!data || !data.data.messages) return [];
204
206
  return data.data.messages.edges;
205
207
  })];
@@ -251,6 +253,8 @@ var getMessage = function getMessage(channelId, messageId) {
251
253
  }).then(function (res) {
252
254
  return res.json();
253
255
  }).then(function (data) {
256
+ if (data.errors) throw data.errors[0];
257
+ if (data.code) throw data;
254
258
  if (!data || !data.data.message) return false;
255
259
  return data.data.message;
256
260
  })];
@@ -288,6 +292,7 @@ var unreadCount = function unreadCount(channelId) {
288
292
  method: "POST",
289
293
  headers: {
290
294
  Authorization: "Bearer " + token,
295
+ 'X-PROJECT-ID': projectId,
291
296
  "Content-Type": "application/json",
292
297
  Accept: "application/json"
293
298
  },
@@ -301,6 +306,8 @@ var unreadCount = function unreadCount(channelId) {
301
306
  }).then(function (res) {
302
307
  return res.json();
303
308
  }).then(function (data) {
309
+ if (data.errors) throw data.errors[0];
310
+ if (data.code) throw data;
304
311
  if (!data || !data.data.mark) return false;
305
312
  return data.data.mark;
306
313
  })];
@@ -187,6 +187,7 @@ var getProject = function getProject() {
187
187
  method: 'POST',
188
188
  headers: {
189
189
  'Authorization': "Bearer " + token,
190
+ 'X-PROJECT-ID': projectId,
190
191
  'Content-Type': CONTENT_TYPE,
191
192
  'Accept': CONTENT_TYPE
192
193
  },
@@ -187,6 +187,7 @@ var getSubscription = function getSubscription(channelId, id) {
187
187
  method: 'POST',
188
188
  headers: {
189
189
  'Authorization': 'Bearer ' + token,
190
+ 'X-PROJECT-ID': projectId,
190
191
  'Content-Type': 'application/json',
191
192
  'Accept': 'application/json'
192
193
  },
@@ -201,6 +202,8 @@ var getSubscription = function getSubscription(channelId, id) {
201
202
  }).then(function (res) {
202
203
  return res.json();
203
204
  }).then(function (data) {
205
+ if (data.errors) throw data.errors[0];
206
+ if (data.code) throw data;
204
207
  if (data.data.subscription) data.data.subscription.id = (0, _Util.ObjectId)(data.data.subscription.id);
205
208
  })];
206
209
 
@@ -237,6 +240,7 @@ var getSubscriptions = function getSubscriptions(filter, sort, option) {
237
240
  method: 'POST',
238
241
  headers: {
239
242
  'Authorization': 'Bearer ' + token,
243
+ 'X-PROJECT-ID': projectId,
240
244
  'Content-Type': 'application/json',
241
245
  'Accept': 'application/json'
242
246
  },
@@ -252,6 +256,8 @@ var getSubscriptions = function getSubscriptions(filter, sort, option) {
252
256
  }).then(function (res) {
253
257
  return res.json();
254
258
  }).then(function (data) {
259
+ if (data.errors) throw data.errors[0];
260
+ if (data.code) throw data;
255
261
  return data.data.subscriptions.edges;
256
262
  })];
257
263
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ncloudchat",
3
3
  "jsName": "ncloudchat",
4
- "version": "0.0.26-beta",
4
+ "version": "0.0.29-beta",
5
5
  "private": false,
6
6
  "description": "",
7
7
  "keywords": [
@@ -1,2 +0,0 @@
1
- export declare const createInvitation: (channelId: string, url: string, inviteForm: string, inviterId: string, invitee: string, content: string) => Promise<any>;
2
- export declare const updateInvitation: (sequenceId: string, inviteStatus?: string, subscribedId?: string) => Promise<any>;
@@ -1,103 +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 createInvitation = function (channelId, url, inviteForm, inviterId, invitee, content) { return __awaiter(void 0, void 0, void 0, function () {
39
- var token, projectId, endpoint, query, CONTENT_TYPE, response, json;
40
- return __generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0:
43
- token = CoreManager.get('TOKEN');
44
- projectId = CoreManager.get('PROJECT_ID');
45
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
46
- query = "\n mutation ($projectId:String!,$channelId:String!,$url:String!,$inviteForm:String!,$inviterId:String!,$invitee:String!, $content:String){\n createInvitation(input:{projectId:$projectId,channelId:$channelId,url:$url,inviteForm:$inviteForm,inviterId:$inviterId,invitee:$invitee,content:$content}){\n invitation {\n id\n sequence_id\n url\n link\n invite_form\n invitee\n invite_status\n send_at\n created_at\n }\n }\n }\n ";
47
- CONTENT_TYPE = 'application/json';
48
- return [4 /*yield*/, fetch(endpoint, {
49
- method: 'POST',
50
- headers: {
51
- 'Authorization': "Bearer " + token,
52
- 'Content-Type': CONTENT_TYPE,
53
- 'Accept': CONTENT_TYPE
54
- },
55
- body: JSON.stringify({
56
- query: query,
57
- variables: { projectId: projectId, channelId: channelId, url: url, inviteForm: inviteForm, inviterId: inviterId, invitee: invitee, content: content }
58
- })
59
- })];
60
- case 1:
61
- response = _a.sent();
62
- return [4 /*yield*/, response.json()];
63
- case 2:
64
- json = _a.sent();
65
- return [2 /*return*/, json.data.createInvitation.invitation];
66
- }
67
- });
68
- }); };
69
- export var updateInvitation = function (sequenceId, inviteStatus, subscribedId) {
70
- if (inviteStatus === void 0) { inviteStatus = 'receive'; }
71
- if (subscribedId === void 0) { subscribedId = ''; }
72
- return __awaiter(void 0, void 0, void 0, function () {
73
- var token, endpoint, query, CONTENT_TYPE, response, json;
74
- return __generator(this, function (_a) {
75
- switch (_a.label) {
76
- case 0:
77
- token = CoreManager.get('TOKEN');
78
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
79
- query = "\n mutation ($sequenceId:String!,$inviteStatus:String!,$subscribedId:String){\n updateInvitation(input:{sequenceId:$sequenceId,inviteStatus:$inviteStatus,subscribedId:$subscribedId}) {\n invitation {\n id\n sequence_id \n link\n invite_form\n invitee\n invite_status\n subscribed_id\n send_at\n received_at\n subscribed_at\n }\n }\n }\n ";
80
- CONTENT_TYPE = 'application/json';
81
- return [4 /*yield*/, fetch(endpoint, {
82
- method: 'POST',
83
- headers: {
84
- 'Authorization': "Bearer " + token,
85
- 'Content-Type': CONTENT_TYPE,
86
- 'Accept': CONTENT_TYPE
87
- },
88
- body: JSON.stringify({
89
- query: query,
90
- variables: { sequenceId: sequenceId, inviteStatus: inviteStatus, subscribedId: subscribedId }
91
- })
92
- })];
93
- case 1:
94
- response = _a.sent();
95
- return [4 /*yield*/, response.json()];
96
- case 2:
97
- json = _a.sent();
98
- return [2 /*return*/, json.data.updateInvitation.invitation];
99
- }
100
- });
101
- });
102
- };
103
- //# sourceMappingURL=memberinvitation.js.map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AAyB;IADzB,6BAAA,EAAA,wBAAgC;IAChC,6BAAA,EAAA,iBAAyB;;;;;;oBAEnB,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oBACjC,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;oBACtD,KAAK,GAAG,yhBAiBb,CAAC;oBAEI,YAAY,GAAG,kBAAkB,CAAC;oBACvB,qBAAM,KAAK,CAAC,QAAQ,EAAE;4BACrC,MAAM,EAAE,MAAM;4BACd,OAAO,EAAE;gCACP,eAAe,EAAE,YAAU,KAAO;gCAClC,cAAc,EAAE,YAAY;gCAC5B,QAAQ,EAAE,YAAY;6BACvB;4BACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gCACnB,KAAK,OAAA;gCACL,SAAS,EAAE,EAAE,UAAU,YAAA,EAAE,YAAY,cAAA,EAAE,YAAY,cAAA,EAAE;6BACtD,CAAC;yBACH,CAAC,EAAA;;oBAXI,QAAQ,GAAG,SAWf;oBACW,qBAAM,QAAQ,CAAC,IAAI,EAAE,EAAA;;oBAA5B,IAAI,GAAG,SAAqB;oBAClC,sBAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAC;;;;CAC9C,CAAA"}
@@ -1,10 +0,0 @@
1
- export declare const createMemberReport: (input: {
2
- channelId: string;
3
- fromMemberId: string;
4
- toMemberId: string;
5
- }) => Promise<any>;
6
- export declare const updateMemberReport: (input: {
7
- sequenceId: string;
8
- status: number;
9
- etc: string;
10
- }) => Promise<any>;