@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.
- package/CHANGELOG.md +58 -0
- package/bin/cdsc.js +7 -2
- package/bin/cdshi.js +24 -17
- package/bin/cdsse.js +17 -18
- package/doc/CHANGELOG_BETA.md +9 -4
- package/lib/api/main.js +19 -2
- package/lib/api/options.js +4 -1
- package/lib/api/validate.js +5 -0
- package/lib/base/builtins.js +1 -0
- package/lib/base/message-registry.js +40 -3
- package/lib/base/messages.js +1 -1
- package/lib/base/model.js +0 -11
- package/lib/checks/actionsFunctions.js +0 -12
- package/lib/checks/structuredAnnoExpressions.js +10 -14
- package/lib/compiler/assert-consistency.js +21 -13
- package/lib/compiler/builtins.js +2 -2
- package/lib/compiler/checks.js +25 -6
- package/lib/compiler/define.js +27 -31
- package/lib/compiler/extend.js +16 -18
- package/lib/compiler/generate.js +3 -3
- package/lib/compiler/populate.js +22 -16
- package/lib/compiler/propagator.js +3 -2
- package/lib/compiler/resolve.js +87 -94
- package/lib/compiler/shared.js +12 -13
- package/lib/compiler/tweak-assocs.js +390 -86
- package/lib/compiler/utils.js +41 -33
- package/lib/compiler/xpr-rewrite.js +45 -58
- package/lib/edm/annotations/genericTranslation.js +17 -13
- package/lib/edm/csn2edm.js +28 -4
- package/lib/edm/edm.js +68 -28
- package/lib/edm/edmInboundChecks.js +5 -8
- package/lib/edm/edmPreprocessor.js +66 -40
- package/lib/edm/edmUtils.js +1 -1
- package/lib/gen/BaseParser.js +778 -0
- package/lib/gen/CdlParser.js +4477 -0
- package/lib/gen/language.checksum +1 -1
- package/lib/gen/language.interp +1 -1
- package/lib/gen/languageParser.js +4072 -4024
- package/lib/inspect/inspectPropagation.js +1 -1
- package/lib/json/from-csn.js +5 -3
- package/lib/json/to-csn.js +7 -10
- package/lib/language/antlrParser.js +96 -0
- package/lib/language/errorStrategy.js +1 -1
- package/lib/language/genericAntlrParser.js +32 -4
- package/lib/language/multiLineStringParser.js +1 -1
- package/lib/main.d.ts +23 -0
- package/lib/model/cloneCsn.js +22 -13
- package/lib/model/csnUtils.js +2 -0
- package/lib/model/revealInternalProperties.js +2 -0
- package/lib/modelCompare/utils/filter.js +70 -42
- package/lib/optionProcessor.js +16 -10
- package/lib/parsers/AstBuildingParser.js +1290 -0
- package/lib/parsers/CdlGrammar.g4 +2013 -0
- package/lib/parsers/Lexer.js +249 -0
- package/lib/render/toCdl.js +46 -45
- package/lib/render/toSql.js +5 -5
- package/lib/transform/addTenantFields.js +4 -4
- package/lib/transform/db/applyTransformations.js +54 -16
- package/lib/transform/draft/odata.js +10 -11
- package/lib/transform/effective/flattening.js +10 -14
- package/lib/transform/forRelationalDB.js +7 -6
- package/lib/transform/odata/flattening.js +42 -31
- package/lib/transform/odata/toFinalBaseType.js +7 -6
- package/lib/transform/universalCsn/universalCsnEnricher.js +1 -0
- package/lib/utils/moduleResolve.js +1 -1
- package/package.json +2 -2
- package/share/messages/redirected-to-ambiguous.md +5 -4
- package/share/messages/redirected-to-complex.md +6 -3
package/lib/optionProcessor.js
CHANGED
|
@@ -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
|
-
|
|
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(' --
|
|
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
|
-
--
|
|
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(' --
|
|
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
|
-
--
|
|
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(' --
|
|
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
|
-
--
|
|
493
|
-
will
|
|
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('
|
|
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
|
|
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.
|