@lafken/dynamo 0.12.15 → 0.12.16
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.
|
@@ -82,10 +82,14 @@ class QueryBuilderBase {
|
|
|
82
82
|
for (const condition of orFilter.OR) {
|
|
83
83
|
const expression = this.getFilterExpression(condition, names, 'and', counter);
|
|
84
84
|
counter += 1;
|
|
85
|
-
|
|
85
|
+
if (expression) {
|
|
86
|
+
orExpressions.push(expression);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (orExpressions.length > 0) {
|
|
90
|
+
const joined = orExpressions.join(' or ');
|
|
91
|
+
filterExpression.push(orExpressions.length > 1 ? `(${joined})` : joined);
|
|
86
92
|
}
|
|
87
|
-
const joined = orExpressions.join(' or ');
|
|
88
|
-
filterExpression.push(orExpressions.length > 1 ? `(${joined})` : joined);
|
|
89
93
|
break;
|
|
90
94
|
}
|
|
91
95
|
case 'AND': {
|
|
@@ -94,9 +98,13 @@ class QueryBuilderBase {
|
|
|
94
98
|
for (const condition of andFilter.AND) {
|
|
95
99
|
const expression = this.getFilterExpression(condition, names, 'and', counter);
|
|
96
100
|
counter += 1;
|
|
97
|
-
|
|
101
|
+
if (expression) {
|
|
102
|
+
andExpressions.push(expression);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (andExpressions.length > 0) {
|
|
106
|
+
filterExpression.push(andExpressions.join(' and '));
|
|
98
107
|
}
|
|
99
|
-
filterExpression.push(andExpressions.join(' and '));
|
|
100
108
|
break;
|
|
101
109
|
}
|
|
102
110
|
default: {
|
|
@@ -111,19 +119,26 @@ class QueryBuilderBase {
|
|
|
111
119
|
const keys = Object.keys(keyFilter || {});
|
|
112
120
|
const filterResolver = keys.find((key) => base_utils_1.filterKeys.has(key));
|
|
113
121
|
if (filterResolver) {
|
|
122
|
+
const filterValue = keyFilter[filterResolver];
|
|
123
|
+
if (filterValue === undefined &&
|
|
124
|
+
!base_utils_1.notValueKeys.has(filterResolver)) {
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
114
127
|
const expression = this.resolveFilter({
|
|
115
128
|
expressionName: keyName,
|
|
116
129
|
keyName: key,
|
|
117
130
|
filterExpressionKey: filterResolver,
|
|
118
131
|
expressionValue: keyValue,
|
|
119
|
-
value:
|
|
132
|
+
value: filterValue,
|
|
120
133
|
});
|
|
121
134
|
filterExpression.push(expression);
|
|
122
135
|
break;
|
|
123
136
|
}
|
|
124
|
-
this.attributeNames[`#${key}`] = key;
|
|
125
137
|
const expression = this.getFilterExpression(keyFilter, currentKeyNames, union);
|
|
126
|
-
|
|
138
|
+
if (expression) {
|
|
139
|
+
this.attributeNames[`#${key}`] = key;
|
|
140
|
+
filterExpression.push(expression);
|
|
141
|
+
}
|
|
127
142
|
break;
|
|
128
143
|
}
|
|
129
144
|
const expression = this.resolveFilter({
|
|
@@ -22,7 +22,7 @@ class FindBuilder extends base_1.QueryBuilderBase {
|
|
|
22
22
|
let filterExpression;
|
|
23
23
|
if (filter) {
|
|
24
24
|
const expression = this.getFilterExpression(filter || {});
|
|
25
|
-
filterExpression = expression;
|
|
25
|
+
filterExpression = expression || undefined;
|
|
26
26
|
}
|
|
27
27
|
this.command = {
|
|
28
28
|
TableName: this.queryOptions.modelProps.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lafken/dynamo",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Define DynamoDB tables using TypeScript decorators - type-safe, declarative infrastructure with Lafken",
|
|
6
6
|
"keywords": [
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@aws-sdk/client-dynamodb": "^3.1062.0",
|
|
60
60
|
"@aws-sdk/util-dynamodb": "^3.996.2",
|
|
61
61
|
"reflect-metadata": "^0.2.2",
|
|
62
|
-
"@lafken/resolver": "0.12.
|
|
62
|
+
"@lafken/resolver": "0.12.16"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@cdktn/provider-aws": "^24.4.0",
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
"typescript": "6.0.3",
|
|
74
74
|
"unplugin-swc": "^1.5.9",
|
|
75
75
|
"vitest": "^4.1.8",
|
|
76
|
-
"@lafken/common": "0.12.
|
|
76
|
+
"@lafken/common": "0.12.16"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"@cdktn/provider-aws": ">=23.0.0",
|
|
80
80
|
"cdktn": ">=0.22.0",
|
|
81
81
|
"constructs": "^10.4.5",
|
|
82
|
-
"@lafken/common": "0.12.
|
|
82
|
+
"@lafken/common": "0.12.16"
|
|
83
83
|
},
|
|
84
84
|
"engines": {
|
|
85
85
|
"node": ">=20.19"
|