@ccci/micro-server 1.0.169 → 1.0.170
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/dist/index.js +26 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -297575,7 +297575,8 @@ function ConstructQuery(query) {
|
|
|
297575
297575
|
let where2 = {};
|
|
297576
297576
|
const pairs = query.search.split(",");
|
|
297577
297577
|
pairs.forEach((field) => {
|
|
297578
|
-
if (field.indexOf("
|
|
297578
|
+
if (field.indexOf("$") > -1) {
|
|
297579
|
+
} else if (field.indexOf("|") > -1) {
|
|
297579
297580
|
if (!where2.hasOwnProperty(Op.or))
|
|
297580
297581
|
where2[Op.or] = [];
|
|
297581
297582
|
let orFields = field.split("|");
|
|
@@ -297648,7 +297649,29 @@ function ConstructQuery(query) {
|
|
|
297648
297649
|
}
|
|
297649
297650
|
if (query.includes) {
|
|
297650
297651
|
let data = query.includes.split(",");
|
|
297651
|
-
let includes =
|
|
297652
|
+
let includes = [];
|
|
297653
|
+
let toplevel = data.filter((el) => el.indexOf(".") == -1);
|
|
297654
|
+
toplevel.forEach((top) => {
|
|
297655
|
+
let association = { association: top };
|
|
297656
|
+
if (query.search) {
|
|
297657
|
+
const queries = query.search.split(",");
|
|
297658
|
+
Logger.info(`queries: ${JSON.stringify(queries)}`);
|
|
297659
|
+
let injectable = queries.find((q) => q.indexOf("$") > -1 && q.indexOf(top) > -1);
|
|
297660
|
+
Logger.info(`injectable: ${JSON.stringify(injectable)}`);
|
|
297661
|
+
if (injectable) {
|
|
297662
|
+
injectable = injectable.replaceAll("$", "");
|
|
297663
|
+
let nested2 = injectable.split(".");
|
|
297664
|
+
Logger.info(`nested: ${JSON.stringify(nested2)}`);
|
|
297665
|
+
let pair = nested2[1].split(":");
|
|
297666
|
+
Logger.info(`pair: ${JSON.stringify(pair)}`);
|
|
297667
|
+
let associationkey = pair[0];
|
|
297668
|
+
Logger.info(`associationkey: ${JSON.stringify(associationkey)}`);
|
|
297669
|
+
association.where = { associationkey: pair[1] };
|
|
297670
|
+
Logger.info(`association.where: ${JSON.stringify(association.where)}`);
|
|
297671
|
+
}
|
|
297672
|
+
}
|
|
297673
|
+
includes.push(association);
|
|
297674
|
+
});
|
|
297652
297675
|
let nested = data.filter((el) => el.indexOf(".") > -1);
|
|
297653
297676
|
nested.forEach((nest) => {
|
|
297654
297677
|
let keypair = nest.split(".");
|
|
@@ -297663,6 +297686,7 @@ function ConstructQuery(query) {
|
|
|
297663
297686
|
}
|
|
297664
297687
|
includes.push(temp);
|
|
297665
297688
|
});
|
|
297689
|
+
Logger.info(`INCLUDES: ${JSON.stringify(includes)}`);
|
|
297666
297690
|
options.includes = includes;
|
|
297667
297691
|
}
|
|
297668
297692
|
if (query.paranoid) {
|