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,4 +1,42 @@
|
|
|
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
|
+
* Request a friendship to a user.
|
|
9
|
+
*
|
|
10
|
+
* @async
|
|
11
|
+
* @function requestFriend
|
|
12
|
+
* @param {string} friendId - An id of the friend to request.
|
|
13
|
+
* @returns {Promise<any>}
|
|
14
|
+
*/
|
|
1
15
|
export declare const requestFriend: (friendId: string) => Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* Accept a friends request.
|
|
18
|
+
*
|
|
19
|
+
* @async
|
|
20
|
+
* @function acceptFriend
|
|
21
|
+
* @param {string} friendId - The id of the friend to accept the request.
|
|
22
|
+
* @returns {Promise<any>}
|
|
23
|
+
*/
|
|
2
24
|
export declare const acceptFriend: (friendId: string) => Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* Reject a friend request.
|
|
27
|
+
*
|
|
28
|
+
* @async
|
|
29
|
+
* @function rejectFriend
|
|
30
|
+
* @param {string} friendId - An id of the friend to be rejected.
|
|
31
|
+
* @returns {Promise<any>}
|
|
32
|
+
*/
|
|
3
33
|
export declare const rejectFriend: (friendId: string) => Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* Remove a friend.
|
|
36
|
+
*
|
|
37
|
+
* @async
|
|
38
|
+
* @function removeFriend
|
|
39
|
+
* @param {string} friendId - An id of the friend to be removed.
|
|
40
|
+
* @returns {Promise<any>}
|
|
41
|
+
*/
|
|
4
42
|
export declare const removeFriend: (friendId: string) => Promise<any>;
|
package/esm/mutations/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,149 +40,81 @@ 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 { acceptFriendQuery, requestFriendQuery, rejectFriendQuery, removeFriendQuery, } from "../graphql/friend";
|
|
45
|
+
import { fetchData } from "../Network";
|
|
46
|
+
/**
|
|
47
|
+
* Request a friendship to a user.
|
|
48
|
+
*
|
|
49
|
+
* @async
|
|
50
|
+
* @function requestFriend
|
|
51
|
+
* @param {string} friendId - An id of the friend to request.
|
|
52
|
+
* @returns {Promise<any>}
|
|
53
|
+
*/
|
|
38
54
|
export var requestFriend = function (friendId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
39
|
-
var token, projectId, endpoint, query;
|
|
40
55
|
return __generator(this, function (_a) {
|
|
41
56
|
switch (_a.label) {
|
|
42
|
-
case 0:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
query = "\n mutation ($projectId: String!, $friendId: String!) {\n requestFriend(input: {projectId: $projectId, friendId: $friendId}) {\n friendship {\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 friend_id\n created_at\n updated_at\n requested_at\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
|
-
friendId: friendId
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
})
|
|
63
|
-
.then(function (res) { return res.json(); })
|
|
64
|
-
.then(function (data) {
|
|
65
|
-
if (data.errors) {
|
|
66
|
-
throw data.errors[0];
|
|
67
|
-
}
|
|
68
|
-
return data.data.requestFriend.friendship;
|
|
69
|
-
})];
|
|
57
|
+
case 0: return [4 /*yield*/, fetchData("requestFriend", requestFriendQuery, {
|
|
58
|
+
projectId: CoreManager.get("PROJECT_ID"),
|
|
59
|
+
friendId: friendId
|
|
60
|
+
})];
|
|
70
61
|
case 1: return [2 /*return*/, _a.sent()];
|
|
71
62
|
}
|
|
72
63
|
});
|
|
73
64
|
}); };
|
|
65
|
+
/**
|
|
66
|
+
* Accept a friends request.
|
|
67
|
+
*
|
|
68
|
+
* @async
|
|
69
|
+
* @function acceptFriend
|
|
70
|
+
* @param {string} friendId - The id of the friend to accept the request.
|
|
71
|
+
* @returns {Promise<any>}
|
|
72
|
+
*/
|
|
74
73
|
export var acceptFriend = function (friendId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
75
|
-
var token, projectId, endpoint, query;
|
|
76
74
|
return __generator(this, function (_a) {
|
|
77
75
|
switch (_a.label) {
|
|
78
|
-
case 0:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
query = "\n mutation ($projectId: String!, $friendId: String!) {\n acceptFriend(input: {projectId: $projectId, friendId: $friendId}) {\n friendship {\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 friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n ";
|
|
83
|
-
return [4 /*yield*/, fetch(endpoint, {
|
|
84
|
-
method: 'POST',
|
|
85
|
-
headers: {
|
|
86
|
-
'Authorization': 'Bearer ' + token,
|
|
87
|
-
'X-PROJECT-ID': projectId,
|
|
88
|
-
'Content-Type': 'application/json',
|
|
89
|
-
'Accept': 'application/json'
|
|
90
|
-
},
|
|
91
|
-
body: JSON.stringify({
|
|
92
|
-
query: query,
|
|
93
|
-
variables: {
|
|
94
|
-
projectId: projectId,
|
|
95
|
-
friendId: friendId
|
|
96
|
-
}
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
|
-
.then(function (res) { return res.json(); })
|
|
100
|
-
.then(function (data) {
|
|
101
|
-
if (data.errors) {
|
|
102
|
-
throw data.errors[0];
|
|
103
|
-
}
|
|
104
|
-
return data.data.acceptFriend.friendship;
|
|
105
|
-
})];
|
|
76
|
+
case 0: return [4 /*yield*/, fetchData("acceptFriend", acceptFriendQuery, {
|
|
77
|
+
projectId: CoreManager.get("PROJECT_ID"),
|
|
78
|
+
friendId: friendId
|
|
79
|
+
})];
|
|
106
80
|
case 1: return [2 /*return*/, _a.sent()];
|
|
107
81
|
}
|
|
108
82
|
});
|
|
109
83
|
}); };
|
|
84
|
+
/**
|
|
85
|
+
* Reject a friend request.
|
|
86
|
+
*
|
|
87
|
+
* @async
|
|
88
|
+
* @function rejectFriend
|
|
89
|
+
* @param {string} friendId - An id of the friend to be rejected.
|
|
90
|
+
* @returns {Promise<any>}
|
|
91
|
+
*/
|
|
110
92
|
export var rejectFriend = function (friendId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
111
|
-
var token, projectId, endpoint, query;
|
|
112
93
|
return __generator(this, function (_a) {
|
|
113
94
|
switch (_a.label) {
|
|
114
|
-
case 0:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
query = "\n mutation ($projectId: String!, $friendId: String!) {\n rejectFriend(input: {projectId: $projectId, friendId: $friendId}) {\n friendship {\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 friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n ";
|
|
119
|
-
return [4 /*yield*/, fetch(endpoint, {
|
|
120
|
-
method: 'POST',
|
|
121
|
-
headers: {
|
|
122
|
-
'Authorization': 'Bearer ' + token,
|
|
123
|
-
'X-PROJECT-ID': projectId,
|
|
124
|
-
'Content-Type': 'application/json',
|
|
125
|
-
'Accept': 'application/json'
|
|
126
|
-
},
|
|
127
|
-
body: JSON.stringify({
|
|
128
|
-
query: query,
|
|
129
|
-
variables: {
|
|
130
|
-
projectId: projectId,
|
|
131
|
-
friendId: friendId
|
|
132
|
-
}
|
|
133
|
-
})
|
|
134
|
-
})
|
|
135
|
-
.then(function (res) { return res.json(); })
|
|
136
|
-
.then(function (data) {
|
|
137
|
-
if (data.errors)
|
|
138
|
-
throw data.errors[0];
|
|
139
|
-
if (data.code)
|
|
140
|
-
throw data;
|
|
141
|
-
return data.data.rejectFriend.friendship;
|
|
142
|
-
})];
|
|
95
|
+
case 0: return [4 /*yield*/, fetchData("rejectFriend", rejectFriendQuery, {
|
|
96
|
+
projectId: CoreManager.get("PROJECT_ID"),
|
|
97
|
+
friendId: friendId
|
|
98
|
+
})];
|
|
143
99
|
case 1: return [2 /*return*/, _a.sent()];
|
|
144
100
|
}
|
|
145
101
|
});
|
|
146
102
|
}); };
|
|
103
|
+
/**
|
|
104
|
+
* Remove a friend.
|
|
105
|
+
*
|
|
106
|
+
* @async
|
|
107
|
+
* @function removeFriend
|
|
108
|
+
* @param {string} friendId - An id of the friend to be removed.
|
|
109
|
+
* @returns {Promise<any>}
|
|
110
|
+
*/
|
|
147
111
|
export var removeFriend = function (friendId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
148
|
-
var token, projectId, endpoint, query;
|
|
149
112
|
return __generator(this, function (_a) {
|
|
150
113
|
switch (_a.label) {
|
|
151
|
-
case 0:
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
query = "\n mutation ($projectId: String!, $friendId: String!) {\n removeFriend(input: {projectId: $projectId, friendId: $friendId}) {\n friendship {\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 friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n ";
|
|
156
|
-
return [4 /*yield*/, fetch(endpoint, {
|
|
157
|
-
method: 'POST',
|
|
158
|
-
headers: {
|
|
159
|
-
'Authorization': 'Bearer ' + token,
|
|
160
|
-
'X-PROJECT-ID': projectId,
|
|
161
|
-
'Content-Type': 'application/json',
|
|
162
|
-
'Accept': 'application/json'
|
|
163
|
-
},
|
|
164
|
-
body: JSON.stringify({
|
|
165
|
-
query: query,
|
|
166
|
-
variables: {
|
|
167
|
-
projectId: projectId,
|
|
168
|
-
friendId: friendId
|
|
169
|
-
}
|
|
170
|
-
})
|
|
171
|
-
})
|
|
172
|
-
.then(function (res) { return res.json(); })
|
|
173
|
-
.then(function (data) {
|
|
174
|
-
if (data.errors)
|
|
175
|
-
throw data.errors[0];
|
|
176
|
-
if (data.code)
|
|
177
|
-
throw data;
|
|
178
|
-
return data.data.removeFriend.friendship;
|
|
179
|
-
})];
|
|
114
|
+
case 0: return [4 /*yield*/, fetchData("removeFriend", removeFriendQuery, {
|
|
115
|
+
projectId: CoreManager.get("PROJECT_ID"),
|
|
116
|
+
friendId: friendId
|
|
117
|
+
})];
|
|
180
118
|
case 1: return [2 /*return*/, _a.sent()];
|
|
181
119
|
}
|
|
182
120
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"friend.js","sourceRoot":"","sources":["../../src/mutations/friend.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"friend.js","sourceRoot":"","sources":["../../src/mutations/friend.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACH,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,aAAa,GAAG,UAAO,QAAgB;;;oBACzC,qBAAM,SAAS,CAAC,eAAe,EAAE,kBAAkB,EAAE;oBACxD,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,QAAQ,UAAA;iBACX,CAAC,EAAA;oBAHF,sBAAO,SAGL,EAAC;;;KACN,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,YAAY,GAAG,UAAO,QAAgB;;;oBACxC,qBAAM,SAAS,CAAC,cAAc,EAAE,iBAAiB,EAAE;oBACtD,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,QAAQ,UAAA;iBACX,CAAC,EAAA;oBAHF,sBAAO,SAGL,EAAC;;;KACN,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,YAAY,GAAG,UAAO,QAAgB;;;oBACxC,qBAAM,SAAS,CAAC,cAAc,EAAE,iBAAiB,EAAE;oBACtD,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,QAAQ,UAAA;iBACX,CAAC,EAAA;oBAHF,sBAAO,SAGL,EAAC;;;KACN,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,IAAM,YAAY,GAAG,UAAO,QAAgB;;;oBACxC,qBAAM,SAAS,CAAC,cAAc,EAAE,iBAAiB,EAAE;oBACtD,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,QAAQ,UAAA;iBACX,CAAC,EAAA;oBAHF,sBAAO,SAGL,EAAC;;;KACN,CAAC"}
|
package/esm/mutations/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
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.
|
|
5
6
|
*/
|
|
6
7
|
export * from './member';
|
|
7
8
|
export * from './channel';
|
|
@@ -9,3 +10,4 @@ export * from './message';
|
|
|
9
10
|
export * from './friend';
|
|
10
11
|
export * from './invite';
|
|
11
12
|
export * from './subscription';
|
|
13
|
+
export * from './pin';
|
package/esm/mutations/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
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.
|
|
5
6
|
*/
|
|
6
7
|
export * from './member';
|
|
7
8
|
export * from './channel';
|
|
@@ -9,4 +10,5 @@ export * from './message';
|
|
|
9
10
|
export * from './friend';
|
|
10
11
|
export * from './invite';
|
|
11
12
|
export * from './subscription';
|
|
13
|
+
export * from './pin';
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mutations/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mutations/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC"}
|
|
@@ -1 +1,16 @@
|
|
|
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
|
+
* Create an invite to a friend users to a channel.
|
|
9
|
+
*
|
|
10
|
+
* @async
|
|
11
|
+
* @function createInvite
|
|
12
|
+
* @param {string} channelId - An id of the channel to be invited.
|
|
13
|
+
* @param {string} friendIds - Id of friends to be invited to the channel.
|
|
14
|
+
* @returns {Promise<any>}
|
|
15
|
+
*/
|
|
1
16
|
export declare const createInvite: (channelId: string, friendIds: any) => Promise<any>;
|
package/esm/mutations/invite.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,26 @@ 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 { createInviteQuery } from "../graphql/invite";
|
|
45
|
+
import { fetchData } from "../Network";
|
|
46
|
+
/**
|
|
47
|
+
* Create an invite to a friend users to a channel.
|
|
48
|
+
*
|
|
49
|
+
* @async
|
|
50
|
+
* @function createInvite
|
|
51
|
+
* @param {string} channelId - An id of the channel to be invited.
|
|
52
|
+
* @param {string} friendIds - Id of friends to be invited to the channel.
|
|
53
|
+
* @returns {Promise<any>}
|
|
54
|
+
*/
|
|
38
55
|
export var createInvite = function (channelId, friendIds) { return __awaiter(void 0, void 0, void 0, function () {
|
|
39
|
-
var token, projectId, endpoint, query;
|
|
40
56
|
return __generator(this, function (_a) {
|
|
41
57
|
switch (_a.label) {
|
|
42
|
-
case 0:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
friendIds: friendIds
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
.then(function (res) { return res.json(); })
|
|
65
|
-
.then(function (data) {
|
|
66
|
-
if (data.errors)
|
|
67
|
-
throw data.errors[0];
|
|
68
|
-
if (data.code)
|
|
69
|
-
throw data;
|
|
70
|
-
return data.data.createFriend.friendship;
|
|
71
|
-
})];
|
|
58
|
+
case 0: return [4 /*yield*/, fetchData("createFriend", createInviteQuery, {
|
|
59
|
+
projectId: CoreManager.get("PROJECT_ID"),
|
|
60
|
+
channelId: channelId,
|
|
61
|
+
friendIds: friendIds
|
|
62
|
+
})];
|
|
72
63
|
case 1: return [2 /*return*/, _a.sent()];
|
|
73
64
|
}
|
|
74
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invite.js","sourceRoot":"","sources":["../../src/mutations/invite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invite.js","sourceRoot":"","sources":["../../src/mutations/invite.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,CAAC,IAAM,YAAY,GAAG,UAAO,SAAiB,EAAE,SAAc;;;oBACzD,qBAAM,SAAS,CAAC,cAAc,EAAE,iBAAiB,EAAE;oBACtD,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,SAAS,WAAA;oBACT,SAAS,WAAA;iBACZ,CAAC,EAAA;oBAJF,sBAAO,SAIL,EAAC;;;KACN,CAAC"}
|
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
* Login a user
|
|
9
|
+
*
|
|
10
|
+
* @async
|
|
11
|
+
* @function login
|
|
12
|
+
* @param {string} user_id - The id of a user loggin in.
|
|
13
|
+
* @param {string} name
|
|
14
|
+
* @param {string} profile
|
|
15
|
+
* @param {string} token
|
|
16
|
+
* @returns {Promise<any>}
|
|
17
|
+
*/
|
|
18
|
+
export declare const login: (user_id: string, name?: string, profile?: string, token?: string, customField?: string) => Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* Create a member block followed by the getMemberBlockSchema.
|
|
21
|
+
* The member block is to used to ban a member.
|
|
22
|
+
*
|
|
23
|
+
* @async
|
|
24
|
+
* @function createMemberBlock
|
|
25
|
+
* @param {string} channelId - The id of a channel.
|
|
26
|
+
* @param {string} memberId - The id of a member.
|
|
27
|
+
* @param {string} options
|
|
28
|
+
* @returns {Promise<any>}
|
|
29
|
+
*/
|
|
3
30
|
export declare const createMemberBlock: (channelId: string, memberId: string, options?: string) => Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* Delete a member block.
|
|
33
|
+
* This is used to unban a member from a channel.
|
|
34
|
+
*
|
|
35
|
+
* @async
|
|
36
|
+
* @function deleteMemberBlock
|
|
37
|
+
* @param {string} channelId - The id of a channel that the member is in.
|
|
38
|
+
* @param {string} memberId - The id of a member to be deleted.
|
|
39
|
+
* @returns {Promise<any>}
|
|
40
|
+
*/
|
|
4
41
|
export declare const deleteMemberBlock: (channelId: string, memberId: string) => Promise<any>;
|