@punks/backend-entity-manager 0.0.320 → 0.0.321
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/cjs/index.js +17 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/integrations/repository/typeorm/queryClauseBuilder.d.ts +1 -0
- package/dist/esm/index.js +18 -11
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/integrations/repository/typeorm/queryClauseBuilder.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -2969,7 +2969,7 @@ class QueryClauseBuilder {
|
|
|
2969
2969
|
enumFilter(filter) {
|
|
2970
2970
|
const clauses = [];
|
|
2971
2971
|
if (!backendCore.isNullOrUndefined(filter?.in)) {
|
|
2972
|
-
clauses.push(
|
|
2972
|
+
clauses.push(this.buildInClause(filter.in));
|
|
2973
2973
|
}
|
|
2974
2974
|
if (!backendCore.isNullOrUndefined(filter?.eq)) {
|
|
2975
2975
|
clauses.push(typeorm.Equal(filter.eq));
|
|
@@ -2978,7 +2978,7 @@ class QueryClauseBuilder {
|
|
|
2978
2978
|
clauses.push(typeorm.Not(typeorm.Equal(filter.ne)));
|
|
2979
2979
|
}
|
|
2980
2980
|
if (!backendCore.isNullOrUndefined(filter?.notIn)) {
|
|
2981
|
-
clauses.push(typeorm.Not(
|
|
2981
|
+
clauses.push(typeorm.Not(this.buildInClause(filter.notIn)));
|
|
2982
2982
|
}
|
|
2983
2983
|
if (filter?.isNull === true) {
|
|
2984
2984
|
clauses.push(typeorm.IsNull());
|
|
@@ -2991,7 +2991,7 @@ class QueryClauseBuilder {
|
|
|
2991
2991
|
idFilter(filter) {
|
|
2992
2992
|
const clauses = [];
|
|
2993
2993
|
if (!backendCore.isNullOrUndefined(filter?.in)) {
|
|
2994
|
-
clauses.push(
|
|
2994
|
+
clauses.push(this.buildInClause(filter.in));
|
|
2995
2995
|
}
|
|
2996
2996
|
if (!backendCore.isNullOrUndefined(filter?.eq)) {
|
|
2997
2997
|
clauses.push(typeorm.Equal(filter.eq));
|
|
@@ -3000,7 +3000,7 @@ class QueryClauseBuilder {
|
|
|
3000
3000
|
clauses.push(typeorm.Not(typeorm.Equal(filter.ne)));
|
|
3001
3001
|
}
|
|
3002
3002
|
if (!backendCore.isNullOrUndefined(filter?.notIn)) {
|
|
3003
|
-
clauses.push(typeorm.Not(
|
|
3003
|
+
clauses.push(typeorm.Not(this.buildInClause(filter.notIn)));
|
|
3004
3004
|
}
|
|
3005
3005
|
if (filter?.isNull === true) {
|
|
3006
3006
|
clauses.push(typeorm.IsNull());
|
|
@@ -3025,7 +3025,7 @@ class QueryClauseBuilder {
|
|
|
3025
3025
|
clauses.push(typeorm.LessThan(filter.lt));
|
|
3026
3026
|
}
|
|
3027
3027
|
if (!backendCore.isNullOrUndefined(filter?.in)) {
|
|
3028
|
-
clauses.push(
|
|
3028
|
+
clauses.push(this.buildInClause(filter.in));
|
|
3029
3029
|
}
|
|
3030
3030
|
if (!backendCore.isNullOrUndefined(filter?.eq)) {
|
|
3031
3031
|
clauses.push(typeorm.Equal(filter.eq));
|
|
@@ -3043,7 +3043,7 @@ class QueryClauseBuilder {
|
|
|
3043
3043
|
clauses.push(typeorm.Not(typeorm.ILike(filter.ine)));
|
|
3044
3044
|
}
|
|
3045
3045
|
if (!backendCore.isNullOrUndefined(filter?.notIn)) {
|
|
3046
|
-
clauses.push(typeorm.Not(
|
|
3046
|
+
clauses.push(typeorm.Not(this.buildInClause(filter.notIn)));
|
|
3047
3047
|
}
|
|
3048
3048
|
if (!backendCore.isNullOrUndefined(filter?.notLike)) {
|
|
3049
3049
|
clauses.push(typeorm.Not(typeorm.ILike(filter.notLike.replaceAll("*", "%"))));
|
|
@@ -3071,10 +3071,10 @@ class QueryClauseBuilder {
|
|
|
3071
3071
|
clauses.push(typeorm.LessThan(filter.lt));
|
|
3072
3072
|
}
|
|
3073
3073
|
if (!backendCore.isNullOrUndefined(filter?.in)) {
|
|
3074
|
-
clauses.push(
|
|
3074
|
+
clauses.push(this.buildInClause(filter.in ?? []));
|
|
3075
3075
|
}
|
|
3076
3076
|
if (!backendCore.isNullOrUndefined(filter?.notIn)) {
|
|
3077
|
-
clauses.push(typeorm.Not(
|
|
3077
|
+
clauses.push(typeorm.Not(this.buildInClause(filter.notIn)));
|
|
3078
3078
|
}
|
|
3079
3079
|
if (!backendCore.isNullOrUndefined(filter?.eq)) {
|
|
3080
3080
|
clauses.push(typeorm.Equal(filter.eq));
|
|
@@ -3124,13 +3124,20 @@ class QueryClauseBuilder {
|
|
|
3124
3124
|
clauses.push(typeorm.Not(typeorm.IsNull()));
|
|
3125
3125
|
}
|
|
3126
3126
|
if (!backendCore.isNullOrUndefined(filter?.in)) {
|
|
3127
|
-
clauses.push(
|
|
3127
|
+
clauses.push(this.buildInClause(filter.in ?? []));
|
|
3128
3128
|
}
|
|
3129
3129
|
if (!backendCore.isNullOrUndefined(filter?.notIn)) {
|
|
3130
|
-
clauses.push(typeorm.Not(
|
|
3130
|
+
clauses.push(typeorm.Not(this.buildInClause(filter.notIn)));
|
|
3131
3131
|
}
|
|
3132
3132
|
return typeorm.And(...clauses);
|
|
3133
3133
|
}
|
|
3134
|
+
buildInClause(values) {
|
|
3135
|
+
const containsNulls = values.some((v) => backendCore.isNullOrUndefined(v));
|
|
3136
|
+
if (!containsNulls) {
|
|
3137
|
+
return typeorm.In(values);
|
|
3138
|
+
}
|
|
3139
|
+
return typeorm.Or(typeorm.In(values.filter((v) => !backendCore.isNullOrUndefined(v))), typeorm.IsNull());
|
|
3140
|
+
}
|
|
3134
3141
|
}
|
|
3135
3142
|
|
|
3136
3143
|
class PermissionsChecker {
|