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 login = function (user_id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
39
|
+
var projectId, endpoint, mutation;
|
|
40
|
+
return __generator(this, function (_a) {
|
|
41
|
+
switch (_a.label) {
|
|
42
|
+
case 0:
|
|
43
|
+
projectId = CoreManager.get("PROJECT_ID");
|
|
44
|
+
endpoint = CoreManager.get('SERVER_URL') + '/graphql';
|
|
45
|
+
mutation = "mutation login ($projectId: String!, $userId: String!) {\n login(input :{ projectId: $projectId, userId:$userId}) {\n token\n }\n }";
|
|
46
|
+
return [4 /*yield*/, fetch(endpoint, {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
headers: {
|
|
49
|
+
'Content-Type': 'application/json',
|
|
50
|
+
'Accept': 'application/json'
|
|
51
|
+
},
|
|
52
|
+
body: JSON.stringify({
|
|
53
|
+
query: mutation,
|
|
54
|
+
variables: {
|
|
55
|
+
projectId: projectId,
|
|
56
|
+
userId: user_id
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
.then(function (res) { return res.json(); })
|
|
61
|
+
.then(function (data) {
|
|
62
|
+
if (data.errors) {
|
|
63
|
+
throw data.errors[0];
|
|
64
|
+
}
|
|
65
|
+
else if (data.data.login.token)
|
|
66
|
+
return data.data.login.token;
|
|
67
|
+
else
|
|
68
|
+
return false;
|
|
69
|
+
})];
|
|
70
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}); };
|
|
74
|
+
//# sourceMappingURL=user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../src/mutations/user.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,IAAM,KAAK,GAAG,UAAO,OAAe;;;;;gBACjC,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAC1C,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;gBACtD,QAAQ,GAAG,iKAIf,CAAC;gBACI,qBAAM,KAAK,CACd,QAAQ,EAAE;wBACV,MAAM,EAAE,MAAM;wBACd,OAAO,EAAE;4BACL,cAAc,EAAE,kBAAkB;4BAClC,QAAQ,EAAE,kBAAkB;yBAC/B;wBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACjB,KAAK,EAAE,QAAQ;4BACf,SAAS,EAAE;gCACP,SAAS,WAAA;gCACT,MAAM,EAAE,OAAO;6BACjB;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;6BACI,IAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK;4BACzB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;;4BAE7B,OAAO,KAAK,CAAC;oBACrB,CAAC,CAAC,EAAA;oBAxBF,sBAAO,SAwBL,EAAC;;;KACN,CAAA"}
|
|
@@ -0,0 +1,119 @@
|
|
|
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 getChannels = 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 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 unique_id\n is_private\n translation\n members\n push\n link_url\n image_url \n created_at\n updated_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
|
+
filter: filter,
|
|
63
|
+
sort: sort,
|
|
64
|
+
option: option
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
.then(function (res) { return res.json(); })
|
|
69
|
+
.then(function (data) {
|
|
70
|
+
if (data.data.channels) {
|
|
71
|
+
return data.data.channels.edges;
|
|
72
|
+
}
|
|
73
|
+
return [];
|
|
74
|
+
})];
|
|
75
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}); };
|
|
79
|
+
export var getChannel = function (id) { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
+
var token, projectId, endpoint, query;
|
|
81
|
+
return __generator(this, function (_a) {
|
|
82
|
+
switch (_a.label) {
|
|
83
|
+
case 0:
|
|
84
|
+
token = CoreManager.get('TOKEN');
|
|
85
|
+
if (!token)
|
|
86
|
+
return [2 /*return*/, null];
|
|
87
|
+
projectId = CoreManager.get('PROJECT_ID');
|
|
88
|
+
if (!projectId)
|
|
89
|
+
return [2 /*return*/, null];
|
|
90
|
+
endpoint = CoreManager.get('SERVER_URL') + '/graphql';
|
|
91
|
+
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 unique_id\n is_private\n translation\n members\n push\n link_url\n image_url \n created_at\n updated_at\n }\n }\n ";
|
|
92
|
+
return [4 /*yield*/, fetch(endpoint, {
|
|
93
|
+
method: 'POST',
|
|
94
|
+
headers: {
|
|
95
|
+
Authorization: 'Bearer ' + token,
|
|
96
|
+
'Content-Type': 'application/json',
|
|
97
|
+
Accept: 'application/json'
|
|
98
|
+
},
|
|
99
|
+
body: JSON.stringify({
|
|
100
|
+
query: query,
|
|
101
|
+
variables: {
|
|
102
|
+
projectId: projectId,
|
|
103
|
+
id: id
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
.then(function (res) { return res.json(); })
|
|
108
|
+
.then(function (data) {
|
|
109
|
+
console.log(data.data);
|
|
110
|
+
if (data.data.channel) {
|
|
111
|
+
return data.data.channel;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
})];
|
|
115
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}); };
|
|
119
|
+
//# sourceMappingURL=channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/queries/channel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,IAAM,WAAW,GAAG,UAAO,MAAc,EAAE,IAAY,EAAE,MAAc;;;;;gBACtE,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACvC,IAAI,CAAC,KAAK;oBAAE,sBAAO,IAAI,EAAC;gBAClB,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAChD,IAAI,CAAC,SAAS;oBAAE,sBAAO,IAAI,EAAC;gBACtB,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;gBACtD,KAAK,GAAG,sxBAuBX,CAAC;gBAEG,qBAAM,KAAK,CAAC,QAAQ,EAAE;wBAC3B,MAAM,EAAE,MAAM;wBACd,OAAO,EAAE;4BACP,a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,OAAA;4BACL,SAAS,EAAE;gCACT,SAAS,WAAA;gCACT,EAAE,IAAA;6BACH;yBACF,CAAC;qBACH,CAAC;yBACD,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC;yBACzB,IAAI,CAAC,UAAC,IAAI;wBACT,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;wBACvB,IAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EACpB;4BACE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;yBAC1B;wBACD,OAAO,KAAK,CAAC;oBAEf,CAAC,CAAC,EAAA;oBAxBF,sBAAO,SAwBL,EAAC;;;KACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getFriends: (offset: number, per_page: number, search: string, query: string) => Promise<any>;
|
|
@@ -0,0 +1,80 @@
|
|
|
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 getFriends = function (offset, per_page, search, query) { return __awaiter(void 0, void 0, void 0, function () {
|
|
39
|
+
var token, projectId, endpoint, lquery;
|
|
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
|
+
lquery = "\n query friends ($projectId: String!, $offset: Int!, $per_page: Int!, $search:String, $query:String) {\n friends(projectId: $projectId, offset:$offset, per_page:$per_page, search:$search, query:$query) {\n totalCount\n edges {\n node {\n project_id\n id\n created_at\n updated_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: lquery,
|
|
60
|
+
variables: {
|
|
61
|
+
projectId: projectId,
|
|
62
|
+
offset: offset,
|
|
63
|
+
per_page: per_page,
|
|
64
|
+
search: search === "" ? undefined : search,
|
|
65
|
+
query: query === "" ? undefined : query
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
.then(function (res) { return res.json(); })
|
|
70
|
+
.then(function (data) {
|
|
71
|
+
if (data.data.channels) {
|
|
72
|
+
return data.data.channels.edges;
|
|
73
|
+
}
|
|
74
|
+
return [];
|
|
75
|
+
})];
|
|
76
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}); };
|
|
80
|
+
//# sourceMappingURL=friend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"friend.js","sourceRoot":"","sources":["../../src/queries/friend.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,IAAM,UAAU,GAAG,UA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ACN,CAAC"}
|
|
@@ -0,0 +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,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
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 getMemberInvitations = function (offset, perPage, channelId) { 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 ($offset:Int!,$per_page:Int,$projectId:String!,$channelId:String) {\n memberInvitations(offset:$offset,per_page:$per_page,projectId:$projectId,channelId:$channelId) {\n edges {\n node {\n id\n project_id\n channel_id\n sequence_id\n url\n link\n invite_form\n invitee\n invite_status\n subscribed_id\n send_at\n received_at\n subscribed_at\n created_at\n updated_at\n } \n }\n totalCount\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: { offset: offset, per_page: perPage, projectId: projectId, channelId: channelId }
|
|
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.memberInvitations.edges];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}); };
|
|
74
|
+
export var getMemberInvitation = function (sequenceId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
75
|
+
var token, projectId, url, endpoint, query, CONTENT_TYPE, response, json;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
token = CoreManager.get("TOKEN");
|
|
80
|
+
if (!token)
|
|
81
|
+
return [2 /*return*/, null];
|
|
82
|
+
projectId = CoreManager.get("PROJECT_ID");
|
|
83
|
+
if (!projectId)
|
|
84
|
+
return [2 /*return*/, null];
|
|
85
|
+
url = CoreManager.get('SERVER_URL');
|
|
86
|
+
endpoint = url + "/graphql";
|
|
87
|
+
query = "\n query ($sequenceId:String!) {\n memberInvitation(sequenceId:$sequenceId) {\n id\n project_id\n channel_id\n sequence_id\n url\n link\n invite_form\n invitee\n invite_status\n subscribed_id\n send_at\n received_at\n subscribed_at\n created_at\n updated_at \n }\n } \n ";
|
|
88
|
+
CONTENT_TYPE = 'application/json';
|
|
89
|
+
return [4 /*yield*/, fetch(endpoint, {
|
|
90
|
+
method: 'POST',
|
|
91
|
+
headers: {
|
|
92
|
+
'Authorization': "Bearer " + token,
|
|
93
|
+
'Content-Type': CONTENT_TYPE,
|
|
94
|
+
'Accept': CONTENT_TYPE
|
|
95
|
+
},
|
|
96
|
+
body: JSON.stringify({
|
|
97
|
+
query: query,
|
|
98
|
+
variables: { sequenceId: sequenceId }
|
|
99
|
+
})
|
|
100
|
+
})];
|
|
101
|
+
case 1:
|
|
102
|
+
response = _a.sent();
|
|
103
|
+
return [4 /*yield*/, response.json()];
|
|
104
|
+
case 2:
|
|
105
|
+
json = _a.sent();
|
|
106
|
+
return [2 /*return*/, json.data.memberInvitation];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}); };
|
|
110
|
+
//# sourceMappingURL=memberinvitation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memberinvitation.js","sourceRoot":"","sources":["../../src/queries/memberinvitation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,MAAM,CAAC,IAAM,oBAAoB,GAAG,UAClC,MAAc,EACd,OAAe,EACf,SAAiB;;;;;gBAEX,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,GA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;4BAC5B,QAAQ,EAAE,YAAY;yBACvB;wBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACnB,KAAK,OAAA;4BACL,SAAS,EAAE,EAAE,UAAU,YAAA,EAAE;yBAC1B,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,gBAAgB,EAAC;;;KACnC,CAAA"}
|
|
@@ -0,0 +1,117 @@
|
|
|
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 getMessages = function (filter, sort, option) { return __awaiter(void 0, void 0, void 0, function () {
|
|
39
|
+
var token, projectId, endpoint, queries;
|
|
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
|
+
queries = "\n query messages ($projectId: String!, $filter: String!, $option: String, $sort: String ) {\n messages(projectId: $projectId, filter: $filter, option:$option, sort:$sort) {\n totalCount\n edges {\n node {\n id\n message_id\n channel_id\n sort_id\n message_type\n sender {\n id\n name\n profile\n }\n admin {\n id\n name\n }\n mentions\n mentions_everyone\n content\n sended_at\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: queries,
|
|
60
|
+
variables: {
|
|
61
|
+
projectId: projectId,
|
|
62
|
+
filter: filter,
|
|
63
|
+
sort: sort,
|
|
64
|
+
option: option
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
.then(function (res) { return res.json(); })
|
|
69
|
+
.then(function (data) {
|
|
70
|
+
if (!data || !data.data.messages)
|
|
71
|
+
return [];
|
|
72
|
+
return data.data.messages.edges;
|
|
73
|
+
})];
|
|
74
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}); };
|
|
78
|
+
export var getMessage = function (channelId, messageId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
79
|
+
var token, projectId, endpoint, queries;
|
|
80
|
+
return __generator(this, function (_a) {
|
|
81
|
+
switch (_a.label) {
|
|
82
|
+
case 0:
|
|
83
|
+
token = CoreManager.get("TOKEN");
|
|
84
|
+
if (!token)
|
|
85
|
+
return [2 /*return*/, null];
|
|
86
|
+
projectId = CoreManager.get("PROJECT_ID");
|
|
87
|
+
if (!projectId)
|
|
88
|
+
return [2 /*return*/, null];
|
|
89
|
+
endpoint = CoreManager.get("SERVER_URL") + "/graphql";
|
|
90
|
+
queries = "\n query message ($projectId: String!, $channelId: String!, $id: ID!) { \n message(projectId: $projectId, channelId:$channelId, id:$id) { \n id\n message_id\n channel_id\n sort_id\n message_type\n sender {\n id\n name\n profile\n }\n admin {\n id\n name\n }\n mentions\n mentions_everyone\n content\n sended_at\n created_at\n } \n }\n ";
|
|
91
|
+
return [4 /*yield*/, fetch(endpoint, {
|
|
92
|
+
method: "POST",
|
|
93
|
+
headers: {
|
|
94
|
+
Authorization: "Bearer " + token,
|
|
95
|
+
"Content-Type": "application/json",
|
|
96
|
+
Accept: "application/json"
|
|
97
|
+
},
|
|
98
|
+
body: JSON.stringify({
|
|
99
|
+
query: queries,
|
|
100
|
+
variables: {
|
|
101
|
+
projectId: projectId,
|
|
102
|
+
channelId: channelId,
|
|
103
|
+
id: messageId
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
.then(function (res) { return res.json(); })
|
|
108
|
+
.then(function (data) {
|
|
109
|
+
if (!data || !data.data.message)
|
|
110
|
+
return false;
|
|
111
|
+
return data.data.message;
|
|
112
|
+
})];
|
|
113
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}); };
|
|
117
|
+
//# sourceMappingURL=message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/queries/message.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,IAAM,WAAW,GAAG,UAAO,MAAc,EAAE,IAAY,EAAE,MAAc;;;;;gBACtE,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACvC,IAAI,CAAC,KAAK;oBAAE,sBAAO,IAAI,EAAC;gBAClB,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAChD,IAAI,CAAC,SAAS;oBAAE,sBAAO,IAAI,EAAC;gBACtB,QAAQ,GAAG,WAAW,CAAC,GAAG,CAA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