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,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,141 +40,88 @@ 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 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";
39
- export var login = function (user_id, name, profile, token) {
40
- if (name === void 0) { name = ''; }
41
- if (profile === void 0) { profile = ''; }
42
- if (token === void 0) { token = ''; }
43
+ import CoreManager from "../CoreManager";
44
+ import { fetchData } from "../Network";
45
+ import { loginQuery, createMemberBlockQuery, deleteMemberBlockQuery, } from "../graphql/member";
46
+ /**
47
+ * Login a user
48
+ *
49
+ * @async
50
+ * @function login
51
+ * @param {string} user_id - The id of a user loggin in.
52
+ * @param {string} name
53
+ * @param {string} profile
54
+ * @param {string} token
55
+ * @returns {Promise<any>}
56
+ */
57
+ export var login = function (user_id, name, profile, token, customField) {
58
+ if (name === void 0) { name = ""; }
59
+ if (profile === void 0) { profile = ""; }
60
+ if (token === void 0) { token = ""; }
61
+ if (customField === void 0) { customField = ""; }
43
62
  return __awaiter(void 0, void 0, void 0, function () {
44
- var projectId, endpoint, mutation;
45
63
  return __generator(this, function (_a) {
46
64
  switch (_a.label) {
47
65
  case 0:
48
66
  CoreManager.set("TOKEN", token);
49
- projectId = CoreManager.get("PROJECT_ID");
50
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
51
- mutation = "mutation login ($projectId: String!, $userId: String!, $name: String, $profile: String) {\n login(input :{ projectId: $projectId, userId:$userId, name:$name, profile:$profile}) {\n token\n }\n }";
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: mutation,
62
- variables: {
63
- projectId: projectId,
64
- userId: user_id,
65
- name: name,
66
- profile: profile,
67
- token: token
68
- }
69
- })
70
- })
71
- .then(function (res) { return res.json(); })
72
- .then(function (data) {
73
- if (data.errors)
74
- throw data.errors[0];
75
- if (data.code)
76
- throw data;
77
- else if (data.data.login.token) {
78
- return data.data.login.token;
79
- }
80
- else
81
- return false;
67
+ return [4 /*yield*/, fetchData("login", loginQuery, {
68
+ projectId: CoreManager.get("PROJECT_ID"),
69
+ userId: user_id,
70
+ name: name,
71
+ profile: profile,
72
+ token: token,
73
+ customField: customField
82
74
  })];
83
75
  case 1: return [2 /*return*/, _a.sent()];
84
76
  }
85
77
  });
86
78
  });
87
79
  };
80
+ /**
81
+ * Create a member block followed by the getMemberBlockSchema.
82
+ * The member block is to used to ban a member.
83
+ *
84
+ * @async
85
+ * @function createMemberBlock
86
+ * @param {string} channelId - The id of a channel.
87
+ * @param {string} memberId - The id of a member.
88
+ * @param {string} options
89
+ * @returns {Promise<any>}
90
+ */
88
91
  export var createMemberBlock = function (channelId, memberId, options) {
89
92
  if (options === void 0) { options = ""; }
90
93
  return __awaiter(void 0, void 0, void 0, function () {
91
- var token, projectId, endpoint, mutation;
92
94
  return __generator(this, function (_a) {
93
95
  switch (_a.label) {
94
- case 0:
95
- token = CoreManager.get("TOKEN");
96
- projectId = CoreManager.get("PROJECT_ID");
97
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
98
- mutation = "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 " + getMemberBlockSchema + "\n }\n }\n }";
99
- return [4 /*yield*/, fetch(endpoint, {
100
- method: 'POST',
101
- headers: {
102
- 'Authorization': 'Bearer ' + token,
103
- 'X-PROJECT-ID': projectId,
104
- 'Content-Type': 'application/json',
105
- 'Accept': 'application/json'
106
- },
107
- body: JSON.stringify({
108
- query: mutation,
109
- variables: {
110
- projectId: projectId,
111
- channelId: channelId,
112
- memberId: memberId,
113
- options: options
114
- }
115
- })
116
- })
117
- .then(function (res) { return res.json(); })
118
- .then(function (data) {
119
- if (data.errors)
120
- throw data.errors[0];
121
- if (data.code)
122
- throw data;
123
- else if (data.data.createMemberBlock) {
124
- return data.data.createMemberBlock;
125
- }
126
- else
127
- return false;
128
- })];
96
+ case 0: return [4 /*yield*/, fetchData("createMemberBlock", createMemberBlockQuery, {
97
+ projectId: CoreManager.get("PROJECT_ID"),
98
+ channelId: channelId,
99
+ memberId: memberId,
100
+ options: options
101
+ })];
129
102
  case 1: return [2 /*return*/, _a.sent()];
130
103
  }
131
104
  });
132
105
  });
133
106
  };
107
+ /**
108
+ * Delete a member block.
109
+ * This is used to unban a member from a channel.
110
+ *
111
+ * @async
112
+ * @function deleteMemberBlock
113
+ * @param {string} channelId - The id of a channel that the member is in.
114
+ * @param {string} memberId - The id of a member to be deleted.
115
+ * @returns {Promise<any>}
116
+ */
134
117
  export var deleteMemberBlock = function (channelId, memberId) { return __awaiter(void 0, void 0, void 0, function () {
135
- var token, projectId, endpoint, mutation;
136
118
  return __generator(this, function (_a) {
137
119
  switch (_a.label) {
138
- case 0:
139
- token = CoreManager.get("TOKEN");
140
- projectId = CoreManager.get("PROJECT_ID");
141
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
142
- mutation = "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 " + getMemberBlockSchema + "\n }\n }\n }";
143
- return [4 /*yield*/, fetch(endpoint, {
144
- method: 'POST',
145
- headers: {
146
- 'Authorization': 'Bearer ' + token,
147
- 'X-PROJECT-ID': projectId,
148
- 'Content-Type': 'application/json',
149
- 'Accept': 'application/json'
150
- },
151
- body: JSON.stringify({
152
- query: mutation,
153
- variables: {
154
- projectId: projectId,
155
- channelId: channelId,
156
- memberId: memberId
157
- }
158
- })
159
- })
160
- .then(function (res) { return res.json(); })
161
- .then(function (data) {
162
- if (data.errors)
163
- throw data.errors[0];
164
- if (data.code)
165
- throw data;
166
- else if (data.data.deleteMemberBlock) {
167
- return data.data.deleteMemberBlock;
168
- }
169
- else
170
- return false;
171
- })];
120
+ case 0: return [4 /*yield*/, fetchData("deleteMemberBlock", deleteMemberBlockQuery, {
121
+ projectId: CoreManager.get("PROJECT_ID"),
122
+ channelId: channelId,
123
+ memberId: memberId
124
+ })];
172
125
  case 1: return [2 /*return*/, _a.sent()];
173
126
  }
174
127
  });
@@ -1 +1 @@
1
- {"version":3,"file":"member.js","sourceRoot":"","sources":["../../src/mutations/member.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,IAAM,oBAAoB,GAAG,wTAkBnC,CAAC;AAEF,MAAM,CAAC,IAAM,KAAK,GAAG,UAAO,OAAe,EAAE,IAAiB,EAAE,OAAmB,EAAE,KAAiB;IAAzD,qBAAA,EAAA,SAAiB;IAAE,wBAAA,EAAA,YAAmB;IAAE,sBAAA,EAAA,UAAiB;;;;;;oBAClG,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;oBAC1B,SAAS,GAAG,WA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ACN,CAAC"}
@@ -1,2 +1,37 @@
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
+ * Trasnslate a text block to the target language from the source language.
9
+ *
10
+ * @async
11
+ * @function translate
12
+ * @param {string} channelId - The id of a channel.
13
+ * @param {string} srcLang - The source language.
14
+ * @param {string} targetLang - The target language.
15
+ * @param {string} text - The text block to be translated.
16
+ * @returns {Promise<any>}
17
+ */
1
18
  export declare const translate: (channelId: string, srcLang: string, targetLang: string, text: string) => Promise<any>;
19
+ /**
20
+ * Upload a file to a channel. Only supports png, jpg, jpeg file types.
21
+ *
22
+ * @async
23
+ * @function upload
24
+ * @param {string} channelId - The id of a channel.
25
+ * @param {any} file - An image file.
26
+ * @returns {Promise<any>}
27
+ */
2
28
  export declare const upload: (channelId: string, file: any) => Promise<any>;
29
+ /**
30
+ * Send a Message
31
+ *
32
+ * @async
33
+ * @function translate
34
+ * @param {string} data - The id of a message.
35
+ * @returns {Promise<any>}
36
+ */
37
+ export declare const message: (data: 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,69 +40,64 @@ 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 { translateQuery, messageQuery } from "../graphql/message";
46
+ /**
47
+ * Trasnslate a text block to the target language from the source language.
48
+ *
49
+ * @async
50
+ * @function translate
51
+ * @param {string} channelId - The id of a channel.
52
+ * @param {string} srcLang - The source language.
53
+ * @param {string} targetLang - The target language.
54
+ * @param {string} text - The text block to be translated.
55
+ * @returns {Promise<any>}
56
+ */
38
57
  export var translate = function (channelId, srcLang, targetLang, text) { return __awaiter(void 0, void 0, void 0, function () {
39
- var token, projectId, endpoint, query;
40
58
  return __generator(this, function (_a) {
41
59
  switch (_a.label) {
42
- case 0:
43
- token = CoreManager.get("TOKEN");
44
- projectId = CoreManager.get("PROJECT_ID");
45
- endpoint = CoreManager.get('SERVER_URL') + '/graphql';
46
- query = "\n mutation ($projectId: String!, $channelId: String!, $srcLang: String!, $text: String!, $targetLang:String!) {\n translation(input: {projectId:$projectId, channelId:$channelId,srcLang:$srcLang,targetLang:$targetLang, text:$text }) {\n result\n {\n status\n message\n lang\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
- srcLang: srcLang,
61
- targetLang: targetLang,
62
- text: text
63
- }
64
- })
65
- })
66
- .then(function (res) { return res.json(); })
67
- .then(function (data) {
68
- if (data.errors)
69
- throw data.errors[0];
70
- if (data.code)
71
- throw data;
72
- return data;
73
- })];
60
+ case 0: return [4 /*yield*/, fetchData("", translateQuery, {
61
+ projectId: CoreManager.get("PROJECT_ID"),
62
+ channelId: channelId,
63
+ srcLang: srcLang,
64
+ targetLang: targetLang,
65
+ text: text
66
+ })];
74
67
  case 1: return [2 /*return*/, _a.sent()];
75
68
  }
76
69
  });
77
70
  }); };
71
+ /**
72
+ * Upload a file to a channel. Only supports png, jpg, jpeg file types.
73
+ *
74
+ * @async
75
+ * @function upload
76
+ * @param {string} channelId - The id of a channel.
77
+ * @param {any} file - An image file.
78
+ * @returns {Promise<any>}
79
+ */
78
80
  export var upload = function (channelId, file) { return __awaiter(void 0, void 0, void 0, function () {
79
- var token, projectId, endpoint, form, result;
81
+ var token, endpoint, form, result;
80
82
  return __generator(this, function (_a) {
81
83
  switch (_a.label) {
82
84
  case 0:
83
85
  token = CoreManager.get("TOKEN");
84
86
  if (!token) {
85
- console.error('Token is not found');
87
+ console.error("Token is not found");
86
88
  return [2 /*return*/];
87
89
  }
88
- projectId = CoreManager.get("PROJECT_ID");
89
- endpoint = CoreManager.get('SERVER_URL') + '/upload';
90
+ endpoint = CoreManager.get("SERVER_URL") + "/upload";
90
91
  form = new FormData();
91
- form.append('file', file);
92
- form.append('channelId', channelId);
93
- form.append('upload', '1');
92
+ form.append("file", file);
93
+ form.append("channelId", channelId);
94
+ form.append("upload", "1");
94
95
  return [4 /*yield*/, fetch(endpoint, {
95
- method: 'POST',
96
+ method: "POST",
96
97
  headers: {
97
- 'Authorization': 'Bearer ' + token,
98
- 'X-PROJECT-ID': projectId,
99
- 'projectid': projectId
98
+ Authorization: "Bearer " + token,
99
+ "X-PROJECT-ID": CoreManager.get("PROJECT_ID"),
100
+ projectid: CoreManager.get("PROJECT_ID")
100
101
  },
101
102
  body: form
102
103
  }).then(function (res) { return res.json(); })];
@@ -106,4 +107,24 @@ export var upload = function (channelId, file) { return __awaiter(void 0, void 0
106
107
  }
107
108
  });
108
109
  }); };
110
+ /**
111
+ * Send a Message
112
+ *
113
+ * @async
114
+ * @function translate
115
+ * @param {string} data - The id of a message.
116
+ * @returns {Promise<any>}
117
+ */
118
+ export var message = function (data) { return __awaiter(void 0, void 0, void 0, function () {
119
+ return __generator(this, function (_a) {
120
+ switch (_a.label) {
121
+ case 0: return [4 /*yield*/, fetchData("createChannelMessage", messageQuery, {
122
+ projectId: CoreManager.get("PROJECT_ID"),
123
+ channelId: data.channelId,
124
+ content: data.message
125
+ })];
126
+ case 1: return [2 /*return*/, _a.sent()];
127
+ }
128
+ });
129
+ }); };
109
130
  //# sourceMappingURL=message.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/mutations/message.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,IAAM,SAAS,GAAG,UAAO,SAAiB,EAAE,OAAe,EAAE,UAAkB,EAAE,IAAY;;;;;gBAC1F,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,uYAWb,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,OAAO,SAAA;gCACP,UAAU,YAAA;gCACV,IAAI,MAAA;6BACN;yBACH,CAAC;qBACP,CAAC;yBACD,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC;yBACvB,IAAI,CAAC,UAAA,IAAI;wBACN,IAAG,IAAI,CAAC,MAAM;4BAAE,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;wBACrC,IAAG,IAAI,CAAC,IAAI;4BAAE,MAAM,IAAI,CAAC;wBACzB,OAAO,IAAI,CAAC;o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AAI,EAAE,IAAI;qBACb,CAAC,CAAC,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC,EAAA;;gBARtB,MAAM,GAAG,SAQa;gBAC5B,sBAAO,MAAM,EAAC;;;KACjB,CAAC;AAGF;;;;;;;GAOG;AACF,MAAM,CAAC,IAAM,OAAO,GAAG,UAAO,IAAS;;;oBAE7B,qBAAM,SAAS,CAAC,sBAAsB,EAAE,YAAY,EAAE;oBACzD,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,OAAO,EAAE,IAAI,CAAC,OAAO;iBACxB,CAAC,EAAA;oBAJF,sBAAO,SAIL,EAAC;;;KACN,CAAC"}
@@ -0,0 +1,28 @@
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
+ import type { PinInput } from "../Type";
8
+ /**
9
+ * Create a new pin.
10
+ *
11
+ * @async
12
+ * @function createPin
13
+ * @param {string} channelId - An id of the channel.
14
+ * @param {PinInput} pin - Configuration options of the new pin.
15
+ * @returns {Promise<any>} The data of the newly created pin.
16
+ */
17
+ export declare const createPin: (channelId: string, pin: PinInput) => Promise<any>;
18
+ /**
19
+ * Update pin options.
20
+ *
21
+ * @async
22
+ * @function updatePin
23
+ * @param {string} id - An id of the pin.
24
+ * @param {string} channelId - An id of the channel.
25
+ * @param {PinInput} pin - New options of the pin.
26
+ * @returns {Promise<any>} The data of the updated created pin.
27
+ */
28
+ export declare const updatePin: (id: string, channelId: string, pin: PinInput) => Promise<any>;
@@ -0,0 +1,88 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
14
+ });
15
+ };
16
+ var __generator = (this && this.__generator) || function (thisArg, body) {
17
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
18
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
19
+ function verb(n) { return function (v) { return step([n, v]); }; }
20
+ function step(op) {
21
+ if (f) throw new TypeError("Generator is already executing.");
22
+ while (_) try {
23
+ 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;
24
+ if (y = 0, t) op = [op[0] & 2, t.value];
25
+ switch (op[0]) {
26
+ case 0: case 1: t = op; break;
27
+ case 4: _.label++; return { value: op[1], done: false };
28
+ case 5: _.label++; y = op[1]; op = [0]; continue;
29
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
30
+ default:
31
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
32
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
33
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
34
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
35
+ if (t[2]) _.ops.pop();
36
+ _.trys.pop(); continue;
37
+ }
38
+ op = body.call(thisArg, _);
39
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
40
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
41
+ }
42
+ };
43
+ import CoreManager from "../CoreManager";
44
+ import { fetchData } from "../Network";
45
+ import { createPinQuery, updatePinQuery } from "../graphql/pin";
46
+ /**
47
+ * Create a new pin.
48
+ *
49
+ * @async
50
+ * @function createPin
51
+ * @param {string} channelId - An id of the channel.
52
+ * @param {PinInput} pin - Configuration options of the new pin.
53
+ * @returns {Promise<any>} The data of the newly created pin.
54
+ */
55
+ export var createPin = function (channelId, pin) { return __awaiter(void 0, void 0, void 0, function () {
56
+ return __generator(this, function (_a) {
57
+ return [2 /*return*/, fetchData("createPin", createPinQuery, {
58
+ projectId: CoreManager.get("PROJECT_ID"),
59
+ channelId: channelId,
60
+ pinned: pin.pinned,
61
+ pinnedAt: pin.pinnedAt,
62
+ expiredAt: pin.expiredAt
63
+ })];
64
+ });
65
+ }); };
66
+ /**
67
+ * Update pin options.
68
+ *
69
+ * @async
70
+ * @function updatePin
71
+ * @param {string} id - An id of the pin.
72
+ * @param {string} channelId - An id of the channel.
73
+ * @param {PinInput} pin - New options of the pin.
74
+ * @returns {Promise<any>} The data of the updated created pin.
75
+ */
76
+ export var updatePin = function (id, channelId, pin) { return __awaiter(void 0, void 0, void 0, function () {
77
+ return __generator(this, function (_a) {
78
+ return [2 /*return*/, fetchData("updatePin", updatePinQuery, {
79
+ id: id,
80
+ projectId: CoreManager.get("PROJECT_ID"),
81
+ channelId: channelId,
82
+ pinned: pin.pinned,
83
+ pinnedAt: pin.pinnedAt,
84
+ expiredAt: pin.expiredAt
85
+ })];
86
+ });
87
+ }); };
88
+ //# sourceMappingURL=pin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pin.js","sourceRoot":"","sources":["../../src/mutations/pin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhE;;;;;;;;EAQE;AACH,MAAM,CAAC,IAAM,SAAS,GAAG,UAAO,SAAiB,EAAE,GAAa;;QAC5D,sBAAO,SAAS,CAAC,WAAW,EAAE,cAAc,EAAE;gBAC1C,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;gBACxC,SAAS,EAAE,SAAS;gBACpB,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,SAAS,EAAE,GAAG,CAAC,SAAS;aAC3B,CAAC,EAAC;;KACN,CAAC;AAEF;;;;;;;;;GASG;AACF,MAAM,CAAC,IAAM,SAAS,GAAG,UACtB,EAAU,EACV,SAAiB,EACjB,GAAa;;QAEb,sBAAO,SAAS,CAAC,WAAW,EAAE,cAAc,EAAE;gBAC1C,EAAE,EAAE,EAAE;gBACN,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;gBACxC,SAAS,EAAE,SAAS;gBACpB,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,SAAS,EAAE,GAAG,CAAC,SAAS;aAC3B,CAAC,EAAC;;KACN,CAAC"}
@@ -1,5 +1,37 @@
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
  import type { MarkInput } from "../Type";
2
- export declare const 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";
8
+ /**
9
+ * Create a subscription.
10
+ *
11
+ * @async
12
+ * @function createSubscription
13
+ * @param {string} channelId - The id of a channel.
14
+ * @param {string} option
15
+ * @returns {Promise<any>}
16
+ */
3
17
  export declare const createSubscription: (channelId: string, option?: string) => Promise<any>;
18
+ /**
19
+ * Delete a subscription.
20
+ *
21
+ * @async
22
+ * @function deleteSubscription
23
+ * @param {string} channelId - The id of a channel.
24
+ * @returns {Promise<any>}
25
+ */
4
26
  export declare const deleteSubscription: (channelId: string) => Promise<any>;
27
+ /**
28
+ * Update a subscription information, such as marking message read.
29
+ *
30
+ * @async
31
+ * @function updateSubscription
32
+ * @param {string} channelId - The id of a channel.
33
+ * @param {MarkInput} mark
34
+ * @param {string} option
35
+ * @returns {Promise<any>}
36
+ */
5
37
  export declare const updateSubscription: (channelId: string, mark: MarkInput, option?: string) => Promise<any>;