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
@@ -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,121 +40,73 @@ 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';
38
- export var getSubscriptionSchema = "\n id\n channel_id\n user_id\n language\n push\n mute\n online\n channel {\n name\n type\n image_url\n push\n disabled\n }\n mark {\n user_id\n message_id\n sort_id\n unread\n }\n uniquekey\n created_at\n updated_at\n";
43
+ import CoreManager from "../CoreManager";
44
+ import { fetchData } from "../Network";
45
+ import { createSubscriptionQuery, deleteSubscriptionQuery, updateSubscriptionQuery, } from "../graphql/subscription";
46
+ /**
47
+ * Create a subscription.
48
+ *
49
+ * @async
50
+ * @function createSubscription
51
+ * @param {string} channelId - The id of a channel.
52
+ * @param {string} option
53
+ * @returns {Promise<any>}
54
+ */
39
55
  export var createSubscription = function (channelId, option) {
40
56
  if (option === void 0) { option = ""; }
41
57
  return __awaiter(void 0, void 0, void 0, function () {
42
- var token, endpoint, projectId, query;
43
58
  return __generator(this, function (_a) {
44
59
  switch (_a.label) {
45
- case 0:
46
- token = CoreManager.get("TOKEN");
47
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
48
- projectId = CoreManager.get('PROJECT_ID');
49
- query = "\n mutation (\n $projectId: String!, \n $channelId: String!,\n $option: String,\n ) {\n createSubscription (\n input: {\n projectId: $projectId, \n channelId: $channelId,\n option: $option\n }\n ) {\n subscription {\n " + getSubscriptionSchema + "\n }\n }\n }\n ";
50
- return [4 /*yield*/, fetch(endpoint, {
51
- method: 'POST',
52
- headers: {
53
- 'Authorization': 'Bearer ' + token,
54
- 'X-PROJECT-ID': projectId,
55
- 'Content-Type': 'application/json',
56
- 'Accept': 'application/json'
57
- },
58
- body: JSON.stringify({
59
- query: query,
60
- variables: {
61
- projectId: projectId,
62
- channelId: channelId,
63
- option: option
64
- }
65
- })
66
- })
67
- .then(function (res) { return res.json(); })
68
- .then(function (data) {
69
- if (data.errors) {
70
- throw data.errors[0];
71
- }
72
- return data.data.createSubscription.subscription;
73
- })];
60
+ case 0: return [4 /*yield*/, fetchData("createSubscription", createSubscriptionQuery, {
61
+ projectId: CoreManager.get("PROJECT_ID"),
62
+ channelId: channelId,
63
+ option: option
64
+ })];
74
65
  case 1: return [2 /*return*/, _a.sent()];
75
66
  }
76
67
  });
77
68
  });
78
69
  };
70
+ /**
71
+ * Delete a subscription.
72
+ *
73
+ * @async
74
+ * @function deleteSubscription
75
+ * @param {string} channelId - The id of a channel.
76
+ * @returns {Promise<any>}
77
+ */
79
78
  export var deleteSubscription = function (channelId) { return __awaiter(void 0, void 0, void 0, function () {
80
- var token, endpoint, projectId, query;
81
79
  return __generator(this, function (_a) {
82
80
  switch (_a.label) {
83
- case 0:
84
- token = CoreManager.get("TOKEN");
85
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
86
- projectId = CoreManager.get('PROJECT_ID');
87
- query = "\n mutation (\n $projectId: String!, \n $channelId: String!\n ) {\n deleteSubscription (\n input: {\n projectId: $projectId, \n channelId: $channelId\n }\n ) {\n subscription {\n " + getSubscriptionSchema + "\n }\n }\n }\n ";
88
- return [4 /*yield*/, fetch(endpoint, {
89
- method: 'POST',
90
- headers: {
91
- 'Authorization': 'Bearer ' + token,
92
- 'X-PROJECT-ID': projectId,
93
- 'Content-Type': 'application/json',
94
- 'Accept': 'application/json'
95
- },
96
- body: JSON.stringify({
97
- query: query,
98
- variables: {
99
- projectId: projectId,
100
- channelId: channelId
101
- }
102
- })
103
- })
104
- .then(function (res) { return res.json(); })
105
- .then(function (data) {
106
- if (data.errors) {
107
- throw data.errors[0];
108
- }
109
- return data.data.deleteSubscription.subscription;
110
- })];
81
+ case 0: return [4 /*yield*/, fetchData("deleteSubscription", deleteSubscriptionQuery, {
82
+ projectId: CoreManager.get("PROJECT_ID"),
83
+ channelId: channelId
84
+ })];
111
85
  case 1: return [2 /*return*/, _a.sent()];
112
86
  }
113
87
  });
114
88
  }); };
89
+ /**
90
+ * Update a subscription information, such as marking message read.
91
+ *
92
+ * @async
93
+ * @function updateSubscription
94
+ * @param {string} channelId - The id of a channel.
95
+ * @param {MarkInput} mark
96
+ * @param {string} option
97
+ * @returns {Promise<any>}
98
+ */
115
99
  export var updateSubscription = function (channelId, mark, option) {
116
100
  if (option === void 0) { option = ""; }
117
101
  return __awaiter(void 0, void 0, void 0, function () {
118
- var token, endpoint, projectId, query;
119
102
  return __generator(this, function (_a) {
120
103
  switch (_a.label) {
121
- case 0:
122
- token = CoreManager.get("TOKEN");
123
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
124
- projectId = CoreManager.get('PROJECT_ID');
125
- query = "\n mutation ($projectId: String!, $channelId: String!, $mark: MarkInput, $option: String!) {\n updateSubscription(input: {projectId: $projectId, channelId: $channelId, mark: $mark, option: $option}) {\n subscription {\n " + getSubscriptionSchema + "\n }\n }\n }\n ";
126
- return [4 /*yield*/, fetch(endpoint, {
127
- method: 'POST',
128
- headers: {
129
- 'Authorization': 'Bearer ' + token,
130
- 'X-PROJECT-ID': projectId,
131
- 'Content-Type': 'application/json',
132
- 'Accept': 'application/json'
133
- },
134
- body: JSON.stringify({
135
- query: query,
136
- variables: {
137
- projectId: projectId,
138
- channelId: channelId,
139
- mark: mark,
140
- option: option
141
- }
142
- })
143
- })
144
- .then(function (res) { return res.json(); })
145
- .then(function (data) {
146
- if (data.errors)
147
- throw data.errors[0];
148
- if (data.code)
149
- throw data;
150
- return data.data.updateSubscription.subscription;
151
- })];
104
+ case 0: return [4 /*yield*/, fetchData("updateSubscription", updateSubscriptionQuery, {
105
+ projectId: CoreManager.get("PROJECT_ID"),
106
+ channelId: channelId,
107
+ mark: mark,
108
+ option: option
109
+ })];
152
110
  case 1: return [2 /*return*/, _a.sent()];
153
111
  }
154
112
  });
@@ -1 +1 @@
1
- {"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/mutations/subscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,MAAM,CAAC,IAAM,qBAAqB,GAAG,onBAwBpC,CAAC;AACF,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAAO,SAAiB,EAAE,MAAmB;IAAnB,uBAAA,EAAA,WAAmB;;;;;;oBACvE,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oBACjC,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;oBACtD,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;oBACxC,KAAK,GAAG,+XAcE,qBAAqB,kDAIpC,CAAC;oBAEK,qBAAM,KAAK,CACd,QAAQ,EAAE;4BACV,MAAM,EAAE,MAAM;4BACd,OAAO,EAAE;gCACL,eAAe,EAAG,SAAS,GAAG,KAAK;gCACnC,cAAc,EAAG,SAAS;gCAC1B,cAAc,EAAE,kBAAkB;gCAClC,QAAQ,EAAE,kBAAkB;6BAC/B;4BACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gCACjB,KAAK,OAAA;gCACL,SAAS,EAAE;oCACP,SAAS,WAAA;oCACT,SAAS,WAAA;oCACT,MAAM,QAAA;iCACR;6BACH,CAAC;yBACP,CAAC;6BACD,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EA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**
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
+ * Get data of a single channel from the endpoint.
9
+ *
10
+ * @async
11
+ * @function getChannel
12
+ * @param {string} id - An id of the channel.
13
+ * @returns {Promise<any>} The data of the channel.
14
+ */
1
15
  export declare const getChannel: (id: string) => Promise<any>;
16
+ /**
17
+ * Get data of multiple channels.
18
+ *
19
+ * @async
20
+ * @function getChannels
21
+ * @param {string} filter - Field value for filter.
22
+ * @param {string} sort - Field value for sorting.
23
+ * @param {string} option - Optional option: ex) offset, per_page.
24
+ * @returns {Promise<any[]>} An array of data of all channels.
25
+ */
2
26
  export declare const getChannels: (filter: string, sort: string, option: 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,95 +40,47 @@ 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';
38
- import { ObjectId } from '../Util';
43
+ import CoreManager from "../CoreManager";
44
+ import { getChannelQuery, getChannelsQuery } from "../graphql/channel";
45
+ import { fetchData } from "../Network";
46
+ /**
47
+ * Get data of a single channel from the endpoint.
48
+ *
49
+ * @async
50
+ * @function getChannel
51
+ * @param {string} id - An id of the channel.
52
+ * @returns {Promise<any>} The data of the channel.
53
+ */
39
54
  export var getChannel = function (id) { return __awaiter(void 0, void 0, void 0, function () {
40
- var token, projectId, endpoint, query;
41
55
  return __generator(this, function (_a) {
42
56
  switch (_a.label) {
43
- case 0:
44
- token = CoreManager.get('TOKEN');
45
- if (!token)
46
- return [2 /*return*/, null];
47
- projectId = CoreManager.get('PROJECT_ID');
48
- if (!projectId)
49
- return [2 /*return*/, null];
50
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
51
- query = "\n query channel ($projectId: String!, $id: String!) {\n channel(projectId: $projectId, id:$id) {\n id\n project_id\n name\n user_id { \n id\n name\n profile\n device_type\n language\n }\n last_message {\n message_id\n sort_id\n project_id\n channel_id\n message_type\n mentions\n mentions_everyone\n has\n sender {\n id\n name\n profile\n }\n admin {\n id\n name\n profile\n }\n content\n created_at\n }\n unique_id\n type\n translation\n members\n push\n link_url\n image_url \n created_at\n updated_at\n }\n }\n ";
52
- return [4 /*yield*/, fetch(endpoint, {
53
- method: 'POST',
54
- headers: {
55
- Authorization: 'Bearer ' + token,
56
- 'X-PROJECT-ID': projectId,
57
- 'Content-Type': 'application/json',
58
- Accept: 'application/json'
59
- },
60
- body: JSON.stringify({
61
- query: query,
62
- variables: {
63
- projectId: projectId,
64
- id: id
65
- }
66
- })
67
- })
68
- .then(function (res) { return res.json(); })
69
- .then(function (data) {
70
- if (data.errors)
71
- throw data.errors[0];
72
- if (data.code)
73
- throw data;
74
- if (data.data.channel) {
75
- data.data.channel.id = ObjectId(data.data.channel.id);
76
- return data.data.channel;
77
- }
78
- return false;
79
- })];
57
+ case 0: return [4 /*yield*/, fetchData("channel", getChannelQuery, {
58
+ projectId: CoreManager.get("PROJECT_ID"),
59
+ id: id
60
+ })];
80
61
  case 1: return [2 /*return*/, _a.sent()];
81
62
  }
82
63
  });
83
64
  }); };
65
+ /**
66
+ * Get data of multiple channels.
67
+ *
68
+ * @async
69
+ * @function getChannels
70
+ * @param {string} filter - Field value for filter.
71
+ * @param {string} sort - Field value for sorting.
72
+ * @param {string} option - Optional option: ex) offset, per_page.
73
+ * @returns {Promise<any[]>} An array of data of all channels.
74
+ */
84
75
  export var getChannels = function (filter, sort, option) { return __awaiter(void 0, void 0, void 0, function () {
85
- var token, projectId, endpoint, query;
86
76
  return __generator(this, function (_a) {
87
77
  switch (_a.label) {
88
- case 0:
89
- token = CoreManager.get('TOKEN');
90
- if (!token)
91
- return [2 /*return*/, null];
92
- projectId = CoreManager.get('PROJECT_ID');
93
- if (!projectId)
94
- return [2 /*return*/, null];
95
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
96
- query = "\n query channels ($projectId: String!, $filter: String!, $sort: String, $option:String) {\n channels(projectId: $projectId, filter:$filter, sort:$sort, option:$option) {\n totalCount\n edges {\n node {\n id\n project_id\n name\n user_id { \n id\n name\n profile\n device_type\n language\n }\n last_message {\n message_id\n sort_id\n project_id\n channel_id\n message_type\n mentions\n mentions_everyone\n has\n sender {\n id\n name\n profile\n }\n admin {\n id\n name\n profile\n }\n content\n }\n unique_id\n type\n translation\n members\n push\n link_url\n image_url \n created_at\n updated_at\n }\n }\n }\n }\n ";
97
- return [4 /*yield*/, fetch(endpoint, {
98
- method: 'POST',
99
- headers: {
100
- Authorization: 'Bearer ' + token,
101
- 'X-PROJECT-ID': projectId,
102
- 'Content-Type': 'application/json',
103
- Accept: 'application/json'
104
- },
105
- body: JSON.stringify({
106
- query: query,
107
- variables: {
108
- projectId: projectId,
109
- filter: filter,
110
- sort: sort,
111
- option: option
112
- }
113
- })
114
- })
115
- .then(function (res) { return res.json(); })
116
- .then(function (data) {
117
- if (data.errors)
118
- throw data.errors[0];
119
- if (data.code)
120
- throw data;
121
- if (data.data.channels) {
122
- return data.data.channels.edges;
123
- }
124
- return [];
125
- })];
78
+ case 0: return [4 /*yield*/, fetchData("channels", getChannelsQuery, {
79
+ projectId: CoreManager.get("PROJECT_ID"),
80
+ filter: filter,
81
+ sort: sort,
82
+ option: option
83
+ })];
126
84
  case 1: return [2 /*return*/, _a.sent()];
127
85
  }
128
86
  });
@@ -1 +1 @@
1
- {"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/queries/channel.ts"],"names":[],"mappings":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C;wBACrC,IAAG,IAAI,CAAC,IAAI;4BAAE,MAAM,IAAI,CAAC;wBAEzB,IAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EACrB;4BACE,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;yBACjC;wBACD,OAAO,EAAE,CAAC;oBAEZ,CAAC,CAAC,EAAA;oBA7BJ,sBAAO,SA6BH,EAAC;;;KACN,CAAC"}
1
+ {"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/queries/channel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG,UAAO,EAAU;;;oBAChC,qBAAM,SAAS,CAAC,SAAS,EAAE,eAAe,EAAE;oBAC/C,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,EAAE,IAAA;iBACL,CAAC,EAAA;oBAHF,sBAAO,SAGL,EAAC;;;KACN,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,IAAM,WAAW,GAAG,UACvB,MAAc,EACd,IAAY,EACZ,MAAc;;;oBAEP,qBAAM,SAAS,CAAC,UAAU,EAAE,gBAAgB,EAAE;oBACjD,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,MAAM,QAAA;oBACN,IAAI,MAAA;oBACJ,MAAM,QAAA;iBACT,CAAC,EAAA;oBALF,sBAAO,SAKL,EAAC;;;KACN,CAAC"}
@@ -1 +1,17 @@
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
+ * Get current friends list of all status.
9
+ *
10
+ * @async
11
+ * @function getFriendships
12
+ * @param {string} filter - Field value for filter.
13
+ * @param {string} sort - Field value for sorting.
14
+ * @param {string} option - Optional option: ex) offset, per_page.
15
+ * @returns {Promise<any>}
16
+ */
1
17
  export declare const getFriendships: (filter: string, sort: string, option: 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,49 +40,28 @@ 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 { fetchData } from "../Network";
45
+ import { getFriendshipsQuery } from "../graphql/friend";
46
+ /**
47
+ * Get current friends list of all status.
48
+ *
49
+ * @async
50
+ * @function getFriendships
51
+ * @param {string} filter - Field value for filter.
52
+ * @param {string} sort - Field value for sorting.
53
+ * @param {string} option - Optional option: ex) offset, per_page.
54
+ * @returns {Promise<any>}
55
+ */
38
56
  export var getFriendships = function (filter, sort, option) { return __awaiter(void 0, void 0, void 0, function () {
39
- var token, projectId, endpoint, lquery;
40
57
  return __generator(this, function (_a) {
41
58
  switch (_a.label) {
42
- case 0:
43
- token = CoreManager.get('TOKEN');
44
- if (!token)
45
- return [2 /*return*/, null];
46
- projectId = CoreManager.get('PROJECT_ID');
47
- if (!projectId)
48
- return [2 /*return*/, null];
49
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
50
- lquery = "\n query friendships ($projectId: String!, $filter: String!, $sort: String, $option: String) {\n friendships(projectId: $projectId, filter:$filter, sort:$sort, option: $option) {\n totalCount\n edges {\n node {\n project_id\n id\n status\n user {\n id\n name\n profile\n }\n friend {\n id\n name\n profile\n }\n user_id\n friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n }\n ";
51
- return [4 /*yield*/, fetch(endpoint, {
52
- method: 'POST',
53
- headers: {
54
- Authorization: 'Bearer ' + token,
55
- 'X-PROJECT-ID': projectId,
56
- 'Content-Type': 'application/json',
57
- Accept: 'application/json'
58
- },
59
- body: JSON.stringify({
60
- query: lquery,
61
- variables: {
62
- projectId: projectId,
63
- filter: filter,
64
- sort: sort,
65
- option: option
66
- }
67
- })
68
- })
69
- .then(function (res) { return res.json(); })
70
- .then(function (data) {
71
- if (data.errors)
72
- throw data.errors[0];
73
- if (data.code)
74
- throw data;
75
- if (data.data.friendships) {
76
- return data.data.friendships.edges;
77
- }
78
- return [];
79
- })];
59
+ case 0: return [4 /*yield*/, fetchData("friendships", getFriendshipsQuery, {
60
+ projectId: CoreManager.get("PROJECT_ID"),
61
+ filter: filter,
62
+ sort: sort,
63
+ option: option
64
+ })];
80
65
  case 1: return [2 /*return*/, _a.sent()];
81
66
  }
82
67
  });
@@ -1 +1 @@
1
- {"version":3,"file":"friend.js","sourceRoot":"","sources":["../../src/queries/friend.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,IAAM,cAAc,GAAG,UAAO,MAAc,EAAE,IAAY,EAAE,MAAa;;;;;gBACxE,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACvC,IAAI,CAAC,KAAK;oBAAE,sBAAO,IAAI,EAAC;gBAClB,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAChD,IAAI,CAAC,SAAS;oBAAE,sBAAO,IAAI,EAAC;gBACtB,QA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B,CAAC;AAExD;;;;;;;;;GASG;AACH,MAAM,CAAC,IAAM,cAAc,GAAG,UAC1B,MAAc,EACd,IAAY,EACZ,MAAc;;;oBAEP,qBAAM,SAAS,CAAC,aAAa,EAAE,mBAAmB,EAAE;oBACvD,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,MAAM,QAAA;oBACN,IAAI,MAAA;oBACJ,MAAM,QAAA;iBACT,CAAC,EAAA;oBALF,sBAAO,SAKL,EAAC;;;KACN,CAAC"}
@@ -1,6 +1,14 @@
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
  export * from './project';
2
8
  export * from './channel';
3
9
  export * from './message';
4
10
  export * from './subscription';
5
11
  export * from './friend';
6
12
  export * from './member';
13
+ export * from './memberblocks';
14
+ export * from './pin';
@@ -1,7 +1,15 @@
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
  export * from './project';
2
8
  export * from './channel';
3
9
  export * from './message';
4
10
  export * from './subscription';
5
11
  export * from './friend';
6
12
  export * from './member';
13
+ export * from './memberblocks';
14
+ export * from './pin';
7
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/queries/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/queries/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC"}
@@ -1 +1,17 @@
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
+ * Get information data of the member.
9
+ *
10
+ * @async
11
+ * @function getMembers
12
+ * @param {string} filter - Field value for filter.
13
+ * @param {string} sort - Field value for sorting.
14
+ * @param {string} option - Optional option: ex) offset, per_page.
15
+ * @returns {Promise<any>}
16
+ */
1
17
  export declare const getMembers: (filter: string, sort: string, option: 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,49 +40,28 @@ 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 { fetchData } from "../Network";
44
+ import CoreManager from "../CoreManager";
45
+ import { getMembersQuery } from "../graphql/member";
46
+ /**
47
+ * Get information data of the member.
48
+ *
49
+ * @async
50
+ * @function getMembers
51
+ * @param {string} filter - Field value for filter.
52
+ * @param {string} sort - Field value for sorting.
53
+ * @param {string} option - Optional option: ex) offset, per_page.
54
+ * @returns {Promise<any>}
55
+ */
38
56
  export var getMembers = function (filter, sort, option) { return __awaiter(void 0, void 0, void 0, function () {
39
- var token, projectId, endpoint, lquery;
40
57
  return __generator(this, function (_a) {
41
58
  switch (_a.label) {
42
- case 0:
43
- token = CoreManager.get('TOKEN');
44
- if (!token)
45
- return [2 /*return*/, null];
46
- projectId = CoreManager.get('PROJECT_ID');
47
- if (!projectId)
48
- return [2 /*return*/, null];
49
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
50
- lquery = "\n query membersForQuery ($projectId: String!, $option: String!, $filter: String!, $sort: String ) {\n membersForQuery (projectId: $projectId, option:$option, filter:$filter, sort:$sort) {\n totalCount\n edges {\n node {\n id\n name\n }\n }\n }\n }\n ";
51
- return [4 /*yield*/, fetch(endpoint, {
52
- method: 'POST',
53
- headers: {
54
- Authorization: 'Bearer ' + token,
55
- 'X-PROJECT-ID': projectId,
56
- 'Content-Type': 'application/json',
57
- Accept: 'application/json'
58
- },
59
- body: JSON.stringify({
60
- query: lquery,
61
- variables: {
62
- projectId: projectId,
63
- filter: filter,
64
- sort: sort,
65
- option: option
66
- }
67
- })
68
- })
69
- .then(function (res) { return res.json(); })
70
- .then(function (data) {
71
- if (data.errors)
72
- throw data.errors[0];
73
- if (data.code)
74
- throw data;
75
- if (data.data.membersForQuery) {
76
- return data.data.membersForQuery.edges;
77
- }
78
- return [];
79
- })];
59
+ case 0: return [4 /*yield*/, fetchData("membersForQuery", getMembersQuery, {
60
+ projectId: CoreManager.get("PROJECT_ID"),
61
+ filter: filter,
62
+ sort: sort,
63
+ option: option
64
+ })];
80
65
  case 1: return [2 /*return*/, _a.sent()];
81
66
  }
82
67
  });
@@ -1 +1 @@
1
- {"version":3,"file":"member.js","sourceRoot":"","sources":["../../src/queries/member.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,IAAM,UAAU,GAAG,UAAO,MAAc,EAAE,IAAY,EAAE,MAAc;;;;;gBACrE,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG,UACtB,MAAc,EACd,IAAY,EACZ,MAAc;;;oBAEP,qBAAM,SAAS,CAAC,iBAAiB,EAAE,eAAe,EAAE;oBACvD,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,MAAM,QAAA;oBACN,IAAI,MAAA;oBACJ,MAAM,QAAA;iBACT,CAAC,EAAA;oBALF,sBAAO,SAKL,EAAC;;;KACN,CAAC"}
@@ -0,0 +1,17 @@
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
+ * Get member blocks.
9
+ *
10
+ * @async
11
+ * @function getMemberBlocks
12
+ * @param {string} filter - Field value for filter.
13
+ * @param {string} sort - Field value for sorting.
14
+ * @param {string} option - Optional option: ex) offset, per_page.
15
+ * @returns {Promise<any>}
16
+ */
17
+ export declare const getMemberBlocks: (filter: string, sort: string, option: string) => Promise<any>;