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,92 +40,49 @@ 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 { fetchData } from "../Network";
|
|
45
|
+
import { getSubscriptionQuery, getSubscriptionsQuery, } from "../graphql/subscription";
|
|
46
|
+
/**
|
|
47
|
+
* Get subscription data of the user.
|
|
48
|
+
*
|
|
49
|
+
* @async
|
|
50
|
+
* @function getSubscription
|
|
51
|
+
* @param {string} channelId - The id of a channel.
|
|
52
|
+
* @param {string} id
|
|
53
|
+
* @returns {Promise<any>}
|
|
54
|
+
*/
|
|
39
55
|
export var getSubscription = function (channelId, id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
40
|
-
var token, projectId, endpoint, query;
|
|
41
56
|
return __generator(this, function (_a) {
|
|
42
57
|
switch (_a.label) {
|
|
43
|
-
case 0:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (!projectId)
|
|
49
|
-
return [2 /*return*/, null];
|
|
50
|
-
endpoint = CoreManager.get('SERVER_URL') + '/graphql';
|
|
51
|
-
query = "\n query subscription ($projectId: String!,$channelId: String!, $id: String!) {\n subscription(projectId: $projectId, channelId: $channelId, id:$id) {\n id\n user {\n name\n profile\n country\n }\n mark {\n user_id\n message_id\n sort_id\n }\n channel_id\n user_id\n online\n push\n created_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
|
-
channelId: channelId,
|
|
65
|
-
id: id
|
|
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.subscription) {
|
|
76
|
-
data.data.subscription.id = ObjectId(data.data.subscription.id);
|
|
77
|
-
return data.data.subscription;
|
|
78
|
-
}
|
|
79
|
-
})];
|
|
58
|
+
case 0: return [4 /*yield*/, fetchData("subscription", getSubscriptionQuery, {
|
|
59
|
+
projectId: CoreManager.get("PROJECT_ID"),
|
|
60
|
+
channelId: channelId,
|
|
61
|
+
id: id
|
|
62
|
+
})];
|
|
80
63
|
case 1: return [2 /*return*/, _a.sent()];
|
|
81
64
|
}
|
|
82
65
|
});
|
|
83
66
|
}); };
|
|
67
|
+
/**
|
|
68
|
+
* Get a list of subscibed member of the channel.
|
|
69
|
+
*
|
|
70
|
+
* @async
|
|
71
|
+
* @function getSubscriptions
|
|
72
|
+
* @param {string} filter - Field value for filter.
|
|
73
|
+
* @param {string} sort - Field value for sorting.
|
|
74
|
+
* @param {string} option - Optional option: ex) offset, per_page.
|
|
75
|
+
* @returns {Promise<any>}
|
|
76
|
+
*/
|
|
84
77
|
export var getSubscriptions = function (filter, sort, option) { return __awaiter(void 0, void 0, void 0, function () {
|
|
85
|
-
var token, projectId, endpoint, query;
|
|
86
78
|
return __generator(this, function (_a) {
|
|
87
79
|
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 subscriptions ($projectId: String!, $option: String!, $filter: String!, $sort: String ) {\n subscriptions (projectId: $projectId, option:$option, filter:$filter, sort:$sort) {\n totalCount\n edges {\n node {\n id\n user {\n name\n profile\n country\n }\n channel_id\n user_id\n online\n push\n created_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
|
-
option: option,
|
|
110
|
-
filter: filter,
|
|
111
|
-
sort: sort
|
|
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
|
-
return data.data.subscriptions.edges;
|
|
122
|
-
})];
|
|
80
|
+
case 0: return [4 /*yield*/, fetchData("subscriptions", getSubscriptionsQuery, {
|
|
81
|
+
projectId: CoreManager.get("PROJECT_ID"),
|
|
82
|
+
option: option,
|
|
83
|
+
filter: filter,
|
|
84
|
+
sort: sort
|
|
85
|
+
})];
|
|
123
86
|
case 1: return [2 /*return*/, _a.sent()];
|
|
124
87
|
}
|
|
125
88
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/queries/subscription.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/queries/subscription.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EACH,oBAAoB,EACpB,qBAAqB,GACxB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG,UAAO,SAAiB,EAAE,EAAU;;;oBACxD,qBAAM,SAAS,CAAC,cAAc,EAAE,oBAAoB,EAAE;oBACzD,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,SAAS,WAAA;oBACT,EAAE,IAAA;iBACL,CAAC,EAAA;oBAJF,sBAAO,SAIL,EAAC;;;KACN,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAO,MAAW,EAAE,IAAS,EAAE,MAAW;;;oBAC/D,qBAAM,SAAS,CAAC,eAAe,EAAE,qBAAqB,EAAE;oBAC3D,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC;oBACxC,MAAM,QAAA;oBACN,MAAM,QAAA;oBACN,IAAI,MAAA;iBACP,CAAC,EAAA;oBALF,sBAAO,SAKL,EAAC;;;KACN,CAAC"}
|