@sap/cds-dk 6.5.2 → 6.6.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 +24 -0
- package/bin/activate.js +7 -0
- package/bin/add.js +1 -2
- package/bin/build/all.js +14 -9
- package/bin/cds.js +11 -8
- package/bin/compile/index.js +13 -3
- package/bin/env.js +16 -25
- package/bin/extend.js +8 -0
- package/bin/init.js +0 -3
- package/bin/login.js +3 -7
- package/bin/logout.js +2 -7
- package/bin/watch.js +4 -5
- package/lib/client/activate.js +1 -1
- package/lib/client/helper/errors.js +2 -1
- package/lib/client/params.js +4 -3
- package/lib/client/pull.js +31 -5
- package/lib/client/push.js +3 -3
- package/lib/client/settings_manager.js +6 -6
- package/lib/client/subscription.js +1 -1
- package/lib/compile/asyncapi/channels.js +22 -0
- package/lib/compile/asyncapi/components/messageTraits/index.js +89 -0
- package/lib/compile/asyncapi/components/messages/index.js +150 -0
- package/lib/compile/asyncapi/components/schemas/annotations.js +13 -0
- package/lib/compile/asyncapi/components/schemas/array.js +8 -0
- package/lib/compile/asyncapi/components/schemas/cache.js +14 -0
- package/lib/compile/asyncapi/components/schemas/definition.js +187 -0
- package/lib/compile/asyncapi/components/schemas/enum.js +16 -0
- package/lib/compile/asyncapi/components/schemas/examples.js +10 -0
- package/lib/compile/asyncapi/components/schemas/index.js +14 -0
- package/lib/compile/asyncapi/components/schemas/localized.js +29 -0
- package/lib/compile/asyncapi/components/schemas/primitiveElement.js +41 -0
- package/lib/compile/asyncapi/components/schemas/ref.js +45 -0
- package/lib/compile/asyncapi/components/schemas/utils.js +108 -0
- package/lib/compile/asyncapi/index.js +226 -0
- package/lib/compile/asyncapi/message.js +13 -0
- package/lib/compile/asyncapi/utils.js +27 -0
- package/lib/compile/index.js +1 -0
- package/lib/compile/openapi/csdl2openapi.js +40 -18
- package/lib/import/message.js +3 -1
- package/lib/import/odata/metadataconverter/MetadataConverter.js +1 -1
- package/lib/import/odata/v2parser.js +131 -50
- package/lib/import/odata/v4parser.js +160 -68
- package/lib/import/openapi/importOpenAPI.js +14 -14
- package/lib/init/constants.js +1 -1
- package/lib/init/index.js +11 -21
- package/lib/init/template/_merging/registry-mta.js +15 -26
- package/lib/init/template/approuter/files/package.json +2 -2
- package/lib/init/template/approuter/index.js +6 -12
- package/lib/init/template/auditlog/files/auditlog.yaml +4 -1
- package/lib/init/template/auditlog/index.js +23 -8
- package/lib/init/template/cf-manifest/index.js +4 -14
- package/lib/init/template/connectivity/files/connectivity-proxy-info.yaml +2 -6
- package/lib/init/template/connectivity/files/values.yaml.hbs +5 -8
- package/lib/init/template/connectivity/index.js +2 -9
- package/lib/init/template/data/index.js +0 -4
- package/lib/init/template/destinations/files/destination.yaml +4 -1
- package/lib/init/template/destinations/index.js +25 -10
- package/lib/init/template/enterprise-messaging/files/event-mesh.yaml +4 -1
- package/lib/init/template/enterprise-messaging/files/values.yaml +1 -2
- package/lib/init/template/enterprise-messaging/index.js +28 -20
- package/lib/init/template/extensibility/index.js +23 -31
- package/lib/init/template/hana/files/hana.yaml +4 -1
- package/lib/init/template/hana/index.js +44 -24
- package/lib/init/template/helm/chart/templates/_helpers.tpl +12 -0
- package/lib/init/template/helm/chart/values.root.schema.json +40 -0
- package/lib/init/template/helm/chart/values.schema.json +32 -69
- package/lib/init/template/helm/index.js +26 -16
- package/lib/init/template/helm/subcharts/content-deployment/templates/_helpers.tpl +13 -26
- package/lib/init/template/helm/subcharts/content-deployment/templates/job.yaml +3 -3
- package/lib/init/template/helm/subcharts/content-deployment/templates/service-account.yaml +2 -0
- package/lib/init/template/helm/subcharts/content-deployment/templates/service-binding.yaml +3 -3
- package/lib/init/template/helm/subcharts/content-deployment/templating.md +37 -0
- package/lib/init/template/helm/subcharts/content-deployment/values.md +182 -185
- package/lib/init/template/helm/subcharts/content-deployment/values.schema.json +18 -22
- package/lib/init/template/helm/subcharts/content-deployment/values.yaml +2 -0
- package/lib/init/template/helm/subcharts/service-instance/Chart.yaml +5 -0
- package/lib/init/template/helm/subcharts/service-instance/templates/_helpers.tpl +65 -0
- package/lib/init/template/helm/subcharts/service-instance/templates/serviceinstance.yaml +23 -0
- package/lib/init/template/helm/subcharts/service-instance/templating.md +18 -0
- package/lib/init/template/helm/subcharts/service-instance/values-lint.yaml +2 -0
- package/lib/init/template/helm/subcharts/service-instance/values.md +186 -0
- package/lib/init/template/helm/subcharts/service-instance/values.schema.json +102 -0
- package/lib/init/template/helm/subcharts/service-instance/values.yaml +15 -0
- package/lib/init/template/html5-repo/files/html5-apps-repo-host.yaml +4 -1
- package/lib/init/template/html5-repo/index.js +30 -21
- package/lib/init/template/java/index.js +2 -5
- package/lib/init/template/kibana-logging/index.js +7 -10
- package/lib/init/template/lint/index.js +2 -3
- package/lib/init/template/mta/files/mta.yaml.hbs +4 -2
- package/lib/init/template/mta/index.js +7 -11
- package/lib/init/template/mtx/index.js +0 -5
- package/lib/init/template/multitenancy/files/java/package.json +16 -7
- package/lib/init/template/multitenancy/files/mta.yaml.hbs +11 -3
- package/lib/init/template/multitenancy/files/saas-registry-secret.yaml +9 -0
- package/lib/init/template/multitenancy/files/saas-registry.yaml +4 -17
- package/lib/init/template/multitenancy/files/service-manager.yaml +4 -1
- package/lib/init/template/multitenancy/files/values.yaml.hbs +15 -3
- package/lib/init/template/multitenancy/index.js +56 -31
- package/lib/init/template/nodejs/index.js +4 -7
- package/lib/init/template/notebook/index.js +1 -3
- package/lib/init/template/pipeline/index.js +2 -5
- package/lib/init/template/samples/index.js +6 -11
- package/lib/init/template/templateBase.js +10 -17
- package/lib/init/template/toggles/index.js +2 -6
- package/lib/init/template/xsuaa/files/values.yaml.hbs +0 -1
- package/lib/init/template/xsuaa/files/xsuaa.yaml +4 -1
- package/lib/init/template/xsuaa/index.js +27 -23
- package/lib/init/types.d.ts +0 -81
- package/lib/init/util/merge.js +23 -25
- package/lib/init/util/projectReader.js +27 -24
- package/lib/lint/Linter.js +31 -13
- package/lib/watch/livereload-server.js +21 -14
- package/lib/watch/node-watch.js +51 -49
- package/npm-shrinkwrap.json +551 -458
- package/package.json +2 -2
- package/readme.md +5 -0
- package/lib/init/template/connectivity/files/connectivity-binding.yaml +0 -9
- package/lib/init/template/connectivity/files/connectivity.yaml +0 -1
- package/lib/init/template/multitenancy/files/xsuaa.yaml +0 -1
- /package/lib/init/template/hana/files/{chart.yaml → hana-deployer.yaml} +0 -0
- /package/lib/init/template/html5-repo/files/{chart.yaml → html5-apps-deployer.yaml} +0 -0
- /package/lib/init/template/multitenancy/files/{chart.yaml → sidecar.yaml} +0 -0
|
@@ -9,7 +9,7 @@ let common = require("../common");
|
|
|
9
9
|
let versionInfo = require('../../../package.json').version;
|
|
10
10
|
const { warn } = require('../../util/term');
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const edmxncdsdatatype = {
|
|
13
13
|
"Edm.String": "cds.LargeString",
|
|
14
14
|
"Edm.Boolean": "cds.Boolean",
|
|
15
15
|
"Edm.Int16": "cds.Integer",
|
|
@@ -39,6 +39,26 @@ let edmxncdsdatatype = {
|
|
|
39
39
|
"Edm.DateTime_a": "cds.Timestamp" //precision > 0
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
const extendedPrimitiveTypes = [
|
|
43
|
+
"Edm.Duration",
|
|
44
|
+
"Edm.Geography",
|
|
45
|
+
"Edm.GeographyPoint",
|
|
46
|
+
"Edm.GeographyLineString",
|
|
47
|
+
"Edm.GeographyPolygon",
|
|
48
|
+
"Edm.GeographyMultiPoint",
|
|
49
|
+
"Edm.GeographyMultiLineString",
|
|
50
|
+
"Edm.GeographyMultiPolygon",
|
|
51
|
+
"Edm.GeographyCollection",
|
|
52
|
+
"Edm.Geometry",
|
|
53
|
+
"Edm.GeometryPoint",
|
|
54
|
+
"Edm.GeometryLineString",
|
|
55
|
+
"Edm.GeometryPolygon",
|
|
56
|
+
"Edm.GeometryMultiPoint",
|
|
57
|
+
"Edm.GeometryMultiLineString",
|
|
58
|
+
"Edm.GeometryMultiPolygon",
|
|
59
|
+
"Edm.GeometryCollection"
|
|
60
|
+
];
|
|
61
|
+
|
|
42
62
|
function _initialize(parserContext) {
|
|
43
63
|
parserContext.serviceNamespace = "";
|
|
44
64
|
parserContext.allEntities = [];
|
|
@@ -54,7 +74,7 @@ function _initialize(parserContext) {
|
|
|
54
74
|
parserContext.allComplexTypeDocs = {};
|
|
55
75
|
parserContext.allComplexTypeNamespaces = {};
|
|
56
76
|
parserContext.allInheritedComplexTypes = {};
|
|
57
|
-
parserContext.allInheritedEntityTypes =
|
|
77
|
+
parserContext.allInheritedEntityTypes = [];
|
|
58
78
|
parserContext.allowedNamespaces = [];
|
|
59
79
|
parserContext.allowAllNamespaces = false;
|
|
60
80
|
}
|
|
@@ -380,6 +400,7 @@ function _getServiceEntityProperty(
|
|
|
380
400
|
documentation,
|
|
381
401
|
allowedNamespaceAttributes = -1,
|
|
382
402
|
nullable,
|
|
403
|
+
defaultValue,
|
|
383
404
|
collectionKind,
|
|
384
405
|
parserContext
|
|
385
406
|
) {
|
|
@@ -441,14 +462,16 @@ function _getServiceEntityProperty(
|
|
|
441
462
|
cdsDataType = dataType;
|
|
442
463
|
}
|
|
443
464
|
|
|
465
|
+
let hasCdsTypeMapping = false;
|
|
466
|
+
if (extendedPrimitiveTypes.includes(dataType)) {
|
|
467
|
+
cdsDataType = dataType;
|
|
468
|
+
hasCdsTypeMapping = true;
|
|
469
|
+
}
|
|
470
|
+
|
|
444
471
|
//if the cdsDataType is undefined/ not supported
|
|
445
472
|
if (cdsDataType === undefined) {
|
|
446
|
-
let message = '"' + dataType + '" is not supported';
|
|
447
473
|
if (propertyName)
|
|
448
|
-
|
|
449
|
-
else
|
|
450
|
-
message += ' (in return type)'
|
|
451
|
-
console.log(warn(message));
|
|
474
|
+
console.log(warn('"' + dataType + '" is not supported (in element:"' + propertyName + '")'));
|
|
452
475
|
return "";
|
|
453
476
|
}
|
|
454
477
|
|
|
@@ -473,10 +496,15 @@ function _getServiceEntityProperty(
|
|
|
473
496
|
propertyJson = propertyJson + '"@odata.Precision": ' + precision + ',\n';
|
|
474
497
|
}
|
|
475
498
|
}
|
|
499
|
+
if (hasCdsTypeMapping) {
|
|
500
|
+
propertyJson = propertyJson + '"@odata.Type": "' + dataType + '"';
|
|
501
|
+
propertyJson = propertyJson + ',\n"items": { \n'
|
|
502
|
+
propertyJson = propertyJson + '"type": "cds.String"';
|
|
503
|
+
} else {
|
|
504
|
+
propertyJson = propertyJson + '"items": { \n'
|
|
505
|
+
propertyJson = propertyJson + '"type":"' + cdsDataType + '"';
|
|
506
|
+
}
|
|
476
507
|
|
|
477
|
-
propertyJson = propertyJson + '"items": { \n'
|
|
478
|
-
propertyJson = propertyJson + '"type":"' + cdsDataType + '"';
|
|
479
|
-
|
|
480
508
|
if (length && length > 0) {
|
|
481
509
|
propertyJson = propertyJson + ',\n"length":' + length;
|
|
482
510
|
} else if (precision && precision > 0 && hasInvalidPrecision === false) {
|
|
@@ -492,8 +520,13 @@ function _getServiceEntityProperty(
|
|
|
492
520
|
propertyJson = propertyJson + '\n}'
|
|
493
521
|
}
|
|
494
522
|
else {
|
|
495
|
-
|
|
496
|
-
|
|
523
|
+
if (hasCdsTypeMapping) {
|
|
524
|
+
propertyJson = propertyJson + '"type": "cds.String"';
|
|
525
|
+
propertyJson = propertyJson + ',\n"@odata.Type": "' + dataType + '"';
|
|
526
|
+
} else {
|
|
527
|
+
propertyJson = propertyJson + '"type":"' + cdsDataType + '"';
|
|
528
|
+
}
|
|
529
|
+
// if annotations to be added
|
|
497
530
|
if (edmxncdsdatatype[dataType + "_a"] && cdsDataType != "cds.Date") {
|
|
498
531
|
if (dataType === 'Edm.Stream')
|
|
499
532
|
propertyJson = propertyJson + ',\n"@Core.MediaType": "application/octet-stream"';
|
|
@@ -501,7 +534,7 @@ function _getServiceEntityProperty(
|
|
|
501
534
|
propertyJson = propertyJson + ',\n"@odata.Type": "' + dataType + '"';
|
|
502
535
|
}
|
|
503
536
|
|
|
504
|
-
if (length && length > 0) {
|
|
537
|
+
if (length && length > 0 && !hasCdsTypeMapping) {
|
|
505
538
|
propertyJson = propertyJson + ',\n"length":' + length;
|
|
506
539
|
} else if (precision && precision > 0 && hasInvalidPrecision === false) {
|
|
507
540
|
propertyJson = propertyJson + ',\n"precision":' + precision;
|
|
@@ -513,7 +546,7 @@ function _getServiceEntityProperty(
|
|
|
513
546
|
}
|
|
514
547
|
|
|
515
548
|
//adding precision in case of DateTime datatypes
|
|
516
|
-
if ((dataType === "Edm.DateTimeOffset" || dataType === "Edm.DateTime") && cdsDataType
|
|
549
|
+
if ((dataType === "Edm.DateTimeOffset" || dataType === "Edm.DateTime") && cdsDataType !== "cds.Date" && !hasCdsTypeMapping) {
|
|
517
550
|
if (precision && precision > 0){
|
|
518
551
|
propertyJson = propertyJson + ',\n"@odata.Precision": ' + precision;
|
|
519
552
|
}
|
|
@@ -532,6 +565,10 @@ function _getServiceEntityProperty(
|
|
|
532
565
|
propertyJson = propertyJson + ',\n"notNull": true';
|
|
533
566
|
}
|
|
534
567
|
|
|
568
|
+
if (defaultValue !== -1 && defaultValue) {
|
|
569
|
+
propertyJson = propertyJson + ', \n"default": {\n"val": "' + defaultValue + '"\n}';
|
|
570
|
+
}
|
|
571
|
+
|
|
535
572
|
if (propertyName)
|
|
536
573
|
propertyJson = propertyJson + "\n}";
|
|
537
574
|
return propertyJson;
|
|
@@ -542,7 +579,7 @@ function _getServiceComplexType(complexTypeKey, complexType, parserContext, isOp
|
|
|
542
579
|
let complexTypeProperty;
|
|
543
580
|
complexTypeCSN = complexTypeCSN + '"kind": "type",\n';
|
|
544
581
|
// checking if the ComplexType is marked open or acts as a BaseType
|
|
545
|
-
if (isOpenType
|
|
582
|
+
if (isOpenType || Object.values(parserContext.allInheritedComplexTypes).indexOf(complexTypeKey) > -1) {
|
|
546
583
|
complexTypeCSN = complexTypeCSN + '"@open": true,\n';
|
|
547
584
|
}
|
|
548
585
|
complexTypeCSN = complexTypeCSN + '"@cds.external": true,\n';
|
|
@@ -564,7 +601,7 @@ function _getServiceComplexType(complexTypeKey, complexType, parserContext, isOp
|
|
|
564
601
|
complexType.CollectionKind = 1;
|
|
565
602
|
}
|
|
566
603
|
let namespaceAttributes = namespaceAttributeFilter(complexTypeProperty, parserContext);
|
|
567
|
-
const complexTypePropertyNamespace = namespaceAttributes.length ? namespaceAttributes : -1
|
|
604
|
+
const complexTypePropertyNamespace = namespaceAttributes.length ? namespaceAttributes : -1;
|
|
568
605
|
|
|
569
606
|
let complexProperty =
|
|
570
607
|
_getServiceEntityProperty(
|
|
@@ -578,6 +615,7 @@ function _getServiceComplexType(complexTypeKey, complexType, parserContext, isOp
|
|
|
578
615
|
complexTypeProperty.doc,
|
|
579
616
|
complexTypePropertyNamespace,
|
|
580
617
|
complexTypeProperty.Nullable,
|
|
618
|
+
complexTypeProperty.DefaultValue,
|
|
581
619
|
complexType.CollectionKind,
|
|
582
620
|
parserContext
|
|
583
621
|
);
|
|
@@ -613,6 +651,7 @@ function _getServiceComplexType(complexTypeKey, complexType, parserContext, isOp
|
|
|
613
651
|
complexTypeProperty.doc,
|
|
614
652
|
complexTypePropertyNamespace,
|
|
615
653
|
complexTypeProperty.Nullable,
|
|
654
|
+
complexTypeProperty.DefaultValue,
|
|
616
655
|
complexTypeProperty.CollectionKind,
|
|
617
656
|
parserContext
|
|
618
657
|
);
|
|
@@ -623,10 +662,16 @@ function _getServiceComplexType(complexTypeKey, complexType, parserContext, isOp
|
|
|
623
662
|
}
|
|
624
663
|
}
|
|
625
664
|
complexTypeCSN = complexTypeCSN + "}\n";
|
|
665
|
+
|
|
626
666
|
if (parserContext.allInheritedComplexTypes[complexTypeKey]) {
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
667
|
+
let baseType = parserContext.allInheritedComplexTypes[complexTypeKey];
|
|
668
|
+
|
|
669
|
+
if (parserContext.allComplexTypes[baseType]) {
|
|
670
|
+
complexTypeCSN = complexTypeCSN + ',\n"includes": ["' + baseType + '"]\n';
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
console.log(warn("BaseType " + baseType + " couldn't be resolved"));
|
|
674
|
+
}
|
|
630
675
|
}
|
|
631
676
|
complexTypeCSN = complexTypeCSN + "}\n";
|
|
632
677
|
return complexTypeCSN;
|
|
@@ -673,6 +718,7 @@ function _parseParameter(parameter, parserContext) {
|
|
|
673
718
|
doc,
|
|
674
719
|
parameterNamespaceAttributes,
|
|
675
720
|
parameter["_attributes"].Nullable,
|
|
721
|
+
-1,
|
|
676
722
|
parameter["_attributes"].CollectionKind,
|
|
677
723
|
parserContext
|
|
678
724
|
);
|
|
@@ -748,17 +794,28 @@ function _getFunctionImport(functionImport, isBounded, entityKeysList, parserCon
|
|
|
748
794
|
}
|
|
749
795
|
}
|
|
750
796
|
}
|
|
797
|
+
// if return type exist
|
|
751
798
|
if (functionImport[2] !== -1) {
|
|
752
|
-
let
|
|
753
|
-
noValue, noValue, noValue, -1, noValue,
|
|
754
|
-
|
|
799
|
+
let returnValue = _getServiceEntityProperty(noValue, functionImport[2], noValue, noValue, noValue, noValue,
|
|
800
|
+
noValue, noValue, noValue, noValue, -1, noValue, parserContext);
|
|
801
|
+
|
|
802
|
+
if (returnValue !== "") {
|
|
755
803
|
csn = csn + ", \n";
|
|
756
804
|
csn = csn + '"returns": { \n';
|
|
757
805
|
//return type
|
|
758
|
-
csn = csn +
|
|
806
|
+
csn = csn + returnValue;
|
|
759
807
|
csn = csn + '\n }';
|
|
808
|
+
} else {
|
|
809
|
+
throw new Error(messages.UNRESOLVED_TYPE + `'${functionImport[2]}'`);
|
|
760
810
|
}
|
|
761
811
|
}
|
|
812
|
+
// if return type is missing, add boolean only for functions
|
|
813
|
+
if (functionImport[2] === -1 && functionImport[1] === "GET") {
|
|
814
|
+
csn = csn + ", \n";
|
|
815
|
+
csn = csn + '"returns": { \n';
|
|
816
|
+
csn = csn + '"type": "cds.Boolean"';
|
|
817
|
+
csn = csn + '\n }';
|
|
818
|
+
}
|
|
762
819
|
if (functionImport[4] !== -1 && functionImport[4]) {
|
|
763
820
|
csn = csn + ',\n "doc": "' + _replaceSpecialCharacters(functionImport[4]) + '"';
|
|
764
821
|
}
|
|
@@ -868,6 +925,12 @@ function _getPropertyAttributes(propAttributes, parserContext) {
|
|
|
868
925
|
} else {
|
|
869
926
|
propOthers.push("true");
|
|
870
927
|
}
|
|
928
|
+
|
|
929
|
+
if (propAttributes.DefaultValue) {
|
|
930
|
+
propOthers.push(propAttributes.DefaultValue);
|
|
931
|
+
} else {
|
|
932
|
+
propOthers.push(-1);
|
|
933
|
+
}
|
|
871
934
|
|
|
872
935
|
if (propAttributes.CollectionKind === 'List' || propAttributes.CollectionKind === 'Bag') {
|
|
873
936
|
propOthers.push(1);
|
|
@@ -933,7 +996,7 @@ function _generateCSNEntityKeys(entityKeysList, entityPropertiesMap, parserConte
|
|
|
933
996
|
|
|
934
997
|
for (let i = 0; i < entityKeysList.length; i++) {
|
|
935
998
|
propAttributes = entityPropertiesMap[entityKeysList[i]];
|
|
936
|
-
if (propAttributes[7]
|
|
999
|
+
if (propAttributes[7] === "true") {
|
|
937
1000
|
console.log(warn("Expected key element to be not nullable"));
|
|
938
1001
|
}
|
|
939
1002
|
|
|
@@ -950,6 +1013,7 @@ function _generateCSNEntityKeys(entityKeysList, entityPropertiesMap, parserConte
|
|
|
950
1013
|
propAttributes[6],
|
|
951
1014
|
"false",
|
|
952
1015
|
propAttributes[8],
|
|
1016
|
+
propAttributes[9],
|
|
953
1017
|
parserContext
|
|
954
1018
|
);
|
|
955
1019
|
csnEntity = csnEntity + keyCsn;
|
|
@@ -984,16 +1048,17 @@ function _generateCSNEntityProperties(entityKeysList, entityPropertiesMap, parse
|
|
|
984
1048
|
let propertyString =
|
|
985
1049
|
_getServiceEntityProperty(
|
|
986
1050
|
property,
|
|
987
|
-
propAttributes[0],
|
|
988
|
-
propAttributes[1],
|
|
989
|
-
propAttributes[2],
|
|
990
|
-
propAttributes[3],
|
|
991
|
-
propAttributes[4],
|
|
992
|
-
false,
|
|
993
|
-
propAttributes[5],
|
|
994
|
-
propAttributes[6],
|
|
995
|
-
propAttributes[7],
|
|
996
|
-
propAttributes[8],
|
|
1051
|
+
propAttributes[0], // dataType
|
|
1052
|
+
propAttributes[1], // length
|
|
1053
|
+
propAttributes[2], // precision
|
|
1054
|
+
propAttributes[3], // scale
|
|
1055
|
+
propAttributes[4], // display
|
|
1056
|
+
false, // isKey
|
|
1057
|
+
propAttributes[5], // doc
|
|
1058
|
+
propAttributes[6], // allowed namespace
|
|
1059
|
+
propAttributes[7], // nullable
|
|
1060
|
+
propAttributes[8], // defaultVal
|
|
1061
|
+
propAttributes[9], // collection
|
|
997
1062
|
parserContext
|
|
998
1063
|
);
|
|
999
1064
|
csnEntity = csnEntity + propertyString;
|
|
@@ -1426,7 +1491,7 @@ function _constructServiceEntity(
|
|
|
1426
1491
|
csnEntity = csnEntity + '"@cds.persistence.skip": true,\n';
|
|
1427
1492
|
}
|
|
1428
1493
|
|
|
1429
|
-
if ((entityAttributes.Abstract
|
|
1494
|
+
if ((entityAttributes.Abstract?.toUpperCase() === "TRUE") || (entityAttributes.OpenType?.toUpperCase() === "TRUE")) {
|
|
1430
1495
|
csnEntity = csnEntity + '"@open": true,\n'
|
|
1431
1496
|
}
|
|
1432
1497
|
|
|
@@ -1488,12 +1553,17 @@ function _constructServiceEntity(
|
|
|
1488
1553
|
csnEntity = csnEntity + "}\n";
|
|
1489
1554
|
|
|
1490
1555
|
if (entityAttributes.BaseType) {
|
|
1491
|
-
let baseTypeName = _getBaseTypeEntityName(entityAttributes.BaseType, parserContext);
|
|
1492
|
-
|
|
1493
|
-
|
|
1556
|
+
let baseTypeName = _getBaseTypeEntityName(entityAttributes.BaseType, parserContext).replace(parserContext.serviceNamespace + '.', '');
|
|
1557
|
+
|
|
1558
|
+
if (parserContext.allEntitiesMC.includes(baseTypeName) || parserContext.allEntities.includes(baseTypeName)) {
|
|
1559
|
+
csnEntity = csnEntity + ',\n"includes": ["' + parserContext.serviceNamespace + '.' + baseTypeName + '"]\n';
|
|
1560
|
+
}
|
|
1561
|
+
else {
|
|
1562
|
+
throw new Error(messages.UNRESOLVED_TYPE + `'${parserContext.serviceNamespace}.${baseTypeName}'`);
|
|
1563
|
+
}
|
|
1494
1564
|
}
|
|
1495
1565
|
|
|
1496
|
-
//if the function import is bounded to entitySet
|
|
1566
|
+
// if the function import is bounded to entitySet
|
|
1497
1567
|
if (parserContext.allFunctionImportsMap[entityName]) {
|
|
1498
1568
|
csnEntity = csnEntity + ', \n "actions": {\n';
|
|
1499
1569
|
csnEntity = csnEntity +
|
|
@@ -1554,8 +1624,12 @@ function _parseServiceEntity(entityName, entity, ignorePersistenceSkip, mockServ
|
|
|
1554
1624
|
}
|
|
1555
1625
|
// If inherited entity found
|
|
1556
1626
|
if (entityAttributes.BaseType) {
|
|
1557
|
-
|
|
1558
|
-
parserContext.
|
|
1627
|
+
let entityName;
|
|
1628
|
+
if (parserContext.allEntitySetMapMC && parserContext.allEntitySetMapMC[entityAttributes.BaseType]) {
|
|
1629
|
+
entityName = parserContext.allEntitySetMapMC[entityAttributes.BaseType][0];
|
|
1630
|
+
}
|
|
1631
|
+
else entityName = _extractEntityFromNamespace(entityAttributes.BaseType);
|
|
1632
|
+
if (!parserContext.allInheritedEntityTypes.includes(entityName)) parserContext.allInheritedEntityTypes.push(entityName);
|
|
1559
1633
|
}
|
|
1560
1634
|
// adding blob element if entity has m:HasStream as true
|
|
1561
1635
|
const checkProperty = entityAttributes["allowedNamespaceAttributes"].filter(e => e["m.HasStream"] === 'true');
|
|
@@ -1643,16 +1717,25 @@ function _getServiceEntitites(entityJson = [], ignorePersistenceSkip, mockServer
|
|
|
1643
1717
|
|
|
1644
1718
|
for (let i = 0; i < 2; i++) {
|
|
1645
1719
|
if (entitiesWithNames[i].length) {
|
|
1646
|
-
parsedEntities[i] = _parsingServiceEntities(entitiesWithNames[i],
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1720
|
+
parsedEntities[i] = _parsingServiceEntities(entitiesWithNames[i], ignorePersistenceSkip, mockServerUc, parserContext);
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
// adding @open annotation to BaseTypes
|
|
1725
|
+
for (let i = 0; i < parsedEntities.length; i++) {
|
|
1726
|
+
for (let j = 0; j < parserContext.allInheritedEntityTypes.length ; j++) {
|
|
1727
|
+
let entityName = parserContext.allInheritedEntityTypes[j];
|
|
1728
|
+
const regEx = RegExp(`"${parserContext.serviceNamespace}.${entityName}": {`, 'g');
|
|
1729
|
+
for (let k = 0; k < parsedEntities[i].length; k++) {
|
|
1730
|
+
let entityString = parsedEntities[i][k];
|
|
1731
|
+
if (entityString.match(regEx)) {
|
|
1732
|
+
parsedEntities[i][k] = parsedEntities[i][k].replace(/}$/, ',"@open": true' + '}');
|
|
1733
|
+
break;
|
|
1652
1734
|
}
|
|
1653
1735
|
}
|
|
1654
1736
|
}
|
|
1655
1737
|
}
|
|
1738
|
+
|
|
1656
1739
|
// if entities from entity set and entity type both are parsed
|
|
1657
1740
|
if (parsedEntities[0] && parsedEntities[1])
|
|
1658
1741
|
return parsedEntities[0].concat(parsedEntities[1]);
|
|
@@ -1719,9 +1802,7 @@ function _generateEDMXJSON2CSN(jsonObj, ignorePersistenceSkip, mockServerUc, par
|
|
|
1719
1802
|
}
|
|
1720
1803
|
|
|
1721
1804
|
if (entityJson) {
|
|
1722
|
-
definitions.push(
|
|
1723
|
-
_getServiceEntitites(entityJson, ignorePersistenceSkip, mockServerUc, parserContext)
|
|
1724
|
-
);
|
|
1805
|
+
definitions.push(_getServiceEntitites(entityJson, ignorePersistenceSkip, mockServerUc, parserContext));
|
|
1725
1806
|
}
|
|
1726
1807
|
|
|
1727
1808
|
// If complex type exists
|