@cap-js/db-service 2.1.2 → 2.2.0

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 CHANGED
@@ -4,6 +4,13 @@
4
4
  - The format is based on [Keep a Changelog](http://keepachangelog.com/).
5
5
  - This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [2.2.0](https://github.com/cap-js/cds-dbs/compare/db-service-v2.1.2...db-service-v2.2.0) (2025-06-30)
8
+
9
+
10
+ ### Added
11
+
12
+ * **recurse:** object-page hierarchies ([#1247](https://github.com/cap-js/cds-dbs/issues/1247)) ([6fe81f2](https://github.com/cap-js/cds-dbs/commit/6fe81f27bc1aee0b8edebe3d9251928ebea8474a))
13
+
7
14
  ## [2.1.2](https://github.com/cap-js/cds-dbs/compare/db-service-v2.1.1...db-service-v2.1.2) (2025-06-12)
8
15
 
9
16
 
package/lib/cqn2sql.js CHANGED
@@ -282,6 +282,25 @@ class CQN2SQLRenderer {
282
282
  SELECT_recurse(q) {
283
283
  let { from, columns, where, orderBy, recurse, _internal } = q.SELECT
284
284
 
285
+ const keys = []
286
+ const _target = q._target
287
+
288
+ if (_target) {
289
+ for (const _key in _target.keys) {
290
+ const k = _target.keys[_key]
291
+ if (!k.virtual && !k.isAssociation && !k.value) {
292
+ keys.push({ ref: [_key] })
293
+ }
294
+ }
295
+
296
+ // `where` needs to be wrapped to also support `where == ['exists', { SELECT }]` which is not allowed in `START WHERE`
297
+ const clone = q.clone()
298
+ clone.columns(keys)
299
+ clone.SELECT.recurse = undefined
300
+ clone.SELECT.expand = undefined // omits JSON
301
+ where = [{ list: keys }, 'in', clone]
302
+ }
303
+
285
304
  const requiredComputedColumns = { PARENT_ID: true, NODE_ID: true }
286
305
  if (!_internal) requiredComputedColumns.RANK = true
287
306
  const addComputedColumn = (name) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/db-service",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "CDS base database service",
5
5
  "homepage": "https://github.com/cap-js/cds-dbs/tree/main/db-service#cds-base-database-service",
6
6
  "repository": {