@sap/cds-compiler 3.8.0 → 3.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 (79) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/bin/cdsc.js +2 -2
  3. package/doc/CHANGELOG_BETA.md +26 -5
  4. package/lib/api/.eslintrc.json +3 -2
  5. package/lib/api/options.js +3 -1
  6. package/lib/api/validate.js +1 -1
  7. package/lib/base/message-registry.js +27 -18
  8. package/lib/base/messages.js +6 -1
  9. package/lib/base/model.js +2 -2
  10. package/lib/checks/.eslintrc.json +1 -0
  11. package/lib/checks/actionsFunctions.js +6 -6
  12. package/lib/checks/annotationsOData.js +1 -1
  13. package/lib/checks/elements.js +28 -17
  14. package/lib/checks/foreignKeys.js +1 -1
  15. package/lib/checks/invalidTarget.js +1 -1
  16. package/lib/checks/onConditions.js +11 -6
  17. package/lib/checks/queryNoDbArtifacts.js +1 -1
  18. package/lib/checks/types.js +1 -1
  19. package/lib/checks/utils.js +1 -1
  20. package/lib/checks/validator.js +3 -2
  21. package/lib/compiler/assert-consistency.js +8 -3
  22. package/lib/compiler/base.js +19 -13
  23. package/lib/compiler/builtins.js +7 -0
  24. package/lib/compiler/checks.js +73 -6
  25. package/lib/compiler/define.js +10 -5
  26. package/lib/compiler/extend.js +924 -1709
  27. package/lib/compiler/finalize-parse-cdl.js +1 -1
  28. package/lib/compiler/generate.js +838 -0
  29. package/lib/compiler/index.js +2 -0
  30. package/lib/compiler/populate.js +2 -2
  31. package/lib/compiler/propagator.js +20 -8
  32. package/lib/compiler/resolve.js +3 -3
  33. package/lib/compiler/shared.js +11 -6
  34. package/lib/edm/annotations/genericTranslation.js +6 -6
  35. package/lib/edm/csn2edm.js +1 -1
  36. package/lib/edm/edm.js +25 -11
  37. package/lib/edm/edmPreprocessor.js +47 -23
  38. package/lib/edm/edmUtils.js +37 -9
  39. package/lib/gen/Dictionary.json +5 -7
  40. package/lib/gen/language.checksum +1 -1
  41. package/lib/gen/language.interp +3 -1
  42. package/lib/gen/language.tokens +24 -23
  43. package/lib/gen/languageLexer.interp +4 -1
  44. package/lib/gen/languageLexer.js +792 -784
  45. package/lib/gen/languageLexer.tokens +12 -11
  46. package/lib/gen/languageParser.js +3944 -3865
  47. package/lib/json/from-csn.js +27 -6
  48. package/lib/json/to-csn.js +10 -6
  49. package/lib/language/antlrParser.js +11 -3
  50. package/lib/language/genericAntlrParser.js +4 -2
  51. package/lib/language/language.g4 +32 -24
  52. package/lib/model/csnRefs.js +15 -7
  53. package/lib/model/csnUtils.js +41 -76
  54. package/lib/modelCompare/utils/.eslintrc.json +1 -1
  55. package/lib/optionProcessor.js +7 -4
  56. package/lib/render/.eslintrc.json +1 -1
  57. package/lib/render/toCdl.js +244 -168
  58. package/lib/render/toHdbcds.js +18 -10
  59. package/lib/render/toSql.js +24 -2
  60. package/lib/transform/db/.eslintrc.json +4 -3
  61. package/lib/transform/db/cdsPersistence.js +1 -1
  62. package/lib/transform/db/expansion.js +11 -6
  63. package/lib/transform/db/flattening.js +22 -15
  64. package/lib/transform/db/rewriteCalculatedElements.js +50 -29
  65. package/lib/transform/db/temporal.js +1 -1
  66. package/lib/transform/db/views.js +1 -1
  67. package/lib/transform/draft/db.js +1 -1
  68. package/lib/transform/draft/odata.js +3 -4
  69. package/lib/transform/forOdataNew.js +5 -6
  70. package/lib/transform/forRelationalDB.js +7 -7
  71. package/lib/transform/odata/toFinalBaseType.js +6 -6
  72. package/lib/transform/odata/typesExposure.js +12 -3
  73. package/lib/transform/odata/utils.js +3 -0
  74. package/lib/transform/transformUtilsNew.js +11 -26
  75. package/lib/transform/translateAssocsToJoins.js +9 -9
  76. package/lib/transform/universalCsn/.eslintrc.json +3 -2
  77. package/lib/transform/universalCsn/coreComputed.js +1 -1
  78. package/lib/transform/universalCsn/universalCsnEnricher.js +6 -4
  79. package/package.json +1 -1
@@ -17,6 +17,6 @@
17
17
  "no-shadow": "warn"
18
18
  },
19
19
  "env": {
20
- "es2020": true
20
+ "es2022": true
21
21
  }
22
22
  }
@@ -108,7 +108,6 @@ optionProcessor
108
108
  enableUniversalCsn
109
109
  postgres
110
110
  aspectWithoutElements
111
- odataOpenType
112
111
  odataTerms
113
112
  optionalActionFunctionParameters
114
113
  --deprecated <list> Comma separated list of deprecated options.
@@ -222,11 +221,12 @@ optionProcessor.command('O, toOdata')
222
221
  .option('-j, --json')
223
222
  .option(' --odata-containment')
224
223
  .option(' --odata-capabilities-pullup')
224
+ .option(' --odata-openapi-hints')
225
225
  .option(' --odata-proxies')
226
226
  .option(' --odata-x-service-refs')
227
227
  .option(' --odata-foreign-keys')
228
228
  .option(' --odata-v2-partial-constr')
229
- .option(' --odata-voc-refs <list>')
229
+ .option(' --odata-vocabularies <list>')
230
230
  .option('-c, --csn')
231
231
  .option('-f, --odata-format <format>', ['flat', 'structured'])
232
232
  .option('-n, --sql-mapping <style>', ['plain', 'quoted', 'hdbcds'], { aliases: [ '--names' ] })
@@ -250,13 +250,14 @@ optionProcessor.command('O, toOdata')
250
250
  structured : (V4 only) Render structured metadata
251
251
  --odata-containment Generate Containment Navigation Properties for compositions (V4 only)
252
252
  --odata-capabilities-pullup Rewrite @Capabilities annotations (V4 containment only).
253
+ --odata-openapi-hints Add various annotations to JSON API as input for OpenAPI generation.
253
254
  --odata-proxies Generate Proxies for out-of-service navigation targets (V4 only).
254
255
  --odata-x-service-refs Generate schema references (V4 only).
255
256
  --odata-foreign-keys Render foreign keys in structured format (V4 only)
256
257
  --odata-v2-partial-constr Render referential constraints also for partial principal key tuple
257
258
  (Not spec compliant and V2 only)
258
- --odata-voc-refs <list> JSON array of adhoc vocabulary definitions
259
- [ { alias, ns, uri }, ... ]
259
+ --odata-vocabularies <list> JSON array of adhoc vocabulary definitions
260
+ { prefix: { alias, ns, uri }, ... }
260
261
  -n, --sql-mapping <style> Annotate artifacts and elements with "@cds.persistence.name", which is
261
262
  the corresponding database name (see "--sql-mapping" for "toHana or "toSql")
262
263
  plain : (default) Names in uppercase and flattened with underscores
@@ -297,6 +298,7 @@ optionProcessor.command('Q, toSql')
297
298
  .option(' --pre2134ReferentialConstraintNames')
298
299
  .option(' --disable-hana-comments')
299
300
  .option(' --generated-by-comment')
301
+ .option(' --better-sqlite-session-variables')
300
302
  .help(`
301
303
  Usage: cdsc toSql [options] <files...>
302
304
 
@@ -348,6 +350,7 @@ optionProcessor.command('Q, toSql')
348
350
  --pre2134ReferentialConstraintNames Do not prefix the constraint identifier with "c__"
349
351
  --disable-hana-comments Disable rendering of doc comments as SAP HANA comments.
350
352
  --generated-by-comment Enable rendering of the initial SQL comment for HDI-based artifacts
353
+ --better-sqlite-session-variables Enable better-sqlite compatible rendering of $user. Only active if sqlDialect is \`sqlite\`
351
354
 
352
355
  `);
353
356
 
@@ -17,6 +17,6 @@
17
17
  "no-shadow": "warn"
18
18
  },
19
19
  "env": {
20
- "es2020": true
20
+ "es2022": true
21
21
  }
22
22
  }