@cheetah.js/orm 0.1.149 → 0.1.150
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.
|
@@ -67,6 +67,9 @@ class SqlConditionBuilder {
|
|
|
67
67
|
if (this.isLogicalOperator(key)) {
|
|
68
68
|
return this.buildLogicalOperatorCondition(key, value, alias, model);
|
|
69
69
|
}
|
|
70
|
+
if (key === '$exists' || key === '$nexists') {
|
|
71
|
+
return this.buildTopLevelExistsCondition(key, value, alias, model);
|
|
72
|
+
}
|
|
70
73
|
return this.buildOperatorConditions(key, value, alias, model);
|
|
71
74
|
}
|
|
72
75
|
buildLogicalOperatorCondition(key, value, alias, model) {
|
|
@@ -228,6 +231,16 @@ class SqlConditionBuilder {
|
|
|
228
231
|
}
|
|
229
232
|
return this.subqueryBuilder.buildExistsSubquery(relationship, filters, alias, negate, model);
|
|
230
233
|
}
|
|
234
|
+
buildTopLevelExistsCondition(operator, value, alias, model) {
|
|
235
|
+
const negate = operator === '$nexists';
|
|
236
|
+
const conditions = [];
|
|
237
|
+
for (const [relationshipKey, filters] of Object.entries(value)) {
|
|
238
|
+
const condition = this.buildExistsCondition(relationshipKey, filters, alias, model, negate);
|
|
239
|
+
conditions.push(condition);
|
|
240
|
+
}
|
|
241
|
+
const result = this.wrapWithLogicalOperator(conditions, 'AND');
|
|
242
|
+
return result;
|
|
243
|
+
}
|
|
231
244
|
resolveColumnName(property, model) {
|
|
232
245
|
if (property.startsWith('$')) {
|
|
233
246
|
return property;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cheetah.js/orm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.150",
|
|
4
4
|
"description": "A simple ORM for Cheetah.js.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"bun",
|
|
56
56
|
"value-object"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "f8214d31758bc38e63d8cc2e4db4c5572db28201"
|
|
59
59
|
}
|