ncloudchat 1.0.23 → 1.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/LICENSE.md +1 -1
  2. package/deploy.sh +1 -1
  3. package/esm/CloudChat.d.ts +434 -10
  4. package/esm/CloudChat.js +975 -302
  5. package/esm/CloudChat.js.map +1 -1
  6. package/esm/CoreManager.d.ts +6 -0
  7. package/esm/CoreManager.js +13 -4
  8. package/esm/CoreManager.js.map +1 -1
  9. package/esm/Dispatcher.d.ts +16 -0
  10. package/esm/Dispatcher.js +19 -4
  11. package/esm/Dispatcher.js.map +1 -1
  12. package/esm/Network.d.ts +7 -0
  13. package/esm/Network.js +93 -0
  14. package/esm/Network.js.map +1 -0
  15. package/esm/Type.d.ts +43 -0
  16. package/esm/Type.js +16 -0
  17. package/esm/Type.js.map +1 -1
  18. package/esm/Util.d.ts +13 -0
  19. package/esm/Util.js +13 -0
  20. package/esm/Util.js.map +1 -1
  21. package/esm/graphql/channel.d.ts +13 -0
  22. package/esm/graphql/channel.js +16 -0
  23. package/esm/graphql/channel.js.map +1 -0
  24. package/esm/graphql/friend.d.ts +11 -0
  25. package/esm/graphql/friend.js +13 -0
  26. package/esm/graphql/friend.js.map +1 -0
  27. package/esm/graphql/invite.d.ts +7 -0
  28. package/esm/graphql/invite.js +8 -0
  29. package/esm/graphql/invite.js.map +1 -0
  30. package/esm/graphql/member.d.ts +11 -0
  31. package/esm/graphql/member.js +13 -0
  32. package/esm/graphql/member.js.map +1 -0
  33. package/esm/graphql/message.d.ts +11 -0
  34. package/esm/graphql/message.js +13 -0
  35. package/esm/graphql/message.js.map +1 -0
  36. package/esm/graphql/pin.d.ts +10 -0
  37. package/esm/graphql/pin.js +12 -0
  38. package/esm/graphql/pin.js.map +1 -0
  39. package/esm/graphql/project.d.ts +7 -0
  40. package/esm/graphql/project.js +8 -0
  41. package/esm/graphql/project.js.map +1 -0
  42. package/esm/graphql/subscription.d.ts +11 -0
  43. package/esm/graphql/subscription.js +13 -0
  44. package/esm/graphql/subscription.js.map +1 -0
  45. package/esm/index.d.ts +6 -0
  46. package/esm/index.js +6 -0
  47. package/esm/index.js.map +1 -1
  48. package/esm/logger.d.ts +9 -3
  49. package/esm/logger.js +6 -0
  50. package/esm/logger.js.map +1 -1
  51. package/esm/mutations/channel.d.ts +50 -0
  52. package/esm/mutations/channel.js +97 -187
  53. package/esm/mutations/channel.js.map +1 -1
  54. package/esm/mutations/friend.d.ts +38 -0
  55. package/esm/mutations/friend.js +57 -119
  56. package/esm/mutations/friend.js.map +1 -1
  57. package/esm/mutations/index.d.ts +5 -3
  58. package/esm/mutations/index.js +5 -3
  59. package/esm/mutations/index.js.map +1 -1
  60. package/esm/mutations/invite.d.ts +15 -0
  61. package/esm/mutations/invite.js +23 -32
  62. package/esm/mutations/invite.js.map +1 -1
  63. package/esm/mutations/member.d.ts +39 -2
  64. package/esm/mutations/member.js +64 -111
  65. package/esm/mutations/member.js.map +1 -1
  66. package/esm/mutations/message.d.ts +35 -0
  67. package/esm/mutations/message.js +66 -45
  68. package/esm/mutations/message.js.map +1 -1
  69. package/esm/mutations/pin.d.ts +28 -0
  70. package/esm/mutations/pin.js +88 -0
  71. package/esm/mutations/pin.js.map +1 -0
  72. package/esm/mutations/subscription.d.ts +33 -1
  73. package/esm/mutations/subscription.js +51 -93
  74. package/esm/mutations/subscription.js.map +1 -1
  75. package/esm/queries/channel.d.ts +24 -0
  76. package/esm/queries/channel.js +37 -79
  77. package/esm/queries/channel.js.map +1 -1
  78. package/esm/queries/friend.d.ts +16 -0
  79. package/esm/queries/friend.js +25 -40
  80. package/esm/queries/friend.js.map +1 -1
  81. package/esm/queries/index.d.ts +7 -0
  82. package/esm/queries/index.js +7 -0
  83. package/esm/queries/index.js.map +1 -1
  84. package/esm/queries/member.d.ts +16 -0
  85. package/esm/queries/member.js +25 -40
  86. package/esm/queries/member.js.map +1 -1
  87. package/esm/queries/memberblocks.d.ts +16 -0
  88. package/esm/queries/memberblocks.js +25 -40
  89. package/esm/queries/memberblocks.js.map +1 -1
  90. package/esm/queries/message.d.ts +33 -0
  91. package/esm/queries/message.js +50 -111
  92. package/esm/queries/message.js.map +1 -1
  93. package/esm/queries/pin.d.ts +28 -0
  94. package/esm/queries/pin.js +92 -0
  95. package/esm/queries/pin.js.map +1 -0
  96. package/esm/queries/project.d.ts +13 -0
  97. package/esm/queries/project.js +20 -32
  98. package/esm/queries/project.js.map +1 -1
  99. package/esm/queries/subscription.d.ts +25 -0
  100. package/esm/queries/subscription.js +39 -76
  101. package/esm/queries/subscription.js.map +1 -1
  102. package/lib/CloudChat.js +1211 -363
  103. package/lib/CoreManager.js +13 -3
  104. package/lib/Dispatcher.js +25 -9
  105. package/lib/Network.js +226 -0
  106. package/lib/Type.js +19 -0
  107. package/lib/Util.js +15 -1
  108. package/lib/graphql/channel.js +32 -0
  109. package/lib/graphql/friend.js +27 -0
  110. package/lib/graphql/invite.js +18 -0
  111. package/lib/graphql/member.js +27 -0
  112. package/lib/graphql/message.js +27 -0
  113. package/lib/graphql/pin.js +25 -0
  114. package/lib/graphql/project.js +18 -0
  115. package/lib/graphql/subscription.js +27 -0
  116. package/lib/index.js +2 -2
  117. package/lib/logger.js +6 -0
  118. package/lib/mutations/channel.js +105 -178
  119. package/lib/mutations/friend.js +62 -115
  120. package/lib/mutations/index.js +23 -3
  121. package/lib/mutations/invite.js +27 -33
  122. package/lib/mutations/member.js +73 -100
  123. package/lib/mutations/message.js +86 -48
  124. package/lib/mutations/pin.js +229 -0
  125. package/lib/mutations/subscription.js +56 -95
  126. package/lib/queries/channel.js +40 -84
  127. package/lib/queries/friend.js +29 -45
  128. package/lib/queries/index.js +24 -3
  129. package/lib/queries/member.js +29 -45
  130. package/lib/queries/memberblocks.js +28 -44
  131. package/lib/queries/message.js +56 -109
  132. package/lib/queries/pin.js +243 -0
  133. package/lib/queries/project.js +24 -41
  134. package/lib/queries/subscription.js +42 -78
  135. package/package.json +19 -45
  136. package/tsconfig.json +1 -0
  137. package//353/260/260/355/217/254/354/210/234/354/204/234.md +8 -0
  138. package/package copy.json +0 -74
@@ -1,4 +1,42 @@
1
+ /**
2
+ * Copyright (c) NBASE CORP. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /**
8
+ * Request a friendship to a user.
9
+ *
10
+ * @async
11
+ * @function requestFriend
12
+ * @param {string} friendId - An id of the friend to request.
13
+ * @returns {Promise<any>}
14
+ */
1
15
  export declare const requestFriend: (friendId: string) => Promise<any>;
16
+ /**
17
+ * Accept a friends request.
18
+ *
19
+ * @async
20
+ * @function acceptFriend
21
+ * @param {string} friendId - The id of the friend to accept the request.
22
+ * @returns {Promise<any>}
23
+ */
2
24
  export declare const acceptFriend: (friendId: string) => Promise<any>;
25
+ /**
26
+ * Reject a friend request.
27
+ *
28
+ * @async
29
+ * @function rejectFriend
30
+ * @param {string} friendId - An id of the friend to be rejected.
31
+ * @returns {Promise<any>}
32
+ */
3
33
  export declare const rejectFriend: (friendId: string) => Promise<any>;
34
+ /**
35
+ * Remove a friend.
36
+ *
37
+ * @async
38
+ * @function removeFriend
39
+ * @param {string} friendId - An id of the friend to be removed.
40
+ * @returns {Promise<any>}
41
+ */
4
42
  export declare const removeFriend: (friendId: string) => Promise<any>;
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Copyright (c) NBASE CORP. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
1
7
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
8
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
9
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -34,149 +40,81 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
34
40
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
41
  }
36
42
  };
37
- import CoreManager from '../CoreManager';
43
+ import CoreManager from "../CoreManager";
44
+ import { acceptFriendQuery, requestFriendQuery, rejectFriendQuery, removeFriendQuery, } from "../graphql/friend";
45
+ import { fetchData } from "../Network";
46
+ /**
47
+ * Request a friendship to a user.
48
+ *
49
+ * @async
50
+ * @function requestFriend
51
+ * @param {string} friendId - An id of the friend to request.
52
+ * @returns {Promise<any>}
53
+ */
38
54
  export var requestFriend = function (friendId) { return __awaiter(void 0, void 0, void 0, function () {
39
- var token, projectId, endpoint, query;
40
55
  return __generator(this, function (_a) {
41
56
  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!, $friendId: String!) {\n requestFriend(input: {projectId: $projectId, friendId: $friendId}) {\n friendship {\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 friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n ";
47
- return [4 /*yield*/, fetch(endpoint, {
48
- method: 'POST',
49
- headers: {
50
- 'Authorization': 'Bearer ' + token,
51
- 'X-PROJECT-ID': projectId,
52
- 'Content-Type': 'application/json',
53
- 'Accept': 'application/json'
54
- },
55
- body: JSON.stringify({
56
- query: query,
57
- variables: {
58
- projectId: projectId,
59
- friendId: friendId
60
- }
61
- })
62
- })
63
- .then(function (res) { return res.json(); })
64
- .then(function (data) {
65
- if (data.errors) {
66
- throw data.errors[0];
67
- }
68
- return data.data.requestFriend.friendship;
69
- })];
57
+ case 0: return [4 /*yield*/, fetchData("requestFriend", requestFriendQuery, {
58
+ projectId: CoreManager.get("PROJECT_ID"),
59
+ friendId: friendId
60
+ })];
70
61
  case 1: return [2 /*return*/, _a.sent()];
71
62
  }
72
63
  });
73
64
  }); };
65
+ /**
66
+ * Accept a friends request.
67
+ *
68
+ * @async
69
+ * @function acceptFriend
70
+ * @param {string} friendId - The id of the friend to accept the request.
71
+ * @returns {Promise<any>}
72
+ */
74
73
  export var acceptFriend = function (friendId) { return __awaiter(void 0, void 0, void 0, function () {
75
- var token, projectId, endpoint, query;
76
74
  return __generator(this, function (_a) {
77
75
  switch (_a.label) {
78
- case 0:
79
- token = CoreManager.get("TOKEN");
80
- projectId = CoreManager.get("PROJECT_ID");
81
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
82
- query = "\n mutation ($projectId: String!, $friendId: String!) {\n acceptFriend(input: {projectId: $projectId, friendId: $friendId}) {\n friendship {\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 friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n ";
83
- return [4 /*yield*/, fetch(endpoint, {
84
- method: 'POST',
85
- headers: {
86
- 'Authorization': 'Bearer ' + token,
87
- 'X-PROJECT-ID': projectId,
88
- 'Content-Type': 'application/json',
89
- 'Accept': 'application/json'
90
- },
91
- body: JSON.stringify({
92
- query: query,
93
- variables: {
94
- projectId: projectId,
95
- friendId: friendId
96
- }
97
- })
98
- })
99
- .then(function (res) { return res.json(); })
100
- .then(function (data) {
101
- if (data.errors) {
102
- throw data.errors[0];
103
- }
104
- return data.data.acceptFriend.friendship;
105
- })];
76
+ case 0: return [4 /*yield*/, fetchData("acceptFriend", acceptFriendQuery, {
77
+ projectId: CoreManager.get("PROJECT_ID"),
78
+ friendId: friendId
79
+ })];
106
80
  case 1: return [2 /*return*/, _a.sent()];
107
81
  }
108
82
  });
109
83
  }); };
84
+ /**
85
+ * Reject a friend request.
86
+ *
87
+ * @async
88
+ * @function rejectFriend
89
+ * @param {string} friendId - An id of the friend to be rejected.
90
+ * @returns {Promise<any>}
91
+ */
110
92
  export var rejectFriend = function (friendId) { return __awaiter(void 0, void 0, void 0, function () {
111
- var token, projectId, endpoint, query;
112
93
  return __generator(this, function (_a) {
113
94
  switch (_a.label) {
114
- case 0:
115
- token = CoreManager.get("TOKEN");
116
- projectId = CoreManager.get("PROJECT_ID");
117
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
118
- query = "\n mutation ($projectId: String!, $friendId: String!) {\n rejectFriend(input: {projectId: $projectId, friendId: $friendId}) {\n friendship {\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 friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n ";
119
- return [4 /*yield*/, fetch(endpoint, {
120
- method: 'POST',
121
- headers: {
122
- 'Authorization': 'Bearer ' + token,
123
- 'X-PROJECT-ID': projectId,
124
- 'Content-Type': 'application/json',
125
- 'Accept': 'application/json'
126
- },
127
- body: JSON.stringify({
128
- query: query,
129
- variables: {
130
- projectId: projectId,
131
- friendId: friendId
132
- }
133
- })
134
- })
135
- .then(function (res) { return res.json(); })
136
- .then(function (data) {
137
- if (data.errors)
138
- throw data.errors[0];
139
- if (data.code)
140
- throw data;
141
- return data.data.rejectFriend.friendship;
142
- })];
95
+ case 0: return [4 /*yield*/, fetchData("rejectFriend", rejectFriendQuery, {
96
+ projectId: CoreManager.get("PROJECT_ID"),
97
+ friendId: friendId
98
+ })];
143
99
  case 1: return [2 /*return*/, _a.sent()];
144
100
  }
145
101
  });
146
102
  }); };
103
+ /**
104
+ * Remove a friend.
105
+ *
106
+ * @async
107
+ * @function removeFriend
108
+ * @param {string} friendId - An id of the friend to be removed.
109
+ * @returns {Promise<any>}
110
+ */
147
111
  export var removeFriend = function (friendId) { return __awaiter(void 0, void 0, void 0, function () {
148
- var token, projectId, endpoint, query;
149
112
  return __generator(this, function (_a) {
150
113
  switch (_a.label) {
151
- case 0:
152
- token = CoreManager.get("TOKEN");
153
- projectId = CoreManager.get("PROJECT_ID");
154
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
155
- query = "\n mutation ($projectId: String!, $friendId: String!) {\n removeFriend(input: {projectId: $projectId, friendId: $friendId}) {\n friendship {\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 friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n ";
156
- return [4 /*yield*/, fetch(endpoint, {
157
- method: 'POST',
158
- headers: {
159
- 'Authorization': 'Bearer ' + token,
160
- 'X-PROJECT-ID': projectId,
161
- 'Content-Type': 'application/json',
162
- 'Accept': 'application/json'
163
- },
164
- body: JSON.stringify({
165
- query: query,
166
- variables: {
167
- projectId: projectId,
168
- friendId: friendId
169
- }
170
- })
171
- })
172
- .then(function (res) { return res.json(); })
173
- .then(function (data) {
174
- if (data.errors)
175
- throw data.errors[0];
176
- if (data.code)
177
- throw data;
178
- return data.data.removeFriend.friendship;
179
- })];
114
+ case 0: return [4 /*yield*/, fetchData("removeFriend", removeFriendQuery, {
115
+ projectId: CoreManager.get("PROJECT_ID"),
116
+ friendId: friendId
117
+ })];
180
118
  case 1: return [2 /*return*/, _a.sent()];
181
119
  }
182
120
  });
@@ -1 +1 @@
1
- {"version":3,"file":"friend.js","sourceRoot":"","sources":["../../src/mutations/friend.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAGzC,MAAM,CAAC,IAAM,aAAa,GAAG,UAAO,QAAgB;;;;;gBAC1C,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACjC,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAC1C,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;gBACtD,KAAK,GAAG,0nBAwBb,CAAC;gBAEK,qBAAM,KAAK,CACd,QAAQ,EAAE;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,CA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Copyright © 2016-present Kriasoft | MIT License
2
+ * Copyright (c) NBASE CORP. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
5
6
  */
6
7
  export * from './member';
7
8
  export * from './channel';
@@ -9,3 +10,4 @@ export * from './message';
9
10
  export * from './friend';
10
11
  export * from './invite';
11
12
  export * from './subscription';
13
+ export * from './pin';
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Node.js GraphQL API Starter Kit
3
- * https://github.com/kriasoft/nodejs-api-starter
4
- * Copyright © 2016-present Kriasoft | MIT License
2
+ * Copyright (c) NBASE CORP. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
5
6
  */
6
7
  export * from './member';
7
8
  export * from './channel';
@@ -9,4 +10,5 @@ export * from './message';
9
10
  export * from './friend';
10
11
  export * from './invite';
11
12
  export * from './subscription';
13
+ export * from './pin';
12
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mutations/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mutations/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC"}
@@ -1 +1,16 @@
1
+ /**
2
+ * Copyright (c) NBASE CORP. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /**
8
+ * Create an invite to a friend users to a channel.
9
+ *
10
+ * @async
11
+ * @function createInvite
12
+ * @param {string} channelId - An id of the channel to be invited.
13
+ * @param {string} friendIds - Id of friends to be invited to the channel.
14
+ * @returns {Promise<any>}
15
+ */
1
16
  export declare const createInvite: (channelId: string, friendIds: any) => Promise<any>;
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Copyright (c) NBASE CORP. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
1
7
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
8
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
9
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -34,41 +40,26 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
34
40
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
41
  }
36
42
  };
37
- import CoreManager from '../CoreManager';
43
+ import CoreManager from "../CoreManager";
44
+ import { createInviteQuery } from "../graphql/invite";
45
+ import { fetchData } from "../Network";
46
+ /**
47
+ * Create an invite to a friend users to a channel.
48
+ *
49
+ * @async
50
+ * @function createInvite
51
+ * @param {string} channelId - An id of the channel to be invited.
52
+ * @param {string} friendIds - Id of friends to be invited to the channel.
53
+ * @returns {Promise<any>}
54
+ */
38
55
  export var createInvite = function (channelId, friendIds) { return __awaiter(void 0, void 0, void 0, function () {
39
- var token, projectId, endpoint, query;
40
56
  return __generator(this, function (_a) {
41
57
  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 (\n $projectId: String!, \n $channelId: String!,\n $friendIds: String!\n ) {\n createInvite(\n input: {\n projectId: $projectId, \n channelId: $channelId,\n friendIds: $friendIds\n }\n ) {\n invite {\n id\n }\n }\n }\n ";
47
- return [4 /*yield*/, fetch(endpoint, {
48
- method: 'POST',
49
- headers: {
50
- 'Authorization': 'Bearer ' + token,
51
- 'X-PROJECT-ID': projectId,
52
- 'Content-Type': 'application/json',
53
- 'Accept': 'application/json'
54
- },
55
- body: JSON.stringify({
56
- query: query,
57
- variables: {
58
- projectId: projectId,
59
- channelId: channelId,
60
- friendIds: friendIds
61
- }
62
- })
63
- })
64
- .then(function (res) { return res.json(); })
65
- .then(function (data) {
66
- if (data.errors)
67
- throw data.errors[0];
68
- if (data.code)
69
- throw data;
70
- return data.data.createFriend.friendship;
71
- })];
58
+ case 0: return [4 /*yield*/, fetchData("createFriend", createInviteQuery, {
59
+ projectId: CoreManager.get("PROJECT_ID"),
60
+ channelId: channelId,
61
+ friendIds: friendIds
62
+ })];
72
63
  case 1: return [2 /*return*/, _a.sent()];
73
64
  }
74
65
  });
@@ -1 +1 @@
1
- {"version":3,"file":"invite.js","sourceRoot":"","sources":["../../src/mutations/invite.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAGzC,MAAM,CAAC,IAAM,YAAY,GAAG,UAAO,SAAiB,EAAE,SAAc;;;;;gBAC1D,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACjC,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAC1C,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;gBACtD,KAAK,GAAG,uYAkBb,CAAC;gBAEK,qBAAM,KAAK,CACd,QAAQ,EAAE;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,SAAS,WAAA;gCACT,SAAS,WAAA;6BACX;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,YAAY,CAAC,UAAU,CAAC;oBAC7C,CAAC,CAAC,EAAA;oBAvBF,sBAAO,SAuBL,EAAC;;;KACN,CAAC"}
1
+ {"version":3,"file":"invite.js","sourceRoot":"","sources":["../../src/mutations/invite.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,CAAC,IAAM,YAAY,GAAG,UAAO,SAAiB,EAAE,SAAc;;;oBACzD,qBAAM,SAAS,CAAC,cAAc,EAAE,iBAAiB,EAAE;oBACtD,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,SAAS,WAAA;oBACT,SAAS,WAAA;iBACZ,CAAC,EAAA;oBAJF,sBAAO,SAIL,EAAC;;;KACN,CAAC"}
@@ -1,4 +1,41 @@
1
- export declare const getMemberBlockSchema = "\n id\n project_id\n member_id\n type\n status\n block_type\n reason\n messageMulti {\n lang\n value\n default\n }\n started_at\n ended_at\n created_at\n updated_at\n deleted_at\n";
2
- export declare const login: (user_id: string, name?: string, profile?: string, token?: string) => Promise<any>;
1
+ /**
2
+ * Copyright (c) NBASE CORP. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /**
8
+ * Login a user
9
+ *
10
+ * @async
11
+ * @function login
12
+ * @param {string} user_id - The id of a user loggin in.
13
+ * @param {string} name
14
+ * @param {string} profile
15
+ * @param {string} token
16
+ * @returns {Promise<any>}
17
+ */
18
+ export declare const login: (user_id: string, name?: string, profile?: string, token?: string, customField?: string) => Promise<any>;
19
+ /**
20
+ * Create a member block followed by the getMemberBlockSchema.
21
+ * The member block is to used to ban a member.
22
+ *
23
+ * @async
24
+ * @function createMemberBlock
25
+ * @param {string} channelId - The id of a channel.
26
+ * @param {string} memberId - The id of a member.
27
+ * @param {string} options
28
+ * @returns {Promise<any>}
29
+ */
3
30
  export declare const createMemberBlock: (channelId: string, memberId: string, options?: string) => Promise<any>;
31
+ /**
32
+ * Delete a member block.
33
+ * This is used to unban a member from a channel.
34
+ *
35
+ * @async
36
+ * @function deleteMemberBlock
37
+ * @param {string} channelId - The id of a channel that the member is in.
38
+ * @param {string} memberId - The id of a member to be deleted.
39
+ * @returns {Promise<any>}
40
+ */
4
41
  export declare const deleteMemberBlock: (channelId: string, memberId: string) => Promise<any>;