@sap/cds-compiler 6.0.12 → 6.0.14

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
@@ -8,6 +8,13 @@ Note: `beta` fixes, changes and features are usually not listed in this ChangeLo
8
8
  but in [doc/CHANGELOG_BETA.md](doc/CHANGELOG_BETA.md).
9
9
  The compiler behavior concerning `beta` features can change at any time without notice.
10
10
 
11
+ ## Version 6.0.14 - 2025-06-18
12
+
13
+ ### Fixed
14
+
15
+ - to.sql: Fix error when calculated element refers to a localized element.
16
+ - to.edm(x): Correctly handle `PropertyPath` in a collection when using expressions as annotation values
17
+
11
18
  ## Version 6.0.12 - 2025-06-06
12
19
 
13
20
  ### Changed
package/bin/cdsc.js CHANGED
@@ -299,7 +299,7 @@ function displayUsage( error, helpText, code ) {
299
299
  */
300
300
  async function createTemporaryFileFromStdin() {
301
301
  const contents = await readStream(process.stdin);
302
- const file = tmpFilePath('cds-compiler-stdin', 'cds');
302
+ const file = tmpFilePath('cds-compiler-stdin.cds');
303
303
  await fs.promises.writeFile(file, contents);
304
304
  return file;
305
305
  }
@@ -1442,6 +1442,15 @@ function csn2annotationEdm( reqDefs, reqDefsUtils, csnVocabularies, serviceName,
1442
1442
  { anno: msg.anno(), '#': 'enuminCollection' });
1443
1443
  }
1444
1444
  else if (value.$edmJson) {
1445
+ if (dTypeName === 'Edm.PropertyPath') {
1446
+ const dPropType = dTypeName.replace(/^Edm\./, '');
1447
+ if (!value.$edmJson[`$${ dPropType }`]) {
1448
+ // Needs to adapt the property type as per the dictionary, because expression refs are always
1449
+ // generated as kind $Path earlier on (edmJson::transform.ref)
1450
+ value.$edmJson[`$${ dPropType }`] = value.$edmJson.$Path;
1451
+ delete value.$edmJson.$Path;
1452
+ }
1453
+ }
1445
1454
  newCollection.append(handleEdmJson(value.$edmJson, msg));
1446
1455
  }
1447
1456
  else {
@@ -697,8 +697,10 @@ function removeDummyValueInEntity( artifact, path, options ) {
697
697
  function dummifyInEntity( artifact, path ) {
698
698
  applyTransformationsOnDictionary(artifact.elements, {
699
699
  value: (parent, _prop, value) => {
700
- if (!value.stored)
700
+ if (!value.stored) {
701
701
  parent.value = { val: 'DUMMY' };
702
+ delete parent.localized;
703
+ }
702
704
  },
703
705
  }, {}, path);
704
706
  }
package/lib/utils/file.js CHANGED
@@ -32,18 +32,14 @@ function fileExtension( filename ) {
32
32
  }
33
33
 
34
34
  /**
35
- * Create a temporary file path using the system's temporary folder and a filename
36
- * consisting of the given name/extension and a random string.
35
+ * Create a temporary file path using the system's temporary folder.
37
36
  *
38
- * @param {string} name
39
- * @param {string} extension
37
+ * @param {string} filename
40
38
  * @returns {string}
41
39
  */
42
- function tmpFilePath( name, extension ) {
43
- const crypto = require('crypto');
44
- const id = crypto.randomBytes(32).toString('hex');
45
- const filename = `${ name }-${ id }.${ extension }`;
46
- return path.join(os.tmpdir(), filename);
40
+ function tmpFilePath( filename ) {
41
+ const dir = fs.mkdtempSync(fs.realpathSync(os.tmpdir()) + path.sep);
42
+ return path.join(dir, filename);
47
43
  }
48
44
 
49
45
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds-compiler",
3
- "version": "6.0.12",
3
+ "version": "6.0.14",
4
4
  "description": "CDS (Core Data Services) compiler and backends",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "author": "SAP SE (https://www.sap.com)",