ncloudchat 1.0.21 → 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 -9
  4. package/esm/CloudChat.js +979 -273
  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 -176
  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 +8 -0
  82. package/esm/queries/index.js +8 -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 +17 -0
  88. package/esm/queries/memberblocks.js +69 -0
  89. package/esm/queries/memberblocks.js.map +1 -0
  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 +1230 -321
  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 +106 -172
  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 +37 -3
  129. package/lib/queries/member.js +29 -45
  130. package/lib/queries/memberblocks.js +207 -0
  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
@@ -7,16 +7,26 @@ _Object$defineProperty(exports, "__esModule", {
7
7
  });
8
8
 
9
9
  exports["default"] = void 0;
10
+
11
+ /**
12
+ * Copyright (c) NBASE CORP. and its affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
10
17
  var config = {
11
18
  // Defaults
12
- IS_NODE: typeof process !== 'undefined' && !!process.versions && !!process.versions.node,
19
+ IS_NODE: typeof process !== "undefined" && !!process.versions && !!process.versions.node,
13
20
  REQUEST_ATTEMPT_LIMIT: 5,
14
21
  REQUEST_BATCH_SIZE: 20,
15
22
  REQUEST_HEADERS: {},
16
23
  TOKEN: "",
17
24
  SERVER_URL: "https://ncloudchat.apigw.ntruss.com/gpapps/v1",
18
25
  SOCKET_URL: "https://soc.ncloudchat.ntruss.com",
19
- VERSION: 'js' + require('../package.json').version,
26
+ // jp / sg
27
+ // SERVER_URL: "https://ncloudchat.apigw.ntruss.com/gpapps/jp-v1",
28
+ // SOCKET_URL: "https://jp-soc.ncloudchat.ntruss.com",
29
+ VERSION: "js" + require("../package.json").version,
20
30
  PROJECT_ID: null
21
31
  };
22
32
  var CoreManager = {
@@ -25,7 +35,7 @@ var CoreManager = {
25
35
  return config[key];
26
36
  }
27
37
 
28
- throw new Error('Configuration key not found: ' + key);
38
+ throw new Error("Configuration key not found: " + key);
29
39
  },
30
40
  set: function set(key, value) {
31
41
  config[key] = value;
package/lib/Dispatcher.js CHANGED
@@ -8,17 +8,36 @@ _Object$defineProperty(exports, "__esModule", {
8
8
 
9
9
  exports["default"] = void 0;
10
10
 
11
- require("core-js/modules/es6.array.for-each");
11
+ require("core-js/modules/es6.string.includes.js");
12
12
 
13
- require("core-js/modules/es6.array.index-of");
13
+ require("core-js/modules/es7.array.includes.js");
14
14
 
15
- require("core-js/modules/es7.array.includes");
15
+ require("core-js/modules/es6.array.index-of.js");
16
16
 
17
- require("core-js/modules/es6.string.includes");
17
+ require("core-js/modules/es6.array.for-each.js");
18
18
 
19
+ require("core-js/modules/es6.array.slice.js");
20
+
21
+ /**
22
+ * Copyright (c) NBASE CORP. and its affiliates.
23
+ *
24
+ * This source code is licensed under the MIT license found in the
25
+ * LICENSE file in the root directory of this source tree.
26
+ */
27
+
28
+ /**
29
+ * Class DispatcherEvent holds all dispatch events functionallities with callbacks.
30
+ *
31
+ * @class
32
+ */
19
33
  var DispatcherEvent =
20
34
  /** @class */
21
35
  function () {
36
+ /**
37
+ * Create a Dispatcher Event instance with an empty callback.
38
+ *
39
+ * @constructs
40
+ */
22
41
  function DispatcherEvent() {
23
42
  this.callbacks = [];
24
43
  }
@@ -86,11 +105,8 @@ function () {
86
105
  var event = this.eventProvider[name];
87
106
 
88
107
  if (event) {
89
- event.unregister(callback);
90
-
91
- if (event.getCallbacks().length === 0) {
92
- delete this.eventProvider[name];
93
- }
108
+ if (callback) event.unregister(callback);
109
+ delete this.eventProvider[name];
94
110
  }
95
111
  };
96
112
 
package/lib/Network.js ADDED
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
+
7
+ _Object$defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+
11
+ exports.fetchData = void 0;
12
+
13
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
14
+
15
+ var _symbol = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/symbol"));
16
+
17
+ var _iterator = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/symbol/iterator"));
18
+
19
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
20
+
21
+ var _CoreManager = _interopRequireDefault(require("./CoreManager"));
22
+
23
+ /**
24
+ * Copyright (c) NBASE CORP. and its affiliates.
25
+ *
26
+ * This source code is licensed under the MIT license found in the
27
+ * LICENSE file in the root directory of this source tree.
28
+ */
29
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
30
+ function adopt(value) {
31
+ return value instanceof P ? value : new P(function (resolve) {
32
+ resolve(value);
33
+ });
34
+ }
35
+
36
+ return new (P || (P = _promise["default"]))(function (resolve, reject) {
37
+ function fulfilled(value) {
38
+ try {
39
+ step(generator.next(value));
40
+ } catch (e) {
41
+ reject(e);
42
+ }
43
+ }
44
+
45
+ function rejected(value) {
46
+ try {
47
+ step(generator["throw"](value));
48
+ } catch (e) {
49
+ reject(e);
50
+ }
51
+ }
52
+
53
+ function step(result) {
54
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
55
+ }
56
+
57
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
58
+ });
59
+ };
60
+
61
+ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
62
+ var _ = {
63
+ label: 0,
64
+ sent: function sent() {
65
+ if (t[0] & 1) throw t[1];
66
+ return t[1];
67
+ },
68
+ trys: [],
69
+ ops: []
70
+ },
71
+ f,
72
+ y,
73
+ t,
74
+ g;
75
+ return g = {
76
+ next: verb(0),
77
+ "throw": verb(1),
78
+ "return": verb(2)
79
+ }, typeof _symbol["default"] === "function" && (g[_iterator["default"]] = function () {
80
+ return this;
81
+ }), g;
82
+
83
+ function verb(n) {
84
+ return function (v) {
85
+ return step([n, v]);
86
+ };
87
+ }
88
+
89
+ function step(op) {
90
+ if (f) throw new TypeError("Generator is already executing.");
91
+
92
+ while (_) {
93
+ try {
94
+ 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;
95
+ if (y = 0, t) op = [op[0] & 2, t.value];
96
+
97
+ switch (op[0]) {
98
+ case 0:
99
+ case 1:
100
+ t = op;
101
+ break;
102
+
103
+ case 4:
104
+ _.label++;
105
+ return {
106
+ value: op[1],
107
+ done: false
108
+ };
109
+
110
+ case 5:
111
+ _.label++;
112
+ y = op[1];
113
+ op = [0];
114
+ continue;
115
+
116
+ case 7:
117
+ op = _.ops.pop();
118
+
119
+ _.trys.pop();
120
+
121
+ continue;
122
+
123
+ default:
124
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
125
+ _ = 0;
126
+ continue;
127
+ }
128
+
129
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
130
+ _.label = op[1];
131
+ break;
132
+ }
133
+
134
+ if (op[0] === 6 && _.label < t[1]) {
135
+ _.label = t[1];
136
+ t = op;
137
+ break;
138
+ }
139
+
140
+ if (t && _.label < t[2]) {
141
+ _.label = t[2];
142
+
143
+ _.ops.push(op);
144
+
145
+ break;
146
+ }
147
+
148
+ if (t[2]) _.ops.pop();
149
+
150
+ _.trys.pop();
151
+
152
+ continue;
153
+ }
154
+
155
+ op = body.call(thisArg, _);
156
+ } catch (e) {
157
+ op = [6, e];
158
+ y = 0;
159
+ } finally {
160
+ f = t = 0;
161
+ }
162
+ }
163
+
164
+ if (op[0] & 5) throw op[1];
165
+ return {
166
+ value: op[0] ? op[1] : void 0,
167
+ done: true
168
+ };
169
+ }
170
+ };
171
+
172
+ var fetchData = function fetchData(returnKey, query, variables) {
173
+ if (returnKey === void 0) {
174
+ returnKey = "";
175
+ }
176
+
177
+ return __awaiter(void 0, void 0, void 0, function () {
178
+ var token, endpoint, projectId, version;
179
+ return __generator(this, function (_a) {
180
+ switch (_a.label) {
181
+ case 0:
182
+ token = "Bearer ".concat(_CoreManager["default"].get("TOKEN"));
183
+ if (!token) throw Error("You are not authorized.");
184
+ endpoint = _CoreManager["default"].get("SERVER_URL") + "/graphql";
185
+ projectId = _CoreManager["default"].get("PROJECT_ID");
186
+ version = _CoreManager["default"].get("VERSION");
187
+ if (!endpoint || !projectId) return [2
188
+ /*return*/
189
+ , null];
190
+ return [4
191
+ /*yield*/
192
+ , fetch(endpoint, {
193
+ method: "POST",
194
+ headers: {
195
+ Authorization: token,
196
+ "X-PROJECT-ID": projectId,
197
+ "Content-Type": "application/json",
198
+ Accept: "application/json",
199
+ "X-SDK-Version": version
200
+ },
201
+ body: (0, _stringify["default"])({
202
+ query: query,
203
+ variables: variables
204
+ })
205
+ }).then(function (res) {
206
+ return res.json();
207
+ }).then(function (resJson) {
208
+ console.log("Fetch Data Response: ", resJson);
209
+ console.log("data: ", resJson.data);
210
+ if (resJson.errors) throw resJson.errors[0];
211
+ if (resJson.code) throw resJson;else if (resJson.data) {
212
+ console.log("JSON DATA: ", resJson.data[returnKey]);
213
+ return returnKey != "" ? resJson.data[returnKey] : resJson.data;
214
+ } else return false;
215
+ })];
216
+
217
+ case 1:
218
+ return [2
219
+ /*return*/
220
+ , _a.sent()];
221
+ }
222
+ });
223
+ });
224
+ };
225
+
226
+ exports.fetchData = fetchData;
package/lib/Type.js CHANGED
@@ -7,6 +7,19 @@ _Object$defineProperty(exports, "__esModule", {
7
7
  });
8
8
 
9
9
  exports.MessageType = exports.ChannelType = void 0;
10
+
11
+ /**
12
+ * Copyright (c) NBASE CORP. and its affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+
18
+ /**
19
+ * Enum for channel types.
20
+ * @readonly
21
+ * @enum {string}
22
+ */
10
23
  var ChannelType;
11
24
  exports.ChannelType = ChannelType;
12
25
 
@@ -14,6 +27,12 @@ exports.ChannelType = ChannelType;
14
27
  ChannelType["PRIVATE"] = "PRIVATE";
15
28
  ChannelType["PUBLIC"] = "PUBLIC";
16
29
  })(ChannelType || (exports.ChannelType = ChannelType = {}));
30
+ /**
31
+ * Enum for message types.
32
+ * @readonly
33
+ * @enum {string}
34
+ */
35
+
17
36
 
18
37
  var MessageType;
19
38
  exports.MessageType = MessageType;
package/lib/Util.js CHANGED
@@ -8,8 +8,22 @@ _Object$defineProperty(exports, "__esModule", {
8
8
 
9
9
  exports.ObjectId = void 0;
10
10
 
11
- require("core-js/modules/es6.regexp.split");
11
+ require("core-js/modules/es6.regexp.split.js");
12
12
 
13
+ /**
14
+ * Copyright (c) NBASE CORP. and its affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */
19
+
20
+ /**
21
+ * Decodes a base-64 encoded string.
22
+ *
23
+ * @function ObjectId
24
+ * @param {string} id - An encoded string to be decoded.
25
+ * @returns {string} decoded string.
26
+ */
13
27
  var ObjectId = function ObjectId(id) {
14
28
  if (!id) return "";
15
29
  return atob(id).split(":")[1];
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+
9
+ exports.updateChannelQuery = exports.removeChannelMembersQuery = exports.getChannelsQuery = exports.getChannelQuery = exports.deleteChannelQuery = exports.createChannelQuery = exports.addChannelMembersQuery = void 0;
10
+
11
+ /**
12
+ * Copyright (c) NBASE CORP. and its affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+ var channelLastMessageFields = "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 }";
18
+ var channelFields = "id\n project_id\n name\n user_id { \n id\n name\n profile\n device_type\n language\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 ";
19
+ var getChannelQuery = "query channel ($projectId: String!, $id: String!) {\n channel (projectId: $projectId, id:$id) {\n ".concat(channelFields, "\n ").concat(channelLastMessageFields, "\n }\n }\n");
20
+ exports.getChannelQuery = getChannelQuery;
21
+ var getChannelsQuery = "query channels (\n $projectId: String!, \n $filter: String!, \n $sort: String, \n $option:String\n ) {\n channels (\n projectId: $projectId, \n filter:$filter, \n sort:$sort, \n option:$option\n ) {\n totalCount\n edges {\n node {\n ".concat(channelFields, "\n ").concat(channelLastMessageFields, "\n }\n }\n }\n }\n");
22
+ exports.getChannelsQuery = getChannelsQuery;
23
+ var createChannelQuery = "mutation (\n $id: String,\n $projectId: String!, \n $name: String!, \n $type: String!,\n $uniqueId: String,\n $translation: Boolean,\n $push: Boolean,\n $mutes: Boolean,\n $linkUrl: String,\n $imageUrl: String,\n $customField: String,\n $members: [String]\n ) {\n createChannel(\n input: { \n id: $id,\n projectId: $projectId, \n name: $name, \n type: $type,\n uniqueId: $uniqueId,\n translation:$translation,\n push:$push,\n mutes: $mutes,\n customField: $customField,\n linkUrl:$linkUrl,\n imageUrl:$imageUrl\n members: $members,\n }\n ) {\n channel {\n ".concat(channelFields, "\n ").concat(channelLastMessageFields, "\n }\n }\n }\n");
24
+ exports.createChannelQuery = createChannelQuery;
25
+ var updateChannelQuery = "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 $customField: String,\n $id: ID!,\n $members: [String]\n ) {\n updateChannel(\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 customField:$customField,\n linkUrl:$linkUrl,\n imageUrl:$imageUrl\n }\n ) {\n channel {\n ".concat(channelFields, "\n ").concat(channelLastMessageFields, "\n }\n }\n }\n");
26
+ exports.updateChannelQuery = updateChannelQuery;
27
+ var deleteChannelQuery = "mutation (\n $projectId: String!, \n $id: ID!\n ) {\n deleteChannel(\n input: { \n projectId: $projectId, \n id: $id,\n }\n ) {\n channel {\n ".concat(channelFields, "\n ").concat(channelLastMessageFields, "\n }\n }\n }\n");
28
+ exports.deleteChannelQuery = deleteChannelQuery;
29
+ var addChannelMembersQuery = "mutation (\n $projectId: String!, \n $channelId: String!, \n $memberIds: [String]!\n ) {\n addChannelMembers(\n input: {\n projectId: $projectId, \n channelId: $channelId, \n memberIds:$memberIds \n }\n ) {\n channel {\n ".concat(channelFields, "\n }\n }\n }\n");
30
+ exports.addChannelMembersQuery = addChannelMembersQuery;
31
+ var removeChannelMembersQuery = "mutation (\n $projectId: String!, \n $channelId: String!, \n $memberIds: [String]!\n ) {\n removeChannelMembers(\n input: {\n projectId: $projectId, \n channelId: $channelId, \n memberIds:$memberIds \n }\n ) {\n channel {\n ".concat(channelFields, "\n }\n }\n }\n");
32
+ exports.removeChannelMembersQuery = removeChannelMembersQuery;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+
9
+ exports.requestFriendQuery = exports.removeFriendQuery = exports.rejectFriendQuery = exports.getFriendshipsQuery = exports.acceptFriendQuery = void 0;
10
+
11
+ /**
12
+ * Copyright (c) NBASE CORP. and its affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+ var friendshipFields = "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 ";
18
+ var requestFriendQuery = "mutation ($projectId: String!, $friendId: String!) {\n requestFriend(\n input: { \n projectId: $projectId, \n friendId: $friendId }\n ) {\n friendship {\n ".concat(friendshipFields, "\n }\n }\n }\n ");
19
+ exports.requestFriendQuery = requestFriendQuery;
20
+ var acceptFriendQuery = "mutation ($projectId: String!, $friendId: String!) {\n acceptFriend(\n input: { projectId: $projectId, friendId: $friendId }\n ) {\n friendship {\n ".concat(friendshipFields, "\n }\n }\n }\n ");
21
+ exports.acceptFriendQuery = acceptFriendQuery;
22
+ var rejectFriendQuery = "mutation ($projectId: String!, $friendId: String!) {\n rejectFriend (\n input: { projectId: $projectId, friendId: $friendId}\n ) {\n friendship {\n ".concat(friendshipFields, "\n }\n }\n }\n ");
23
+ exports.rejectFriendQuery = rejectFriendQuery;
24
+ var removeFriendQuery = "mutation ($projectId: String!, $friendId: String!) {\n removeFriend(\n input: { projectId: $projectId, friendId: $friendId }\n ) {\n friendship {\n ".concat(friendshipFields, "\n }\n }\n }\n ");
25
+ exports.removeFriendQuery = removeFriendQuery;
26
+ var getFriendshipsQuery = "query friendships (\n $projectId: String!, \n $filter: String!, \n $sort: String, \n $option: String\n ) {\n friendships (\n projectId: $projectId, \n filter:$filter, \n sort:$sort, \n option: $option\n ) {\n totalCount\n edges {\n node {\n ".concat(friendshipFields, "\n }\n }\n }\n }\n ");
27
+ exports.getFriendshipsQuery = getFriendshipsQuery;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+
9
+ exports.createInviteQuery = void 0;
10
+
11
+ /**
12
+ * Copyright (c) NBASE CORP. and its affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+ var createInviteQuery = "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";
18
+ exports.createInviteQuery = createInviteQuery;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+
9
+ exports.loginQuery = exports.getMembersQuery = exports.getMemberBlocksQuery = exports.deleteMemberBlockQuery = exports.createMemberBlockQuery = void 0;
10
+
11
+ /**
12
+ * Copyright (c) NBASE CORP. and its affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+ var memberFields = "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 ";
18
+ var loginQuery = "mutation login(\n $projectId: String!\n $userId: String!\n $name: String\n $profile: String\n $customField: String\n ) {\n login(\n input: {\n projectId: $projectId\n userId: $userId\n name: $name\n profile: $profile\n customField: $customField\n }\n ) {\n token\n }\n }";
19
+ exports.loginQuery = loginQuery;
20
+ var createMemberBlockQuery = "mutation createMemberBlock(\n $projectId: String!\n $memberId: String!\n $channelId: String\n $options: String\n ) {\n createMemberBlock(\n input: {\n projectId: $projectId\n memberId: $memberId\n channelId: $channelId\n options: $options\n }\n ) {\n memberBlock {\n ".concat(memberFields, "\n }\n }\n }");
21
+ exports.createMemberBlockQuery = createMemberBlockQuery;
22
+ var deleteMemberBlockQuery = "mutation deleteMemberBlock (\n $projectId: String!\n $memberId: String!\n $channelId: String\n ) {\n deleteMemberBlock(\n input: {\n projectId: $projectId\n memberId: $memberId\n channelId: $channelId\n }\n ) {\n memberBlock {\n ".concat(memberFields, "\n }\n }\n }\n");
23
+ exports.deleteMemberBlockQuery = deleteMemberBlockQuery;
24
+ var getMembersQuery = "query membersForQuery (\n $projectId: String!, \n $option: String!, \n $filter: String!, \n $sort: String \n ) {\n membersForQuery (\n projectId: $projectId, \n option:$option, \n filter:$filter, \n sort:$sort\n ) {\n totalCount\n edges {\n node {\n id\n name\n }\n }\n }\n }\n";
25
+ exports.getMembersQuery = getMembersQuery;
26
+ var getMemberBlocksQuery = "query memberblocks (\n $projectId: String!, \n $filter: String!, \n $sort: String, \n $option:String\n ) {\n memberblocks(\n projectId: $projectId, \n filter:$filter, \n sort:$sort, \n option:$option\n ) {\n totalCount\n edges {\n node {\n id\n project_id\n member_id\n type\n status\n block_type\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 }\n }\n }\n }\n";
27
+ exports.getMemberBlocksQuery = getMemberBlocksQuery;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+
9
+ exports.unreadCountQuery = exports.translateQuery = exports.messageQuery = exports.getMessagesQuery = exports.getMessageQuery = void 0;
10
+
11
+ /**
12
+ * Copyright (c) NBASE CORP. and its affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+ var messageFields = "id \n message_id\n channel_id\n sort_id\n message_type\n sender {\n id\n name\n profile\n }\n admin {\n id\n name\n profile\n }\n attachment_filenames {\n name\n size\n type\n url\n }\n has\n embed_providers\n embed_type\n isExpress\n link_hostnames\n mentions\n bytes\n mentions_everyone\n content\n sended_at\n created_at\n";
18
+ var translateQuery = "mutation (\n $projectId: String!, \n $channelId: String!, \n $srcLang: String!, \n $text: String!, \n $targetLang:String!\n ) {\n translation(\n input: {\n projectId:$projectId, \n channelId:$channelId,\n srcLang:$srcLang,\n targetLang:$targetLang, \n text:$text \n }\n ) {\n result\n {\n status\n message\n lang\n }\n }\n }\n";
19
+ exports.translateQuery = translateQuery;
20
+ var getMessageQuery = "query message (\n $projectId: String!, \n $channelId: String!, \n $id: ID!\n ) { \n message(\n projectId: $projectId, \n channelId:$channelId, \n id:$id\n ) { \n ".concat(messageFields, "\n } \n }\n");
21
+ exports.getMessageQuery = getMessageQuery;
22
+ var getMessagesQuery = "query messages (\n $projectId: String!, \n $filter: String!, \n $option: String, \n $sort: String \n ) {\n messages(\n projectId: $projectId, \n filter: $filter, \n option:$option, \n sort:$sort\n ) {\n totalCount\n edges {\n node {\n ".concat(messageFields, "\n }\n }\n }\n }\n");
23
+ exports.getMessagesQuery = getMessagesQuery;
24
+ var unreadCountQuery = "query mark (\n $projectId: String!, \n $channelId: String!\n ) { \n mark (\n projectId: $projectId, \n channelId:$channelId\n ) { \n user_id,\n message_id,\n sort_id, \n unread\n } \n }\n";
25
+ exports.unreadCountQuery = unreadCountQuery;
26
+ var messageQuery = "mutation (\n $projectId: String!\n $channelId: String!\n $content: String!\n ) {\n createChannelMessage(\n input: {\n projectId: $projectId\n channelId: $channelId\n content: $content\n }\n ) {\n message {\n ".concat(messageFields, "\n }\n }\n }\n");
27
+ exports.messageQuery = messageQuery;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+
9
+ exports.updatePinQuery = exports.getPinsQuery = exports.getPinQuery = exports.createPinQuery = void 0;
10
+
11
+ /**
12
+ * Copyright (c) NBASE CORP. and its affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+ var pinFields = "\n id\n project_id\n channel_id\n pinned\n pinnedAt\n user_id {\n id\n name\n profile\n }\n expiredAt\n createdAt\n";
18
+ var getPinQuery = "query pin (\n $projectId: String!,\n $channelId: String!,\n $id: String!\n ) {\n pin (\n projectId: $projectId,\n channelId: $channelId,\n id:$id\n ) {\n ".concat(pinFields, "\n }\n }\n ");
19
+ exports.getPinQuery = getPinQuery;
20
+ var getPinsQuery = "query pins (\n $projectId: String!,\n $channelId: String!,\n $filter: String!,\n $option: String,\n $sort: String\n ) { \n pins (\n projectId: $projectId,\n channelId: $channelId,\n filter: $filter,\n option:$option,\n sort:$sort\n ) {\n totalCount \n edges { \n node { \n ".concat(pinFields, "\n } \n } \n } \n }");
21
+ exports.getPinsQuery = getPinsQuery;
22
+ var createPinQuery = "mutation (\n $projectId: String!, \n $channelId: String!, \n $pinned: Boolean!, \n $pinnedAt: String, \n $expiredAt: String\n ) { \n createPin(\n input: {\n projectId: $projectId, \n channelId: $channelId, \n pinned: $pinned, \n pinnedAt: $pinnedAt, \n expiredAt: $expiredAt \n }\n ) { \n pin { \n ".concat(pinFields, "\n } \n } \n }");
23
+ exports.createPinQuery = createPinQuery;
24
+ var updatePinQuery = "mutation updatePin(\n $id: ID!, \n $projectId: String!, \n $channelId: String!, \n $pinned: Boolean!, \n $pinnedAt: String, \n $expiredAt: String\n ) { \n updatePin(\n input: {\n id: $id, \n projectId: $projectId, \n channelId: $channelId, \n pinned: $pinned, \n pinnedAt: $pinnedAt, \n expiredAt: $expiredAt \n }) { \n pin { \n ".concat(pinFields, "\n } \n } \n }");
25
+ exports.updatePinQuery = updatePinQuery;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+
9
+ exports.getProjectQuery = void 0;
10
+
11
+ /**
12
+ * Copyright (c) NBASE CORP. and its affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+ var getProjectQuery = "query project($id: ID!) {\n project(id:$id) { \n ncp_project_id\n name\n }\n }\n";
18
+ exports.getProjectQuery = getProjectQuery;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
+
5
+ _Object$defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+
9
+ exports.updateSubscriptionQuery = exports.getSubscriptionsQuery = exports.getSubscriptionQuery = exports.deleteSubscriptionQuery = exports.createSubscriptionQuery = void 0;
10
+
11
+ /**
12
+ * Copyright (c) NBASE CORP. and its affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+ var subscriptionFields = "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";
18
+ var createSubscriptionQuery = "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 ".concat(subscriptionFields, "\n }\n }\n }\n");
19
+ exports.createSubscriptionQuery = createSubscriptionQuery;
20
+ var deleteSubscriptionQuery = "mutation (\n $projectId: String!, \n $channelId: String!\n ) {\n deleteSubscription (\n input: {\n projectId: $projectId, \n channelId: $channelId\n }\n ) {\n subscription {\n ".concat(subscriptionFields, "\n }\n }\n }\n");
21
+ exports.deleteSubscriptionQuery = deleteSubscriptionQuery;
22
+ var updateSubscriptionQuery = "mutation (\n $projectId: String!, \n $channelId: String!, \n $mark: MarkInput, \n $option: String!\n ) {\n updateSubscription(\n input: {\n projectId: \n $projectId, \n channelId: \n $channelId, \n mark: $mark, \n option: $option\n }\n ) {\n subscription {\n ".concat(subscriptionFields, "\n }\n }\n }\n");
23
+ exports.updateSubscriptionQuery = updateSubscriptionQuery;
24
+ var getSubscriptionQuery = "query subscription (\n $projectId: String!,\n $channelId: String!, \n $id: String!\n ) {\n subscription (\n projectId: $projectId, \n channelId: $channelId, \n id:$id\n ) {\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";
25
+ exports.getSubscriptionQuery = getSubscriptionQuery;
26
+ var getSubscriptionsQuery = "query subscriptions (\n $projectId: String!, \n $option: String!, \n $filter: String!, \n $sort: String \n ) {\n subscriptions (\n projectId: $projectId, \n option:$option, \n filter:$filter, \n sort:$sort\n ) {\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";
27
+ exports.getSubscriptionsQuery = getSubscriptionsQuery;
package/lib/index.js CHANGED
@@ -1,9 +1,9 @@
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
  });
package/lib/logger.js CHANGED
@@ -8,6 +8,12 @@ _Object$defineProperty(exports, "__esModule", {
8
8
 
9
9
  exports.info = exports.error = exports.debug = void 0;
10
10
 
11
+ /**
12
+ * Copyright (c) NBASE CORP. and its affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
11
17
  var debug = function debug(value) {
12
18
  return console.log(value);
13
19
  };