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.
- package/LICENSE.md +1 -1
- package/deploy.sh +1 -1
- package/esm/CloudChat.d.ts +434 -10
- package/esm/CloudChat.js +975 -302
- package/esm/CloudChat.js.map +1 -1
- package/esm/CoreManager.d.ts +6 -0
- package/esm/CoreManager.js +13 -4
- package/esm/CoreManager.js.map +1 -1
- package/esm/Dispatcher.d.ts +16 -0
- package/esm/Dispatcher.js +19 -4
- package/esm/Dispatcher.js.map +1 -1
- package/esm/Network.d.ts +7 -0
- package/esm/Network.js +93 -0
- package/esm/Network.js.map +1 -0
- package/esm/Type.d.ts +43 -0
- package/esm/Type.js +16 -0
- package/esm/Type.js.map +1 -1
- package/esm/Util.d.ts +13 -0
- package/esm/Util.js +13 -0
- package/esm/Util.js.map +1 -1
- package/esm/graphql/channel.d.ts +13 -0
- package/esm/graphql/channel.js +16 -0
- package/esm/graphql/channel.js.map +1 -0
- package/esm/graphql/friend.d.ts +11 -0
- package/esm/graphql/friend.js +13 -0
- package/esm/graphql/friend.js.map +1 -0
- package/esm/graphql/invite.d.ts +7 -0
- package/esm/graphql/invite.js +8 -0
- package/esm/graphql/invite.js.map +1 -0
- package/esm/graphql/member.d.ts +11 -0
- package/esm/graphql/member.js +13 -0
- package/esm/graphql/member.js.map +1 -0
- package/esm/graphql/message.d.ts +11 -0
- package/esm/graphql/message.js +13 -0
- package/esm/graphql/message.js.map +1 -0
- package/esm/graphql/pin.d.ts +10 -0
- package/esm/graphql/pin.js +12 -0
- package/esm/graphql/pin.js.map +1 -0
- package/esm/graphql/project.d.ts +7 -0
- package/esm/graphql/project.js +8 -0
- package/esm/graphql/project.js.map +1 -0
- package/esm/graphql/subscription.d.ts +11 -0
- package/esm/graphql/subscription.js +13 -0
- package/esm/graphql/subscription.js.map +1 -0
- package/esm/index.d.ts +6 -0
- package/esm/index.js +6 -0
- package/esm/index.js.map +1 -1
- package/esm/logger.d.ts +9 -3
- package/esm/logger.js +6 -0
- package/esm/logger.js.map +1 -1
- package/esm/mutations/channel.d.ts +50 -0
- package/esm/mutations/channel.js +97 -187
- package/esm/mutations/channel.js.map +1 -1
- package/esm/mutations/friend.d.ts +38 -0
- package/esm/mutations/friend.js +57 -119
- package/esm/mutations/friend.js.map +1 -1
- package/esm/mutations/index.d.ts +5 -3
- package/esm/mutations/index.js +5 -3
- package/esm/mutations/index.js.map +1 -1
- package/esm/mutations/invite.d.ts +15 -0
- package/esm/mutations/invite.js +23 -32
- package/esm/mutations/invite.js.map +1 -1
- package/esm/mutations/member.d.ts +39 -2
- package/esm/mutations/member.js +64 -111
- package/esm/mutations/member.js.map +1 -1
- package/esm/mutations/message.d.ts +35 -0
- package/esm/mutations/message.js +66 -45
- package/esm/mutations/message.js.map +1 -1
- package/esm/mutations/pin.d.ts +28 -0
- package/esm/mutations/pin.js +88 -0
- package/esm/mutations/pin.js.map +1 -0
- package/esm/mutations/subscription.d.ts +33 -1
- package/esm/mutations/subscription.js +51 -93
- package/esm/mutations/subscription.js.map +1 -1
- package/esm/queries/channel.d.ts +24 -0
- package/esm/queries/channel.js +37 -79
- package/esm/queries/channel.js.map +1 -1
- package/esm/queries/friend.d.ts +16 -0
- package/esm/queries/friend.js +25 -40
- package/esm/queries/friend.js.map +1 -1
- package/esm/queries/index.d.ts +7 -0
- package/esm/queries/index.js +7 -0
- package/esm/queries/index.js.map +1 -1
- package/esm/queries/member.d.ts +16 -0
- package/esm/queries/member.js +25 -40
- package/esm/queries/member.js.map +1 -1
- package/esm/queries/memberblocks.d.ts +16 -0
- package/esm/queries/memberblocks.js +25 -40
- package/esm/queries/memberblocks.js.map +1 -1
- package/esm/queries/message.d.ts +33 -0
- package/esm/queries/message.js +50 -111
- package/esm/queries/message.js.map +1 -1
- package/esm/queries/pin.d.ts +28 -0
- package/esm/queries/pin.js +92 -0
- package/esm/queries/pin.js.map +1 -0
- package/esm/queries/project.d.ts +13 -0
- package/esm/queries/project.js +20 -32
- package/esm/queries/project.js.map +1 -1
- package/esm/queries/subscription.d.ts +25 -0
- package/esm/queries/subscription.js +39 -76
- package/esm/queries/subscription.js.map +1 -1
- package/lib/CloudChat.js +1211 -363
- package/lib/CoreManager.js +13 -3
- package/lib/Dispatcher.js +25 -9
- package/lib/Network.js +226 -0
- package/lib/Type.js +19 -0
- package/lib/Util.js +15 -1
- package/lib/graphql/channel.js +32 -0
- package/lib/graphql/friend.js +27 -0
- package/lib/graphql/invite.js +18 -0
- package/lib/graphql/member.js +27 -0
- package/lib/graphql/message.js +27 -0
- package/lib/graphql/pin.js +25 -0
- package/lib/graphql/project.js +18 -0
- package/lib/graphql/subscription.js +27 -0
- package/lib/index.js +2 -2
- package/lib/logger.js +6 -0
- package/lib/mutations/channel.js +105 -178
- package/lib/mutations/friend.js +62 -115
- package/lib/mutations/index.js +23 -3
- package/lib/mutations/invite.js +27 -33
- package/lib/mutations/member.js +73 -100
- package/lib/mutations/message.js +86 -48
- package/lib/mutations/pin.js +229 -0
- package/lib/mutations/subscription.js +56 -95
- package/lib/queries/channel.js +40 -84
- package/lib/queries/friend.js +29 -45
- package/lib/queries/index.js +24 -3
- package/lib/queries/member.js +29 -45
- package/lib/queries/memberblocks.js +28 -44
- package/lib/queries/message.js +56 -109
- package/lib/queries/pin.js +243 -0
- package/lib/queries/project.js +24 -41
- package/lib/queries/subscription.js +42 -78
- package/package.json +19 -45
- package/tsconfig.json +1 -0
- package//353/260/260/355/217/254/354/210/234/354/204/234.md +8 -0
- 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,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
|
|
43
|
+
import { getMemberBlocksQuery } from "../graphql/member";
|
|
44
|
+
import { fetchData } from "../Network";
|
|
45
|
+
import CoreManager from "../CoreManager";
|
|
46
|
+
/**
|
|
47
|
+
* Get member blocks.
|
|
48
|
+
*
|
|
49
|
+
* @async
|
|
50
|
+
* @function getMemberBlocks
|
|
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 getMemberBlocks = 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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return [2 /*return*/, null];
|
|
49
|
-
endpoint = CoreManager.get('SERVER_URL') + '/graphql';
|
|
50
|
-
lquery = "\n query memberblocks ($projectId: String!, $filter: String!, $sort: String, $option:String) {\n memberblocks(projectId: $projectId, filter:$filter, sort:$sort, option:$option) {\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 \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.memberblocks) {
|
|
76
|
-
return data.data.memberblocks.edges;
|
|
77
|
-
}
|
|
78
|
-
return [];
|
|
79
|
-
})];
|
|
59
|
+
case 0: return [4 /*yield*/, fetchData("memberblocks", getMemberBlocksQuery, {
|
|
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":"memberblocks.js","sourceRoot":"","sources":["../../src/queries/memberblocks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"memberblocks.js","sourceRoot":"","sources":["../../src/queries/memberblocks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC;;;;;;;;;GASG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG,UAC3B,MAAc,EACd,IAAY,EACZ,MAAc;;;oBAEP,qBAAM,SAAS,CAAC,cAAc,EAAE,oBAAoB,EAAE;oBACzD,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"}
|
package/esm/queries/message.d.ts
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
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 data of the all messages.
|
|
9
|
+
*
|
|
10
|
+
* @async
|
|
11
|
+
* @function getMessages
|
|
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 getMessages: (filter: string, sort: string, option: string) => Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* Get data of a single message.
|
|
20
|
+
*
|
|
21
|
+
* @async
|
|
22
|
+
* @function getMessage
|
|
23
|
+
* @param {string} channelId - The id of a channel.
|
|
24
|
+
* @param {string} messageId - The id of a message.
|
|
25
|
+
* @returns {Promise<any>}
|
|
26
|
+
*/
|
|
2
27
|
export declare const getMessage: (channelId: string, messageId: string) => Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* Get a count of unread messages of a channel.
|
|
30
|
+
*
|
|
31
|
+
* @async
|
|
32
|
+
* @function unreadCount
|
|
33
|
+
* @param {string} channelId - The id of a channel.
|
|
34
|
+
* @returns {Promise<any>}
|
|
35
|
+
*/
|
|
3
36
|
export declare const unreadCount: (channelId: string) => Promise<any>;
|
package/esm/queries/message.js
CHANGED
|
@@ -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) {
|
|
@@ -35,134 +41,67 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
41
|
}
|
|
36
42
|
};
|
|
37
43
|
import CoreManager from "../CoreManager";
|
|
44
|
+
import { fetchData } from "../Network";
|
|
45
|
+
import { getMessageQuery, getMessagesQuery, unreadCountQuery, } from "../graphql/message";
|
|
46
|
+
/**
|
|
47
|
+
* Get data of the all messages.
|
|
48
|
+
*
|
|
49
|
+
* @async
|
|
50
|
+
* @function getMessages
|
|
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 getMessages = function (filter, sort, option) { return __awaiter(void 0, void 0, void 0, function () {
|
|
39
|
-
var token, projectId, endpoint, queries;
|
|
40
57
|
return __generator(this, function (_a) {
|
|
41
58
|
switch (_a.label) {
|
|
42
|
-
case 0:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return [2 /*return*/, null];
|
|
49
|
-
endpoint = CoreManager.get("SERVER_URL") + "/graphql";
|
|
50
|
-
queries = "\n query messages ($projectId: String!, $filter: String!, $option: String, $sort: String ) {\n messages(projectId: $projectId, filter: $filter, option:$option, sort:$sort) {\n totalCount\n edges {\n node {\n 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 }\n mentions\n mentions_everyone\n content\n sended_at\n created_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: queries,
|
|
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.data.messages)
|
|
76
|
-
return [];
|
|
77
|
-
return data.data.messages.edges;
|
|
78
|
-
})];
|
|
59
|
+
case 0: return [4 /*yield*/, fetchData("messages", getMessagesQuery, {
|
|
60
|
+
projectId: CoreManager.get("PROJECT_ID"),
|
|
61
|
+
filter: filter,
|
|
62
|
+
sort: sort,
|
|
63
|
+
option: option
|
|
64
|
+
})];
|
|
79
65
|
case 1: return [2 /*return*/, _a.sent()];
|
|
80
66
|
}
|
|
81
67
|
});
|
|
82
68
|
}); };
|
|
69
|
+
/**
|
|
70
|
+
* Get data of a single message.
|
|
71
|
+
*
|
|
72
|
+
* @async
|
|
73
|
+
* @function getMessage
|
|
74
|
+
* @param {string} channelId - The id of a channel.
|
|
75
|
+
* @param {string} messageId - The id of a message.
|
|
76
|
+
* @returns {Promise<any>}
|
|
77
|
+
*/
|
|
83
78
|
export var getMessage = function (channelId, messageId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
84
|
-
var token, projectId, endpoint, queries;
|
|
85
79
|
return __generator(this, function (_a) {
|
|
86
80
|
switch (_a.label) {
|
|
87
|
-
case 0:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (!projectId)
|
|
93
|
-
return [2 /*return*/, null];
|
|
94
|
-
endpoint = CoreManager.get("SERVER_URL") + "/graphql";
|
|
95
|
-
queries = "\n query message ($projectId: String!, $channelId: String!, $id: ID!) { \n message(projectId: $projectId, channelId:$channelId, id:$id) { \n 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 }\n mentions\n mentions_everyone\n content\n sended_at\n created_at\n } \n }\n ";
|
|
96
|
-
return [4 /*yield*/, fetch(endpoint, {
|
|
97
|
-
method: "POST",
|
|
98
|
-
headers: {
|
|
99
|
-
Authorization: "Bearer " + token,
|
|
100
|
-
'X-PROJECT-ID': projectId,
|
|
101
|
-
"Content-Type": "application/json",
|
|
102
|
-
Accept: "application/json"
|
|
103
|
-
},
|
|
104
|
-
body: JSON.stringify({
|
|
105
|
-
query: queries,
|
|
106
|
-
variables: {
|
|
107
|
-
projectId: projectId,
|
|
108
|
-
channelId: channelId,
|
|
109
|
-
id: messageId
|
|
110
|
-
}
|
|
111
|
-
})
|
|
112
|
-
})
|
|
113
|
-
.then(function (res) { return res.json(); })
|
|
114
|
-
.then(function (data) {
|
|
115
|
-
if (data.errors)
|
|
116
|
-
throw data.errors[0];
|
|
117
|
-
if (data.code)
|
|
118
|
-
throw data;
|
|
119
|
-
if (!data || !data.data.message)
|
|
120
|
-
return false;
|
|
121
|
-
return data.data.message;
|
|
122
|
-
})];
|
|
81
|
+
case 0: return [4 /*yield*/, fetchData("message", getMessageQuery, {
|
|
82
|
+
projectId: CoreManager.get("PROJECT_ID"),
|
|
83
|
+
channelId: channelId,
|
|
84
|
+
id: messageId
|
|
85
|
+
})];
|
|
123
86
|
case 1: return [2 /*return*/, _a.sent()];
|
|
124
87
|
}
|
|
125
88
|
});
|
|
126
89
|
}); };
|
|
90
|
+
/**
|
|
91
|
+
* Get a count of unread messages of a channel.
|
|
92
|
+
*
|
|
93
|
+
* @async
|
|
94
|
+
* @function unreadCount
|
|
95
|
+
* @param {string} channelId - The id of a channel.
|
|
96
|
+
* @returns {Promise<any>}
|
|
97
|
+
*/
|
|
127
98
|
export var unreadCount = function (channelId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
128
|
-
var token, projectId, endpoint, queries;
|
|
129
99
|
return __generator(this, function (_a) {
|
|
130
100
|
switch (_a.label) {
|
|
131
|
-
case 0:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
projectId = CoreManager.get("PROJECT_ID");
|
|
136
|
-
if (!projectId)
|
|
137
|
-
return [2 /*return*/, null];
|
|
138
|
-
endpoint = CoreManager.get("SERVER_URL") + "/graphql";
|
|
139
|
-
queries = "\n query mark ($projectId: String!, $channelId: String!) { \n mark (projectId: $projectId, channelId:$channelId) { \n user_id,\n message_id,\n sort_id, \n unread\n } \n }\n ";
|
|
140
|
-
return [4 /*yield*/, fetch(endpoint, {
|
|
141
|
-
method: "POST",
|
|
142
|
-
headers: {
|
|
143
|
-
Authorization: "Bearer " + token,
|
|
144
|
-
'X-PROJECT-ID': projectId,
|
|
145
|
-
"Content-Type": "application/json",
|
|
146
|
-
Accept: "application/json"
|
|
147
|
-
},
|
|
148
|
-
body: JSON.stringify({
|
|
149
|
-
query: queries,
|
|
150
|
-
variables: {
|
|
151
|
-
projectId: projectId,
|
|
152
|
-
channelId: channelId
|
|
153
|
-
}
|
|
154
|
-
})
|
|
155
|
-
})
|
|
156
|
-
.then(function (res) { return res.json(); })
|
|
157
|
-
.then(function (data) {
|
|
158
|
-
if (data.errors)
|
|
159
|
-
throw data.errors[0];
|
|
160
|
-
if (data.code)
|
|
161
|
-
throw data;
|
|
162
|
-
if (!data || !data.data.mark)
|
|
163
|
-
return false;
|
|
164
|
-
return data.data.mark;
|
|
165
|
-
})];
|
|
101
|
+
case 0: return [4 /*yield*/, fetchData("mark", unreadCountQuery, {
|
|
102
|
+
projectId: CoreManager.get("PROJECT_ID"),
|
|
103
|
+
channelId: channelId
|
|
104
|
+
})];
|
|
166
105
|
case 1: return [2 /*return*/, _a.sent()];
|
|
167
106
|
}
|
|
168
107
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/queries/message.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/queries/message.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EACH,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;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;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG,UAAO,SAAiB,EAAE,SAAiB;;;oBAC1D,qBAAM,SAAS,CAAC,SAAS,EAAE,eAAe,EAAE;oBAC/C,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,SAAS,WAAA;oBACT,EAAE,EAAE,SAAS;iBAChB,CAAC,EAAA;oBAJF,sBAAO,SAIL,EAAC;;;KACN,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,WAAW,GAAG,UAAO,SAAiB;;;oBACxC,qBAAM,SAAS,CAAC,MAAM,EAAE,gBAAgB,EAAE;oBAC7C,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,SAAS,WAAA;iBACZ,CAAC,EAAA;oBAHF,sBAAO,SAGL,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
|
+
/**
|
|
8
|
+
* Get data of a single pin from the endpoint.
|
|
9
|
+
*
|
|
10
|
+
* @async
|
|
11
|
+
* @function getPin
|
|
12
|
+
* @param {string} channelId - An id of the channel.
|
|
13
|
+
* @param {string} id - An id of the pin.
|
|
14
|
+
* @returns {Promise<any>} The data of the pin.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getPin: (channelId: string, id: string) => Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Get data of multiple pins.
|
|
19
|
+
*
|
|
20
|
+
* @async
|
|
21
|
+
* @function getPins
|
|
22
|
+
* @param {string} channelId - An id of the channel.
|
|
23
|
+
* @param {string} filter - Field value for filter.
|
|
24
|
+
* @param {string} sort - Field value for sorting.
|
|
25
|
+
* @param {string} option - Optional option: ex) offset, per_page.
|
|
26
|
+
* @returns {Promise<any[]>} An array of data of all pins.
|
|
27
|
+
*/
|
|
28
|
+
export declare const getPins: (channelId: string, filter: string, sort: string, option: string) => Promise<any>;
|
|
@@ -0,0 +1,92 @@
|
|
|
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 { getPinQuery, getPinsQuery } from "../graphql/pin";
|
|
46
|
+
/**
|
|
47
|
+
* Get data of a single pin from the endpoint.
|
|
48
|
+
*
|
|
49
|
+
* @async
|
|
50
|
+
* @function getPin
|
|
51
|
+
* @param {string} channelId - An id of the channel.
|
|
52
|
+
* @param {string} id - An id of the pin.
|
|
53
|
+
* @returns {Promise<any>} The data of the pin.
|
|
54
|
+
*/
|
|
55
|
+
export var getPin = function (channelId, id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0: return [4 /*yield*/, fetchData("pin", getPinQuery, {
|
|
59
|
+
projectId: CoreManager.get("PROJECT_ID"),
|
|
60
|
+
channelId: channelId,
|
|
61
|
+
id: id
|
|
62
|
+
})];
|
|
63
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}); };
|
|
67
|
+
/**
|
|
68
|
+
* Get data of multiple pins.
|
|
69
|
+
*
|
|
70
|
+
* @async
|
|
71
|
+
* @function getPins
|
|
72
|
+
* @param {string} channelId - An id of the channel.
|
|
73
|
+
* @param {string} filter - Field value for filter.
|
|
74
|
+
* @param {string} sort - Field value for sorting.
|
|
75
|
+
* @param {string} option - Optional option: ex) offset, per_page.
|
|
76
|
+
* @returns {Promise<any[]>} An array of data of all pins.
|
|
77
|
+
*/
|
|
78
|
+
export var getPins = function (channelId, filter, sort, option) { return __awaiter(void 0, void 0, void 0, function () {
|
|
79
|
+
return __generator(this, function (_a) {
|
|
80
|
+
switch (_a.label) {
|
|
81
|
+
case 0: return [4 /*yield*/, fetchData("pins", getPinsQuery, {
|
|
82
|
+
projectId: CoreManager.get("PROJECT_ID"),
|
|
83
|
+
channelId: channelId,
|
|
84
|
+
filter: filter,
|
|
85
|
+
sort: sort,
|
|
86
|
+
option: option
|
|
87
|
+
})];
|
|
88
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}); };
|
|
92
|
+
//# sourceMappingURL=pin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pin.js","sourceRoot":"","sources":["../../src/queries/pin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE3D;;;;;;;;GAQG;AACH,MAAM,CAAC,IAAM,MAAM,GAAG,UAAO,SAAiB,EAAE,EAAU;;;oBAC/C,qBAAM,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE;oBACvC,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,SAAS,EAAE,SAAS;oBACpB,EAAE,EAAE,EAAE;iBACT,CAAC,EAAA;oBAJF,sBAAO,SAIL,EAAA;;;KACL,CAAC;AAEF;;;;;;;;;;GAUG;AACF,MAAM,CAAC,IAAM,OAAO,GAAG,UACpB,SAAiB,EACjB,MAAc,EACd,IAAY,EACZ,MAAc;;;oBAEP,qBAAM,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE;oBACzC,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,SAAS,EAAE,SAAS;oBACpB,MAAM,QAAA;oBACN,IAAI,MAAA;oBACJ,MAAM,QAAA;iBACT,CAAC,EAAA;oBANF,sBAAO,SAML,EAAC;;;KACN,CAAC"}
|
package/esm/queries/project.d.ts
CHANGED
|
@@ -1 +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
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Get data of a project.
|
|
9
|
+
*
|
|
10
|
+
* @async
|
|
11
|
+
* @function getProject
|
|
12
|
+
* @returns {Promise<any>}
|
|
13
|
+
*/
|
|
1
14
|
export declare const getProject: () => Promise<any>;
|
package/esm/queries/project.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) NBASE CORP. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
1
7
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
8
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
9
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -34,41 +40,23 @@ 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
|
|
43
|
+
import CoreManager from "../CoreManager";
|
|
44
|
+
import { fetchData } from "../Network";
|
|
45
|
+
import { getProjectQuery } from "../graphql/project";
|
|
46
|
+
/**
|
|
47
|
+
* Get data of a project.
|
|
48
|
+
*
|
|
49
|
+
* @async
|
|
50
|
+
* @function getProject
|
|
51
|
+
* @returns {Promise<any>}
|
|
52
|
+
*/
|
|
38
53
|
export var getProject = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
39
|
-
var token, projectId, url, endpoint, query, CONTENT_TYPE, response, json;
|
|
40
54
|
return __generator(this, function (_a) {
|
|
41
55
|
switch (_a.label) {
|
|
42
|
-
case 0:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
projectId = CoreManager.get("PROJECT_ID");
|
|
47
|
-
if (!projectId)
|
|
48
|
-
return [2 /*return*/, null];
|
|
49
|
-
url = CoreManager.get('SERVER_URL');
|
|
50
|
-
endpoint = url + "/graphql";
|
|
51
|
-
query = "\n query project($id: ID!) {\n project(id:$id) { \n ncp_project_id\n name\n }\n }\n ";
|
|
52
|
-
CONTENT_TYPE = 'application/json';
|
|
53
|
-
return [4 /*yield*/, fetch(endpoint, {
|
|
54
|
-
method: 'POST',
|
|
55
|
-
headers: {
|
|
56
|
-
'Authorization': "Bearer " + token,
|
|
57
|
-
'X-PROJECT-ID': projectId,
|
|
58
|
-
'Content-Type': CONTENT_TYPE,
|
|
59
|
-
'Accept': CONTENT_TYPE
|
|
60
|
-
},
|
|
61
|
-
body: JSON.stringify({
|
|
62
|
-
query: query,
|
|
63
|
-
variables: { id: projectId }
|
|
64
|
-
})
|
|
65
|
-
})];
|
|
66
|
-
case 1:
|
|
67
|
-
response = _a.sent();
|
|
68
|
-
return [4 /*yield*/, response.json()];
|
|
69
|
-
case 2:
|
|
70
|
-
json = _a.sent();
|
|
71
|
-
return [2 /*return*/, json.data.project];
|
|
56
|
+
case 0: return [4 /*yield*/, fetchData("project", getProjectQuery, {
|
|
57
|
+
id: CoreManager.get("PROJECT_ID")
|
|
58
|
+
})];
|
|
59
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
72
60
|
}
|
|
73
61
|
});
|
|
74
62
|
}); };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/queries/project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/queries/project.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG;;;oBACf,qBAAM,SAAS,CAAC,SAAS,EAAE,eAAe,EAAE;oBAC/C,EAAE,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;iBACpC,CAAC,EAAA;oBAFF,sBAAO,SAEL,EAAC;;;KACN,CAAC"}
|
|
@@ -1,2 +1,27 @@
|
|
|
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 subscription data of the user.
|
|
9
|
+
*
|
|
10
|
+
* @async
|
|
11
|
+
* @function getSubscription
|
|
12
|
+
* @param {string} channelId - The id of a channel.
|
|
13
|
+
* @param {string} id
|
|
14
|
+
* @returns {Promise<any>}
|
|
15
|
+
*/
|
|
1
16
|
export declare const getSubscription: (channelId: string, id: string) => Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Get a list of subscibed member of the channel.
|
|
19
|
+
*
|
|
20
|
+
* @async
|
|
21
|
+
* @function getSubscriptions
|
|
22
|
+
* @param {string} filter - Field value for filter.
|
|
23
|
+
* @param {string} sort - Field value for sorting.
|
|
24
|
+
* @param {string} option - Optional option: ex) offset, per_page.
|
|
25
|
+
* @returns {Promise<any>}
|
|
26
|
+
*/
|
|
2
27
|
export declare const getSubscriptions: (filter: any, sort: any, option: any) => Promise<any>;
|