@punks/backend-entity-manager 0.0.228 → 0.0.229

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.
@@ -5,6 +5,7 @@ export type NumericFilter = {
5
5
  gte?: number;
6
6
  lt?: number;
7
7
  lte?: number;
8
+ isNull?: boolean;
8
9
  };
9
10
  export type StringFilter = {
10
11
  gt?: string;
@@ -19,22 +20,26 @@ export type StringFilter = {
19
20
  ine?: string;
20
21
  notIn?: string[];
21
22
  notLike?: string;
23
+ isNull?: boolean;
22
24
  };
23
25
  export type IdFilter = {
24
26
  in?: string[];
25
27
  eq?: string;
26
28
  ne?: string;
27
29
  notIn?: string[];
30
+ isNull?: boolean;
28
31
  };
29
32
  export type EnumFilter<T> = {
30
33
  in?: T[];
31
34
  eq?: T;
32
35
  ne?: T;
33
36
  notIn?: T[];
37
+ isNull?: boolean;
34
38
  };
35
39
  export type BooleanFilter = {
36
40
  eq?: boolean;
37
41
  ne?: boolean;
42
+ isNull?: boolean;
38
43
  };
39
44
  export type DateFilter = {
40
45
  in?: Date[];
@@ -43,4 +48,5 @@ export type DateFilter = {
43
48
  gte?: Date;
44
49
  lt?: Date;
45
50
  lte?: Date;
51
+ isNull?: boolean;
46
52
  };
@@ -5,6 +5,7 @@ export declare class NumericFilter {
5
5
  gte?: number;
6
6
  lt?: number;
7
7
  lte?: number;
8
+ isNull?: boolean;
8
9
  }
9
10
  export declare class StringFilter {
10
11
  gt?: string;
@@ -19,10 +20,25 @@ export declare class StringFilter {
19
20
  ine?: string;
20
21
  notIn?: string[];
21
22
  notLike?: string;
23
+ isNull?: boolean;
24
+ }
25
+ export declare class IdFilter {
26
+ in?: string[];
27
+ eq?: string;
28
+ ne?: string;
29
+ notIn?: string[];
30
+ isNull?: boolean;
31
+ }
32
+ export declare class EnumFilter<T> {
33
+ in?: T[];
34
+ eq?: T;
35
+ ne?: T;
36
+ notIn?: T[];
22
37
  }
23
38
  export declare class BooleanFilter {
24
39
  eq?: boolean;
25
40
  ne?: boolean;
41
+ isNull?: boolean;
26
42
  }
27
43
  export declare class DateFilter {
28
44
  in?: Date[];
@@ -31,4 +47,5 @@ export declare class DateFilter {
31
47
  gte?: Date;
32
48
  lt?: Date;
33
49
  lte?: Date;
50
+ isNull?: boolean;
34
51
  }
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, And, MoreThan, LessThanOrEqual, LessThan, ILike, Like } from 'typeorm';
2
+ import { MoreThanOrEqual, In, Equal, Not, IsNull, And, MoreThan, LessThanOrEqual, LessThan, ILike, Like } 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';
@@ -2864,6 +2864,12 @@ class QueryClauseBuilder {
2864
2864
  if (!!filter?.notIn) {
2865
2865
  clauses.push(Not(In(filter.notIn)));
2866
2866
  }
2867
+ if (filter?.isNull === true) {
2868
+ clauses.push(IsNull());
2869
+ }
2870
+ if (filter?.isNull === false) {
2871
+ clauses.push(Not(IsNull()));
2872
+ }
2867
2873
  return And(...clauses);
2868
2874
  }
2869
2875
  idFilter(filter) {
@@ -2880,6 +2886,12 @@ class QueryClauseBuilder {
2880
2886
  if (!!filter?.notIn) {
2881
2887
  clauses.push(Not(In(filter.notIn)));
2882
2888
  }
2889
+ if (filter?.isNull === true) {
2890
+ clauses.push(IsNull());
2891
+ }
2892
+ if (filter?.isNull === false) {
2893
+ clauses.push(Not(IsNull()));
2894
+ }
2883
2895
  return And(...clauses);
2884
2896
  }
2885
2897
  stringFilter(filter) {
@@ -2920,6 +2932,12 @@ class QueryClauseBuilder {
2920
2932
  if (!!filter?.notLike) {
2921
2933
  clauses.push(Not(Like(filter.notLike.replaceAll("*", "%"))));
2922
2934
  }
2935
+ if (filter?.isNull === true) {
2936
+ clauses.push(IsNull());
2937
+ }
2938
+ if (filter?.isNull === false) {
2939
+ clauses.push(Not(IsNull()));
2940
+ }
2923
2941
  return And(...clauses);
2924
2942
  }
2925
2943
  numericFilter(filter) {
@@ -2936,6 +2954,12 @@ class QueryClauseBuilder {
2936
2954
  if (!!filter?.lt) {
2937
2955
  clauses.push(LessThan(filter.lt));
2938
2956
  }
2957
+ if (filter?.isNull === true) {
2958
+ clauses.push(IsNull());
2959
+ }
2960
+ if (filter?.isNull === false) {
2961
+ clauses.push(Not(IsNull()));
2962
+ }
2939
2963
  return And(...clauses);
2940
2964
  }
2941
2965
  dateFilter(filter) {
@@ -2952,6 +2976,12 @@ class QueryClauseBuilder {
2952
2976
  if (!!filter?.lt) {
2953
2977
  clauses.push(LessThan(filter.lt));
2954
2978
  }
2979
+ if (filter?.isNull === true) {
2980
+ clauses.push(IsNull());
2981
+ }
2982
+ if (filter?.isNull === false) {
2983
+ clauses.push(Not(IsNull()));
2984
+ }
2955
2985
  return And(...clauses);
2956
2986
  }
2957
2987
  boolFilter(filter) {
@@ -2962,6 +2992,12 @@ class QueryClauseBuilder {
2962
2992
  if (!isNullOrUndefined(filter?.ne)) {
2963
2993
  clauses.push(Not(Equal(filter.ne)));
2964
2994
  }
2995
+ if (filter?.isNull === true) {
2996
+ clauses.push(IsNull());
2997
+ }
2998
+ if (filter?.isNull === false) {
2999
+ clauses.push(Not(IsNull()));
3000
+ }
2965
3001
  return And(...clauses);
2966
3002
  }
2967
3003
  }