blixify-server 0.1.81 → 0.1.83
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mondayWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/mondayWrapper.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"mondayWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/mondayWrapper.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAqB5C,eAAO,MAAM,cAAc,UAClB,MAAM,SACN,GAAG,cACE,GAAG,qDAchB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,aAAa;IACxB,WAAW,SAAM;IACjB,OAAO,SAAM;IACb,OAAO,SAAM;IACb,MAAM,EAAE,cAAc,CAQpB;IACF,GAAG,EAAE,UAAU,CAAC;IAEhB,YAAY,QAAS,GAAG,aAEtB;IACF,SAAS;cAAe,MAAM,EAAE;;;;MAK9B;gBAGA,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,EACrD,SAAS,EAAE,MAAM;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE;YAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;KAAE,EACpE,GAAG,EAAE,UAAU;IAWjB,UAAU,eAAgB;QACxB,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,MAAM,CAAC;QACb,aAAa,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC9D,SAaC;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAuDtC;IAEF,OAAO,QAAe,GAAG,OAAO,GAAG;;mBA+CjC;IAEF,QAAQ,QAAe,GAAG,OAAO,GAAG;;;mBA0NlC;IAEF,UAAU,QAAe,GAAG,OAAO,GAAG;;mBAsFpC;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBA8DtC;IAEF,IAAI,YA8CF;CACH"}
|
|
@@ -15,12 +15,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.MondayWrapper = exports.queryMondayApi = void 0;
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
|
17
17
|
const QueryModel_1 = require("../model/QueryModel");
|
|
18
|
+
const handleFormatRules = (rules) => {
|
|
19
|
+
return rules
|
|
20
|
+
.map((rule) => {
|
|
21
|
+
return `{\n column_id:"${rule.column_id}",\n compare_value:"${rule.compare_value}",\n operator:${rule.operator}\n}`;
|
|
22
|
+
})
|
|
23
|
+
.join(",\n");
|
|
24
|
+
};
|
|
18
25
|
const queryMondayApi = (token, query, variables) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
26
|
const mondayResponse = yield axios_1.default.post("https://api.monday.com/v2", { query, variables }, {
|
|
20
27
|
headers: {
|
|
21
28
|
"Content-Type": "application/json",
|
|
22
29
|
Authorization: token !== null && token !== void 0 ? token : "",
|
|
23
|
-
"API-version": "
|
|
30
|
+
"API-version": "2024-10",
|
|
24
31
|
},
|
|
25
32
|
});
|
|
26
33
|
return mondayResponse;
|
|
@@ -205,14 +212,110 @@ class MondayWrapper {
|
|
|
205
212
|
}`;
|
|
206
213
|
}
|
|
207
214
|
else {
|
|
215
|
+
const orQueries = [];
|
|
216
|
+
const andQueries = [];
|
|
217
|
+
// INFO - Monday Not Support ><
|
|
208
218
|
if (reqQuery && reqQuery.length > 0) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
219
|
+
reqQuery.map((eachQuery) => {
|
|
220
|
+
var _a;
|
|
221
|
+
const queryId = (_a = eachQuery.queryId) !== null && _a !== void 0 ? _a : "";
|
|
222
|
+
const value = eachQuery.value;
|
|
223
|
+
const isOr = eachQuery.orQuery;
|
|
224
|
+
switch (eachQuery.type) {
|
|
225
|
+
case "search":
|
|
226
|
+
if (eachQuery.searchIds && eachQuery.searchIds.length > 0) {
|
|
227
|
+
eachQuery.searchIds.map((eachSearchIds) => {
|
|
228
|
+
orQueries.push({
|
|
229
|
+
column_id: eachSearchIds,
|
|
230
|
+
compare_value: value,
|
|
231
|
+
operator: "contains_text",
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
break;
|
|
236
|
+
case "=":
|
|
237
|
+
isOr
|
|
238
|
+
? orQueries.push({
|
|
239
|
+
column_id: queryId,
|
|
240
|
+
compare_value: value,
|
|
241
|
+
operator: "contains_terms",
|
|
242
|
+
})
|
|
243
|
+
: andQueries.push({
|
|
244
|
+
column_id: queryId,
|
|
245
|
+
compare_value: value,
|
|
246
|
+
operator: "contains_terms",
|
|
247
|
+
});
|
|
248
|
+
break;
|
|
249
|
+
case "in":
|
|
250
|
+
isOr
|
|
251
|
+
? orQueries.push({
|
|
252
|
+
column_id: queryId,
|
|
253
|
+
compare_value: value,
|
|
254
|
+
operator: "contains_text",
|
|
255
|
+
})
|
|
256
|
+
: andQueries.push({
|
|
257
|
+
column_id: queryId,
|
|
258
|
+
compare_value: value,
|
|
259
|
+
operator: "contains_text",
|
|
260
|
+
});
|
|
261
|
+
break;
|
|
262
|
+
case "!=":
|
|
263
|
+
isOr
|
|
264
|
+
? orQueries.push({
|
|
265
|
+
column_id: queryId,
|
|
266
|
+
compare_value: value,
|
|
267
|
+
operator: "not_any_of",
|
|
268
|
+
})
|
|
269
|
+
: andQueries.push({
|
|
270
|
+
column_id: queryId,
|
|
271
|
+
compare_value: value,
|
|
272
|
+
operator: "not_any_of",
|
|
273
|
+
});
|
|
274
|
+
break;
|
|
275
|
+
case ">":
|
|
276
|
+
isOr
|
|
277
|
+
? orQueries.push({
|
|
278
|
+
column_id: queryId,
|
|
279
|
+
compare_value: value,
|
|
280
|
+
operator: "greater_than",
|
|
281
|
+
})
|
|
282
|
+
: andQueries.push({
|
|
283
|
+
column_id: queryId,
|
|
284
|
+
compare_value: value,
|
|
285
|
+
operator: "greater_than",
|
|
286
|
+
});
|
|
287
|
+
break;
|
|
288
|
+
case "<":
|
|
289
|
+
isOr
|
|
290
|
+
? orQueries.push({
|
|
291
|
+
column_id: queryId,
|
|
292
|
+
compare_value: value,
|
|
293
|
+
operator: "lower_than",
|
|
294
|
+
})
|
|
295
|
+
: andQueries.push({
|
|
296
|
+
column_id: queryId,
|
|
297
|
+
compare_value: value,
|
|
298
|
+
operator: "lower_than",
|
|
299
|
+
});
|
|
300
|
+
break;
|
|
301
|
+
default:
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
});
|
|
213
305
|
query = `query {
|
|
214
306
|
boards(ids:${this.boardId}){
|
|
215
|
-
items_page(
|
|
307
|
+
items_page(
|
|
308
|
+
${limitQuery}
|
|
309
|
+
query_params: {
|
|
310
|
+
groups: {
|
|
311
|
+
rules: [\n${handleFormatRules(andQueries)}\n],
|
|
312
|
+
operator: and,
|
|
313
|
+
groups: {
|
|
314
|
+
rules: [\n${handleFormatRules(orQueries)}\n],
|
|
315
|
+
operator: or
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}) {
|
|
216
319
|
cursor
|
|
217
320
|
items {
|
|
218
321
|
id
|
|
@@ -227,19 +330,31 @@ class MondayWrapper {
|
|
|
227
330
|
}
|
|
228
331
|
}`;
|
|
229
332
|
}
|
|
333
|
+
else {
|
|
334
|
+
query = `query {
|
|
335
|
+
boards(ids:${this.boardId}){
|
|
336
|
+
items_page(${limitQuery}) {
|
|
337
|
+
cursor
|
|
338
|
+
items {
|
|
339
|
+
id
|
|
340
|
+
name
|
|
341
|
+
column_values {
|
|
342
|
+
id
|
|
343
|
+
text
|
|
344
|
+
value
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}`;
|
|
350
|
+
}
|
|
230
351
|
}
|
|
231
352
|
mondayResponse = yield (0, exports.queryMondayApi)(this.mondayToken, query);
|
|
232
353
|
if (cursorQuery) {
|
|
233
354
|
mondayDataList = mondayResponse.data.data.next_items_page.items;
|
|
234
355
|
}
|
|
235
356
|
else {
|
|
236
|
-
|
|
237
|
-
mondayDataList =
|
|
238
|
-
mondayResponse.data.data.items_page_by_column_values.items;
|
|
239
|
-
}
|
|
240
|
-
else
|
|
241
|
-
mondayDataList =
|
|
242
|
-
mondayResponse.data.data.boards[0].items_page.items;
|
|
357
|
+
mondayDataList = mondayResponse.data.data.boards[0].items_page.items;
|
|
243
358
|
}
|
|
244
359
|
let validOpsConfig = true;
|
|
245
360
|
const dataList = [];
|
|
@@ -260,12 +375,7 @@ class MondayWrapper {
|
|
|
260
375
|
cursor = mondayResponse.data.data.next_items_page.cursor;
|
|
261
376
|
}
|
|
262
377
|
else {
|
|
263
|
-
|
|
264
|
-
cursor =
|
|
265
|
-
mondayResponse.data.data.items_page_by_column_values.cursor;
|
|
266
|
-
}
|
|
267
|
-
else
|
|
268
|
-
cursor = mondayResponse.data.data.boards[0].items_page.cursor;
|
|
378
|
+
cursor = mondayResponse.data.data.boards[0].items_page.cursor;
|
|
269
379
|
}
|
|
270
380
|
}
|
|
271
381
|
const resBody = {
|