@cheetah.js/orm 0.1.149 → 0.1.151
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/entry.js
CHANGED
|
@@ -7,7 +7,7 @@ const orm_service_1 = require("./orm.service");
|
|
|
7
7
|
const entities_1 = require("./domain/entities");
|
|
8
8
|
const identity_map_middleware_1 = require("./middleware/identity-map.middleware");
|
|
9
9
|
exports.CheetahOrm = new core_1.Cheetah({
|
|
10
|
-
exports: [orm_1.Orm, orm_service_1.OrmService, entities_1.EntityStorage],
|
|
10
|
+
exports: [orm_1.Orm, orm_service_1.OrmService, entities_1.EntityStorage, identity_map_middleware_1.IdentityMapMiddleware],
|
|
11
11
|
providers: [identity_map_middleware_1.IdentityMapMiddleware],
|
|
12
12
|
globalMiddlewares: [identity_map_middleware_1.IdentityMapMiddleware],
|
|
13
13
|
});
|
|
@@ -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.151",
|
|
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": "a31bb6c87c61938c635391d9c2b705f15f2eb8cf"
|
|
59
59
|
}
|