@sap/cds-compiler 2.10.4 → 2.12.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/bin/.eslintrc.json +1 -2
  3. package/bin/cds_update_identifiers.js +10 -8
  4. package/bin/cdsc.js +58 -35
  5. package/bin/cdsse.js +1 -0
  6. package/bin/cdsv2m.js +3 -2
  7. package/doc/CHANGELOG_ARCHIVE.md +1 -1
  8. package/doc/CHANGELOG_BETA.md +16 -0
  9. package/lib/api/.eslintrc.json +2 -0
  10. package/lib/api/main.js +10 -36
  11. package/lib/api/options.js +17 -8
  12. package/lib/api/validate.js +30 -3
  13. package/lib/backends.js +12 -13
  14. package/lib/base/dictionaries.js +2 -1
  15. package/lib/base/keywords.js +3 -2
  16. package/lib/base/message-registry.js +64 -11
  17. package/lib/base/messages.js +38 -18
  18. package/lib/base/model.js +6 -4
  19. package/lib/base/optionProcessorHelper.js +148 -86
  20. package/lib/checks/.eslintrc.json +2 -0
  21. package/lib/checks/actionsFunctions.js +2 -1
  22. package/lib/checks/emptyOrOnlyVirtual.js +2 -2
  23. package/lib/checks/foreignKeys.js +4 -4
  24. package/lib/checks/managedInType.js +4 -4
  25. package/lib/checks/queryNoDbArtifacts.js +1 -3
  26. package/lib/checks/selectItems.js +4 -0
  27. package/lib/checks/sql-snippets.js +93 -0
  28. package/lib/checks/unknownMagic.js +6 -3
  29. package/lib/checks/validator.js +8 -0
  30. package/lib/compiler/assert-consistency.js +14 -5
  31. package/lib/compiler/base.js +64 -0
  32. package/lib/compiler/builtins.js +62 -16
  33. package/lib/compiler/checks.js +34 -10
  34. package/lib/compiler/definer.js +91 -112
  35. package/lib/compiler/index.js +30 -30
  36. package/lib/compiler/propagator.js +8 -4
  37. package/lib/compiler/resolver.js +279 -63
  38. package/lib/compiler/shared.js +65 -230
  39. package/lib/compiler/utils.js +191 -0
  40. package/lib/edm/annotations/genericTranslation.js +35 -18
  41. package/lib/edm/annotations/preprocessAnnotations.js +1 -1
  42. package/lib/edm/csn2edm.js +4 -3
  43. package/lib/edm/edm.js +8 -8
  44. package/lib/edm/edmPreprocessor.js +61 -59
  45. package/lib/edm/edmUtils.js +14 -15
  46. package/lib/gen/Dictionary.json +82 -40
  47. package/lib/gen/language.checksum +1 -1
  48. package/lib/gen/language.interp +19 -1
  49. package/lib/gen/language.tokens +80 -73
  50. package/lib/gen/languageLexer.interp +27 -1
  51. package/lib/gen/languageLexer.js +925 -826
  52. package/lib/gen/languageLexer.tokens +72 -65
  53. package/lib/gen/languageParser.js +4817 -4102
  54. package/lib/json/from-csn.js +57 -26
  55. package/lib/json/to-csn.js +244 -51
  56. package/lib/language/antlrParser.js +12 -1
  57. package/lib/language/docCommentParser.js +1 -1
  58. package/lib/language/errorStrategy.js +26 -8
  59. package/lib/language/genericAntlrParser.js +106 -30
  60. package/lib/language/language.g4 +200 -70
  61. package/lib/language/multiLineStringParser.js +536 -0
  62. package/lib/main.d.ts +220 -21
  63. package/lib/main.js +6 -3
  64. package/lib/model/api.js +2 -2
  65. package/lib/model/csnRefs.js +218 -86
  66. package/lib/model/csnUtils.js +99 -178
  67. package/lib/model/enrichCsn.js +84 -43
  68. package/lib/model/revealInternalProperties.js +25 -8
  69. package/lib/model/sortViews.js +8 -1
  70. package/lib/modelCompare/compare.js +2 -1
  71. package/lib/optionProcessor.js +33 -18
  72. package/lib/render/.eslintrc.json +1 -2
  73. package/lib/render/DuplicateChecker.js +2 -2
  74. package/lib/render/manageConstraints.js +1 -1
  75. package/lib/render/toCdl.js +202 -82
  76. package/lib/render/toHdbcds.js +194 -135
  77. package/lib/render/toRename.js +7 -10
  78. package/lib/render/toSql.js +91 -51
  79. package/lib/render/utils/common.js +24 -5
  80. package/lib/render/utils/sql.js +6 -4
  81. package/lib/transform/braceExpression.js +4 -2
  82. package/lib/transform/db/applyTransformations.js +189 -0
  83. package/lib/transform/db/associations.js +389 -0
  84. package/lib/transform/db/cdsPersistence.js +150 -0
  85. package/lib/transform/db/constraints.js +275 -119
  86. package/lib/transform/db/draft.js +6 -4
  87. package/lib/transform/db/expansion.js +10 -9
  88. package/lib/transform/db/flattening.js +23 -8
  89. package/lib/transform/db/temporal.js +236 -0
  90. package/lib/transform/db/transformExists.js +106 -25
  91. package/lib/transform/db/views.js +485 -0
  92. package/lib/transform/forHanaNew.js +90 -1036
  93. package/lib/transform/forOdataNew.js +11 -3
  94. package/lib/transform/localized.js +5 -14
  95. package/lib/transform/odata/generateForeignKeyElements.js +2 -2
  96. package/lib/transform/transformUtilsNew.js +34 -20
  97. package/lib/transform/translateAssocsToJoins.js +15 -23
  98. package/lib/transform/universalCsnEnricher.js +217 -47
  99. package/lib/utils/file.js +13 -6
  100. package/lib/utils/term.js +65 -42
  101. package/lib/utils/timetrace.js +55 -27
  102. package/package.json +1 -1
  103. package/lib/transform/db/helpers.js +0 -58
@@ -4,7 +4,8 @@
4
4
  "Type": "Aggregation.ApplySupportedType",
5
5
  "AppliesTo": [
6
6
  "EntitySet",
7
- "Collection"
7
+ "Collection",
8
+ "EntityType"
8
9
  ]
9
10
  },
10
11
  "Aggregation.ApplySupportedDefaults": {
@@ -36,7 +37,8 @@
36
37
  "AppliesTo": [
37
38
  "EntitySet",
38
39
  "Collection",
39
- "EntityContainer"
40
+ "EntityContainer",
41
+ "EntityType"
40
42
  ]
41
43
  },
42
44
  "Aggregation.ContextDefiningProperties": {
@@ -207,38 +209,44 @@
207
209
  "Type": "Capabilities.CountRestrictionsType",
208
210
  "AppliesTo": [
209
211
  "EntitySet",
210
- "Singleton"
212
+ "Singleton",
213
+ "Collection"
211
214
  ]
212
215
  },
213
216
  "Capabilities.NavigationRestrictions": {
214
217
  "Type": "Capabilities.NavigationRestrictionsType",
215
218
  "AppliesTo": [
216
219
  "EntitySet",
217
- "Singleton"
220
+ "Singleton",
221
+ "Collection"
218
222
  ]
219
223
  },
220
224
  "Capabilities.IndexableByKey": {
221
225
  "Type": "Core.Tag",
222
226
  "AppliesTo": [
223
- "EntitySet"
227
+ "EntitySet",
228
+ "Collection"
224
229
  ]
225
230
  },
226
231
  "Capabilities.TopSupported": {
227
232
  "Type": "Core.Tag",
228
233
  "AppliesTo": [
229
- "EntitySet"
234
+ "EntitySet",
235
+ "Collection"
230
236
  ]
231
237
  },
232
238
  "Capabilities.SkipSupported": {
233
239
  "Type": "Core.Tag",
234
240
  "AppliesTo": [
235
- "EntitySet"
241
+ "EntitySet",
242
+ "Collection"
236
243
  ]
237
244
  },
238
245
  "Capabilities.ComputeSupported": {
239
246
  "Type": "Core.Tag",
240
247
  "AppliesTo": [
241
- "EntitySet"
248
+ "EntitySet",
249
+ "Collection"
242
250
  ]
243
251
  },
244
252
  "Capabilities.SelectSupport": {
@@ -246,7 +254,8 @@
246
254
  "AppliesTo": [
247
255
  "EntityContainer",
248
256
  "EntitySet",
249
- "Singleton"
257
+ "Singleton",
258
+ "Collection"
250
259
  ]
251
260
  },
252
261
  "Capabilities.BatchSupported": {
@@ -265,32 +274,37 @@
265
274
  "Type": "Collection(Edm.String)",
266
275
  "AppliesTo": [
267
276
  "EntityContainer",
268
- "EntitySet"
277
+ "EntitySet",
278
+ "Collection"
269
279
  ]
270
280
  },
271
281
  "Capabilities.FilterRestrictions": {
272
282
  "Type": "Capabilities.FilterRestrictionsType",
273
283
  "AppliesTo": [
274
- "EntitySet"
284
+ "EntitySet",
285
+ "Collection"
275
286
  ]
276
287
  },
277
288
  "Capabilities.SortRestrictions": {
278
289
  "Type": "Capabilities.SortRestrictionsType",
279
290
  "AppliesTo": [
280
- "EntitySet"
291
+ "EntitySet",
292
+ "Collection"
281
293
  ]
282
294
  },
283
295
  "Capabilities.ExpandRestrictions": {
284
296
  "Type": "Capabilities.ExpandRestrictionsType",
285
297
  "AppliesTo": [
286
298
  "EntitySet",
287
- "Singleton"
299
+ "Singleton",
300
+ "Collection"
288
301
  ]
289
302
  },
290
303
  "Capabilities.SearchRestrictions": {
291
304
  "Type": "Capabilities.SearchRestrictionsType",
292
305
  "AppliesTo": [
293
- "EntitySet"
306
+ "EntitySet",
307
+ "Collection"
294
308
  ]
295
309
  },
296
310
  "Capabilities.KeyAsSegmentSupported": {
@@ -309,14 +323,15 @@
309
323
  "Type": "Capabilities.InsertRestrictionsType",
310
324
  "AppliesTo": [
311
325
  "EntitySet",
312
- "EntityType"
326
+ "Collection"
313
327
  ]
314
328
  },
315
329
  "Capabilities.DeepInsertSupport": {
316
330
  "Type": "Capabilities.DeepInsertSupportType",
317
331
  "AppliesTo": [
318
332
  "EntityContainer",
319
- "EntitySet"
333
+ "EntitySet",
334
+ "Collection"
320
335
  ]
321
336
  },
322
337
  "Capabilities.UpdateRestrictions": {
@@ -324,14 +339,15 @@
324
339
  "AppliesTo": [
325
340
  "EntitySet",
326
341
  "Singleton",
327
- "EntityType"
342
+ "Collection"
328
343
  ]
329
344
  },
330
345
  "Capabilities.DeepUpdateSupport": {
331
346
  "Type": "Capabilities.DeepUpdateSupportType",
332
347
  "AppliesTo": [
333
348
  "EntityContainer",
334
- "EntitySet"
349
+ "EntitySet",
350
+ "Collection"
335
351
  ]
336
352
  },
337
353
  "Capabilities.DeleteRestrictions": {
@@ -339,7 +355,7 @@
339
355
  "AppliesTo": [
340
356
  "EntitySet",
341
357
  "Singleton",
342
- "EntityType"
358
+ "Collection"
343
359
  ]
344
360
  },
345
361
  "Capabilities.CollectionPropertyRestrictions": {
@@ -374,7 +390,8 @@
374
390
  "Type": "Capabilities.ReadRestrictionsType",
375
391
  "AppliesTo": [
376
392
  "EntitySet",
377
- "Singleton"
393
+ "Singleton",
394
+ "Collection"
378
395
  ]
379
396
  },
380
397
  "Capabilities.CustomHeaders": {
@@ -581,7 +598,7 @@
581
598
  "Property"
582
599
  ],
583
600
  "$deprecated": true,
584
- "$deprecationText": "Use terms `MaskedValue` and `MaskedAlways` instead"
601
+ "$deprecationText": "Use terms `MaskedValue` instead"
585
602
  },
586
603
  "Common.MaskedValue": {
587
604
  "Type": "Edm.String",
@@ -590,8 +607,8 @@
590
607
  ],
591
608
  "$experimental": true
592
609
  },
593
- "Common.MaskedAlways": {
594
- "Type": "Core.Tag",
610
+ "Common.RevealOnDemand": {
611
+ "Type": "Edm.Boolean",
595
612
  "AppliesTo": [
596
613
  "Property"
597
614
  ],
@@ -602,7 +619,8 @@
602
619
  "AppliesTo": [
603
620
  "EntitySet",
604
621
  "EntityType",
605
- "Property"
622
+ "Property",
623
+ "NavigationProperty"
606
624
  ]
607
625
  },
608
626
  "Common.SemanticObjectMapping": {
@@ -1060,6 +1078,13 @@
1060
1078
  ],
1061
1079
  "$experimental": true
1062
1080
  },
1081
+ "Common.WebSocketBaseURL": {
1082
+ "Type": "Edm.String",
1083
+ "AppliesTo": [
1084
+ "EntityContainer"
1085
+ ],
1086
+ "$experimental": true
1087
+ },
1063
1088
  "Communication.Contact": {
1064
1089
  "Type": "Communication.ContactType",
1065
1090
  "AppliesTo": [
@@ -1165,12 +1190,6 @@
1165
1190
  "Term"
1166
1191
  ]
1167
1192
  },
1168
- "Core.AppliesToTypeIfDynamic": {
1169
- "Type": "Core.Tag",
1170
- "AppliesTo": [
1171
- "Term"
1172
- ]
1173
- },
1174
1193
  "Core.AppliesViaContainer": {
1175
1194
  "Type": "Core.Tag",
1176
1195
  "AppliesTo": [
@@ -1277,6 +1296,7 @@
1277
1296
  "Core.ContentDisposition": {
1278
1297
  "Type": "Core.ContentDispositionType",
1279
1298
  "AppliesTo": [
1299
+ "EntityType",
1280
1300
  "Property",
1281
1301
  "Term"
1282
1302
  ]
@@ -1417,8 +1437,7 @@
1417
1437
  "Type": "PersonalData.EntitySemanticsType",
1418
1438
  "AppliesTo": [
1419
1439
  "EntitySet"
1420
- ],
1421
- "$experimental": true
1440
+ ]
1422
1441
  },
1423
1442
  "PersonalData.DataSubjectRole": {
1424
1443
  "Type": "Edm.String",
@@ -1438,15 +1457,13 @@
1438
1457
  "Type": "PersonalData.FieldSemanticsType",
1439
1458
  "AppliesTo": [
1440
1459
  "Property"
1441
- ],
1442
- "$experimental": true
1460
+ ]
1443
1461
  },
1444
1462
  "PersonalData.IsPotentiallyPersonal": {
1445
1463
  "Type": "Core.Tag",
1446
1464
  "AppliesTo": [
1447
1465
  "Property"
1448
- ],
1449
- "$experimental": true
1466
+ ]
1450
1467
  },
1451
1468
  "PersonalData.IsPotentiallySensitive": {
1452
1469
  "Type": "Core.Tag",
@@ -3001,6 +3018,7 @@
3001
3018
  "Core.ContentDispositionType": {
3002
3019
  "$kind": "ComplexType",
3003
3020
  "Properties": {
3021
+ "Type": "Edm.String",
3004
3022
  "Filename": "Edm.String"
3005
3023
  }
3006
3024
  },
@@ -3128,18 +3146,17 @@
3128
3146
  },
3129
3147
  "PersonalData.EntitySemanticsType": {
3130
3148
  "$kind": "TypeDefinition",
3131
- "UnderlyingType": "Edm.String",
3132
- "$experimental": true
3149
+ "UnderlyingType": "Edm.String"
3133
3150
  },
3134
3151
  "PersonalData.FieldSemanticsType": {
3135
3152
  "$kind": "TypeDefinition",
3136
- "UnderlyingType": "Edm.String",
3137
- "$experimental": true
3153
+ "UnderlyingType": "Edm.String"
3138
3154
  },
3139
3155
  "Session.StickySessionSupportedType": {
3140
3156
  "$kind": "ComplexType",
3141
3157
  "Properties": {
3142
3158
  "NewAction": "Common.QualifiedName",
3159
+ "AdditionalNewActions": "Collection(Common.QualifiedName)",
3143
3160
  "EditAction": "Common.QualifiedName",
3144
3161
  "SaveAction": "Common.QualifiedName",
3145
3162
  "DiscardAction": "Common.SimpleIdentifier"
@@ -3583,6 +3600,18 @@
3583
3600
  "IconUrl": "Edm.String"
3584
3601
  }
3585
3602
  },
3603
+ "UI.DataFieldForActionGroup": {
3604
+ "$kind": "ComplexType",
3605
+ "BaseType": "UI.DataFieldAbstract",
3606
+ "Properties": {
3607
+ "Actions": "Collection(UI.DataFieldForActionAbstract)",
3608
+ "Label": "Edm.String",
3609
+ "Criticality": "UI.CriticalityType",
3610
+ "CriticalityRepresentation": "UI.CriticalityRepresentationType",
3611
+ "IconUrl": "Edm.String"
3612
+ },
3613
+ "$experimental": true
3614
+ },
3586
3615
  "UI.DataField": {
3587
3616
  "$kind": "ComplexType",
3588
3617
  "BaseType": "UI.DataFieldAbstract",
@@ -3645,6 +3674,19 @@
3645
3674
  "IconUrl": "Edm.String"
3646
3675
  }
3647
3676
  },
3677
+ "UI.DataFieldWithActionGroup": {
3678
+ "$kind": "ComplexType",
3679
+ "BaseType": "UI.DataField",
3680
+ "Properties": {
3681
+ "Actions": "Collection(UI.DataField)",
3682
+ "Value": "Edm.PrimitiveType",
3683
+ "Label": "Edm.String",
3684
+ "Criticality": "UI.CriticalityType",
3685
+ "CriticalityRepresentation": "UI.CriticalityRepresentationType",
3686
+ "IconUrl": "Edm.String"
3687
+ },
3688
+ "$experimental": true
3689
+ },
3648
3690
  "UI.RecommendationListType": {
3649
3691
  "$kind": "ComplexType",
3650
3692
  "Properties": {
@@ -1 +1 @@
1
- 1bb596306f100150c345f169744f5170
1
+ 08b778f3db88cf2de248a5fbf7ed4c8a