ncloudchat 0.0.24-beta → 0.0.25-beta
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/esm/CloudChat.d.ts +6 -1
- package/esm/CloudChat.js +171 -52
- package/esm/CloudChat.js.map +1 -1
- package/esm/mutations/friend.d.ts +3 -4
- package/esm/mutations/friend.js +51 -19
- package/esm/mutations/friend.js.map +1 -1
- package/esm/mutations/user.d.ts +1 -1
- package/esm/mutations/user.js +6 -3
- package/esm/mutations/user.js.map +1 -1
- package/esm/queries/friend.d.ts +1 -1
- package/esm/queries/friend.js +7 -8
- package/esm/queries/friend.js.map +1 -1
- package/lib/CloudChat.js +258 -50
- package/lib/mutations/friend.js +62 -29
- package/lib/mutations/user.js +9 -3
- package/lib/queries/friend.js +9 -10
- package/ncloudchat_javascript.md +3 -4
- package/package.json +3 -2
package/esm/mutations/friend.js
CHANGED
|
@@ -35,7 +35,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
import CoreManager from '../CoreManager';
|
|
38
|
-
export var
|
|
38
|
+
export var requestFriend = function (friendId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
39
39
|
var token, projectId, endpoint, query;
|
|
40
40
|
return __generator(this, function (_a) {
|
|
41
41
|
switch (_a.label) {
|
|
@@ -43,7 +43,7 @@ export var createFriend = function (channelId, friendIds) { return __awaiter(voi
|
|
|
43
43
|
token = CoreManager.get("TOKEN");
|
|
44
44
|
projectId = CoreManager.get("PROJECT_ID");
|
|
45
45
|
endpoint = CoreManager.get('SERVER_URL') + '/graphql';
|
|
46
|
-
query = "\n mutation (
|
|
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 nickname\n profile\n }\n friend {\n id\n nickname\n profile\n }\n friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n ";
|
|
47
47
|
return [4 /*yield*/, fetch(endpoint, {
|
|
48
48
|
method: 'POST',
|
|
49
49
|
headers: {
|
|
@@ -55,14 +55,16 @@ export var createFriend = function (channelId, friendIds) { return __awaiter(voi
|
|
|
55
55
|
query: query,
|
|
56
56
|
variables: {
|
|
57
57
|
projectId: projectId,
|
|
58
|
-
|
|
59
|
-
friendIds: friendIds
|
|
58
|
+
friendId: friendId
|
|
60
59
|
}
|
|
61
60
|
})
|
|
62
61
|
})
|
|
63
62
|
.then(function (res) { return res.json(); })
|
|
64
63
|
.then(function (data) {
|
|
65
|
-
|
|
64
|
+
if (data.errors) {
|
|
65
|
+
throw data.errors[0];
|
|
66
|
+
}
|
|
67
|
+
return data.data.requestFriend.friendship;
|
|
66
68
|
})];
|
|
67
69
|
case 1: return [2 /*return*/, _a.sent()];
|
|
68
70
|
}
|
|
@@ -76,7 +78,7 @@ export var acceptFriend = function (friendId) { return __awaiter(void 0, void 0,
|
|
|
76
78
|
token = CoreManager.get("TOKEN");
|
|
77
79
|
projectId = CoreManager.get("PROJECT_ID");
|
|
78
80
|
endpoint = CoreManager.get('SERVER_URL') + '/graphql';
|
|
79
|
-
query = "\n mutation (
|
|
81
|
+
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 nickname\n profile\n }\n friend {\n id\n nickname\n profile\n }\n friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n ";
|
|
80
82
|
return [4 /*yield*/, fetch(endpoint, {
|
|
81
83
|
method: 'POST',
|
|
82
84
|
headers: {
|
|
@@ -94,13 +96,16 @@ export var acceptFriend = function (friendId) { return __awaiter(void 0, void 0,
|
|
|
94
96
|
})
|
|
95
97
|
.then(function (res) { return res.json(); })
|
|
96
98
|
.then(function (data) {
|
|
97
|
-
|
|
99
|
+
if (data.errors) {
|
|
100
|
+
throw data.errors[0];
|
|
101
|
+
}
|
|
102
|
+
return data.data.acceptFriend.friendship;
|
|
98
103
|
})];
|
|
99
104
|
case 1: return [2 /*return*/, _a.sent()];
|
|
100
105
|
}
|
|
101
106
|
});
|
|
102
107
|
}); };
|
|
103
|
-
export var rejectFriend = function (
|
|
108
|
+
export var rejectFriend = function (friendId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
104
109
|
var token, projectId, endpoint, query;
|
|
105
110
|
return __generator(this, function (_a) {
|
|
106
111
|
switch (_a.label) {
|
|
@@ -108,7 +113,7 @@ export var rejectFriend = function (channelId, friendIds) { return __awaiter(voi
|
|
|
108
113
|
token = CoreManager.get("TOKEN");
|
|
109
114
|
projectId = CoreManager.get("PROJECT_ID");
|
|
110
115
|
endpoint = CoreManager.get('SERVER_URL') + '/graphql';
|
|
111
|
-
query = "\n mutation (
|
|
116
|
+
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 nickname\n profile\n }\n friend {\n id\n nickname\n profile\n }\n friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n ";
|
|
112
117
|
return [4 /*yield*/, fetch(endpoint, {
|
|
113
118
|
method: 'POST',
|
|
114
119
|
headers: {
|
|
@@ -120,27 +125,54 @@ export var rejectFriend = function (channelId, friendIds) { return __awaiter(voi
|
|
|
120
125
|
query: query,
|
|
121
126
|
variables: {
|
|
122
127
|
projectId: projectId,
|
|
123
|
-
|
|
124
|
-
friendIds: friendIds
|
|
128
|
+
friendId: friendId
|
|
125
129
|
}
|
|
126
130
|
})
|
|
127
131
|
})
|
|
128
132
|
.then(function (res) { return res.json(); })
|
|
129
133
|
.then(function (data) {
|
|
130
|
-
|
|
134
|
+
if (data.errors) {
|
|
135
|
+
throw data.errors[0];
|
|
136
|
+
}
|
|
137
|
+
return data.data.rejectFriend.friendship;
|
|
131
138
|
})];
|
|
132
139
|
case 1: return [2 /*return*/, _a.sent()];
|
|
133
140
|
}
|
|
134
141
|
});
|
|
135
142
|
}); };
|
|
136
|
-
export var
|
|
137
|
-
|
|
138
|
-
return [2 /*return*/];
|
|
139
|
-
});
|
|
140
|
-
}); };
|
|
141
|
-
export var deleteFriend = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
143
|
+
export var removeFriend = function (friendId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
144
|
+
var token, projectId, endpoint, query;
|
|
142
145
|
return __generator(this, function (_a) {
|
|
143
|
-
|
|
146
|
+
switch (_a.label) {
|
|
147
|
+
case 0:
|
|
148
|
+
token = CoreManager.get("TOKEN");
|
|
149
|
+
projectId = CoreManager.get("PROJECT_ID");
|
|
150
|
+
endpoint = CoreManager.get('SERVER_URL') + '/graphql';
|
|
151
|
+
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 nickname\n profile\n }\n friend {\n id\n nickname\n profile\n }\n friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n ";
|
|
152
|
+
return [4 /*yield*/, fetch(endpoint, {
|
|
153
|
+
method: 'POST',
|
|
154
|
+
headers: {
|
|
155
|
+
'Authorization': 'Bearer ' + token,
|
|
156
|
+
'Content-Type': 'application/json',
|
|
157
|
+
'Accept': 'application/json'
|
|
158
|
+
},
|
|
159
|
+
body: JSON.stringify({
|
|
160
|
+
query: query,
|
|
161
|
+
variables: {
|
|
162
|
+
projectId: projectId,
|
|
163
|
+
friendId: friendId
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
.then(function (res) { return res.json(); })
|
|
168
|
+
.then(function (data) {
|
|
169
|
+
if (data.errors) {
|
|
170
|
+
throw data.errors[0];
|
|
171
|
+
}
|
|
172
|
+
return data.data.removeFriend.friendship;
|
|
173
|
+
})];
|
|
174
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
175
|
+
}
|
|
144
176
|
});
|
|
145
177
|
}); };
|
|
146
178
|
//# sourceMappingURL=friend.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"friend.js","sourceRoot":"","sources":["../../src/mutations/friend.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAGzC,MAAM,CAAC,IAAM,
|
|
1
|
+
{"version":3,"file":"friend.js","sourceRoot":"","sources":["../../src/mutations/friend.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAGzC,MAAM,CAAC,IAAM,aAAa,GAAG,UAAO,QAAgB;;;;;gBAC1C,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,koBAwBb,CAAC;gBAEK,qBAAM,KAAK,CACd,QAAQ,EAAE;wBACV,MAAM,EAAE,MAAM;wBACd,OAAO,EAAE;4BACL,eAAe,EAAG,SAAS,GAAG,KAAK;4BACnC,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,QAAQ,UAAA;6BACV;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,EAAE;4BACZ,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;yBACxB;wBACD,OAAO,IAAI,C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QAAQ,EAAE,kBAAkB;yBAC/B;wBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACjB,KAAK,OAAA;4BACL,SAAS,EAAE;gCACP,SAAS,WAAA;gCACT,QAAQ,UAAA;6BACV;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,EAAE;4BACZ,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;yBACxB;wBACD,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;oBAC7C,CAAC,CAAC,EAAA;oBAtBF,sBAAO,SAsBL,EAAC;;;KACN,CAAC"}
|
package/esm/mutations/user.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const login: (user_id: string, name?: string, profile?: string) => Promise<any>;
|
|
1
|
+
export declare const login: (user_id: string, name?: string, profile?: string, token?: string) => Promise<any>;
|
package/esm/mutations/user.js
CHANGED
|
@@ -35,9 +35,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
import CoreManager from '../CoreManager';
|
|
38
|
-
export var login = function (user_id, name, profile) {
|
|
38
|
+
export var login = function (user_id, name, profile, token) {
|
|
39
39
|
if (name === void 0) { name = ''; }
|
|
40
40
|
if (profile === void 0) { profile = ''; }
|
|
41
|
+
if (token === void 0) { token = ''; }
|
|
41
42
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
42
43
|
var projectId, endpoint, mutation;
|
|
43
44
|
return __generator(this, function (_a) {
|
|
@@ -45,10 +46,11 @@ export var login = function (user_id, name, profile) {
|
|
|
45
46
|
case 0:
|
|
46
47
|
projectId = CoreManager.get("PROJECT_ID");
|
|
47
48
|
endpoint = CoreManager.get('SERVER_URL') + '/graphql';
|
|
48
|
-
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 }";
|
|
49
|
+
mutation = "mutation login ($projectId: String!, $userId: String!, $name: String, $profile: String, $token: String) {\n login(input :{ projectId: $projectId, userId:$userId, name:$name, profile:$profile, token:$token}) {\n token\n }\n }";
|
|
49
50
|
return [4 /*yield*/, fetch(endpoint, {
|
|
50
51
|
method: 'POST',
|
|
51
52
|
headers: {
|
|
53
|
+
'Authorization': 'Bearer ' + token,
|
|
52
54
|
'Content-Type': 'application/json',
|
|
53
55
|
'Accept': 'application/json'
|
|
54
56
|
},
|
|
@@ -58,7 +60,8 @@ export var login = function (user_id, name, profile) {
|
|
|
58
60
|
projectId: projectId,
|
|
59
61
|
userId: user_id,
|
|
60
62
|
name: name,
|
|
61
|
-
profile: profile
|
|
63
|
+
profile: profile,
|
|
64
|
+
token: token
|
|
62
65
|
}
|
|
63
66
|
})
|
|
64
67
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/mutations/user.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,IAAM,KAAK,GAAG,UAAO,OAAe,EAAE,IAAiB,EAAE,OAAmB;
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/mutations/user.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,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;;;;;;oBAC5F,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;oBAC1C,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;oBACtD,QAAQ,GAAG,8PAIf,CAAC;oBACI,qBAAM,KAAK,CACd,QAAQ,EAAE;4BACV,MAAM,EAAE,MAAM;4BACd,OAAO,EAAE;gCACL,eAAe,EAAG,SAAS,GAAG,KAAK;gCACnC,cAAc,EAAE,kBAAkB;gCAClC,QAAQ,EAAE,kBAAkB;6BAC/B;4BACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gCACjB,KAAK,EAAE,QAAQ;gCACf,SAAS,EAAE;oCACP,SAAS,WAAA;oCACT,MAAM,EAAE,OAAO;oCACf,IAAI,MAAA;oCACJ,OAAO,SAAA;oCACP,KAAK,OAAA;iCACP;6BACH,CAAC;yBACP,CAAC;6BACD,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC;6BACvB,IAAI,CAAC,UAAA,IAAI;4BACN,IAAG,IAAI,CAAC,MAAM,EAAE;gCACZ,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;6BACxB;iCACI,IAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK;gCACzB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;;gCAE7B,OAAO,KAAK,CAAC;wBACrB,CAAC,CAAC,EAAA;wBA5BF,sBAAO,SA4BL,EAAC;;;;CACN,CAAA"}
|
package/esm/queries/friend.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const getFriendships: (filter: string, sort: string, option: string) => Promise<any>;
|
package/esm/queries/friend.js
CHANGED
|
@@ -35,7 +35,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
import CoreManager from '../CoreManager';
|
|
38
|
-
export var
|
|
38
|
+
export var getFriendships = function (filter, sort, option) { return __awaiter(void 0, void 0, void 0, function () {
|
|
39
39
|
var token, projectId, endpoint, lquery;
|
|
40
40
|
return __generator(this, function (_a) {
|
|
41
41
|
switch (_a.label) {
|
|
@@ -47,7 +47,7 @@ export var getFriends = function (offset, per_page, search, query) { return __aw
|
|
|
47
47
|
if (!projectId)
|
|
48
48
|
return [2 /*return*/, null];
|
|
49
49
|
endpoint = CoreManager.get('SERVER_URL') + '/graphql';
|
|
50
|
-
lquery = "\n
|
|
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 nickname\n profile\n }\n friend {\n id\n nickname\n profile\n }\n user_id\n friend_id\n created_at\n updated_at\n requested_at\n }\n }\n }\n }\n ";
|
|
51
51
|
return [4 /*yield*/, fetch(endpoint, {
|
|
52
52
|
method: 'POST',
|
|
53
53
|
headers: {
|
|
@@ -59,17 +59,16 @@ export var getFriends = function (offset, per_page, search, query) { return __aw
|
|
|
59
59
|
query: lquery,
|
|
60
60
|
variables: {
|
|
61
61
|
projectId: projectId,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
query: query === "" ? undefined : query
|
|
62
|
+
filter: filter,
|
|
63
|
+
sort: sort,
|
|
64
|
+
option: option
|
|
66
65
|
}
|
|
67
66
|
})
|
|
68
67
|
})
|
|
69
68
|
.then(function (res) { return res.json(); })
|
|
70
69
|
.then(function (data) {
|
|
71
|
-
if (data.data.
|
|
72
|
-
return data.data.
|
|
70
|
+
if (data.data.friendships) {
|
|
71
|
+
return data.data.friendships.edges;
|
|
73
72
|
}
|
|
74
73
|
return [];
|
|
75
74
|
})];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"friend.js","sourceRoot":"","sources":["../../src/queries/friend.ts"],"names":[],"mappings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