ncloudchat 1.0.19 → 1.0.23
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 +3 -0
- package/esm/CloudChat.js +136 -59
- package/esm/CloudChat.js.map +1 -1
- package/esm/CoreManager.js.map +1 -1
- package/esm/mutations/channel.d.ts +1 -1
- package/esm/mutations/channel.js +13 -3
- package/esm/mutations/channel.js.map +1 -1
- package/esm/mutations/index.d.ts +1 -1
- package/esm/mutations/index.js +1 -1
- package/esm/mutations/index.js.map +1 -1
- package/esm/mutations/member.d.ts +4 -0
- package/esm/mutations/member.js +176 -0
- package/esm/mutations/member.js.map +1 -0
- package/esm/mutations/message.js +4 -0
- package/esm/mutations/message.js.map +1 -1
- package/esm/mutations/subscription.d.ts +1 -0
- package/esm/mutations/subscription.js +4 -3
- package/esm/mutations/subscription.js.map +1 -1
- package/esm/queries/index.d.ts +1 -0
- package/esm/queries/index.js +1 -0
- package/esm/queries/index.js.map +1 -1
- package/esm/queries/memberblocks.d.ts +1 -0
- package/esm/{mutations/user.js → queries/memberblocks.js} +45 -48
- package/esm/queries/memberblocks.js.map +1 -0
- package/lib/CloudChat.js +194 -60
- package/lib/mutations/channel.js +9 -3
- package/lib/mutations/index.js +3 -3
- package/lib/mutations/member.js +331 -0
- package/lib/mutations/message.js +8 -0
- package/lib/mutations/subscription.js +7 -4
- package/lib/queries/index.js +13 -0
- package/lib/{mutations/user.js → queries/memberblocks.js} +26 -30
- package/package.json +1 -1
- package/esm/mutations/user.d.ts +0 -1
- package/esm/mutations/user.js.map +0 -1
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
6
|
+
|
|
7
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
exports.deleteMemberBlock = exports.createMemberBlock = exports.login = exports.getMemberBlockSchema = void 0;
|
|
12
|
+
|
|
13
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
14
|
+
|
|
15
|
+
var _iterator = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/symbol/iterator"));
|
|
16
|
+
|
|
17
|
+
var _symbol = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/symbol"));
|
|
18
|
+
|
|
19
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
20
|
+
|
|
21
|
+
var _CoreManager = _interopRequireDefault(require("../CoreManager"));
|
|
22
|
+
|
|
23
|
+
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
24
|
+
function adopt(value) {
|
|
25
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
26
|
+
resolve(value);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return new (P || (P = _promise["default"]))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) {
|
|
32
|
+
try {
|
|
33
|
+
step(generator.next(value));
|
|
34
|
+
} catch (e) {
|
|
35
|
+
reject(e);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function rejected(value) {
|
|
40
|
+
try {
|
|
41
|
+
step(generator["throw"](value));
|
|
42
|
+
} catch (e) {
|
|
43
|
+
reject(e);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function step(result) {
|
|
48
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
|
56
|
+
var _ = {
|
|
57
|
+
label: 0,
|
|
58
|
+
sent: function sent() {
|
|
59
|
+
if (t[0] & 1) throw t[1];
|
|
60
|
+
return t[1];
|
|
61
|
+
},
|
|
62
|
+
trys: [],
|
|
63
|
+
ops: []
|
|
64
|
+
},
|
|
65
|
+
f,
|
|
66
|
+
y,
|
|
67
|
+
t,
|
|
68
|
+
g;
|
|
69
|
+
return g = {
|
|
70
|
+
next: verb(0),
|
|
71
|
+
"throw": verb(1),
|
|
72
|
+
"return": verb(2)
|
|
73
|
+
}, typeof _symbol["default"] === "function" && (g[_iterator["default"]] = function () {
|
|
74
|
+
return this;
|
|
75
|
+
}), g;
|
|
76
|
+
|
|
77
|
+
function verb(n) {
|
|
78
|
+
return function (v) {
|
|
79
|
+
return step([n, v]);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function step(op) {
|
|
84
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
85
|
+
|
|
86
|
+
while (_) {
|
|
87
|
+
try {
|
|
88
|
+
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;
|
|
89
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
90
|
+
|
|
91
|
+
switch (op[0]) {
|
|
92
|
+
case 0:
|
|
93
|
+
case 1:
|
|
94
|
+
t = op;
|
|
95
|
+
break;
|
|
96
|
+
|
|
97
|
+
case 4:
|
|
98
|
+
_.label++;
|
|
99
|
+
return {
|
|
100
|
+
value: op[1],
|
|
101
|
+
done: false
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
case 5:
|
|
105
|
+
_.label++;
|
|
106
|
+
y = op[1];
|
|
107
|
+
op = [0];
|
|
108
|
+
continue;
|
|
109
|
+
|
|
110
|
+
case 7:
|
|
111
|
+
op = _.ops.pop();
|
|
112
|
+
|
|
113
|
+
_.trys.pop();
|
|
114
|
+
|
|
115
|
+
continue;
|
|
116
|
+
|
|
117
|
+
default:
|
|
118
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
119
|
+
_ = 0;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
124
|
+
_.label = op[1];
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
129
|
+
_.label = t[1];
|
|
130
|
+
t = op;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (t && _.label < t[2]) {
|
|
135
|
+
_.label = t[2];
|
|
136
|
+
|
|
137
|
+
_.ops.push(op);
|
|
138
|
+
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (t[2]) _.ops.pop();
|
|
143
|
+
|
|
144
|
+
_.trys.pop();
|
|
145
|
+
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
op = body.call(thisArg, _);
|
|
150
|
+
} catch (e) {
|
|
151
|
+
op = [6, e];
|
|
152
|
+
y = 0;
|
|
153
|
+
} finally {
|
|
154
|
+
f = t = 0;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (op[0] & 5) throw op[1];
|
|
159
|
+
return {
|
|
160
|
+
value: op[0] ? op[1] : void 0,
|
|
161
|
+
done: true
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
var getMemberBlockSchema = "\n id\n project_id\n member_id\n type\n status\n block_type\n reason\n messageMulti {\n lang\n value\n default\n }\n started_at\n ended_at\n created_at\n updated_at\n deleted_at\n";
|
|
167
|
+
exports.getMemberBlockSchema = getMemberBlockSchema;
|
|
168
|
+
|
|
169
|
+
var login = function login(user_id, name, profile, token) {
|
|
170
|
+
if (name === void 0) {
|
|
171
|
+
name = '';
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (profile === void 0) {
|
|
175
|
+
profile = '';
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (token === void 0) {
|
|
179
|
+
token = '';
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
183
|
+
var projectId, endpoint, mutation;
|
|
184
|
+
return __generator(this, function (_a) {
|
|
185
|
+
switch (_a.label) {
|
|
186
|
+
case 0:
|
|
187
|
+
_CoreManager["default"].set("TOKEN", token);
|
|
188
|
+
|
|
189
|
+
projectId = _CoreManager["default"].get("PROJECT_ID");
|
|
190
|
+
endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
|
|
191
|
+
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 }";
|
|
192
|
+
return [4
|
|
193
|
+
/*yield*/
|
|
194
|
+
, fetch(endpoint, {
|
|
195
|
+
method: 'POST',
|
|
196
|
+
headers: {
|
|
197
|
+
'Authorization': 'Bearer ' + token,
|
|
198
|
+
'X-PROJECT-ID': projectId,
|
|
199
|
+
'Content-Type': 'application/json',
|
|
200
|
+
'Accept': 'application/json'
|
|
201
|
+
},
|
|
202
|
+
body: (0, _stringify["default"])({
|
|
203
|
+
query: mutation,
|
|
204
|
+
variables: {
|
|
205
|
+
projectId: projectId,
|
|
206
|
+
userId: user_id,
|
|
207
|
+
name: name,
|
|
208
|
+
profile: profile,
|
|
209
|
+
token: token
|
|
210
|
+
}
|
|
211
|
+
})
|
|
212
|
+
}).then(function (res) {
|
|
213
|
+
return res.json();
|
|
214
|
+
}).then(function (data) {
|
|
215
|
+
if (data.errors) throw data.errors[0];
|
|
216
|
+
if (data.code) throw data;else if (data.data.login.token) {
|
|
217
|
+
return data.data.login.token;
|
|
218
|
+
} else return false;
|
|
219
|
+
})];
|
|
220
|
+
|
|
221
|
+
case 1:
|
|
222
|
+
return [2
|
|
223
|
+
/*return*/
|
|
224
|
+
, _a.sent()];
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
exports.login = login;
|
|
231
|
+
|
|
232
|
+
var createMemberBlock = function createMemberBlock(channelId, memberId, options) {
|
|
233
|
+
if (options === void 0) {
|
|
234
|
+
options = "";
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
238
|
+
var token, projectId, endpoint, mutation;
|
|
239
|
+
return __generator(this, function (_a) {
|
|
240
|
+
switch (_a.label) {
|
|
241
|
+
case 0:
|
|
242
|
+
token = _CoreManager["default"].get("TOKEN");
|
|
243
|
+
projectId = _CoreManager["default"].get("PROJECT_ID");
|
|
244
|
+
endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
|
|
245
|
+
mutation = "mutation createMemberBlock(\n $projectId: String!\n $memberId: String!\n $channelId: String\n $options: String\n ) {\n createMemberBlock(\n input: {\n projectId: $projectId\n memberId: $memberId\n channelId: $channelId\n options: $options\n }\n ) {\n memberBlock {\n " + getMemberBlockSchema + "\n }\n }\n }";
|
|
246
|
+
return [4
|
|
247
|
+
/*yield*/
|
|
248
|
+
, fetch(endpoint, {
|
|
249
|
+
method: 'POST',
|
|
250
|
+
headers: {
|
|
251
|
+
'Authorization': 'Bearer ' + token,
|
|
252
|
+
'X-PROJECT-ID': projectId,
|
|
253
|
+
'Content-Type': 'application/json',
|
|
254
|
+
'Accept': 'application/json'
|
|
255
|
+
},
|
|
256
|
+
body: (0, _stringify["default"])({
|
|
257
|
+
query: mutation,
|
|
258
|
+
variables: {
|
|
259
|
+
projectId: projectId,
|
|
260
|
+
channelId: channelId,
|
|
261
|
+
memberId: memberId,
|
|
262
|
+
options: options
|
|
263
|
+
}
|
|
264
|
+
})
|
|
265
|
+
}).then(function (res) {
|
|
266
|
+
return res.json();
|
|
267
|
+
}).then(function (data) {
|
|
268
|
+
if (data.errors) throw data.errors[0];
|
|
269
|
+
if (data.code) throw data;else if (data.data.createMemberBlock) {
|
|
270
|
+
return data.data.createMemberBlock;
|
|
271
|
+
} else return false;
|
|
272
|
+
})];
|
|
273
|
+
|
|
274
|
+
case 1:
|
|
275
|
+
return [2
|
|
276
|
+
/*return*/
|
|
277
|
+
, _a.sent()];
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
exports.createMemberBlock = createMemberBlock;
|
|
284
|
+
|
|
285
|
+
var deleteMemberBlock = function deleteMemberBlock(channelId, memberId) {
|
|
286
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
287
|
+
var token, projectId, endpoint, mutation;
|
|
288
|
+
return __generator(this, function (_a) {
|
|
289
|
+
switch (_a.label) {
|
|
290
|
+
case 0:
|
|
291
|
+
token = _CoreManager["default"].get("TOKEN");
|
|
292
|
+
projectId = _CoreManager["default"].get("PROJECT_ID");
|
|
293
|
+
endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
|
|
294
|
+
mutation = "mutation deleteMemberBlock(\n $projectId: String!\n $memberId: String!\n $channelId: String\n ) {\n deleteMemberBlock(\n input: {\n projectId: $projectId\n memberId: $memberId\n channelId: $channelId\n }\n ) {\n memberBlock {\n " + getMemberBlockSchema + "\n }\n }\n }";
|
|
295
|
+
return [4
|
|
296
|
+
/*yield*/
|
|
297
|
+
, fetch(endpoint, {
|
|
298
|
+
method: 'POST',
|
|
299
|
+
headers: {
|
|
300
|
+
'Authorization': 'Bearer ' + token,
|
|
301
|
+
'X-PROJECT-ID': projectId,
|
|
302
|
+
'Content-Type': 'application/json',
|
|
303
|
+
'Accept': 'application/json'
|
|
304
|
+
},
|
|
305
|
+
body: (0, _stringify["default"])({
|
|
306
|
+
query: mutation,
|
|
307
|
+
variables: {
|
|
308
|
+
projectId: projectId,
|
|
309
|
+
channelId: channelId,
|
|
310
|
+
memberId: memberId
|
|
311
|
+
}
|
|
312
|
+
})
|
|
313
|
+
}).then(function (res) {
|
|
314
|
+
return res.json();
|
|
315
|
+
}).then(function (data) {
|
|
316
|
+
if (data.errors) throw data.errors[0];
|
|
317
|
+
if (data.code) throw data;else if (data.data.deleteMemberBlock) {
|
|
318
|
+
return data.data.deleteMemberBlock;
|
|
319
|
+
} else return false;
|
|
320
|
+
})];
|
|
321
|
+
|
|
322
|
+
case 1:
|
|
323
|
+
return [2
|
|
324
|
+
/*return*/
|
|
325
|
+
, _a.sent()];
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
});
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
exports.deleteMemberBlock = deleteMemberBlock;
|
package/lib/mutations/message.js
CHANGED
|
@@ -219,6 +219,14 @@ var upload = function upload(channelId, file) {
|
|
|
219
219
|
switch (_a.label) {
|
|
220
220
|
case 0:
|
|
221
221
|
token = _CoreManager["default"].get("TOKEN");
|
|
222
|
+
|
|
223
|
+
if (!token) {
|
|
224
|
+
console.error('Token is not found');
|
|
225
|
+
return [2
|
|
226
|
+
/*return*/
|
|
227
|
+
];
|
|
228
|
+
}
|
|
229
|
+
|
|
222
230
|
projectId = _CoreManager["default"].get("PROJECT_ID");
|
|
223
231
|
endpoint = _CoreManager["default"].get('SERVER_URL') + '/upload';
|
|
224
232
|
form = new FormData();
|
|
@@ -8,7 +8,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
exports.updateSubscription = exports.deleteSubscription = exports.createSubscription = void 0;
|
|
11
|
+
exports.updateSubscription = exports.deleteSubscription = exports.createSubscription = exports.getSubscriptionSchema = void 0;
|
|
12
12
|
|
|
13
13
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
14
14
|
|
|
@@ -163,6 +163,9 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
+
var getSubscriptionSchema = "\n id\n channel_id\n user_id\n language\n push\n mute\n online\n channel {\n name\n type\n image_url\n push\n disabled\n }\n mark {\n user_id\n message_id\n sort_id\n unread\n }\n uniquekey\n created_at\n updated_at\n";
|
|
167
|
+
exports.getSubscriptionSchema = getSubscriptionSchema;
|
|
168
|
+
|
|
166
169
|
var createSubscription = function createSubscription(channelId, option) {
|
|
167
170
|
if (option === void 0) {
|
|
168
171
|
option = "";
|
|
@@ -176,7 +179,7 @@ var createSubscription = function createSubscription(channelId, option) {
|
|
|
176
179
|
token = _CoreManager["default"].get("TOKEN");
|
|
177
180
|
endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
|
|
178
181
|
projectId = _CoreManager["default"].get('PROJECT_ID');
|
|
179
|
-
query = "\n mutation (\n $projectId: String!, \n $channelId: String!,\n $option: String,\n ) {\n createSubscription (\n input: {\n projectId: $projectId, \n channelId: $channelId,\n option: $option\n }\n ) {\n subscription {\n
|
|
182
|
+
query = "\n mutation (\n $projectId: String!, \n $channelId: String!,\n $option: String,\n ) {\n createSubscription (\n input: {\n projectId: $projectId, \n channelId: $channelId,\n option: $option\n }\n ) {\n subscription {\n " + getSubscriptionSchema + "\n }\n }\n }\n ";
|
|
180
183
|
return [4
|
|
181
184
|
/*yield*/
|
|
182
185
|
, fetch(endpoint, {
|
|
@@ -225,7 +228,7 @@ var deleteSubscription = function deleteSubscription(channelId) {
|
|
|
225
228
|
token = _CoreManager["default"].get("TOKEN");
|
|
226
229
|
endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
|
|
227
230
|
projectId = _CoreManager["default"].get('PROJECT_ID');
|
|
228
|
-
query = "\n mutation (\n $projectId: String!, \n $channelId: String!\n ) {\n deleteSubscription (\n input: {\n projectId: $projectId, \n channelId: $channelId\n }\n ) {\n subscription {\n
|
|
231
|
+
query = "\n mutation (\n $projectId: String!, \n $channelId: String!\n ) {\n deleteSubscription (\n input: {\n projectId: $projectId, \n channelId: $channelId\n }\n ) {\n subscription {\n " + getSubscriptionSchema + "\n }\n }\n }\n ";
|
|
229
232
|
return [4
|
|
230
233
|
/*yield*/
|
|
231
234
|
, fetch(endpoint, {
|
|
@@ -277,7 +280,7 @@ var updateSubscription = function updateSubscription(channelId, mark, option) {
|
|
|
277
280
|
token = _CoreManager["default"].get("TOKEN");
|
|
278
281
|
endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
|
|
279
282
|
projectId = _CoreManager["default"].get('PROJECT_ID');
|
|
280
|
-
query = "\n mutation ($projectId: String!, $channelId: String!, $mark: MarkInput, $option: String!) {\n updateSubscription(input: {projectId: $projectId,channelId: $channelId, mark: $mark, option: $option}) {\n subscription {\n
|
|
283
|
+
query = "\n mutation ($projectId: String!, $channelId: String!, $mark: MarkInput, $option: String!) {\n updateSubscription(input: {projectId: $projectId, channelId: $channelId, mark: $mark, option: $option}) {\n subscription {\n " + getSubscriptionSchema + "\n }\n }\n }\n ";
|
|
281
284
|
return [4
|
|
282
285
|
/*yield*/
|
|
283
286
|
, fetch(endpoint, {
|
package/lib/queries/index.js
CHANGED
|
@@ -86,4 +86,17 @@ _Object$keys(_member).forEach(function (key) {
|
|
|
86
86
|
return _member[key];
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
var _memberblocks = require("./memberblocks");
|
|
92
|
+
|
|
93
|
+
_Object$keys(_memberblocks).forEach(function (key) {
|
|
94
|
+
if (key === "default" || key === "__esModule") return;
|
|
95
|
+
|
|
96
|
+
_Object$defineProperty(exports, key, {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function get() {
|
|
99
|
+
return _memberblocks[key];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
89
102
|
});
|
|
@@ -8,7 +8,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
exports.
|
|
11
|
+
exports.getMemberBlocks = void 0;
|
|
12
12
|
|
|
13
13
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
14
14
|
|
|
@@ -163,56 +163,52 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
|
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
-
var
|
|
167
|
-
if (name === void 0) {
|
|
168
|
-
name = '';
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (profile === void 0) {
|
|
172
|
-
profile = '';
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (token === void 0) {
|
|
176
|
-
token = '';
|
|
177
|
-
}
|
|
178
|
-
|
|
166
|
+
var getMemberBlocks = function getMemberBlocks(filter, sort, option) {
|
|
179
167
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
180
|
-
var projectId, endpoint,
|
|
168
|
+
var token, projectId, endpoint, lquery;
|
|
181
169
|
return __generator(this, function (_a) {
|
|
182
170
|
switch (_a.label) {
|
|
183
171
|
case 0:
|
|
184
|
-
_CoreManager["default"].
|
|
185
|
-
|
|
186
|
-
|
|
172
|
+
token = _CoreManager["default"].get('TOKEN');
|
|
173
|
+
if (!token) return [2
|
|
174
|
+
/*return*/
|
|
175
|
+
, null];
|
|
176
|
+
projectId = _CoreManager["default"].get('PROJECT_ID');
|
|
177
|
+
if (!projectId) return [2
|
|
178
|
+
/*return*/
|
|
179
|
+
, null];
|
|
187
180
|
endpoint = _CoreManager["default"].get('SERVER_URL') + '/graphql';
|
|
188
|
-
|
|
181
|
+
lquery = "\n query memberblocks ($projectId: String!, $filter: String!, $sort: String, $option:String) {\n memberblocks(projectId: $projectId, filter:$filter, sort:$sort, option:$option) {\n totalCount\n edges {\n node {\n id\n project_id\n member_id\n type\n status\n block_type\n messageMulti {\n lang\n value\n default\n }\n started_at\n ended_at\n created_at\n updated_at\n deleted_at\n }\n }\n }\n }\n \n ";
|
|
189
182
|
return [4
|
|
190
183
|
/*yield*/
|
|
191
184
|
, fetch(endpoint, {
|
|
192
185
|
method: 'POST',
|
|
193
186
|
headers: {
|
|
194
|
-
|
|
187
|
+
Authorization: 'Bearer ' + token,
|
|
195
188
|
'X-PROJECT-ID': projectId,
|
|
196
189
|
'Content-Type': 'application/json',
|
|
197
|
-
|
|
190
|
+
Accept: 'application/json'
|
|
198
191
|
},
|
|
199
192
|
body: (0, _stringify["default"])({
|
|
200
|
-
query:
|
|
193
|
+
query: lquery,
|
|
201
194
|
variables: {
|
|
202
195
|
projectId: projectId,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
token: token
|
|
196
|
+
filter: filter,
|
|
197
|
+
sort: sort,
|
|
198
|
+
option: option
|
|
207
199
|
}
|
|
208
200
|
})
|
|
209
201
|
}).then(function (res) {
|
|
210
202
|
return res.json();
|
|
211
203
|
}).then(function (data) {
|
|
212
204
|
if (data.errors) throw data.errors[0];
|
|
213
|
-
if (data.code) throw data;
|
|
214
|
-
|
|
215
|
-
|
|
205
|
+
if (data.code) throw data;
|
|
206
|
+
|
|
207
|
+
if (data.data.memberblocks) {
|
|
208
|
+
return data.data.memberblocks.edges;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return [];
|
|
216
212
|
})];
|
|
217
213
|
|
|
218
214
|
case 1:
|
|
@@ -224,4 +220,4 @@ var login = function login(user_id, name, profile, token) {
|
|
|
224
220
|
});
|
|
225
221
|
};
|
|
226
222
|
|
|
227
|
-
exports.
|
|
223
|
+
exports.getMemberBlocks = getMemberBlocks;
|
package/package.json
CHANGED
package/esm/mutations/user.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const login: (user_id: string, name?: string, profile?: string, token?: string) => Promise<any>;
|
|
@@ -1 +0,0 @@
|
|
|
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;;;;;;oBAClG,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;oBAC1B,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;oBAC1C,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;oBACtD,QAAQ,GAAG,gOAIf,CAAC;oBACI,qBAAM,KAAK,CACd,QAAQ,EAAE;4BACV,MAAM,EAAE,MAAM;4BACd,OAAO,EAAE;gCACL,eAAe,EAAG,SAAS,GAAG,KAAK;gCACnC,cAAc,EAAG,SAAS;gCAC1B,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;4BAEN,IAAG,IAAI,CAAC,MAAM;gCAAE,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;4BACrC,IAAG,IAAI,CAAC,IAAI;gCAAE,MAAM,IAAI,CAAC;iCACpB,IAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;gCAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;6BAChC;;gCAEG,OAAO,KAAK,CAAC;wBACrB,CAAC,CAAC,EAAA;wBA9BF,sBAAO,SA8BL,EAAC;;;;CACN,CAAA"}
|