av6-core 1.5.13 → 1.5.15

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 CHANGED
@@ -375,39 +375,6 @@ function smartAndMerge(a, b) {
375
375
  if (merged !== void 0) return merged;
376
376
  return andWrap(a, b);
377
377
  }
378
- function normalizeWhere(where) {
379
- if (Array.isArray(where)) return where.map(normalizeWhere);
380
- if (!isPlainObject(where)) return where;
381
- for (const k of Object.keys(where)) {
382
- where[k] = normalizeWhere(where[k]);
383
- }
384
- if (Array.isArray(where.OR) && where.OR.length > 0) {
385
- const orItems = where.OR;
386
- const keys = orItems.map((it) => isPlainObject(it) ? Object.keys(it) : []);
387
- const allSingleKey = keys.every((k) => k.length === 1);
388
- if (allSingleKey) {
389
- const commonKey = keys[0][0];
390
- const allSameKey = keys.every((k) => k[0] === commonKey);
391
- const isLogicalKey = commonKey === "AND" || commonKey === "OR" || commonKey === "NOT";
392
- if (allSameKey && !isLogicalKey) {
393
- const inner = orItems.map((it) => it[commonKey]).filter((v) => isPlainObject(v));
394
- const foldedRel = { OR: inner };
395
- if (isPlainObject(where[commonKey])) {
396
- where[commonKey] = { ...where[commonKey], ...foldedRel };
397
- if (Array.isArray(where[commonKey].OR) && Array.isArray(foldedRel.OR)) {
398
- }
399
- } else {
400
- where[commonKey] = foldedRel;
401
- }
402
- delete where.OR;
403
- }
404
- }
405
- }
406
- if (Array.isArray(where.AND)) {
407
- where.AND = where.AND.map(normalizeWhere);
408
- }
409
- return where;
410
- }
411
378
 
412
379
  // src/repository/common.repository.ts
413
380
  var import_util2 = require("util");
@@ -735,7 +702,6 @@ var commonRepository = (serviceDeps) => {
735
702
  if (searchOR?.length) {
736
703
  whereClause = smartAndMerge(whereClause, { OR: searchOR });
737
704
  }
738
- whereClause = normalizeWhere(whereClause);
739
705
  const orderByClause = {};
740
706
  if (sortBy && sortDir) {
741
707
  orderByClause[sortBy] = sortDir.toLowerCase();
package/dist/index.mjs CHANGED
@@ -325,39 +325,6 @@ function smartAndMerge(a, b) {
325
325
  if (merged !== void 0) return merged;
326
326
  return andWrap(a, b);
327
327
  }
328
- function normalizeWhere(where) {
329
- if (Array.isArray(where)) return where.map(normalizeWhere);
330
- if (!isPlainObject(where)) return where;
331
- for (const k of Object.keys(where)) {
332
- where[k] = normalizeWhere(where[k]);
333
- }
334
- if (Array.isArray(where.OR) && where.OR.length > 0) {
335
- const orItems = where.OR;
336
- const keys = orItems.map((it) => isPlainObject(it) ? Object.keys(it) : []);
337
- const allSingleKey = keys.every((k) => k.length === 1);
338
- if (allSingleKey) {
339
- const commonKey = keys[0][0];
340
- const allSameKey = keys.every((k) => k[0] === commonKey);
341
- const isLogicalKey = commonKey === "AND" || commonKey === "OR" || commonKey === "NOT";
342
- if (allSameKey && !isLogicalKey) {
343
- const inner = orItems.map((it) => it[commonKey]).filter((v) => isPlainObject(v));
344
- const foldedRel = { OR: inner };
345
- if (isPlainObject(where[commonKey])) {
346
- where[commonKey] = { ...where[commonKey], ...foldedRel };
347
- if (Array.isArray(where[commonKey].OR) && Array.isArray(foldedRel.OR)) {
348
- }
349
- } else {
350
- where[commonKey] = foldedRel;
351
- }
352
- delete where.OR;
353
- }
354
- }
355
- }
356
- if (Array.isArray(where.AND)) {
357
- where.AND = where.AND.map(normalizeWhere);
358
- }
359
- return where;
360
- }
361
328
 
362
329
  // src/repository/common.repository.ts
363
330
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "util";
@@ -685,7 +652,6 @@ var commonRepository = (serviceDeps) => {
685
652
  if (searchOR?.length) {
686
653
  whereClause = smartAndMerge(whereClause, { OR: searchOR });
687
654
  }
688
- whereClause = normalizeWhere(whereClause);
689
655
  const orderByClause = {};
690
656
  if (sortBy && sortDir) {
691
657
  orderByClause[sortBy] = sortDir.toLowerCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "av6-core",
3
- "version": "1.5.13",
3
+ "version": "1.5.15",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",