@ccci/micro-server 1.0.169 → 1.0.171

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.
Files changed (2) hide show
  1. package/dist/index.js +27 -2
  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("|") > -1) {
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,30 @@ function ConstructQuery(query) {
297648
297649
  }
297649
297650
  if (query.includes) {
297650
297651
  let data = query.includes.split(",");
297651
- let includes = data.filter((el) => el.indexOf(".") == -1);
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 = {};
297670
+ association.where[associationkey] = pair[1];
297671
+ Logger.info(`association.where: ${JSON.stringify(association.where)}`);
297672
+ }
297673
+ }
297674
+ includes.push(association);
297675
+ });
297652
297676
  let nested = data.filter((el) => el.indexOf(".") > -1);
297653
297677
  nested.forEach((nest) => {
297654
297678
  let keypair = nest.split(".");
@@ -297663,6 +297687,7 @@ function ConstructQuery(query) {
297663
297687
  }
297664
297688
  includes.push(temp);
297665
297689
  });
297690
+ Logger.info(`INCLUDES: ${JSON.stringify(includes)}`);
297666
297691
  options.includes = includes;
297667
297692
  }
297668
297693
  if (query.paranoid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccci/micro-server",
3
- "version": "1.0.169",
3
+ "version": "1.0.171",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",