@sap/cds-compiler 3.4.2 → 3.5.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 (143) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +1 -0
  3. package/bin/cds_update_identifiers.js +5 -5
  4. package/bin/cdsc.js +15 -16
  5. package/bin/cdshi.js +19 -6
  6. package/doc/CHANGELOG_ARCHIVE.md +2 -2
  7. package/doc/CHANGELOG_BETA.md +9 -1
  8. package/doc/CHANGELOG_DEPRECATED.md +2 -0
  9. package/lib/api/main.js +61 -59
  10. package/lib/api/options.js +4 -2
  11. package/lib/api/validate.js +2 -2
  12. package/lib/base/cleanSymbols.js +2 -3
  13. package/lib/base/dictionaries.js +6 -6
  14. package/lib/base/error.js +2 -2
  15. package/lib/base/keywords.js +6 -6
  16. package/lib/base/location.js +11 -12
  17. package/lib/base/message-registry.js +177 -58
  18. package/lib/base/messages.js +252 -180
  19. package/lib/base/model.js +14 -11
  20. package/lib/base/node-helpers.js +9 -10
  21. package/lib/base/optionProcessorHelper.js +138 -129
  22. package/lib/checks/.eslintrc.json +2 -0
  23. package/lib/checks/actionsFunctions.js +5 -5
  24. package/lib/checks/annotationsOData.js +4 -4
  25. package/lib/checks/arrayOfs.js +1 -1
  26. package/lib/checks/cdsPersistence.js +1 -1
  27. package/lib/checks/checkForTypes.js +3 -3
  28. package/lib/checks/defaultValues.js +3 -3
  29. package/lib/checks/elements.js +7 -7
  30. package/lib/checks/emptyOrOnlyVirtual.js +2 -2
  31. package/lib/checks/foreignKeys.js +1 -1
  32. package/lib/checks/invalidTarget.js +4 -4
  33. package/lib/checks/managedInType.js +1 -1
  34. package/lib/checks/managedWithoutKeys.js +1 -1
  35. package/lib/checks/nonexpandableStructured.js +5 -3
  36. package/lib/checks/nullableKeys.js +1 -1
  37. package/lib/checks/onConditions.js +5 -6
  38. package/lib/checks/parameters.js +1 -1
  39. package/lib/checks/queryNoDbArtifacts.js +2 -2
  40. package/lib/checks/selectItems.js +4 -4
  41. package/lib/checks/sql-snippets.js +4 -4
  42. package/lib/checks/types.js +7 -7
  43. package/lib/checks/utils.js +4 -4
  44. package/lib/checks/validator.js +16 -13
  45. package/lib/compiler/.eslintrc.json +4 -1
  46. package/lib/compiler/assert-consistency.js +8 -7
  47. package/lib/compiler/builtins.js +14 -14
  48. package/lib/compiler/checks.js +123 -48
  49. package/lib/compiler/define.js +12 -13
  50. package/lib/compiler/extend.js +266 -60
  51. package/lib/compiler/finalize-parse-cdl.js +10 -5
  52. package/lib/compiler/index.js +17 -14
  53. package/lib/compiler/populate.js +14 -6
  54. package/lib/compiler/propagator.js +2 -0
  55. package/lib/compiler/resolve.js +2 -15
  56. package/lib/compiler/shared.js +27 -16
  57. package/lib/compiler/tweak-assocs.js +5 -6
  58. package/lib/compiler/utils.js +20 -0
  59. package/lib/edm/annotations/genericTranslation.js +604 -358
  60. package/lib/edm/annotations/preprocessAnnotations.js +39 -35
  61. package/lib/edm/csn2edm.js +275 -222
  62. package/lib/edm/edm.js +17 -3
  63. package/lib/edm/edmAnnoPreprocessor.js +6 -6
  64. package/lib/edm/edmInboundChecks.js +2 -2
  65. package/lib/edm/edmPreprocessor.js +107 -77
  66. package/lib/edm/edmUtils.js +44 -5
  67. package/lib/gen/Dictionary.json +210 -8
  68. package/lib/gen/language.checksum +1 -1
  69. package/lib/gen/language.interp +67 -63
  70. package/lib/gen/language.tokens +81 -81
  71. package/lib/gen/languageLexer.interp +4 -10
  72. package/lib/gen/languageLexer.js +854 -869
  73. package/lib/gen/languageLexer.tokens +79 -81
  74. package/lib/gen/languageParser.js +14309 -13832
  75. package/lib/inspect/inspectModelStatistics.js +2 -2
  76. package/lib/inspect/inspectPropagation.js +6 -6
  77. package/lib/inspect/inspectUtils.js +2 -2
  78. package/lib/json/from-csn.js +102 -55
  79. package/lib/json/to-csn.js +119 -198
  80. package/lib/language/antlrParser.js +5 -2
  81. package/lib/language/docCommentParser.js +6 -6
  82. package/lib/language/errorStrategy.js +43 -23
  83. package/lib/language/genericAntlrParser.js +113 -133
  84. package/lib/language/language.g4 +1550 -1506
  85. package/lib/language/multiLineStringParser.js +3 -3
  86. package/lib/language/textUtils.js +2 -2
  87. package/lib/main.js +3 -3
  88. package/lib/model/csnRefs.js +5 -0
  89. package/lib/model/csnUtils.js +130 -122
  90. package/lib/model/revealInternalProperties.js +1 -1
  91. package/lib/model/sortViews.js +4 -6
  92. package/lib/modelCompare/compare.js +2 -2
  93. package/lib/modelCompare/utils/.eslintrc.json +22 -0
  94. package/lib/modelCompare/utils/filter.js +100 -0
  95. package/lib/optionProcessor.js +5 -0
  96. package/lib/render/.eslintrc.json +1 -0
  97. package/lib/render/DuplicateChecker.js +1 -1
  98. package/lib/render/manageConstraints.js +12 -12
  99. package/lib/render/toCdl.js +311 -276
  100. package/lib/render/toHdbcds.js +97 -94
  101. package/lib/render/toRename.js +5 -5
  102. package/lib/render/toSql.js +127 -223
  103. package/lib/render/utils/common.js +141 -108
  104. package/lib/render/utils/delta.js +227 -0
  105. package/lib/render/utils/sql.js +22 -6
  106. package/lib/render/utils/stringEscapes.js +3 -3
  107. package/lib/transform/db/.eslintrc.json +2 -0
  108. package/lib/transform/db/applyTransformations.js +3 -3
  109. package/lib/transform/db/assertUnique.js +13 -12
  110. package/lib/transform/db/associations.js +5 -5
  111. package/lib/transform/db/cdsPersistence.js +10 -8
  112. package/lib/transform/db/constraints.js +14 -14
  113. package/lib/transform/db/expansion.js +20 -22
  114. package/lib/transform/db/flattening.js +24 -42
  115. package/lib/transform/db/groupByOrderBy.js +3 -3
  116. package/lib/transform/db/temporal.js +6 -6
  117. package/lib/transform/db/transformExists.js +23 -23
  118. package/lib/transform/db/views.js +16 -16
  119. package/lib/transform/draft/.eslintrc.json +1 -35
  120. package/lib/transform/draft/db.js +10 -10
  121. package/lib/transform/draft/odata.js +2 -2
  122. package/lib/transform/forOdataNew.js +8 -29
  123. package/lib/transform/forRelationalDB.js +16 -6
  124. package/lib/transform/localized.js +11 -10
  125. package/lib/transform/odata/toFinalBaseType.js +41 -27
  126. package/lib/transform/odata/typesExposure.js +113 -47
  127. package/lib/transform/parseExpr.js +209 -106
  128. package/lib/transform/transformUtilsNew.js +17 -10
  129. package/lib/transform/translateAssocsToJoins.js +24 -19
  130. package/lib/transform/universalCsn/coreComputed.js +10 -10
  131. package/lib/transform/universalCsn/universalCsnEnricher.js +26 -26
  132. package/lib/transform/universalCsn/utils.js +3 -3
  133. package/lib/utils/file.js +5 -5
  134. package/lib/utils/moduleResolve.js +13 -13
  135. package/lib/utils/objectUtils.js +6 -6
  136. package/lib/utils/term.js +5 -2
  137. package/lib/utils/timetrace.js +51 -24
  138. package/package.json +5 -8
  139. package/share/messages/check-proper-type-of.md +1 -1
  140. package/share/messages/message-explanations.json +1 -1
  141. package/share/messages/redirected-to-complex.md +4 -4
  142. package/share/messages/{syntax-expecting-integer.md → syntax-expecting-unsigned-int.md} +7 -4
  143. package/lib/modelCompare/filter.js +0 -83
@@ -1499,6 +1499,23 @@
1499
1499
  ],
1500
1500
  "$experimental": true
1501
1501
  },
1502
+ "Offline.ClientOnly": {
1503
+ "Type": "Core.Tag",
1504
+ "AppliesTo": [
1505
+ "EntityType",
1506
+ "EntitySet",
1507
+ "EnumType",
1508
+ "ComplexType",
1509
+ "TypeDefinition"
1510
+ ],
1511
+ "$experimental": true
1512
+ },
1513
+ "PDF.Features": {
1514
+ "Type": "PDF.FeaturesType",
1515
+ "AppliesTo": [
1516
+ "EntityContainer"
1517
+ ]
1518
+ },
1502
1519
  "PersonalData.EntitySemantics": {
1503
1520
  "Type": "PersonalData.EntitySemanticsType",
1504
1521
  "AppliesTo": [
@@ -2599,7 +2616,36 @@
2599
2616
  },
2600
2617
  "Capabilities.FilterExpressionType": {
2601
2618
  "$kind": "TypeDefinition",
2602
- "UnderlyingType": "Edm.String"
2619
+ "UnderlyingType": "Edm.String",
2620
+ "$Allowed": {
2621
+ "Values": {
2622
+ "SingleValue": {
2623
+ "Value": "SingleValue",
2624
+ "Type": "String"
2625
+ },
2626
+ "MultiValue": {
2627
+ "Value": "MultiValue",
2628
+ "Type": "String"
2629
+ },
2630
+ "SingleRange": {
2631
+ "Value": "SingleRange",
2632
+ "Type": "String"
2633
+ },
2634
+ "MultiRange": {
2635
+ "Value": "MultiRange",
2636
+ "Type": "String"
2637
+ },
2638
+ "SearchExpression": {
2639
+ "Value": "SearchExpression",
2640
+ "Type": "String"
2641
+ },
2642
+ "MultiRangeOrSearchExpression": {
2643
+ "Value": "MultiRangeOrSearchExpression",
2644
+ "Type": "String"
2645
+ }
2646
+ },
2647
+ "Symbols": {}
2648
+ }
2603
2649
  },
2604
2650
  "CodeList.CodeListSource": {
2605
2651
  "$kind": "ComplexType",
@@ -2836,11 +2882,45 @@
2836
2882
  },
2837
2883
  "Common.NumericMessageSeverityType": {
2838
2884
  "$kind": "TypeDefinition",
2839
- "UnderlyingType": "Edm.Byte"
2885
+ "UnderlyingType": "Edm.Byte",
2886
+ "$Allowed": {
2887
+ "Values": {
2888
+ "1": {
2889
+ "Value": "1",
2890
+ "Type": "Int"
2891
+ },
2892
+ "2": {
2893
+ "Value": "2",
2894
+ "Type": "Int"
2895
+ },
2896
+ "3": {
2897
+ "Value": "3",
2898
+ "Type": "Int"
2899
+ },
2900
+ "4": {
2901
+ "Value": "4",
2902
+ "Type": "Int"
2903
+ }
2904
+ },
2905
+ "Symbols": {}
2906
+ }
2840
2907
  },
2841
2908
  "Common.FetchValuesType": {
2842
2909
  "$kind": "TypeDefinition",
2843
- "UnderlyingType": "Edm.Byte"
2910
+ "UnderlyingType": "Edm.Byte",
2911
+ "$Allowed": {
2912
+ "Values": {
2913
+ "1": {
2914
+ "Value": "1",
2915
+ "Type": "Int"
2916
+ },
2917
+ "2": {
2918
+ "Value": "2",
2919
+ "Type": "Int"
2920
+ }
2921
+ },
2922
+ "Symbols": {}
2923
+ }
2844
2924
  },
2845
2925
  "Common.SimpleIdentifier": {
2846
2926
  "$kind": "TypeDefinition",
@@ -3187,7 +3267,28 @@
3187
3267
  },
3188
3268
  "Core.MessageSeverity": {
3189
3269
  "$kind": "TypeDefinition",
3190
- "UnderlyingType": "Edm.String"
3270
+ "UnderlyingType": "Edm.String",
3271
+ "$Allowed": {
3272
+ "Values": {
3273
+ "success": {
3274
+ "Value": "success",
3275
+ "Type": "String"
3276
+ },
3277
+ "info": {
3278
+ "Value": "info",
3279
+ "Type": "String"
3280
+ },
3281
+ "warning": {
3282
+ "Value": "warning",
3283
+ "Type": "String"
3284
+ },
3285
+ "error": {
3286
+ "Value": "error",
3287
+ "Type": "String"
3288
+ }
3289
+ },
3290
+ "Symbols": {}
3291
+ }
3191
3292
  },
3192
3293
  "Core.Tag": {
3193
3294
  "$kind": "TypeDefinition",
@@ -3254,15 +3355,99 @@
3254
3355
  },
3255
3356
  "Measures.DurationGranularityType": {
3256
3357
  "$kind": "TypeDefinition",
3257
- "UnderlyingType": "Edm.String"
3358
+ "UnderlyingType": "Edm.String",
3359
+ "$Allowed": {
3360
+ "Values": {
3361
+ "days": {
3362
+ "Value": "days",
3363
+ "Type": "String"
3364
+ },
3365
+ "hours": {
3366
+ "Value": "hours",
3367
+ "Type": "String"
3368
+ },
3369
+ "minutes": {
3370
+ "Value": "minutes",
3371
+ "Type": "String"
3372
+ }
3373
+ },
3374
+ "Symbols": {}
3375
+ }
3376
+ },
3377
+ "PDF.FeaturesType": {
3378
+ "$kind": "ComplexType",
3379
+ "Properties": {
3380
+ "DocumentDescriptionReference": "Edm.String",
3381
+ "DocumentDescriptionCollection": "Edm.String",
3382
+ "ArchiveFormat": "Edm.Boolean",
3383
+ "Signature": "Edm.Boolean",
3384
+ "CoverPage": "Edm.Boolean",
3385
+ "FontName": "Edm.Boolean",
3386
+ "FontSize": "Edm.Boolean",
3387
+ "Margin": "Edm.Boolean",
3388
+ "Border": "Edm.Boolean",
3389
+ "FitToPage": "Edm.Boolean",
3390
+ "ResultSizeDefault": "Edm.Int32",
3391
+ "ResultSizeMaximum": "Edm.Int32"
3392
+ }
3258
3393
  },
3259
3394
  "PersonalData.EntitySemanticsType": {
3260
3395
  "$kind": "TypeDefinition",
3261
- "UnderlyingType": "Edm.String"
3396
+ "UnderlyingType": "Edm.String",
3397
+ "$Allowed": {
3398
+ "Values": {
3399
+ "DataSubject": {
3400
+ "Value": "DataSubject",
3401
+ "Type": "String"
3402
+ },
3403
+ "DataSubjectDetails": {
3404
+ "Value": "DataSubjectDetails",
3405
+ "Type": "String"
3406
+ },
3407
+ "Other": {
3408
+ "Value": "Other",
3409
+ "Type": "String"
3410
+ }
3411
+ },
3412
+ "Symbols": {}
3413
+ }
3262
3414
  },
3263
3415
  "PersonalData.FieldSemanticsType": {
3264
3416
  "$kind": "TypeDefinition",
3265
- "UnderlyingType": "Edm.String"
3417
+ "UnderlyingType": "Edm.String",
3418
+ "$Allowed": {
3419
+ "Values": {
3420
+ "DataSubjectID": {
3421
+ "Value": "DataSubjectID",
3422
+ "Type": "String"
3423
+ },
3424
+ "DataSubjectIDType": {
3425
+ "Value": "DataSubjectIDType",
3426
+ "Type": "String"
3427
+ },
3428
+ "ConsentID": {
3429
+ "Value": "ConsentID",
3430
+ "Type": "String"
3431
+ },
3432
+ "PurposeID": {
3433
+ "Value": "PurposeID",
3434
+ "Type": "String"
3435
+ },
3436
+ "ContractRelatedID": {
3437
+ "Value": "ContractRelatedID",
3438
+ "Type": "String"
3439
+ },
3440
+ "LegalEntityID": {
3441
+ "Value": "LegalEntityID",
3442
+ "Type": "String"
3443
+ },
3444
+ "UserID": {
3445
+ "Value": "UserID",
3446
+ "Type": "String"
3447
+ }
3448
+ },
3449
+ "Symbols": {}
3450
+ }
3266
3451
  },
3267
3452
  "Session.StickySessionSupportedType": {
3268
3453
  "$kind": "ComplexType",
@@ -3986,7 +4171,24 @@
3986
4171
  },
3987
4172
  "UI.RecommendationStateType": {
3988
4173
  "$kind": "TypeDefinition",
3989
- "UnderlyingType": "Edm.Byte"
4174
+ "UnderlyingType": "Edm.Byte",
4175
+ "$Allowed": {
4176
+ "Values": {
4177
+ "0": {
4178
+ "Value": "0",
4179
+ "Type": "Int"
4180
+ },
4181
+ "1": {
4182
+ "Value": "1",
4183
+ "Type": "Int"
4184
+ },
4185
+ "2": {
4186
+ "Value": "2",
4187
+ "Type": "Int"
4188
+ }
4189
+ },
4190
+ "Symbols": {}
4191
+ }
3990
4192
  },
3991
4193
  "Validation.AllowedValue": {
3992
4194
  "$kind": "ComplexType",
@@ -1 +1 @@
1
- 5a5c0432924af9c8833ad5aa6b94724f
1
+ bdbb2e738b68d13dc2f0f03c0caf5fc0