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.
- package/LICENSE.md +1 -1
- package/deploy.sh +1 -1
- package/esm/CloudChat.d.ts +434 -9
- package/esm/CloudChat.js +979 -273
- 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 -176
- 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 +8 -0
- package/esm/queries/index.js +8 -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 +17 -0
- package/esm/queries/memberblocks.js +69 -0
- package/esm/queries/memberblocks.js.map +1 -0
- 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 +1230 -321
- 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 +106 -172
- 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 +37 -3
- package/lib/queries/member.js +29 -45
- package/lib/queries/memberblocks.js +207 -0
- 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,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
|
|
38
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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":"
|
|
1
|
+
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/mutations/subscription.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EACH,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,GAC1B,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAC9B,SAAiB,EACjB,MAAmB;IAAnB,uBAAA,EAAA,WAAmB;;;;wBAEZ,qBAAM,SAAS,CAAC,oBAAoB,EAAE,uBAAuB,EAAE;wBAClE,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;wBACxC,SAAS,WAAA;wBACT,MAAM,QAAA;qBACT,CAAC,EAAA;wBAJF,sBAAO,SAIL,EAAC;;;;CACN,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAAO,SAAiB;;;oBAC/C,qBAAM,SAAS,CAAC,oBAAoB,EAAE,uBAAuB,EAAE;oBAClE,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,SAAS,WAAA;iBACZ,CAAC,EAAA;oBAHF,sBAAO,SAGL,EAAC;;;KACN,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAC9B,SAAiB,EACjB,IAAe,EACf,MAAmB;IAAnB,uBAAA,EAAA,WAAmB;;;;wBAEZ,qBAAM,SAAS,CAAC,oBAAoB,EAAE,uBAAuB,EAAE;wBAClE,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;wBACxC,SAAS,WAAA;wBACT,IAAI,MAAA;wBACJ,MAAM,QAAA;qBACT,CAAC,EAAA;wBALF,sBAAO,SAKL,EAAC;;;;CACN,CAAC"}
|
package/esm/queries/channel.d.ts
CHANGED
|
@@ -1,2 +1,26 @@
|
|
|
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 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>;
|
package/esm/queries/channel.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,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
|
|
38
|
-
import {
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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":"
|
|
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"}
|
package/esm/queries/friend.d.ts
CHANGED
|
@@ -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>;
|
package/esm/queries/friend.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,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
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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":"
|
|
1
|
+
{"version":3,"file":"friend.js","sourceRoot":"","sources":["../../src/queries/friend.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,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"}
|
package/esm/queries/index.d.ts
CHANGED
|
@@ -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';
|
package/esm/queries/index.js
CHANGED
|
@@ -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
|
package/esm/queries/index.js.map
CHANGED
|
@@ -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"}
|
package/esm/queries/member.d.ts
CHANGED
|
@@ -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>;
|
package/esm/queries/member.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,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 { 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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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":"
|
|
1
|
+
{"version":3,"file":"member.js","sourceRoot":"","sources":["../../src/queries/member.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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>;
|