@sap/cds-compiler 5.1.2 → 5.3.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 (68) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/bin/cdsc.js +7 -2
  3. package/bin/cdshi.js +24 -17
  4. package/bin/cdsse.js +17 -18
  5. package/doc/CHANGELOG_BETA.md +9 -4
  6. package/lib/api/main.js +19 -2
  7. package/lib/api/options.js +4 -1
  8. package/lib/api/validate.js +5 -0
  9. package/lib/base/builtins.js +1 -0
  10. package/lib/base/message-registry.js +40 -3
  11. package/lib/base/messages.js +1 -1
  12. package/lib/base/model.js +0 -11
  13. package/lib/checks/actionsFunctions.js +0 -12
  14. package/lib/checks/structuredAnnoExpressions.js +10 -14
  15. package/lib/compiler/assert-consistency.js +21 -13
  16. package/lib/compiler/builtins.js +2 -2
  17. package/lib/compiler/checks.js +25 -6
  18. package/lib/compiler/define.js +27 -31
  19. package/lib/compiler/extend.js +16 -18
  20. package/lib/compiler/generate.js +3 -3
  21. package/lib/compiler/populate.js +22 -16
  22. package/lib/compiler/propagator.js +3 -2
  23. package/lib/compiler/resolve.js +87 -94
  24. package/lib/compiler/shared.js +12 -13
  25. package/lib/compiler/tweak-assocs.js +390 -86
  26. package/lib/compiler/utils.js +41 -33
  27. package/lib/compiler/xpr-rewrite.js +45 -58
  28. package/lib/edm/annotations/genericTranslation.js +17 -13
  29. package/lib/edm/csn2edm.js +28 -4
  30. package/lib/edm/edm.js +68 -28
  31. package/lib/edm/edmInboundChecks.js +5 -8
  32. package/lib/edm/edmPreprocessor.js +66 -40
  33. package/lib/edm/edmUtils.js +1 -1
  34. package/lib/gen/BaseParser.js +778 -0
  35. package/lib/gen/CdlParser.js +4477 -0
  36. package/lib/gen/language.checksum +1 -1
  37. package/lib/gen/language.interp +1 -1
  38. package/lib/gen/languageParser.js +4072 -4024
  39. package/lib/inspect/inspectPropagation.js +1 -1
  40. package/lib/json/from-csn.js +5 -3
  41. package/lib/json/to-csn.js +7 -10
  42. package/lib/language/antlrParser.js +96 -0
  43. package/lib/language/errorStrategy.js +1 -1
  44. package/lib/language/genericAntlrParser.js +32 -4
  45. package/lib/language/multiLineStringParser.js +1 -1
  46. package/lib/main.d.ts +23 -0
  47. package/lib/model/cloneCsn.js +22 -13
  48. package/lib/model/csnUtils.js +2 -0
  49. package/lib/model/revealInternalProperties.js +2 -0
  50. package/lib/modelCompare/utils/filter.js +70 -42
  51. package/lib/optionProcessor.js +16 -10
  52. package/lib/parsers/AstBuildingParser.js +1290 -0
  53. package/lib/parsers/CdlGrammar.g4 +2013 -0
  54. package/lib/parsers/Lexer.js +249 -0
  55. package/lib/render/toCdl.js +46 -45
  56. package/lib/render/toSql.js +5 -5
  57. package/lib/transform/addTenantFields.js +4 -4
  58. package/lib/transform/db/applyTransformations.js +54 -16
  59. package/lib/transform/draft/odata.js +10 -11
  60. package/lib/transform/effective/flattening.js +10 -14
  61. package/lib/transform/forRelationalDB.js +7 -6
  62. package/lib/transform/odata/flattening.js +42 -31
  63. package/lib/transform/odata/toFinalBaseType.js +7 -6
  64. package/lib/transform/universalCsn/universalCsnEnricher.js +1 -0
  65. package/lib/utils/moduleResolve.js +1 -1
  66. package/package.json +2 -2
  67. package/share/messages/redirected-to-ambiguous.md +5 -4
  68. package/share/messages/redirected-to-complex.md +6 -3
@@ -38,6 +38,7 @@ optionProcessor
38
38
  .option(' --debug <id-list>')
39
39
  .option('-E, --enrich-csn')
40
40
  .option('-R, --raw-output <name>')
41
+ .option(' --new-parser')
41
42
  .option(' --internal-msg')
42
43
  .option(' --beta-mode')
43
44
  .option(' --beta <list>')
@@ -54,6 +55,7 @@ optionProcessor
54
55
  .option(' --default-binary-length <length>')
55
56
  .option(' --default-string-length <length>')
56
57
  .option(' --no-recompile')
58
+ .option(' --skip-name-check', { optionName: '$skipNameCheck' })
57
59
  .positionalArgument('<files...>')
58
60
  .help(`
59
61
  Usage: cdsc <command> [options] <files...>
@@ -113,6 +115,7 @@ optionProcessor
113
115
  with name = "+", write complete XSN, long!
114
116
  --tenant-discriminator Add tenant fields to entities
115
117
  --internal-msg Write raw messages with call stack to <stdout>/<stderr>
118
+ --new-parser Use the new CDL parser
116
119
  --beta-mode Enable all unsupported, incomplete (beta) features
117
120
  --beta <list> Comma separated list of unsupported, incomplete (beta) features to use.
118
121
  Valid values are:
@@ -150,6 +153,7 @@ optionProcessor
150
153
  to "sap.common.Languages" if it exists
151
154
  --localized-without-coalesce Omit coalesce in localized convenience views
152
155
  --no-recompile Don't recompile in case of internal errors
156
+ --skip-name-check Skip certain name checks, e.g. that there must be no '.' in element names.
153
157
 
154
158
  Commands
155
159
  H, toHana [options] <files...> Generate HANA CDS source files
@@ -166,7 +170,7 @@ optionProcessor
166
170
  manageConstraints [options] <files...> (internal) Generate ALTER TABLE statements to
167
171
  add / modify referential constraints.
168
172
  inspect [options] <files...> (internal) Inspect the given CDS files.
169
- toEffectiveCsn [options] <files...> (internal) Get an effective CSN; requires beta mode
173
+ forEffective [options] <files...> (internal) Get an effective CSN; requires beta mode
170
174
  forSeal [options] <files...> (internal) Get a SEAL CSN
171
175
 
172
176
  Environment variables
@@ -245,11 +249,12 @@ optionProcessor.command('O, toOdata')
245
249
  .option(' --odata-foreign-keys')
246
250
  .option(' --odata-v2-partial-constr')
247
251
  .option(' --odata-vocabularies <list>')
252
+ .option(' --odata-no-creator')
248
253
  .option('-c, --csn')
249
254
  .option('-f, --odata-format <format>', { valid: ['flat', 'structured'] })
250
255
  .option('-n, --sql-mapping <style>', { valid: ['plain', 'quoted', 'hdbcds'], aliases: [ '--names' ] })
251
256
  .option('-s, --service-names <list>')
252
- .option(' --fewer-localized-views')
257
+ .option(' --transitive-localized-views')
253
258
  .help(`
254
259
  Usage: cdsc toOdata [options] <files...>
255
260
 
@@ -278,6 +283,7 @@ optionProcessor.command('O, toOdata')
278
283
  (Not spec compliant and V2 only)
279
284
  --odata-vocabularies <list> JSON array of adhoc vocabulary definitions
280
285
  { prefix: { alias, ns, uri }, ... }
286
+ --odata-no-creator Omit creator identification in API
281
287
  -n, --sql-mapping <style> Annotate artifacts and elements with "@cds.persistence.name", which is
282
288
  the corresponding database name (see "--sql-mapping" for "toHana or "toSql")
283
289
  plain : (default) Names in uppercase and flattened with underscores
@@ -287,7 +293,7 @@ optionProcessor.command('O, toOdata')
287
293
  source (like "quoted", but using element names with dots)
288
294
  -s, --service-names <list> List of comma-separated service names to be rendered
289
295
  (default) empty, all services are rendered
290
- --fewer-localized-views If set, the backends will not create localized convenience views for
296
+ --transitive-localized-views If set, the backends will create localized convenience views for
291
297
  those views, that only have an association to a localized entity/view.
292
298
  `);
293
299
 
@@ -332,7 +338,7 @@ optionProcessor.command('Q, toSql')
332
338
  .option(' --disable-hana-comments')
333
339
  .option(' --generated-by-comment')
334
340
  .option(' --better-sqlite-session-variables <bool>')
335
- .option(' --fewer-localized-views')
341
+ .option(' --transitive-localized-views')
336
342
  .option(' --with-hana-associations <bool>', { valid: [ 'true', 'false' ] })
337
343
  .help(`
338
344
  Usage: cdsc toSql [options] <files...>
@@ -390,7 +396,7 @@ optionProcessor.command('Q, toSql')
390
396
  active if sqlDialect is \`sqlite\`:
391
397
  true : (default) Render better-sqlite session_context(…)
392
398
  false : Render session variables as string literals, used e.g. with sqlite3 driver
393
- --fewer-localized-views If set, the backends will not create localized convenience views for
399
+ --transitive-localized-views If set, the backends will create localized convenience views for
394
400
  those views, that only have an association to a localized entity/view.
395
401
  --with-hana-associations <bool>
396
402
  Enable and disable rendering of "WITH ASSOCIATIONS" for sqlDialect 'hana'.
@@ -472,7 +478,7 @@ optionProcessor.command('toCsn')
472
478
  .option(' --with-localized')
473
479
  .option(' --with-locations')
474
480
  .option(' --struct-xpr')
475
- .option(' --fewer-localized-views')
481
+ .option(' --transitive-localized-views')
476
482
  .help(`
477
483
  Usage: cdsc toCsn [options] <files...>
478
484
 
@@ -489,8 +495,8 @@ optionProcessor.command('toCsn')
489
495
  universal: in development (BETA)
490
496
  --with-locations Add $location to CSN artifacts. In contrast to \`--enrich-csn\`,
491
497
  $location is an object with 'file', 'line' and 'col' properties.
492
- --fewer-localized-views If --with-locations and this option are set, the backends
493
- will not create localized convenience views for those views,
498
+ --transitive-localized-views If --with-locations and this option are set, the backends
499
+ will create localized convenience views for those views,
494
500
  that only have an association to a localized entity/view.
495
501
 
496
502
  Internal options (for testing only, may be changed/removed at any time)
@@ -564,7 +570,7 @@ optionProcessor.command('inspect')
564
570
  --propagation <art> Show propagation sources for <art>
565
571
  `);
566
572
 
567
- optionProcessor.command('toEffectiveCsn')
573
+ optionProcessor.command('forEffective')
568
574
  .option('-h, --help')
569
575
  .option('--resolve-simple-types <val>', { valid: ['true', 'false'] } )
570
576
  .option('--resolve-projections <val>', { valid: ['true', 'false'] } )
@@ -572,7 +578,7 @@ optionProcessor.command('toEffectiveCsn')
572
578
  .option('--keep-localized <val>', { valid: ['true', 'false'] } )
573
579
  .positionalArgument('<files...>')
574
580
  .help(`
575
- Usage: cdsc toEffectiveCsn [options] <files...>
581
+ Usage: cdsc forEffective [options] <files...>
576
582
 
577
583
  (internal): Get the effective CSN model compiled from the provided CDS files.
578
584
  This command may change any time, including its name.