@sap/cds-compiler 2.13.8 → 3.0.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 (127) hide show
  1. package/CHANGELOG.md +155 -1594
  2. package/bin/cdsc.js +144 -66
  3. package/doc/CHANGELOG_ARCHIVE.md +1592 -0
  4. package/doc/CHANGELOG_BETA.md +3 -4
  5. package/doc/CHANGELOG_DEPRECATED.md +35 -1
  6. package/doc/{DeprecatedOptions.md → DeprecatedOptions_v2.md} +3 -1
  7. package/doc/Versioning.md +20 -1
  8. package/lib/api/.eslintrc.json +2 -2
  9. package/lib/api/main.js +237 -122
  10. package/lib/api/options.js +17 -88
  11. package/lib/api/validate.js +12 -16
  12. package/lib/base/keywords.js +216 -109
  13. package/lib/base/message-registry.js +152 -37
  14. package/lib/base/messages.js +145 -83
  15. package/lib/base/model.js +44 -2
  16. package/lib/base/optionProcessorHelper.js +19 -0
  17. package/lib/checks/actionsFunctions.js +7 -5
  18. package/lib/checks/annotationsOData.js +11 -32
  19. package/lib/checks/arrayOfs.js +1 -34
  20. package/lib/checks/cdsPersistence.js +1 -0
  21. package/lib/checks/elements.js +6 -6
  22. package/lib/checks/invalidTarget.js +1 -1
  23. package/lib/checks/nonexpandableStructured.js +1 -1
  24. package/lib/checks/queryNoDbArtifacts.js +2 -1
  25. package/lib/checks/selectItems.js +5 -1
  26. package/lib/checks/types.js +4 -2
  27. package/lib/checks/utils.js +2 -2
  28. package/lib/checks/validator.js +4 -5
  29. package/lib/compiler/assert-consistency.js +16 -10
  30. package/lib/compiler/base.js +1 -0
  31. package/lib/compiler/builtins.js +98 -9
  32. package/lib/compiler/checks.js +22 -70
  33. package/lib/compiler/define.js +61 -13
  34. package/lib/compiler/extend.js +79 -14
  35. package/lib/compiler/finalize-parse-cdl.js +46 -29
  36. package/lib/compiler/index.js +100 -37
  37. package/lib/compiler/moduleLayers.js +7 -0
  38. package/lib/compiler/populate.js +19 -18
  39. package/lib/compiler/propagator.js +7 -4
  40. package/lib/compiler/resolve.js +297 -234
  41. package/lib/compiler/shared.js +107 -102
  42. package/lib/compiler/tweak-assocs.js +16 -11
  43. package/lib/compiler/utils.js +5 -0
  44. package/lib/edm/annotations/genericTranslation.js +93 -21
  45. package/lib/edm/csn2edm.js +230 -115
  46. package/lib/edm/edm.js +305 -226
  47. package/lib/edm/edmPreprocessor.js +509 -438
  48. package/lib/edm/edmUtils.js +31 -45
  49. package/lib/gen/Dictionary.json +98 -22
  50. package/lib/gen/language.checksum +1 -1
  51. package/lib/gen/language.interp +10 -30
  52. package/lib/gen/language.tokens +105 -114
  53. package/lib/gen/languageLexer.interp +1 -34
  54. package/lib/gen/languageLexer.js +889 -1007
  55. package/lib/gen/languageLexer.tokens +95 -106
  56. package/lib/gen/languageParser.js +20786 -22199
  57. package/lib/json/csnVersion.js +10 -11
  58. package/lib/json/from-csn.js +59 -51
  59. package/lib/json/to-csn.js +10 -10
  60. package/lib/language/antlrParser.js +2 -2
  61. package/lib/language/docCommentParser.js +62 -39
  62. package/lib/language/errorStrategy.js +52 -40
  63. package/lib/language/genericAntlrParser.js +348 -229
  64. package/lib/language/language.g4 +629 -653
  65. package/lib/language/multiLineStringParser.js +14 -42
  66. package/lib/language/textUtils.js +44 -0
  67. package/lib/main.d.ts +46 -43
  68. package/lib/main.js +108 -79
  69. package/lib/model/csnRefs.js +34 -7
  70. package/lib/model/csnUtils.js +337 -332
  71. package/lib/model/enrichCsn.js +1 -0
  72. package/lib/model/revealInternalProperties.js +30 -10
  73. package/lib/model/sortViews.js +32 -31
  74. package/lib/modelCompare/compare.js +6 -6
  75. package/lib/optionProcessor.js +73 -46
  76. package/lib/render/.eslintrc.json +1 -1
  77. package/lib/render/DuplicateChecker.js +4 -7
  78. package/lib/render/manageConstraints.js +70 -2
  79. package/lib/render/toCdl.js +1042 -882
  80. package/lib/render/toHdbcds.js +195 -245
  81. package/lib/render/toRename.js +44 -22
  82. package/lib/render/toSql.js +225 -241
  83. package/lib/render/utils/common.js +145 -15
  84. package/lib/render/utils/sql.js +20 -19
  85. package/lib/sql-identifier.js +6 -0
  86. package/lib/transform/db/.eslintrc.json +4 -3
  87. package/lib/transform/db/associations.js +2 -2
  88. package/lib/transform/db/cdsPersistence.js +5 -15
  89. package/lib/transform/db/constraints.js +4 -2
  90. package/lib/transform/db/expansion.js +22 -16
  91. package/lib/transform/db/flattening.js +109 -80
  92. package/lib/transform/db/transformExists.js +7 -7
  93. package/lib/transform/db/views.js +9 -6
  94. package/lib/transform/draft/.eslintrc.json +2 -2
  95. package/lib/transform/draft/db.js +6 -6
  96. package/lib/transform/draft/odata.js +6 -7
  97. package/lib/transform/forHanaNew.js +62 -48
  98. package/lib/transform/forOdataNew.js +49 -50
  99. package/lib/transform/localized.js +31 -20
  100. package/lib/transform/odata/toFinalBaseType.js +16 -14
  101. package/lib/transform/odata/typesExposure.js +146 -198
  102. package/lib/transform/odata/utils.js +1 -38
  103. package/lib/transform/transformUtilsNew.js +67 -84
  104. package/lib/transform/translateAssocsToJoins.js +7 -3
  105. package/lib/transform/universalCsn/.eslintrc.json +2 -2
  106. package/lib/transform/universalCsn/coreComputed.js +16 -9
  107. package/lib/transform/universalCsn/universalCsnEnricher.js +60 -10
  108. package/lib/utils/file.js +3 -3
  109. package/lib/utils/moduleResolve.js +13 -6
  110. package/lib/utils/timetrace.js +20 -21
  111. package/package.json +35 -4
  112. package/share/messages/message-explanations.json +2 -1
  113. package/share/messages/syntax-expected-integer.md +37 -0
  114. package/doc/ApiMigration.md +0 -237
  115. package/doc/CommandLineMigration.md +0 -58
  116. package/doc/ErrorMessages.md +0 -175
  117. package/doc/FioriAnnotations.md +0 -94
  118. package/doc/ODataTransformation.md +0 -273
  119. package/lib/backends.js +0 -529
  120. package/lib/fix_antlr4-8_warning.js +0 -56
  121. package/lib/transform/odata/attachPath.js +0 -96
  122. package/lib/transform/odata/expandStructKeysInAssociations.js +0 -59
  123. package/lib/transform/odata/generateForeignKeyElements.js +0 -261
  124. package/lib/transform/odata/referenceFlattener.js +0 -296
  125. package/lib/transform/odata/sortByAssociationDependency.js +0 -105
  126. package/lib/transform/odata/structuralPath.js +0 -72
  127. package/lib/transform/odata/structureFlattener.js +0 -171
@@ -8,12 +8,11 @@ Note: `beta` fixes, changes and features are listed in this ChangeLog just for i
8
8
  The compiler behavior concerning `beta` features can change at any time without notice.
9
9
  **Don't use `beta` fixes, changes and features in productive mode.**
10
10
 
11
- ## Version 2.XX.YY
11
+ ## Version 3.0.0 - 2022-XX-YY
12
12
 
13
- ### Removed `assocsWithParams`
13
+ ### Removed `addTextsLanguageAssoc`
14
14
 
15
- Instead, of using the beta flag `assocsWithParams`, you can change the severity of the messages
16
- `def-unexpected-paramview-assoc` and `def-unexpected-calcview-assoc`.
15
+ Instead, use the option `addTextsLanguageAssoc`, which is available since v2.8.0.
17
16
 
18
17
  ## Version 2.12.0 - 2022-01-25
19
18
 
@@ -11,7 +11,41 @@ Note: `deprecated` features are listed in this ChangeLog just for information.
11
11
  **When the `deprecated` option is set, the `beta` option is ignored,
12
12
  and several new features are not available.**
13
13
 
14
- ## Version 2.XX.YY - 2022-MM-DD
14
+ ## Version 3.0.0 - 2022-XX-YY
15
+
16
+ Version 3 of the cds-compiler removes all v2 deprecated flags.
17
+
18
+ ### Removed `createLocalizedViews`
19
+
20
+ ### Removed `downgradableErrors`
21
+
22
+ ### Removed `generatedEntityNameWithUnderscore`
23
+
24
+ ### Removed `longAutoexposed`
25
+
26
+ ### Removed `noElementsExpansion`
27
+
28
+ ### Removed `noInheritedAutoexposeViaComposition`
29
+
30
+ ### Removed `noScopedRedirections`
31
+
32
+ ### Removed `oldVirtualNotNullPropagation`
33
+
34
+ ### Removed `parensAsStrings`
35
+
36
+ ### Removed `projectionAsQuery`
37
+
38
+ ### Removed `redirectInSubQueries`
39
+
40
+ ### Removed `renderVirtualElements`
41
+
42
+ ### Removed `shortAutoexposed`
43
+
44
+ ### Removed `unmanagedUpInComponent`
45
+
46
+ ### Removed `v1KeysForTemporal`
47
+
48
+ ## Version 2.13.0 - 2022-03-22
15
49
 
16
50
  ### Added `redirectInSubQueries`
17
51
 
@@ -1,8 +1,10 @@
1
1
  # Deprecated Options and How to Avoid Them
2
2
 
3
+ __Important__: With compiler v3, these deprecated options were removed!
4
+
3
5
  To ease the migration to CDS Compiler Version 2,
4
6
  the compiler can be called with an option `deprecated`
5
- which make the compiler behave more like Compiler Version 1 for certain features.
7
+ which makes the compiler behave more like Compiler Version 1 for certain features.
6
8
 
7
9
  As the name suggest, this option should be used only for a limited time.
8
10
  The support for certain v1 features might also be dropped after a while
package/doc/Versioning.md CHANGED
@@ -5,6 +5,17 @@ The cds-compiler uses [Semantic Versioning][SemVer] for its version numbers.
5
5
  This document clarifies how we use [SemVer] and what you can and what you can‘t
6
6
  expect from version updates.
7
7
 
8
+ <!-- toc: start -->
9
+
10
+ 1. [Public API](#public-api)
11
+ 2. [Patch Versions](#patch-versions)
12
+ 3. [Minor Versions](#minor-versions)
13
+ 4. [Beta Flags](#beta-flags)
14
+ 5. [Deprecated Flags](#deprecated-flags)
15
+ 6. [Command Line Tool `cdsc`](#command-line-tool-cdsc)
16
+
17
+ <!-- toc: end -->
18
+
8
19
  ## Public API
9
20
 
10
21
  According to [§1] of SemVer, a public API must be made available. Our public
@@ -41,7 +52,7 @@ we detect invalid CDS code.
41
52
 
42
53
  ## Beta Flags
43
54
 
44
- The compiler provides so called “beta flags” that enable or disable certain
55
+ The compiler provides so-called “beta flags” that enable or disable certain
45
56
  features. We do not guarantee that any such flags stay consistent between
46
57
  patch versions! Beta flags may change any time.
47
58
 
@@ -57,6 +68,14 @@ period.
57
68
  Refer to [CHANGELOG_DEPRECATED.md](./CHANGELOG_DEPRECATED.md) for changes
58
69
  to deprecated flags.
59
70
 
71
+ ## Command Line Tool `cdsc`
72
+
73
+ `bin/cdsc.js` as well as all other command line tools do _not_ guarantee any
74
+ stability. It is considered a compiler internal tool that only serves for
75
+ debugging. The official command line tool `cds` of the `@sap/cds` and
76
+ `@sap/cds-dk` packages are to be used by users. That means commands and
77
+ options may change any time without prior notice. Changes may still be listed
78
+ in [CHANGELOG.md](../CHANGELOG.md).
60
79
 
61
80
  [SemVer]: https://semver.org/
62
81
  [§1]: https://semver.org/#spec-item-1
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "root": true,
3
3
  "env": {
4
- "es6": true,
4
+ "es2020": true,
5
5
  "node": true
6
6
  },
7
7
  // we actually do not extend airbnb-base, as it weakens some eslint:recommended rules
8
8
  "extends": ["../../.eslintrc-ydkjsi.json", "plugin:jsdoc/recommended"],
9
9
  "parserOptions": {
10
- "ecmaVersion": 2018,
10
+ "ecmaVersion": 2020,
11
11
  "sourceType": "script"
12
12
  },
13
13
  "plugins": [