ncloudchat 0.0.19-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/LICENSE.md +21 -0
- package/README.md +69 -0
- package/esm/CloudChat.d.ts +38 -0
- package/esm/CloudChat.js +592 -0
- package/esm/CloudChat.js.map +1 -0
- package/esm/CoreManager.d.ts +5 -0
- package/esm/CoreManager.js +27 -0
- package/esm/CoreManager.js.map +1 -0
- package/esm/Dispatcher.d.ts +21 -0
- package/esm/Dispatcher.js +78 -0
- package/esm/Dispatcher.js.map +1 -0
- package/esm/Type.d.ts +35 -0
- package/esm/Type.js +12 -0
- package/esm/Type.js.map +1 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +3 -0
- package/esm/index.js.map +1 -0
- package/esm/logger.d.ts +4 -0
- package/esm/logger.js +11 -0
- package/esm/logger.js.map +1 -0
- package/esm/mutations/channel.d.ts +4 -0
- package/esm/mutations/channel.js +162 -0
- package/esm/mutations/channel.js.map +1 -0
- package/esm/mutations/friend.d.ts +5 -0
- package/esm/mutations/friend.js +146 -0
- package/esm/mutations/friend.js.map +1 -0
- package/esm/mutations/index.d.ts +14 -0
- package/esm/mutations/index.js +15 -0
- package/esm/mutations/index.js.map +1 -0
- package/esm/mutations/invite.d.ts +1 -0
- package/esm/mutations/invite.js +71 -0
- package/esm/mutations/invite.js.map +1 -0
- package/esm/mutations/memberinvitation.d.ts +2 -0
- package/esm/mutations/memberinvitation.js +103 -0
- package/esm/mutations/memberinvitation.js.map +1 -0
- package/esm/mutations/memberreport.d.ts +10 -0
- package/esm/mutations/memberreport.js +110 -0
- package/esm/mutations/memberreport.js.map +1 -0
- package/esm/mutations/message.d.ts +2 -0
- package/esm/mutations/message.js +97 -0
- package/esm/mutations/message.js.map +1 -0
- package/esm/mutations/messageread.d.ts +1 -0
- package/esm/mutations/messageread.js +69 -0
- package/esm/mutations/messageread.js.map +1 -0
- package/esm/mutations/subscription.d.ts +4 -0
- package/esm/mutations/subscription.js +139 -0
- package/esm/mutations/subscription.js.map +1 -0
- package/esm/mutations/user.d.ts +1 -0
- package/esm/mutations/user.js +74 -0
- package/esm/mutations/user.js.map +1 -0
- package/esm/queries/channel.d.ts +2 -0
- package/esm/queries/channel.js +119 -0
- package/esm/queries/channel.js.map +1 -0
- package/esm/queries/friend.d.ts +1 -0
- package/esm/queries/friend.js +80 -0
- package/esm/queries/friend.js.map +1 -0
- package/esm/queries/index.d.ts +7 -0
- package/esm/queries/index.js +8 -0
- package/esm/queries/index.js.map +1 -0
- package/esm/queries/memberinvitation.d.ts +2 -0
- package/esm/queries/memberinvitation.js +110 -0
- package/esm/queries/memberinvitation.js.map +1 -0
- package/esm/queries/message.d.ts +2 -0
- package/esm/queries/message.js +117 -0
- package/esm/queries/message.js.map +1 -0
- package/esm/queries/messageread.d.ts +1 -0
- package/esm/queries/messageread.js +74 -0
- package/esm/queries/messageread.js.map +1 -0
- package/esm/queries/project.d.ts +1 -0
- package/esm/queries/project.js +74 -0
- package/esm/queries/project.js.map +1 -0
- package/esm/queries/subscription.d.ts +2 -0
- package/esm/queries/subscription.js +112 -0
- package/esm/queries/subscription.js.map +1 -0
- package/lib/CloudChat.js +1032 -0
- package/lib/CoreManager.js +35 -0
- package/lib/Dispatcher.js +109 -0
- package/lib/Type.js +25 -0
- package/lib/index.js +18 -0
- package/lib/logger.js +27 -0
- package/lib/mutations/channel.js +324 -0
- package/lib/mutations/friend.js +319 -0
- package/lib/mutations/index.js +128 -0
- package/lib/mutations/invite.js +208 -0
- package/lib/mutations/memberinvitation.js +271 -0
- package/lib/mutations/memberreport.js +272 -0
- package/lib/mutations/message.js +246 -0
- package/lib/mutations/messageread.js +215 -0
- package/lib/mutations/subscription.js +299 -0
- package/lib/mutations/user.js +207 -0
- package/lib/queries/channel.js +274 -0
- package/lib/queries/friend.js +220 -0
- package/lib/queries/index.js +102 -0
- package/lib/queries/memberinvitation.js +273 -0
- package/lib/queries/message.js +267 -0
- package/lib/queries/messageread.js +219 -0
- package/lib/queries/project.js +217 -0
- package/lib/queries/subscription.js +264 -0
- package/ncloudchat_javascript.md +290 -0
- package/package copy.json +74 -0
- package/package.json +76 -0
- package/tsconfig.json +31 -0
- package/types/exif.d.ts +10 -0
- package/types/window.d.ts +5 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import CoreManager from "../CoreManager";
|
|
38
|
+
export var getMessageRead = function (channelId, memberId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
39
|
+
var token, projectId, url, endpoint, query, CONTENT_TYPE, response, json;
|
|
40
|
+
return __generator(this, function (_a) {
|
|
41
|
+
switch (_a.label) {
|
|
42
|
+
case 0:
|
|
43
|
+
token = CoreManager.get("TOKEN");
|
|
44
|
+
if (!token)
|
|
45
|
+
return [2 /*return*/, null];
|
|
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 ($projectId: String!, $channelId: String!, $memberId: String! ) {\n messageRead (projectId: $projectId, channelId: $channelId, memberId: $memberId) { \n member_id\n last_member_id\n last_message_id\n last_sort_id\n }\n }\n ";
|
|
52
|
+
CONTENT_TYPE = 'application/json';
|
|
53
|
+
return [4 /*yield*/, fetch(endpoint, {
|
|
54
|
+
method: 'POST',
|
|
55
|
+
headers: {
|
|
56
|
+
'Authorization': "Bearer " + token,
|
|
57
|
+
'Content-Type': CONTENT_TYPE,
|
|
58
|
+
'Accept': CONTENT_TYPE
|
|
59
|
+
},
|
|
60
|
+
body: JSON.stringify({
|
|
61
|
+
query: query,
|
|
62
|
+
variables: { projectId: projectId, channelId: channelId, memberId: memberId }
|
|
63
|
+
})
|
|
64
|
+
})];
|
|
65
|
+
case 1:
|
|
66
|
+
response = _a.sent();
|
|
67
|
+
return [4 /*yield*/, response.json()];
|
|
68
|
+
case 2:
|
|
69
|
+
json = _a.sent();
|
|
70
|
+
return [2 /*return*/, json.data.messageRead];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}); };
|
|
74
|
+
//# sourceMappingURL=messageread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageread.js","sourceRoot":"","sources":["../../src/queries/messageread.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,IAAM,cAAc,GAAG,UAAO,SAAiB,EAAE,QAAgB;;;;;gBAEhE,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACvC,IAAI,CAAC,KAAK;oBAAE,sBAAO,IAAI,EAAC;gBAElB,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAChD,IAAI,CAAC,SAAS;oBAAE,sBAAO,IAAI,EAAC;gBAEtB,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBACpC,QAAQ,GAAM,GAAG,aAAU,CAAC;gBAC5B,KAAK,GAAG,4RASb,CAAC;gBAEI,YAAY,GAAG,kBAAkB,CAAC;gBACvB,qBAAM,KAAK,CAAC,QAAQ,EAAE;wBACrC,MAAM,EAAE,MAAM;wBACd,OAAO,EAAE;4BACP,eAAe,EAAE,YAAU,KAAO;4BAClC,cAAc,EAAE,YAAY;4BAC5B,QAAQ,EAAE,YAAY;yBACvB;wBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACnB,KAAK,OAAA;4BACL,SAAS,EAAE,EAAE,SAAS,WAAA,EAAE,SAAS,WAAA,EAAE,QAAQ,UAAA,EAAE;yBAC9C,CAAC;qBACH,CAAC,EAAA;;gBAXI,QAAQ,GAAG,SAWf;gBACW,qBAAM,QAAQ,CAAC,IAAI,EAAE,EAAA;;gBAA5B,IAAI,GAAG,SAAqB;gBAClC,sBAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAC;;;KAC9B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getProject: () => Promise<any>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import CoreManager from '../CoreManager';
|
|
38
|
+
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
|
+
return __generator(this, function (_a) {
|
|
41
|
+
switch (_a.label) {
|
|
42
|
+
case 0:
|
|
43
|
+
token = CoreManager.get("TOKEN");
|
|
44
|
+
if (!token)
|
|
45
|
+
return [2 /*return*/, null];
|
|
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
|
+
'Content-Type': CONTENT_TYPE,
|
|
58
|
+
'Accept': CONTENT_TYPE
|
|
59
|
+
},
|
|
60
|
+
body: JSON.stringify({
|
|
61
|
+
query: query,
|
|
62
|
+
variables: { id: projectId }
|
|
63
|
+
})
|
|
64
|
+
})];
|
|
65
|
+
case 1:
|
|
66
|
+
response = _a.sent();
|
|
67
|
+
return [4 /*yield*/, response.json()];
|
|
68
|
+
case 2:
|
|
69
|
+
json = _a.sent();
|
|
70
|
+
return [2 /*return*/, json.data.project];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}); };
|
|
74
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/queries/project.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,MAAM,CAAC,IAAM,UAAU,GAAG;;;;;gBAClB,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACvC,IAAI,CAAC,KAAK;oBAAE,sBAAO,IAAI,EAAC;gBAElB,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAChD,IAAI,CAAC,SAAS;oBAAE,sBAAO,IAAI,EAAC;gBAEtB,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBACpC,QAAQ,GAAM,GAAG,aAAU,CAAC;gBAC5B,KAAK,GAAG,wHAOb,CAAC;gBAEI,YAAY,GAAG,kBAAkB,CAAC;gBACvB,qBAAM,KAAK,CAAC,QAAQ,EAAE;wBACrC,MAAM,EAAE,MAAM;wBACd,OAAO,EAAE;4BACP,eAAe,EAAE,YAAU,KAAO;4BAClC,cAAc,EAAE,YAAY;4BAC5B,QAAQ,EAAE,YAAY;yBACvB;wBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACnB,KAAK,OAAA;4BACL,SAAS,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE;yBAC7B,CAAC;qBACH,CAAC,EAAA;;gBAXI,QAAQ,GAAG,SAWf;gBACW,qBAAM,QAAQ,CAAC,IAAI,EAAE,EAAA;;gBAA5B,IAAI,GAAG,SAAqB;gBAClC,sBAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAC;;;KAC1B,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import CoreManager from '../CoreManager';
|
|
38
|
+
export var getSubscriptions = function (filter, sort, option) { return __awaiter(void 0, void 0, void 0, function () {
|
|
39
|
+
var token, projectId, endpoint, query;
|
|
40
|
+
return __generator(this, function (_a) {
|
|
41
|
+
switch (_a.label) {
|
|
42
|
+
case 0:
|
|
43
|
+
token = CoreManager.get("TOKEN");
|
|
44
|
+
if (!token)
|
|
45
|
+
return [2 /*return*/, null];
|
|
46
|
+
projectId = CoreManager.get("PROJECT_ID");
|
|
47
|
+
if (!projectId)
|
|
48
|
+
return [2 /*return*/, null];
|
|
49
|
+
endpoint = CoreManager.get('SERVER_URL') + '/graphql';
|
|
50
|
+
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 nickname\n profile_url\n country\n }\n channel_id\n user_id\n online\n push\n created_at\n }\n }\n }\n }\n ";
|
|
51
|
+
return [4 /*yield*/, fetch(endpoint, {
|
|
52
|
+
method: 'POST',
|
|
53
|
+
headers: {
|
|
54
|
+
'Authorization': 'Bearer ' + token,
|
|
55
|
+
'Content-Type': 'application/json',
|
|
56
|
+
'Accept': 'application/json'
|
|
57
|
+
},
|
|
58
|
+
body: JSON.stringify({
|
|
59
|
+
query: query,
|
|
60
|
+
variables: {
|
|
61
|
+
projectId: projectId,
|
|
62
|
+
option: option,
|
|
63
|
+
filter: filter,
|
|
64
|
+
sort: sort
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
.then(function (res) { return res.json(); })
|
|
69
|
+
.then(function (data) {
|
|
70
|
+
return data.data.subscriptions.edges;
|
|
71
|
+
})];
|
|
72
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}); };
|
|
76
|
+
export var getSubscriptionByConnection = function (channelId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
77
|
+
var token, projectId, endpoint, query;
|
|
78
|
+
return __generator(this, function (_a) {
|
|
79
|
+
switch (_a.label) {
|
|
80
|
+
case 0:
|
|
81
|
+
token = CoreManager.get("TOKEN");
|
|
82
|
+
if (!token)
|
|
83
|
+
return [2 /*return*/, null];
|
|
84
|
+
projectId = CoreManager.get("PROJECT_ID");
|
|
85
|
+
if (!projectId)
|
|
86
|
+
return [2 /*return*/, null];
|
|
87
|
+
endpoint = CoreManager.get('SERVER_URL') + '/graphql';
|
|
88
|
+
query = "\n query subscriptionsByConnection(\n $projectId: String!, \n $channelId: String!\n ) {\n subscriptionsByConnection(\n projectId: $projectId\n channelId: $channelId\n ) {\n totalCount\n edges {\n node {\n id\n project_id\n channel_id\n user_id\n notice\n member_read {\n id\n project_id\n channel_id\n member_id\n last_member_id\n last_message_id\n last_sort_id\n created_at\n updated_at\n }\n created_at\n updated_at\n }\n }\n }\n }\n ";
|
|
89
|
+
return [4 /*yield*/, fetch(endpoint, {
|
|
90
|
+
method: 'POST',
|
|
91
|
+
headers: {
|
|
92
|
+
'Authorization': 'Bearer ' + token,
|
|
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
|
+
return data.data.subscriptionsByConnection.edges;
|
|
107
|
+
})];
|
|
108
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}); };
|
|
112
|
+
//# sourceMappingURL=subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/queries/subscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,IAAO,gBAAgB,GAAG,UAAO,MAAW,EAAE,IAAS,EAAE,MAAW;;;;;gBACjE,KAAK,GAAG,WAAW,CAAC,GAAG,CAA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