@punks/backend-entity-manager 0.0.236 → 0.0.237

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.
@@ -17,6 +17,7 @@ export interface ITraverseFilters {
17
17
  export interface ISearchOptions {
18
18
  includeFacets?: boolean;
19
19
  includeChildrenMap?: boolean;
20
+ facetsFilters?: ISearchFilters;
20
21
  }
21
22
  export interface ISearchRequestPaging<TCursor> {
22
23
  cursor?: TCursor;
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Log, csvParse, excelParse, excelBuild, csvBuild, isNullOrUndefined, addTime, newUuid as newUuid$1, buildObject, sort, byField, toDict, ensureTailingSlash, ensureStartSlash, removeUndefinedProps } from '@punks/backend-core';
2
- import { MoreThanOrEqual, In, Equal, Not, IsNull, And, MoreThan, LessThanOrEqual, LessThan, ILike, Like } from 'typeorm';
2
+ import { MoreThanOrEqual, In, Equal, Not, IsNull, And, MoreThan, LessThanOrEqual, LessThan, ILike } from 'typeorm';
3
3
  import { applyDecorators, Injectable, SetMetadata, createParamDecorator, Global, Module, Scope, Logger, StreamableFile, HttpException, HttpStatus } from '@nestjs/common';
4
4
  import { Reflector } from '@nestjs/core';
5
5
  import { AsyncLocalStorage } from 'async_hooks';
@@ -2918,7 +2918,7 @@ class QueryClauseBuilder {
2918
2918
  clauses.push(ILike(filter.eq));
2919
2919
  }
2920
2920
  if (!isNullOrUndefined(filter?.like)) {
2921
- clauses.push(Like(filter.like.replaceAll("*", "%")));
2921
+ clauses.push(ILike(filter.like.replaceAll("*", "%")));
2922
2922
  }
2923
2923
  if (!isNullOrUndefined(filter?.ne)) {
2924
2924
  clauses.push(Not(Equal(filter.ne)));
@@ -2930,7 +2930,7 @@ class QueryClauseBuilder {
2930
2930
  clauses.push(Not(In(filter.notIn)));
2931
2931
  }
2932
2932
  if (!isNullOrUndefined(filter?.notLike)) {
2933
- clauses.push(Not(Like(filter.notLike.replaceAll("*", "%"))));
2933
+ clauses.push(Not(ILike(filter.notLike.replaceAll("*", "%"))));
2934
2934
  }
2935
2935
  if (filter?.isNull === true) {
2936
2936
  clauses.push(IsNull());
@@ -2954,6 +2954,12 @@ class QueryClauseBuilder {
2954
2954
  if (!isNullOrUndefined(filter?.lt)) {
2955
2955
  clauses.push(LessThan(filter.lt));
2956
2956
  }
2957
+ if (!isNullOrUndefined(filter?.in)) {
2958
+ clauses.push(In(filter.in ?? []));
2959
+ }
2960
+ if (!isNullOrUndefined(filter?.eq)) {
2961
+ clauses.push(Equal(filter.eq));
2962
+ }
2957
2963
  if (filter?.isNull === true) {
2958
2964
  clauses.push(IsNull());
2959
2965
  }
@@ -3083,7 +3089,11 @@ class TypeOrmQueryBuilder extends QueryBuilderBase {
3083
3089
  const queryResults = await this.countQueryResults(request, context);
3084
3090
  const results = await this.findPagedQueryResults(request, context);
3085
3091
  const facets = request.options?.includeFacets
3086
- ? await this.calculateFacets(request, context)
3092
+ ? // todo: refactor avoiding to manipulate the request object
3093
+ await this.calculateFacets({
3094
+ ...request,
3095
+ filters: request.options.facetsFilters,
3096
+ }, context)
3087
3097
  : undefined;
3088
3098
  const childrenMap = request.options?.includeChildrenMap
3089
3099
  ? await this.calculateChildrenMap(results)