@sap/cds-compiler 2.15.6 → 2.15.8

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
@@ -7,6 +7,16 @@
7
7
  Note: `beta` fixes, changes and features are usually not listed in this ChangeLog but [here](doc/CHANGELOG_BETA.md).
8
8
  The compiler behavior concerning `beta` features can change at any time without notice.
9
9
 
10
+ ## Version 2.15.8 - 2022-08-02
11
+
12
+ ### Fixed
13
+
14
+ - to.edm(x): Nested `@UI.TextArrangement` has precedence over `@TextArrangement` shortcut annotation for `@Common.Text`.
15
+ - to.hdi.migration:
16
+ + Respect option `disableHanaComments` when rendering the `ALTER` statements
17
+ + Doc comments rendered the _full doc comment_ instead of only the first paragraph, as `to.hdi` does.
18
+ - compiler: An association's cardinality was lost for associations published in projections.
19
+
10
20
  ## Version 2.15.6 - 2022-07-26
11
21
 
12
22
  ### Fixed
@@ -297,8 +297,12 @@ function preprocessAnnotations(csn, serviceName, options) {
297
297
 
298
298
  //change the scalar anno into a "pseudo-structured" one
299
299
  // TODO should be flattened, but then alphabetical order is destroyed
300
- let newTextAnno = { '$value': textAnno, '@UI.TextArrangement': value };
301
- carrier['@Common.Text'] = newTextAnno;
300
+
301
+ // Do not overwrite existing nested annotation values, instead give existing
302
+ // nested annotation precedence and remove outer annotation (always)
303
+ if(!carrier['@Common.Text.@UI.TextArrangement'] && textAnno) {
304
+ carrier['@Common.Text'] = { '$value': textAnno, '@UI.TextArrangement': value };
305
+ }
302
306
  delete carrier[aName];
303
307
  }
304
308
  }
@@ -102,6 +102,7 @@ const ourpropsRegex = /^[_$]?[a-zA-Z]+[0-9]*$/;
102
102
  const typeProperties = [
103
103
  // do not include CSN v0.1.0 properties here:
104
104
  'target', 'elements', 'enum', 'items',
105
+ 'cardinality', // for association publishing in views
105
106
  'type', 'length', 'precision', 'scale', 'srid', 'localized', 'notNull',
106
107
  'keys', 'on', // only with 'target'
107
108
  ];
@@ -184,9 +184,11 @@ const propertyOrder = (function orderPositions() {
184
184
  }());
185
185
 
186
186
  // sync with definition in from-csn.js:
187
+ // Note: Order here is also the property order in CSN.
187
188
  const typeProperties = [
188
- 'target', 'elements', 'enum', 'items', // TODO: notNull?
189
- 'type', 'length', 'precision', 'scale', 'srid', 'localized',
189
+ 'target', 'elements', 'enum', 'items',
190
+ 'cardinality', // for association publishing in views
191
+ 'type', 'length', 'precision', 'scale', 'srid', 'localized', // TODO: notNull?
190
192
  'foreignKeys', 'on', // for explicit ON/keys with REDIRECTED
191
193
  ];
192
194
 
@@ -200,7 +200,7 @@ function toSqlDdl(csn, options) {
200
200
  Render comment string.
201
201
  */
202
202
  comment(comment) {
203
- return comment && renderStringForSql(comment, options.sqlDialect) || 'NULL';
203
+ return comment && renderStringForSql(getHanaComment({ doc: comment }), options.sqlDialect) || 'NULL';
204
204
  },
205
205
  /*
206
206
  Alter SQL snippet for entity.
@@ -461,7 +461,7 @@ function toSqlDdl(csn, options) {
461
461
  // Change entity properties
462
462
  if (migration.properties) {
463
463
  for (const [ prop, def ] of Object.entries(migration.properties)) {
464
- if (prop === 'doc') {
464
+ if (prop === 'doc' && !options.disableHanaComments) { // def.new may be `null`
465
465
  const alterComment = render.alterEntityComment(tableName, def.new);
466
466
  addMigration(resultObj, artifactName, false, alterComment);
467
467
  }
@@ -527,7 +527,7 @@ function toSqlDdl(csn, options) {
527
527
  }
528
528
  }
529
529
 
530
- if (def.old.doc !== def.new.doc) {
530
+ if (!options.disableHanaComments && def.old.doc !== def.new.doc) {
531
531
  const eltStrOldNoDoc = getEltStrNoProps(def.old, eltName, 'doc');
532
532
  const eltStrNewNoDoc = getEltStrNoProps(def.new, eltName, 'doc');
533
533
  if (eltStrOldNoDoc === eltStrNewNoDoc) { // only `doc` changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds-compiler",
3
- "version": "2.15.6",
3
+ "version": "2.15.8",
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)",