blixify-server 0.1.81 → 0.1.82
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;;;mBAuMlC;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,109 @@ class MondayWrapper {
|
|
|
205
212
|
}`;
|
|
206
213
|
}
|
|
207
214
|
else {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
215
|
+
const orQueries = [];
|
|
216
|
+
const andQueries = [];
|
|
217
|
+
// INFO - Monday Not Support ><
|
|
218
|
+
reqQuery.map((eachQuery) => {
|
|
219
|
+
var _a;
|
|
220
|
+
const queryId = (_a = eachQuery.queryId) !== null && _a !== void 0 ? _a : "";
|
|
221
|
+
const value = eachQuery.value;
|
|
222
|
+
const isOr = eachQuery.orQuery;
|
|
223
|
+
switch (eachQuery.type) {
|
|
224
|
+
case "search":
|
|
225
|
+
if (eachQuery.searchIds && eachQuery.searchIds.length > 0) {
|
|
226
|
+
eachQuery.searchIds.map((eachSearchIds) => {
|
|
227
|
+
orQueries.push({
|
|
228
|
+
column_id: eachSearchIds,
|
|
229
|
+
compare_value: value,
|
|
230
|
+
operator: "contains_text",
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
break;
|
|
235
|
+
case "=":
|
|
236
|
+
isOr
|
|
237
|
+
? orQueries.push({
|
|
238
|
+
column_id: queryId,
|
|
239
|
+
compare_value: value,
|
|
240
|
+
operator: "contains_terms",
|
|
241
|
+
})
|
|
242
|
+
: andQueries.push({
|
|
243
|
+
column_id: queryId,
|
|
244
|
+
compare_value: value,
|
|
245
|
+
operator: "contains_terms",
|
|
246
|
+
});
|
|
247
|
+
break;
|
|
248
|
+
case "in":
|
|
249
|
+
isOr
|
|
250
|
+
? orQueries.push({
|
|
251
|
+
column_id: queryId,
|
|
252
|
+
compare_value: value,
|
|
253
|
+
operator: "contains_text",
|
|
254
|
+
})
|
|
255
|
+
: andQueries.push({
|
|
256
|
+
column_id: queryId,
|
|
257
|
+
compare_value: value,
|
|
258
|
+
operator: "contains_text",
|
|
259
|
+
});
|
|
260
|
+
break;
|
|
261
|
+
case "!=":
|
|
262
|
+
isOr
|
|
263
|
+
? orQueries.push({
|
|
264
|
+
column_id: queryId,
|
|
265
|
+
compare_value: value,
|
|
266
|
+
operator: "not_any_of",
|
|
267
|
+
})
|
|
268
|
+
: andQueries.push({
|
|
269
|
+
column_id: queryId,
|
|
270
|
+
compare_value: value,
|
|
271
|
+
operator: "not_any_of",
|
|
272
|
+
});
|
|
273
|
+
break;
|
|
274
|
+
case ">":
|
|
275
|
+
isOr
|
|
276
|
+
? orQueries.push({
|
|
277
|
+
column_id: queryId,
|
|
278
|
+
compare_value: value,
|
|
279
|
+
operator: "greater_than",
|
|
280
|
+
})
|
|
281
|
+
: andQueries.push({
|
|
282
|
+
column_id: queryId,
|
|
283
|
+
compare_value: value,
|
|
284
|
+
operator: "greater_than",
|
|
285
|
+
});
|
|
286
|
+
break;
|
|
287
|
+
case "<":
|
|
288
|
+
isOr
|
|
289
|
+
? orQueries.push({
|
|
290
|
+
column_id: queryId,
|
|
291
|
+
compare_value: value,
|
|
292
|
+
operator: "lower_than",
|
|
293
|
+
})
|
|
294
|
+
: andQueries.push({
|
|
295
|
+
column_id: queryId,
|
|
296
|
+
compare_value: value,
|
|
297
|
+
operator: "lower_than",
|
|
298
|
+
});
|
|
299
|
+
break;
|
|
300
|
+
default:
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
query = `query {
|
|
214
305
|
boards(ids:${this.boardId}){
|
|
215
|
-
items_page(
|
|
306
|
+
items_page(
|
|
307
|
+
${limitQuery}
|
|
308
|
+
query_params: {
|
|
309
|
+
groups: {
|
|
310
|
+
rules: [\n${handleFormatRules(andQueries)}\n],
|
|
311
|
+
operator: and,
|
|
312
|
+
groups: {
|
|
313
|
+
rules: [\n${handleFormatRules(orQueries)}\n],
|
|
314
|
+
operator: or
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}) {
|
|
216
318
|
cursor
|
|
217
319
|
items {
|
|
218
320
|
id
|
|
@@ -226,20 +328,13 @@ class MondayWrapper {
|
|
|
226
328
|
}
|
|
227
329
|
}
|
|
228
330
|
}`;
|
|
229
|
-
}
|
|
230
331
|
}
|
|
231
332
|
mondayResponse = yield (0, exports.queryMondayApi)(this.mondayToken, query);
|
|
232
333
|
if (cursorQuery) {
|
|
233
334
|
mondayDataList = mondayResponse.data.data.next_items_page.items;
|
|
234
335
|
}
|
|
235
336
|
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;
|
|
337
|
+
mondayDataList = mondayResponse.data.data.boards[0].items_page.items;
|
|
243
338
|
}
|
|
244
339
|
let validOpsConfig = true;
|
|
245
340
|
const dataList = [];
|
|
@@ -260,12 +355,7 @@ class MondayWrapper {
|
|
|
260
355
|
cursor = mondayResponse.data.data.next_items_page.cursor;
|
|
261
356
|
}
|
|
262
357
|
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;
|
|
358
|
+
cursor = mondayResponse.data.data.boards[0].items_page.cursor;
|
|
269
359
|
}
|
|
270
360
|
}
|
|
271
361
|
const resBody = {
|