remult 0.22.7-exp.1 → 0.22.7
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/src/data-api.js
CHANGED
|
@@ -23,7 +23,7 @@ export class DataApi {
|
|
|
23
23
|
async httpPost(res, req, body, serializeContext) {
|
|
24
24
|
const action = req?.get('__action');
|
|
25
25
|
if (action?.startsWith(liveQueryAction))
|
|
26
|
-
return this.liveQuery(res, req,
|
|
26
|
+
return this.liveQuery(res, req, body, serializeContext, action.substring(liveQueryAction.length));
|
|
27
27
|
switch (action) {
|
|
28
28
|
case 'get':
|
|
29
29
|
return this.getArray(res, req, body);
|
|
@@ -377,12 +377,15 @@ export function buildFilterFromRequestParameters(entity, filterInfo) {
|
|
|
377
377
|
let val = filterInfo.get('OR');
|
|
378
378
|
if (val) {
|
|
379
379
|
const array = separateArrayFromInnerArray(val);
|
|
380
|
-
|
|
381
|
-
$
|
|
382
|
-
|
|
383
|
-
get: (key) => x[key],
|
|
384
|
-
})),
|
|
380
|
+
const or = array.map((v) => ({
|
|
381
|
+
$or: v.map((x) => buildFilterFromRequestParameters(entity, {
|
|
382
|
+
get: (key) => x[key],
|
|
385
383
|
})),
|
|
384
|
+
}));
|
|
385
|
+
if (or.length == 1)
|
|
386
|
+
return or[0];
|
|
387
|
+
where.push({
|
|
388
|
+
$and: or,
|
|
386
389
|
});
|
|
387
390
|
}
|
|
388
391
|
for (const key in entity.entityType) {
|
|
@@ -405,6 +408,8 @@ export function buildFilterFromRequestParameters(entity, filterInfo) {
|
|
|
405
408
|
}
|
|
406
409
|
}
|
|
407
410
|
}
|
|
411
|
+
if (where.length == 1)
|
|
412
|
+
return where[0];
|
|
408
413
|
return { $and: where };
|
|
409
414
|
function separateArrayFromInnerArray(val) {
|
|
410
415
|
if (!Array.isArray(val))
|
package/package.json
CHANGED
package/src/data-api.js
CHANGED
|
@@ -30,7 +30,7 @@ var DataApi = /** @class */ (function () {
|
|
|
30
30
|
case 0:
|
|
31
31
|
action = req === null || req === void 0 ? void 0 : req.get('__action');
|
|
32
32
|
if (action === null || action === void 0 ? void 0 : action.startsWith(rest_data_provider_1.liveQueryAction))
|
|
33
|
-
return [2 /*return*/, this.liveQuery(res, req,
|
|
33
|
+
return [2 /*return*/, this.liveQuery(res, req, body, serializeContext, action.substring(rest_data_provider_1.liveQueryAction.length))];
|
|
34
34
|
_a = action;
|
|
35
35
|
switch (_a) {
|
|
36
36
|
case 'get': return [3 /*break*/, 1];
|
|
@@ -497,14 +497,17 @@ function buildFilterFromRequestParameters(entity, filterInfo) {
|
|
|
497
497
|
var val = filterInfo.get('OR');
|
|
498
498
|
if (val) {
|
|
499
499
|
var array = separateArrayFromInnerArray(val);
|
|
500
|
+
var or = array.map(function (v) { return ({
|
|
501
|
+
$or: v.map(function (x) {
|
|
502
|
+
return buildFilterFromRequestParameters(entity, {
|
|
503
|
+
get: function (key) { return x[key]; },
|
|
504
|
+
});
|
|
505
|
+
}),
|
|
506
|
+
}); });
|
|
507
|
+
if (or.length == 1)
|
|
508
|
+
return or[0];
|
|
500
509
|
where.push({
|
|
501
|
-
$and:
|
|
502
|
-
$or: v.map(function (x) {
|
|
503
|
-
return buildFilterFromRequestParameters(entity, {
|
|
504
|
-
get: function (key) { return x[key]; },
|
|
505
|
-
});
|
|
506
|
-
}),
|
|
507
|
-
}); }),
|
|
510
|
+
$and: or,
|
|
508
511
|
});
|
|
509
512
|
}
|
|
510
513
|
var _loop_2 = function (key) {
|
|
@@ -531,6 +534,8 @@ function buildFilterFromRequestParameters(entity, filterInfo) {
|
|
|
531
534
|
for (var key in entity.entityType) {
|
|
532
535
|
_loop_2(key);
|
|
533
536
|
}
|
|
537
|
+
if (where.length == 1)
|
|
538
|
+
return where[0];
|
|
534
539
|
return { $and: where };
|
|
535
540
|
function separateArrayFromInnerArray(val) {
|
|
536
541
|
var e_4, _a;
|