@sap/cds-compiler 6.7.2 → 6.7.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 +6 -0
- package/lib/transform/translateAssocsToJoins.js +28 -28
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -13,6 +13,12 @@ we might not list every change in its behavior here.
|
|
|
13
13
|
Productive code should never require a `beta` flag to be set, and
|
|
14
14
|
might use a deprecated flag only for a limited period of time.
|
|
15
15
|
|
|
16
|
+
## Version 6.7.3 - 2026-02-11
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- **sql:** do not resolve path navigations to virtual elements which resulted in an internal error.
|
|
21
|
+
|
|
16
22
|
## Version 6.7.2 - 2026-02-04
|
|
17
23
|
|
|
18
24
|
### Fixed
|
|
@@ -331,10 +331,16 @@ function translateAssocsToJoins(model, inputOptions = {}) {
|
|
|
331
331
|
pos++;
|
|
332
332
|
// QA + tail is the rewritten path
|
|
333
333
|
tail = tail.slice(pos);
|
|
334
|
+
|
|
335
|
+
// leave virtual paths as is
|
|
336
|
+
if ( tail.at(-1)._artifact.virtual?.val ) {
|
|
337
|
+
replaceNodeContent(pathNode, constructPathNode([ constructTableAliasPathStep(QA), ...tail ]));
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
|
|
334
341
|
// check from left to right (longest match) if a subsequent QAT is $njr
|
|
335
342
|
// if so, substitute path with pregenerated foreign key, prepend by optional
|
|
336
343
|
// (to be flattened) prefix
|
|
337
|
-
|
|
338
344
|
for (let i = 0; i < tail.length - 1; i++) {
|
|
339
345
|
if (tail[i]._navigation) {
|
|
340
346
|
// the correct flattened foreign key must match the leaf artifact and access path prefix of this path
|
|
@@ -345,36 +351,30 @@ function translateAssocsToJoins(model, inputOptions = {}) {
|
|
|
345
351
|
throw new CompilerAssertion('Debug me: No FK found for FK rewriting');
|
|
346
352
|
}
|
|
347
353
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
newTail.push({
|
|
369
|
-
id: tail.slice(i).map(ps => ps.id).join(pathDelimiter),
|
|
370
|
-
_artifact: tail.at(-1)._artifact,
|
|
371
|
-
});
|
|
372
|
-
}
|
|
354
|
+
const newTail = [];
|
|
355
|
+
// construct the tail (segment after last join relevant navigation) and preserve association steps
|
|
356
|
+
// each association may have a structured prefix
|
|
357
|
+
// `struct.foo.bar.assoc. otherStruct.baz.otherAssoc.fk`
|
|
358
|
+
// --> `[otherStruct_baz_otherAssoc, fk]
|
|
359
|
+
for (let i = 0; i < tail.length; i++) {
|
|
360
|
+
if (tail[i]._navigation) {
|
|
361
|
+
const nextNavigation = tail.slice(i + 1).findIndex(ps => ps._navigation);
|
|
362
|
+
if (nextNavigation >= 0) {
|
|
363
|
+
newTail.push({
|
|
364
|
+
id: tail.slice(i, i + 1 + nextNavigation).map(ps => ps.id).join(pathDelimiter),
|
|
365
|
+
_artifact: tail[i + nextNavigation]._artifact,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
newTail.push({
|
|
370
|
+
id: tail.slice(i).map(ps => ps.id).join(pathDelimiter),
|
|
371
|
+
_artifact: tail.at(-1)._artifact,
|
|
372
|
+
});
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
replaceNodeContent(pathNode,
|
|
376
|
-
constructPathNode([ constructTableAliasPathStep(QA), ...newTail ]));
|
|
377
375
|
}
|
|
376
|
+
replaceNodeContent(pathNode,
|
|
377
|
+
constructPathNode([ constructTableAliasPathStep(QA), ...newTail ]));
|
|
378
378
|
}
|
|
379
379
|
|
|
380
380
|
function findForeignKey(assoc, fk) {
|