uql-orm 0.2.2 → 0.2.3
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/CHANGELOG.md +15 -7
- package/README.md +2 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,13 +3,9 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [0.2.
|
|
6
|
+
## [0.2.3](https://github.com/rogerpadilla/uql/compare/uql-orm@0.2.2...uql-orm@0.2.3) (2026-03-09)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
* implement aggregate query API with `$group`, `$having`, and `$distinct` support, accompanied by sorting bug fixes and extensive code refactoring. ([fa90ee9](https://github.com/rogerpadilla/uql/commit/fa90ee9313645179c4d7d1ec2e4ec291dfe7285b))
|
|
12
|
-
* Introduce aggregate query support with `GROUP BY`, `HAVING`, `$count`, `$sum`, `$avg`, `$min`, `$max`, and `DISTINCT` across all dialects. ([2ba02e9](https://github.com/rogerpadilla/uql/commit/2ba02e9070c8a457a651507cd55ee8e94e22819e))
|
|
8
|
+
**Note:** Version bump only for package uql-orm
|
|
13
9
|
|
|
14
10
|
|
|
15
11
|
|
|
@@ -21,6 +17,13 @@ All notable changes to this project will be documented in this file. Please add
|
|
|
21
17
|
|
|
22
18
|
date format is [yyyy-mm-dd]
|
|
23
19
|
|
|
20
|
+
## [0.2.3] - 2026-03-09
|
|
21
|
+
### Documentation
|
|
22
|
+
- **Aggregate Queries guide**: Added dedicated [aggregate documentation page](https://uql-orm.dev/querying/aggregate) covering `$group`, `$having`, `$where` vs `$having`, sorting/pagination, and `$distinct`.
|
|
23
|
+
- **README**: Added Aggregate Queries to features table, new §4 subsection with code examples and generated SQL, and "Learn more" link.
|
|
24
|
+
- **Querier methods table**: Added `aggregate()` to the website's querier reference.
|
|
25
|
+
- **Simplified tsconfig**: Removed `module`/`target` from recommended config — only decorator flags are UQL-specific. Added Pure ESM note.
|
|
26
|
+
|
|
24
27
|
## [0.2.2] - 2026-03-09
|
|
25
28
|
### New Features
|
|
26
29
|
- **Aggregate Query API**: Added `querier.aggregate()` with full support across all SQL dialects and MongoDB. Includes typed `QueryAggregate<E>`, `QueryGroupMap`, `QueryHavingMap`, and `QueryAggregateOp` types. Supports `$group` (with `$count`, `$sum`, `$avg`, `$min`, `$max`), `$having` (post-aggregation filtering with operator support), `$where` (pre-aggregation filtering), `$sort`, `$skip`, and `$limit`.
|
|
@@ -37,7 +40,7 @@ date format is [yyyy-mm-dd]
|
|
|
37
40
|
|
|
38
41
|
### Bug Fixes
|
|
39
42
|
- **Sort direction with numeric `-1`**: `SORT_DIRECTION_MAP` only had the string key `'-1'`, not the numeric `-1` from `QuerySortDirection`. Queries using `$sort: { field: -1 }` silently produced ascending order. Now both numeric and string forms work correctly.
|
|
40
|
-
- **MongoDB sort normalization**: `
|
|
43
|
+
- **MongoDB sort normalization**: Unified sort direction normalization into `sort()` method, ensuring all callers (find queries and aggregate pipelines) normalize string directions (`'asc'`/`'desc'`) to numeric `1`/`-1` for the MongoDB server.
|
|
41
44
|
|
|
42
45
|
### Type Safety
|
|
43
46
|
- **`QueryAggregateFn` enforces single operation**: Changed from a mapped type (which allowed invalid `{ $count: '*', $sum: 'amount' }`) to a discriminated union that enforces exactly one aggregate op per entry.
|
|
@@ -57,6 +60,11 @@ date format is [yyyy-mm-dd]
|
|
|
57
60
|
- **`insertRelations` cleanup**: Replaced `.map()` with implicit undefined return with `.filter().map()` pattern.
|
|
58
61
|
- **Dead code removal**: Removed dead `Array.isArray` branch in `fillToManyRelations` (array-based `$select` was removed in 3.14.0), dead `Promise.resolve()` in async context, unused generic type parameter.
|
|
59
62
|
- **`havingCondition` visibility**: Changed from `private` to `protected` to allow dialect subclass overrides.
|
|
63
|
+
- **`insertRelations` DRY**: Eliminated double `filterPersistableRelationKeys` call per item using a single `.reduce()` pass.
|
|
64
|
+
- **`where()` loop**: Replaced `.reduce()` accumulator in MongoDB `where()` with a cleaner `for...of` loop.
|
|
65
|
+
- **`_id` constant**: Extracted repeated `'_id'` string literal to `MongoDialect.ID_KEY` class constant.
|
|
66
|
+
- **`negateOperatorMap` static**: Promoted per-call `negateOperatorMap` allocation in `compareLogicalOperator` to `static readonly NEGATE_OP_MAP`.
|
|
67
|
+
- **`AGGREGATE_OP_MAP` class-level**: Moved module-level `MONGO_AGGREGATE_OP_MAP` to `MongoDialect.AGGREGATE_OP_MAP` static, consistent with `REGEX_OP_MAP` and `NATIVE_OPS`.
|
|
60
68
|
|
|
61
69
|
### Test Coverage
|
|
62
70
|
- Added comprehensive tests for `aggregate()` (all SQL dialects + MongoDB pipeline stages), HAVING `$in`/`$nin`/`$isNull`/`$isNotNull`, sort with numeric `-1`, mixed sort directions, MongoDB string-to-numeric sort normalization, aggregate pagination, `parseGroupMap` (edge cases), and `deleteMany` dual-API pattern. All coverage thresholds met.
|
package/README.md
CHANGED
|
@@ -66,14 +66,12 @@ Ensure your `tsconfig.json` is configured to support decorators and metadata:
|
|
|
66
66
|
{
|
|
67
67
|
"compilerOptions": {
|
|
68
68
|
"experimentalDecorators": true,
|
|
69
|
-
"emitDecoratorMetadata": true
|
|
70
|
-
"module": "NodeNext",
|
|
71
|
-
"target": "ESNext"
|
|
69
|
+
"emitDecoratorMetadata": true
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
72
|
```
|
|
75
73
|
|
|
76
|
-
**Note:**
|
|
74
|
+
**Note:** UQL is Pure ESM — ensure your project's `module` supports ESM imports (e.g., `NodeNext`, `ESNext`, `Bundler`).
|
|
77
75
|
|
|
78
76
|
## 2. Define the Entities
|
|
79
77
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"homepage": "https://uql-orm.dev",
|
|
4
4
|
"description": "One Language. Frontend to Backend.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.2.
|
|
6
|
+
"version": "0.2.3",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"main": "./dist/index.js",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"express": "^5.2.1",
|
|
106
106
|
"mariadb": "^3.5.2",
|
|
107
107
|
"mongodb": "^7.1.0",
|
|
108
|
-
"mysql2": "^3.19.
|
|
108
|
+
"mysql2": "^3.19.1",
|
|
109
109
|
"pg": "^8.20.0"
|
|
110
110
|
},
|
|
111
111
|
"author": "Roger Padilla",
|
|
@@ -142,5 +142,5 @@
|
|
|
142
142
|
"publishConfig": {
|
|
143
143
|
"access": "public"
|
|
144
144
|
},
|
|
145
|
-
"gitHead": "
|
|
145
|
+
"gitHead": "090cb43fa837e421b6bfffaba30902bb90e349c4"
|
|
146
146
|
}
|