@sap/cds-compiler 3.3.2 → 3.4.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 +21 -0
- package/bin/cdsc.js +3 -1
- package/doc/CHANGELOG_BETA.md +17 -0
- package/lib/api/main.js +147 -18
- package/lib/api/validate.js +8 -3
- package/lib/base/dictionaries.js +6 -6
- package/lib/base/keywords.js +104 -0
- package/lib/base/message-registry.js +136 -67
- package/lib/base/messages.js +59 -48
- package/lib/base/model.js +1 -0
- package/lib/checks/actionsFunctions.js +1 -1
- package/lib/checks/cdsPersistence.js +1 -1
- package/lib/checks/checkForTypes.js +13 -8
- package/lib/checks/defaultValues.js +3 -1
- package/lib/checks/elements.js +1 -1
- package/lib/checks/parameters.js +4 -2
- package/lib/checks/queryNoDbArtifacts.js +1 -1
- package/lib/checks/sql-snippets.js +12 -10
- package/lib/checks/validator.js +14 -4
- package/lib/compiler/assert-consistency.js +8 -7
- package/lib/compiler/checks.js +30 -20
- package/lib/compiler/define.js +89 -25
- package/lib/compiler/extend.js +21 -18
- package/lib/compiler/finalize-parse-cdl.js +14 -9
- package/lib/compiler/populate.js +30 -8
- package/lib/compiler/propagator.js +4 -2
- package/lib/compiler/resolve.js +11 -5
- package/lib/compiler/shared.js +66 -48
- package/lib/compiler/tweak-assocs.js +2 -3
- package/lib/compiler/utils.js +11 -0
- package/lib/edm/annotations/genericTranslation.js +7 -4
- package/lib/edm/csn2edm.js +1 -1
- package/lib/gen/language.checksum +1 -1
- package/lib/gen/language.interp +1 -1
- package/lib/gen/languageParser.js +3565 -3544
- package/lib/json/csnVersion.js +13 -13
- package/lib/json/from-csn.js +140 -158
- package/lib/json/to-csn.js +23 -5
- package/lib/language/.eslintrc.json +4 -0
- package/lib/language/antlrParser.js +7 -10
- package/lib/language/docCommentParser.js +1 -2
- package/lib/language/errorStrategy.js +54 -27
- package/lib/language/genericAntlrParser.js +115 -84
- package/lib/language/language.g4 +29 -25
- package/lib/language/multiLineStringParser.js +75 -63
- package/lib/main.js +1 -0
- package/lib/model/csnRefs.js +4 -3
- package/lib/model/csnUtils.js +39 -7
- package/lib/model/sortViews.js +7 -3
- package/lib/modelCompare/compare.js +49 -15
- package/lib/modelCompare/filter.js +83 -0
- package/lib/optionProcessor.js +5 -1
- package/lib/render/manageConstraints.js +9 -5
- package/lib/render/toCdl.js +120 -62
- package/lib/render/toHdbcds.js +1 -1
- package/lib/render/toSql.js +6 -2
- package/lib/render/utils/common.js +7 -0
- package/lib/sql-identifier.js +7 -0
- package/lib/transform/db/assertUnique.js +27 -38
- package/lib/transform/db/expansion.js +11 -4
- package/lib/transform/db/temporal.js +3 -1
- package/lib/transform/db/transformExists.js +7 -1
- package/lib/transform/db/views.js +42 -13
- package/lib/transform/draft/db.js +2 -2
- package/lib/transform/forRelationalDB.js +12 -6
- package/lib/transform/localized.js +1 -1
- package/lib/transform/odata/typesExposure.js +2 -1
- package/lib/transform/parseExpr.js +245 -0
- package/lib/transform/transformUtilsNew.js +23 -14
- package/lib/transform/translateAssocsToJoins.js +12 -12
- package/lib/utils/term.js +5 -5
- package/package.json +2 -2
- package/share/messages/message-explanations.json +1 -1
- package/share/messages/{syntax-expected-integer.md → syntax-expecting-integer.md} +1 -1
package/lib/json/csnVersion.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
+
// csn version functions
|
|
3
4
|
|
|
4
5
|
// The CSN file format version produced by this compiler
|
|
5
6
|
// (Note that all 0.x.x versions are floating targets, i.e. the format is frequently
|
|
@@ -18,15 +19,12 @@
|
|
|
18
19
|
// Use literal version constants intentionally and not number intervals to
|
|
19
20
|
// record all published version strings of the core compiler.
|
|
20
21
|
const newCSNVersions = [ '0.1.99', '0.2', '0.2.0', '1.0', '2.0' ];
|
|
21
|
-
|
|
22
|
-
//
|
|
22
|
+
|
|
23
|
+
// Check if new-style CSN is requested, i.e. versions >= 0.1.99
|
|
23
24
|
function isNewCSN(csn, options) {
|
|
24
|
-
|
|
25
|
+
return !( options?.newCsn === false ||
|
|
25
26
|
(csn.version && !newCSNVersions.includes(csn.version.csn)) ||
|
|
26
|
-
(csn.$version && !newCSNVersions.includes(csn.$version)))
|
|
27
|
-
return false;
|
|
28
|
-
|
|
29
|
-
return true;
|
|
27
|
+
(csn.$version && !newCSNVersions.includes(csn.$version)));
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
function checkCSNVersion(csn, options) {
|
|
@@ -35,11 +33,13 @@ function checkCSNVersion(csn, options) {
|
|
|
35
33
|
const { makeMessageFunction } = require('../base/messages');
|
|
36
34
|
const { error, throwWithAnyError } = makeMessageFunction(csn, options);
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
const version = csn.version?.csn ? csn.version.csn : (csn.$version || 'unknown');
|
|
37
|
+
const variant = options.newCsn !== undefined ? 'newCsn' : 'std';
|
|
38
|
+
error('api-unsupported-csn-version', null,
|
|
39
|
+
{ '#': variant, version, code: options.newCsn }, {
|
|
40
|
+
std: 'CSN version $(VERSION) not supported',
|
|
41
|
+
newCsn: 'CSN version $(VERSION) not supported; options.newCsn: $(CODE)',
|
|
42
|
+
});
|
|
43
43
|
throwWithAnyError();
|
|
44
44
|
}
|
|
45
45
|
}
|