@sap/cds-compiler 4.8.0 → 4.9.2

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 (95) hide show
  1. package/CHANGELOG.md +38 -4
  2. package/bin/cds_remove_invalid_whitespace.js +135 -0
  3. package/bin/cds_update_annotations.js +180 -0
  4. package/bin/cds_update_identifiers.js +3 -4
  5. package/bin/cdsc.js +30 -17
  6. package/doc/CHANGELOG_BETA.md +19 -0
  7. package/lib/api/main.js +59 -24
  8. package/lib/api/options.js +12 -1
  9. package/lib/api/validate.js +1 -5
  10. package/lib/base/builtins.js +27 -0
  11. package/lib/base/message-registry.js +38 -21
  12. package/lib/base/messages.js +51 -20
  13. package/lib/base/model.js +4 -5
  14. package/lib/checks/actionsFunctions.js +2 -2
  15. package/lib/checks/annotationsOData.js +3 -0
  16. package/lib/checks/defaultValues.js +5 -2
  17. package/lib/checks/queryNoDbArtifacts.js +3 -2
  18. package/lib/checks/validator.js +2 -34
  19. package/lib/compiler/assert-consistency.js +10 -3
  20. package/lib/compiler/checks.js +44 -18
  21. package/lib/compiler/define.js +38 -30
  22. package/lib/compiler/extend.js +33 -10
  23. package/lib/compiler/index.js +0 -1
  24. package/lib/compiler/lsp-api.js +5 -0
  25. package/lib/compiler/populate.js +0 -2
  26. package/lib/compiler/propagator.js +23 -19
  27. package/lib/compiler/resolve.js +48 -29
  28. package/lib/compiler/shared.js +60 -20
  29. package/lib/compiler/tweak-assocs.js +72 -116
  30. package/lib/compiler/xpr-rewrite.js +762 -0
  31. package/lib/edm/annotations/edmJson.js +24 -7
  32. package/lib/edm/annotations/genericTranslation.js +81 -61
  33. package/lib/edm/edm.js +4 -4
  34. package/lib/edm/edmInboundChecks.js +33 -0
  35. package/lib/edm/edmPreprocessor.js +9 -6
  36. package/lib/gen/Dictionary.json +129 -14
  37. package/lib/gen/language.checksum +1 -1
  38. package/lib/gen/language.interp +1 -1
  39. package/lib/gen/languageParser.js +1523 -1518
  40. package/lib/json/from-csn.js +13 -4
  41. package/lib/json/to-csn.js +12 -12
  42. package/lib/language/genericAntlrParser.js +14 -6
  43. package/lib/main.d.ts +67 -14
  44. package/lib/main.js +1 -0
  45. package/lib/model/cloneCsn.js +6 -3
  46. package/lib/model/csnRefs.js +23 -11
  47. package/lib/model/csnUtils.js +13 -7
  48. package/lib/model/enrichCsn.js +3 -1
  49. package/lib/model/revealInternalProperties.js +2 -1
  50. package/lib/model/sortViews.js +14 -6
  51. package/lib/modelCompare/compare.js +33 -34
  52. package/lib/optionProcessor.js +27 -2
  53. package/lib/render/DuplicateChecker.js +6 -6
  54. package/lib/render/manageConstraints.js +1 -0
  55. package/lib/render/toCdl.js +3 -1
  56. package/lib/transform/db/applyTransformations.js +33 -0
  57. package/lib/transform/db/constraints.js +75 -28
  58. package/lib/transform/db/expansion.js +8 -3
  59. package/lib/transform/db/flattening.js +2 -2
  60. package/lib/transform/db/groupByOrderBy.js +2 -2
  61. package/lib/transform/db/temporal.js +6 -3
  62. package/lib/transform/db/transformExists.js +2 -2
  63. package/lib/transform/effective/annotations.js +194 -0
  64. package/lib/transform/effective/main.js +6 -8
  65. package/lib/transform/effective/misc.js +31 -10
  66. package/lib/transform/forOdata.js +23 -7
  67. package/lib/transform/forRelationalDB.js +3 -3
  68. package/lib/transform/localized.js +7 -6
  69. package/lib/transform/odata/flattening.js +221 -124
  70. package/lib/transform/odata/toFinalBaseType.js +1 -1
  71. package/lib/transform/odata/typesExposure.js +15 -12
  72. package/lib/transform/parseExpr.js +4 -4
  73. package/lib/transform/transformUtils.js +47 -42
  74. package/lib/transform/translateAssocsToJoins.js +47 -47
  75. package/lib/transform/universalCsn/universalCsnEnricher.js +16 -19
  76. package/package.json +1 -1
  77. package/share/messages/anno-missing-rewrite.md +45 -0
  78. package/share/messages/message-explanations.json +1 -0
  79. package/bin/.eslintrc.json +0 -17
  80. package/lib/api/.eslintrc.json +0 -37
  81. package/lib/checks/.eslintrc.json +0 -31
  82. package/lib/compiler/.eslintrc.json +0 -8
  83. package/lib/edm/.eslintrc.json +0 -46
  84. package/lib/inspect/.eslintrc.json +0 -4
  85. package/lib/json/.eslintrc.json +0 -4
  86. package/lib/language/.eslintrc.json +0 -4
  87. package/lib/model/.eslintrc.json +0 -13
  88. package/lib/modelCompare/utils/.eslintrc.json +0 -22
  89. package/lib/render/.eslintrc.json +0 -22
  90. package/lib/transform/.eslintrc.json +0 -13
  91. package/lib/transform/db/.eslintrc.json +0 -41
  92. package/lib/transform/draft/.eslintrc.json +0 -4
  93. package/lib/transform/effective/.eslintrc.json +0 -4
  94. package/lib/transform/universalCsn/.eslintrc.json +0 -37
  95. package/lib/utils/.eslintrc.json +0 -7
@@ -213,7 +213,6 @@
213
213
  "Type": "Capabilities.CountRestrictionsType",
214
214
  "AppliesTo": [
215
215
  "EntitySet",
216
- "Singleton",
217
216
  "Collection"
218
217
  ]
219
218
  },
@@ -417,6 +416,12 @@
417
416
  "Property"
418
417
  ]
419
418
  },
419
+ "Capabilities.DefaultCapabilities": {
420
+ "Type": "Capabilities.DefaultCapabilitiesType",
421
+ "AppliesTo": [
422
+ "EntityContainer"
423
+ ]
424
+ },
420
425
  "CodeList.CurrencyCodes": {
421
426
  "Type": "CodeList.CodeListSource",
422
427
  "AppliesTo": [
@@ -2553,20 +2558,34 @@
2553
2558
  "DocumentationUrl": "Edm.String"
2554
2559
  }
2555
2560
  },
2561
+ "Capabilities.ChangeTrackingBase": {
2562
+ "$kind": "ComplexType",
2563
+ "Properties": {
2564
+ "Supported": "Edm.Boolean"
2565
+ }
2566
+ },
2556
2567
  "Capabilities.ChangeTrackingType": {
2557
2568
  "$kind": "ComplexType",
2569
+ "BaseType": "Capabilities.ChangeTrackingBase",
2558
2570
  "Properties": {
2559
- "Supported": "Edm.Boolean",
2560
2571
  "FilterableProperties": "Collection(Edm.PropertyPath)",
2561
- "ExpandableProperties": "Collection(Edm.NavigationPropertyPath)"
2572
+ "ExpandableProperties": "Collection(Edm.NavigationPropertyPath)",
2573
+ "Supported": "Edm.Boolean"
2574
+ }
2575
+ },
2576
+ "Capabilities.CountRestrictionsBase": {
2577
+ "$kind": "ComplexType",
2578
+ "Properties": {
2579
+ "Countable": "Edm.Boolean"
2562
2580
  }
2563
2581
  },
2564
2582
  "Capabilities.CountRestrictionsType": {
2565
2583
  "$kind": "ComplexType",
2584
+ "BaseType": "Capabilities.CountRestrictionsBase",
2566
2585
  "Properties": {
2567
- "Countable": "Edm.Boolean",
2568
2586
  "NonCountableProperties": "Collection(Edm.PropertyPath)",
2569
- "NonCountableNavigationProperties": "Collection(Edm.NavigationPropertyPath)"
2587
+ "NonCountableNavigationProperties": "Collection(Edm.NavigationPropertyPath)",
2588
+ "Countable": "Edm.Boolean"
2570
2589
  }
2571
2590
  },
2572
2591
  "Capabilities.NavigationRestrictionsType": {
@@ -2625,14 +2644,23 @@
2625
2644
  "SupportedFormats": "Collection(Edm.String)"
2626
2645
  }
2627
2646
  },
2628
- "Capabilities.FilterRestrictionsType": {
2647
+ "Capabilities.FilterRestrictionsBase": {
2629
2648
  "$kind": "ComplexType",
2630
2649
  "Properties": {
2631
2650
  "Filterable": "Edm.Boolean",
2632
2651
  "RequiresFilter": "Edm.Boolean",
2652
+ "MaxLevels": "Edm.Int32"
2653
+ }
2654
+ },
2655
+ "Capabilities.FilterRestrictionsType": {
2656
+ "$kind": "ComplexType",
2657
+ "BaseType": "Capabilities.FilterRestrictionsBase",
2658
+ "Properties": {
2633
2659
  "RequiredProperties": "Collection(Edm.PropertyPath)",
2634
2660
  "NonFilterableProperties": "Collection(Edm.PropertyPath)",
2635
2661
  "FilterExpressionRestrictions": "Collection(Capabilities.FilterExpressionRestrictionType)",
2662
+ "Filterable": "Edm.Boolean",
2663
+ "RequiresFilter": "Edm.Boolean",
2636
2664
  "MaxLevels": "Edm.Int32"
2637
2665
  }
2638
2666
  },
@@ -2643,22 +2671,38 @@
2643
2671
  "AllowedExpressions": "Capabilities.FilterExpressionType"
2644
2672
  }
2645
2673
  },
2674
+ "Capabilities.SortRestrictionsBase": {
2675
+ "$kind": "ComplexType",
2676
+ "Properties": {
2677
+ "Sortable": "Edm.Boolean"
2678
+ }
2679
+ },
2646
2680
  "Capabilities.SortRestrictionsType": {
2647
2681
  "$kind": "ComplexType",
2682
+ "BaseType": "Capabilities.SortRestrictionsBase",
2648
2683
  "Properties": {
2649
- "Sortable": "Edm.Boolean",
2650
2684
  "AscendingOnlyProperties": "Collection(Edm.PropertyPath)",
2651
2685
  "DescendingOnlyProperties": "Collection(Edm.PropertyPath)",
2652
- "NonSortableProperties": "Collection(Edm.PropertyPath)"
2686
+ "NonSortableProperties": "Collection(Edm.PropertyPath)",
2687
+ "Sortable": "Edm.Boolean"
2653
2688
  }
2654
2689
  },
2655
- "Capabilities.ExpandRestrictionsType": {
2690
+ "Capabilities.ExpandRestrictionsBase": {
2656
2691
  "$kind": "ComplexType",
2657
2692
  "Properties": {
2658
2693
  "Expandable": "Edm.Boolean",
2659
2694
  "StreamsExpandable": "Edm.Boolean",
2695
+ "MaxLevels": "Edm.Int32"
2696
+ }
2697
+ },
2698
+ "Capabilities.ExpandRestrictionsType": {
2699
+ "$kind": "ComplexType",
2700
+ "BaseType": "Capabilities.ExpandRestrictionsBase",
2701
+ "Properties": {
2660
2702
  "NonExpandableProperties": "Collection(Edm.NavigationPropertyPath)",
2661
2703
  "NonExpandableStreamProperties": "Collection(Edm.PropertyPath)",
2704
+ "Expandable": "Edm.Boolean",
2705
+ "StreamsExpandable": "Edm.Boolean",
2662
2706
  "MaxLevels": "Edm.Int32"
2663
2707
  }
2664
2708
  },
@@ -2669,16 +2713,31 @@
2669
2713
  "UnsupportedExpressions": "Capabilities.SearchExpressions"
2670
2714
  }
2671
2715
  },
2672
- "Capabilities.InsertRestrictionsType": {
2716
+ "Capabilities.InsertRestrictionsBase": {
2673
2717
  "$kind": "ComplexType",
2674
2718
  "Properties": {
2675
2719
  "Insertable": "Edm.Boolean",
2720
+ "MaxLevels": "Edm.Int32",
2721
+ "TypecastSegmentSupported": "Edm.Boolean",
2722
+ "QueryOptions": "Capabilities.ModificationQueryOptionsType",
2723
+ "CustomHeaders": "Collection(Capabilities.CustomParameter)",
2724
+ "CustomQueryOptions": "Collection(Capabilities.CustomParameter)",
2725
+ "Description": "Edm.String",
2726
+ "LongDescription": "Edm.String",
2727
+ "ErrorResponses": "Collection(Capabilities.HttpResponse)"
2728
+ }
2729
+ },
2730
+ "Capabilities.InsertRestrictionsType": {
2731
+ "$kind": "ComplexType",
2732
+ "BaseType": "Capabilities.InsertRestrictionsBase",
2733
+ "Properties": {
2676
2734
  "NonInsertableProperties": "Collection(Edm.PropertyPath)",
2677
2735
  "NonInsertableNavigationProperties": "Collection(Edm.NavigationPropertyPath)",
2678
2736
  "RequiredProperties": "Collection(Edm.PropertyPath)",
2737
+ "Permissions": "Collection(Capabilities.PermissionType)",
2738
+ "Insertable": "Edm.Boolean",
2679
2739
  "MaxLevels": "Edm.Int32",
2680
2740
  "TypecastSegmentSupported": "Edm.Boolean",
2681
- "Permissions": "Collection(Capabilities.PermissionType)",
2682
2741
  "QueryOptions": "Capabilities.ModificationQueryOptionsType",
2683
2742
  "CustomHeaders": "Collection(Capabilities.CustomParameter)",
2684
2743
  "CustomQueryOptions": "Collection(Capabilities.CustomParameter)",
@@ -2708,7 +2767,7 @@
2708
2767
  "ContentIDSupported": "Edm.Boolean"
2709
2768
  }
2710
2769
  },
2711
- "Capabilities.UpdateRestrictionsType": {
2770
+ "Capabilities.UpdateRestrictionsBase": {
2712
2771
  "$kind": "ComplexType",
2713
2772
  "Properties": {
2714
2773
  "Updatable": "Edm.Boolean",
@@ -2717,9 +2776,29 @@
2717
2776
  "UpdateMethod": "Capabilities.HttpMethod",
2718
2777
  "FilterSegmentSupported": "Edm.Boolean",
2719
2778
  "TypecastSegmentSupported": "Edm.Boolean",
2779
+ "MaxLevels": "Edm.Int32",
2780
+ "Permissions": "Collection(Capabilities.PermissionType)",
2781
+ "QueryOptions": "Capabilities.ModificationQueryOptionsType",
2782
+ "CustomHeaders": "Collection(Capabilities.CustomParameter)",
2783
+ "CustomQueryOptions": "Collection(Capabilities.CustomParameter)",
2784
+ "Description": "Edm.String",
2785
+ "LongDescription": "Edm.String",
2786
+ "ErrorResponses": "Collection(Capabilities.HttpResponse)"
2787
+ }
2788
+ },
2789
+ "Capabilities.UpdateRestrictionsType": {
2790
+ "$kind": "ComplexType",
2791
+ "BaseType": "Capabilities.UpdateRestrictionsBase",
2792
+ "Properties": {
2720
2793
  "NonUpdatableProperties": "Collection(Edm.PropertyPath)",
2721
2794
  "NonUpdatableNavigationProperties": "Collection(Edm.NavigationPropertyPath)",
2722
2795
  "RequiredProperties": "Collection(Edm.PropertyPath)",
2796
+ "Updatable": "Edm.Boolean",
2797
+ "Upsertable": "Edm.Boolean",
2798
+ "DeltaUpdateSupported": "Edm.Boolean",
2799
+ "UpdateMethod": "Capabilities.HttpMethod",
2800
+ "FilterSegmentSupported": "Edm.Boolean",
2801
+ "TypecastSegmentSupported": "Edm.Boolean",
2723
2802
  "MaxLevels": "Edm.Int32",
2724
2803
  "Permissions": "Collection(Capabilities.PermissionType)",
2725
2804
  "QueryOptions": "Capabilities.ModificationQueryOptionsType",
@@ -2737,11 +2816,27 @@
2737
2816
  "ContentIDSupported": "Edm.Boolean"
2738
2817
  }
2739
2818
  },
2740
- "Capabilities.DeleteRestrictionsType": {
2819
+ "Capabilities.DeleteRestrictionsBase": {
2741
2820
  "$kind": "ComplexType",
2742
2821
  "Properties": {
2743
2822
  "Deletable": "Edm.Boolean",
2823
+ "MaxLevels": "Edm.Int32",
2824
+ "FilterSegmentSupported": "Edm.Boolean",
2825
+ "TypecastSegmentSupported": "Edm.Boolean",
2826
+ "Permissions": "Collection(Capabilities.PermissionType)",
2827
+ "CustomHeaders": "Collection(Capabilities.CustomParameter)",
2828
+ "CustomQueryOptions": "Collection(Capabilities.CustomParameter)",
2829
+ "Description": "Edm.String",
2830
+ "LongDescription": "Edm.String",
2831
+ "ErrorResponses": "Collection(Capabilities.HttpResponse)"
2832
+ }
2833
+ },
2834
+ "Capabilities.DeleteRestrictionsType": {
2835
+ "$kind": "ComplexType",
2836
+ "BaseType": "Capabilities.DeleteRestrictionsBase",
2837
+ "Properties": {
2744
2838
  "NonDeletableNavigationProperties": "Collection(Edm.NavigationPropertyPath)",
2839
+ "Deletable": "Edm.Boolean",
2745
2840
  "MaxLevels": "Edm.Int32",
2746
2841
  "FilterSegmentSupported": "Edm.Boolean",
2747
2842
  "TypecastSegmentSupported": "Edm.Boolean",
@@ -2841,6 +2936,27 @@
2841
2936
  "ExampleValues": "Collection(Core.PrimitiveExampleValue)"
2842
2937
  }
2843
2938
  },
2939
+ "Capabilities.DefaultCapabilitiesType": {
2940
+ "$kind": "ComplexType",
2941
+ "Properties": {
2942
+ "ChangeTracking": "Capabilities.ChangeTrackingBase",
2943
+ "CountRestrictions": "Capabilities.CountRestrictionsBase",
2944
+ "IndexableByKey": "Core.Tag",
2945
+ "TopSupported": "Core.Tag",
2946
+ "SkipSupported": "Core.Tag",
2947
+ "ComputeSupported": "Core.Tag",
2948
+ "SelectSupport": "Capabilities.SelectSupportType",
2949
+ "FilterRestrictions": "Capabilities.FilterRestrictionsBase",
2950
+ "SortRestrictions": "Capabilities.SortRestrictionsBase",
2951
+ "ExpandRestrictions": "Capabilities.ExpandRestrictionsBase",
2952
+ "SearchRestrictions": "Capabilities.SearchRestrictionsType",
2953
+ "InsertRestrictions": "Capabilities.InsertRestrictionsBase",
2954
+ "UpdateRestrictions": "Capabilities.UpdateRestrictionsBase",
2955
+ "DeleteRestrictions": "Capabilities.DeleteRestrictionsBase",
2956
+ "OperationRestrictions": "Capabilities.OperationRestrictionsType",
2957
+ "ReadRestrictions": "Capabilities.ReadRestrictionsType"
2958
+ }
2959
+ },
2844
2960
  "Capabilities.HttpResponse": {
2845
2961
  "$kind": "ComplexType",
2846
2962
  "Properties": {
@@ -3102,7 +3218,6 @@
3102
3218
  "TargetEntities": "Collection(Edm.NavigationPropertyPath)",
3103
3219
  "EffectTypes": "Common.EffectType",
3104
3220
  "TriggerAction": "Common.QualifiedName",
3105
- "TriggeredIndicator": "Edm.Boolean",
3106
3221
  "Discretionary": "Edm.Boolean"
3107
3222
  }
3108
3223
  },
@@ -1 +1 @@
1
- 94c7898bd2c786378430965b9e240ce0
1
+ 0c76b255e5fe55c0f8527a4d9f1b563f