@sap/cds-dk 6.0.3 → 6.1.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.
- package/CHANGELOG.md +62 -0
- package/bin/add.js +29 -16
- package/bin/compile/index.js +7 -2
- package/bin/fix-redirects.js +4 -2
- package/bin/init.js +5 -0
- package/bin/login.js +20 -4
- package/bin/pull.js +58 -0
- package/bin/push.js +52 -0
- package/bin/subscribe.js +45 -0
- package/lib/bind/bindingUtil.js +1 -2
- package/lib/bind/cfKeyProvider.js +3 -3
- package/lib/cds.js +2 -3
- package/lib/client/activate.js +17 -16
- package/lib/client/auth_manager.js +10 -5
- package/lib/client/base_command.js +4 -6
- package/lib/client/extend.js +3 -2
- package/lib/client/helper/cf_helper.js +1 -0
- package/lib/client/helper/errors.js +11 -0
- package/lib/client/helper/logging.js +3 -10
- package/lib/client/helper/url_helper.js +7 -3
- package/lib/client/index.js +1 -1
- package/lib/client/params.js +9 -6
- package/lib/client/pull.js +48 -0
- package/lib/client/push.js +45 -0
- package/lib/client/settings_manager.js +81 -27
- package/lib/compile/openapi/csdl2openapi.js +135 -163
- package/lib/compile/openapi/index.js +0 -1
- package/lib/import/common.js +9 -1
- package/lib/import/odata/metadataconverter/MetadataConverter.js +17 -4
- package/lib/import/odata/v2parser.js +50 -26
- package/lib/import/odata/v4parser.js +110 -29
- package/lib/import/openapi/importOpenAPI.js +3 -3
- package/lib/init/constants.js +9 -3
- package/lib/init/template/_merging/registry-mta.js +284 -0
- package/lib/init/template/approuter/files/xs-app.json.hbs +7 -7
- package/lib/init/template/approuter/index.js +22 -32
- package/lib/init/template/auditlog/index.js +7 -9
- package/lib/init/template/data/index.js +2 -4
- package/lib/init/template/extensibility/files/cds.package.json +7 -0
- package/lib/init/template/extensibility/files/cds.package.json.hbs +9 -0
- package/lib/init/template/extensibility/files/xs-security.json.hbs +26 -0
- package/lib/init/template/extensibility/index.js +48 -0
- package/lib/init/template/hana/files/java/cdsrc.json.hbs +1 -1
- package/lib/init/template/hana/files/java/profile.cdsrc.json.hbs +2 -2
- package/lib/init/template/hana/files/mta.yaml.hbs +10 -0
- package/lib/init/template/hana/files/nodejs/cds.package.json.hbs +1 -1
- package/lib/init/template/hana/files/nodejs/cds.profile.package.json.hbs +2 -2
- package/lib/init/template/hana/index.js +76 -63
- package/lib/init/template/kibana-logging/index.js +31 -37
- package/lib/init/template/lint/files/.eslint/rules/no-entity-moo.js +14 -14
- package/lib/init/template/mta/files/mta.yaml.hbs +1 -1
- package/lib/init/template/mta/index.js +13 -7
- package/lib/init/template/mtx/index.js +2 -142
- package/lib/init/template/multitenancy/files/cds.package.json +7 -0
- package/lib/init/template/multitenancy/files/cds.package.json.hbs +9 -0
- package/lib/init/template/{mtx → multitenancy}/files/dependencies.package.json +1 -1
- package/lib/init/template/multitenancy/files/java/.cdsrc.json +19 -0
- package/lib/init/template/multitenancy/files/java/package.json +31 -0
- package/lib/init/template/{mtx → multitenancy}/files/mta.yaml.hbs +13 -6
- package/lib/init/template/multitenancy/files/xs-security.json.hbs +18 -0
- package/lib/init/template/multitenancy/index.js +109 -0
- package/lib/init/template/nodejs/files/package.json.hbs +3 -0
- package/lib/init/template/templateBase.js +2 -1
- package/lib/init/template/toggles/files/cds.package.json +7 -0
- package/lib/init/template/toggles/files/cds.package.json.hbs +9 -0
- package/lib/init/template/toggles/index.js +24 -0
- package/lib/init/template/xsuaa/files/mta.yaml.hbs +10 -0
- package/lib/init/template/xsuaa/index.js +44 -33
- package/lib/init/util/projectReader.js +12 -7
- package/lib/init/util/templateUtil.js +113 -111
- package/lib/k8s/ChartAdder.js +13 -3
- package/lib/k8s/ChartBuilder.js +6 -0
- package/lib/k8s/buildModel.js +1 -3
- package/lib/k8s/connectivity/index.js +5 -5
- package/lib/k8s/deployment/index.js +2 -4
- package/lib/k8s/deployment/subchart/Chart.yaml +1 -1
- package/lib/k8s/deployment/subchart/templates/_helpers.tpl +22 -11
- package/lib/k8s/deployment/subchart/templates/deployment.yaml +12 -5
- package/lib/k8s/deployment/subchart/templates/network-policy.yaml +3 -1
- package/lib/k8s/deployment/subchart/templates/pod-disruption-budget.yaml +1 -1
- package/lib/k8s/deployment/subchart/values.md +812 -0
- package/lib/k8s/deployment/subchart/values.schema.json +125 -30
- package/lib/k8s/deployment/subchart/values.yaml +7 -3
- package/lib/k8s/hana-deployer/index.js +10 -0
- package/lib/k8s/hana-deployer/templates/hana-deployer-job.yaml +8 -0
- package/lib/k8s/html5-apps-deployer/index.js +10 -0
- package/lib/k8s/html5-apps-deployer/templates/html5-apps-deployer-job.yaml +8 -0
- package/lib/k8s/index.js +2 -2
- package/lib/k8s/resources/helm/chart/schemas/values.root.schema.json +11 -0
- package/lib/k8s/resources/helm/chart/schemas/values.schema.json +479 -0
- package/lib/k8s/resources/helm/chart/templates/_deployment_helpers.tpl +1 -159
- package/lib/k8s/resources/helm/chart/templates/_helpers.tpl +0 -33
- package/lib/k8s/resources/helm/chart/templates/_sapcp_helpers.tpl +1 -1
- package/lib/lint/Linter.js +155 -158
- package/lib/lint/io.js +12 -5
- package/npm-shrinkwrap.json +1052 -135
- package/package.json +5 -4
- package/lib/init/template/_merging/existences.js +0 -297
- package/lib/init/template/mtx/files/cds.package.json +0 -12
- package/lib/init/template/mtx/files/cds.package.json.hbs +0 -14
- package/lib/init/template/mtx/files/java/.cdsrc.json +0 -17
- package/lib/init/template/mtx/files/java/package.json +0 -43
- package/lib/init/template/mtx/files/java/server.js +0 -30
- package/lib/init/template/mtx/files/xs-security.json.hbs +0 -48
- package/lib/lint/.eslintrc.js +0 -3
|
@@ -448,38 +448,63 @@ function _getServiceEntityProperty(
|
|
|
448
448
|
propertyJson = propertyJson + '"key": true,\n';
|
|
449
449
|
}
|
|
450
450
|
if (isCollection === 1) {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
451
|
+
//if annotations to be added
|
|
452
|
+
if (edmxncdsdatatype[dataType + "_a"] && cdsDataType != "cds.Date") {
|
|
453
|
+
if (dataType === 'Edm.Stream')
|
|
454
|
+
propertyJson = propertyJson + '"@Core.MediaType": "application/octet-stream",\n';
|
|
455
|
+
else
|
|
456
|
+
propertyJson = propertyJson + '"@odata.Type": "' + dataType + '",\n';
|
|
457
|
+
}
|
|
454
458
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
propertyJson = propertyJson + '
|
|
459
|
-
|
|
460
|
-
propertyJson = propertyJson + ',\n"@odata.Type": "' + dataType + '"';
|
|
461
|
-
}
|
|
459
|
+
//adding precision in case of DateTime datatypes
|
|
460
|
+
if ((dataType === "Edm.DateTimeOffset" || dataType === "Edm.DateTime") && cdsDataType != "cds.Date") {
|
|
461
|
+
if (!precision || precision === -1) precision = 0;
|
|
462
|
+
propertyJson = propertyJson + '"@odata.Precision": ' + precision + ',\n';
|
|
463
|
+
}
|
|
462
464
|
|
|
463
|
-
|
|
464
|
-
propertyJson = propertyJson + '
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
465
|
+
propertyJson = propertyJson + '"items": { \n'
|
|
466
|
+
propertyJson = propertyJson + '"type":"' + cdsDataType + '"';
|
|
467
|
+
|
|
468
|
+
if (length && length > 0) {
|
|
469
|
+
propertyJson = propertyJson + ',\n"length":' + length;
|
|
470
|
+
} else if (precision && precision > 0 && hasInvalidPrecision === false) {
|
|
471
|
+
propertyJson = propertyJson + ',\n"precision":' + precision;
|
|
472
|
+
if (scale && scale > 0) {
|
|
473
|
+
propertyJson = propertyJson + ',\n"scale":' + scale;
|
|
474
|
+
} else {
|
|
475
|
+
propertyJson = propertyJson + ',\n"scale":' + 0;
|
|
476
|
+
}
|
|
471
477
|
}
|
|
478
|
+
propertyJson = propertyJson + '\n}'
|
|
472
479
|
}
|
|
480
|
+
else{
|
|
481
|
+
propertyJson = propertyJson + '"type":"' + cdsDataType + '"';
|
|
482
|
+
//if annotations to be added
|
|
483
|
+
if (edmxncdsdatatype[dataType + "_a"] && cdsDataType != "cds.Date") {
|
|
484
|
+
if (dataType === 'Edm.Stream')
|
|
485
|
+
propertyJson = propertyJson + ',\n"@Core.MediaType": "application/octet-stream"';
|
|
486
|
+
else
|
|
487
|
+
propertyJson = propertyJson + ',\n"@odata.Type": "' + dataType + '"';
|
|
488
|
+
}
|
|
473
489
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
if (
|
|
477
|
-
|
|
478
|
-
|
|
490
|
+
if (length && length > 0) {
|
|
491
|
+
propertyJson = propertyJson + ',\n"length":' + length;
|
|
492
|
+
} else if (precision && precision > 0 && hasInvalidPrecision === false) {
|
|
493
|
+
propertyJson = propertyJson + ',\n"precision":' + precision;
|
|
494
|
+
if (scale && scale > 0) {
|
|
495
|
+
propertyJson = propertyJson + ',\n"scale":' + scale;
|
|
496
|
+
} else {
|
|
497
|
+
propertyJson = propertyJson + ',\n"scale":' + 0;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
479
500
|
|
|
480
|
-
|
|
481
|
-
|
|
501
|
+
//adding precision in case of DateTime datatypes
|
|
502
|
+
if ((dataType === "Edm.DateTimeOffset" || dataType === "Edm.DateTime") && cdsDataType != "cds.Date") {
|
|
503
|
+
if (!precision || precision === -1) precision = 0;
|
|
504
|
+
propertyJson = propertyJson + ',\n"@odata.Precision": ' + precision;
|
|
505
|
+
}
|
|
482
506
|
}
|
|
507
|
+
|
|
483
508
|
if (documentation != -1 && documentation) {
|
|
484
509
|
propertyJson = propertyJson + ',\n"doc":"' + documentation + '"';
|
|
485
510
|
}
|
|
@@ -1143,7 +1168,6 @@ function _getCSNAssociatedEntitySet(
|
|
|
1143
1168
|
) {
|
|
1144
1169
|
let associationSet = parserContext.allAssociationSets[relationshipName];
|
|
1145
1170
|
if (associationSet === undefined) {
|
|
1146
|
-
console.log(relationshipName + " " + parserContext.serviceNamespace);
|
|
1147
1171
|
throw new Error(messages.MISSING_ASSOCIATION_SETS);
|
|
1148
1172
|
}
|
|
1149
1173
|
let associationName = associationSet.Name;
|
|
@@ -43,6 +43,27 @@ const edmxncdsdatatype = {
|
|
|
43
43
|
"Edm.DateTimeOffset_a": "cds.Timestamp",
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
const known_vocabularies = {
|
|
47
|
+
'Org.OData.Authorization.V1': 'Authorization',
|
|
48
|
+
'Org.OData.Aggregation.V1': 'Aggregation',
|
|
49
|
+
'Org.OData.Core.V1': 'Core',
|
|
50
|
+
'Org.OData.Capabilities.V1': 'Capabilities',
|
|
51
|
+
'Org.OData.Validation.V1': 'Validation',
|
|
52
|
+
'Org.OData.Measures.V1': 'Measures',
|
|
53
|
+
'Org.OData.Repeatability.V1': 'Repeatability',
|
|
54
|
+
|
|
55
|
+
'com.sap.vocabularies.Analytics.v1': 'Analytics',
|
|
56
|
+
'com.sap.vocabularies.CodeList.v1': 'CodeList',
|
|
57
|
+
'com.sap.vocabularies.Common.v1': 'Common',
|
|
58
|
+
'com.sap.vocabularies.Communication.v1': 'Communication',
|
|
59
|
+
'com.sap.vocabularies.Graph.v1': 'Graph',
|
|
60
|
+
'com.sap.vocabularies.HTML5.v1': 'HTML5',
|
|
61
|
+
'com.sap.vocabularies.ODM.v1': 'ODM',
|
|
62
|
+
'com.sap.vocabularies.PersonalData.v1': 'PersonalData',
|
|
63
|
+
'com.sap.vocabularies.Session.v1': 'Session',
|
|
64
|
+
'com.sap.vocabularies.UI.v1': 'UI',
|
|
65
|
+
};
|
|
66
|
+
|
|
46
67
|
function _initialize(parserContext) {
|
|
47
68
|
parserContext.unboundedActions = {};
|
|
48
69
|
parserContext.boundedActions = {};
|
|
@@ -117,6 +138,13 @@ function _includeExternalNamespaceAnnotation(source, target) {
|
|
|
117
138
|
|
|
118
139
|
function _typeWithCollections(property, type, isCollection) {
|
|
119
140
|
if (isCollection === true) {
|
|
141
|
+
let typeKeys = Object.keys(type);
|
|
142
|
+
for (let i = 0; i < typeKeys.length; i++) {
|
|
143
|
+
if(typeKeys[i].startsWith("@")){
|
|
144
|
+
property[typeKeys[i]] = type[typeKeys[i]];
|
|
145
|
+
delete type[typeKeys[i]];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
120
148
|
property.items = type;
|
|
121
149
|
} else {
|
|
122
150
|
Object.assign(property, type);
|
|
@@ -883,7 +911,7 @@ function _generateCSN(edmxAsJson, ignorePersistenceSkip, mockServerUc, parserCon
|
|
|
883
911
|
_parseBounded(csn.definitions, 0, parserContext);
|
|
884
912
|
_parseBounded(csn.definitions, 1, parserContext);
|
|
885
913
|
// Step 7: get all annotations
|
|
886
|
-
_generateDocumentation(schemaData, csn.definitions);
|
|
914
|
+
_generateDocumentation(edmxAsJson, schemaData, csn.definitions, parserContext);
|
|
887
915
|
|
|
888
916
|
return JSON.stringify(csn, null, 4);
|
|
889
917
|
}
|
|
@@ -892,7 +920,7 @@ function _replaceSpecialCharacters(text) {
|
|
|
892
920
|
return text.replace(/(?:\\[rn]|[\r\n]+)+/gm, "\n").replace(/\s+/g, ' ').replace(/"/g, """).trim();
|
|
893
921
|
}
|
|
894
922
|
|
|
895
|
-
function _checkAnnotatationTerm(annotation, path, no_of_terms, targetString) {
|
|
923
|
+
function _checkAnnotatationTerm(annotation, path, no_of_terms, targetString, vocab) {
|
|
896
924
|
if (path) {
|
|
897
925
|
if (targetString === "@Core.Description" && annotation[1]["@Core.Description"]) {
|
|
898
926
|
if (path.doc === undefined)
|
|
@@ -903,60 +931,114 @@ function _checkAnnotatationTerm(annotation, path, no_of_terms, targetString) {
|
|
|
903
931
|
else if (targetString === "@Core.LongDescription" && annotation[1]["@Core.LongDescription"]) {
|
|
904
932
|
_generateLongDescription(annotation, path, no_of_terms);
|
|
905
933
|
}
|
|
934
|
+
else if (vocab) {
|
|
935
|
+
if (vocab.includes(targetString.substring(targetString.indexOf('@') + 1, targetString.lastIndexOf('.')))) {
|
|
936
|
+
path[targetString] = annotation[1][targetString];
|
|
937
|
+
}
|
|
938
|
+
}
|
|
906
939
|
}
|
|
907
940
|
}
|
|
908
|
-
function _checkAnnotationTarget(annotation, cdsDefs, str, no_of_terms) {
|
|
909
|
-
if (annotation[0].indexOf('/') === -1 && annotation[0].indexOf('(') === -1) {
|
|
910
|
-
if (annotation[0].endsWith(".EntityContainer")) {
|
|
911
|
-
let path = annotation[0].split(".")[0];
|
|
912
941
|
|
|
913
|
-
|
|
914
|
-
|
|
942
|
+
function checkEntitySetMap(pathName, parserContext) {
|
|
943
|
+
if (parserContext.entitySetToEntityTypeMap.get(pathName) != null) {
|
|
944
|
+
pathName = parserContext.namespace + '.' + parserContext.entitySetToEntityTypeMap.get(pathName)[0];
|
|
945
|
+
}
|
|
946
|
+
return pathName;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
function _checkAnnotationTarget(annotation, cdsDefs, str, no_of_terms, vocab, parserContext) {
|
|
950
|
+
if ((annotation[0].indexOf('/') === -1 && annotation[0].indexOf('(') === -1) || annotation[0].includes("Container")) {
|
|
915
951
|
if (cdsDefs[annotation[0]]) {
|
|
916
|
-
_checkAnnotatationTerm(annotation, cdsDefs[annotation[0]], no_of_terms, str);
|
|
952
|
+
_checkAnnotatationTerm(annotation, cdsDefs[annotation[0]], no_of_terms, str, vocab);
|
|
953
|
+
}
|
|
954
|
+
if (annotation[0].indexOf('/') > 0) {
|
|
955
|
+
let path = annotation[0].split('/');
|
|
956
|
+
let temp = parserContext.namespace + '.' + path[1];
|
|
957
|
+
let path1 = checkEntitySetMap(temp, parserContext);
|
|
958
|
+
if (cdsDefs[path1]) {
|
|
959
|
+
_checkAnnotatationTerm(annotation, cdsDefs[path1], no_of_terms, str, vocab);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
else if (annotation[0].includes("Container")) {
|
|
963
|
+
let path = annotation[0].substring(0,annotation[0].lastIndexOf('.'));
|
|
964
|
+
let actualPath = checkEntitySetMap(path, parserContext);
|
|
965
|
+
_checkAnnotatationTerm(annotation, cdsDefs[actualPath], no_of_terms, str, vocab);
|
|
917
966
|
}
|
|
918
|
-
}
|
|
967
|
+
}
|
|
968
|
+
else if (annotation[0].indexOf('(') === -1 && !(annotation[0].indexOf('/') === -1)) {
|
|
919
969
|
let path = annotation[0].split('/');
|
|
920
|
-
|
|
921
|
-
|
|
970
|
+
let path1 = checkEntitySetMap(path[0], parserContext);
|
|
971
|
+
if (cdsDefs[path1]) {
|
|
972
|
+
_checkAnnotatationTerm(annotation, cdsDefs[path1]["elements"][path[1]], no_of_terms, str, vocab);
|
|
922
973
|
}
|
|
923
974
|
} else {
|
|
924
975
|
let path = annotation[0].split('(');
|
|
925
|
-
|
|
976
|
+
let actualPath = checkEntitySetMap(path[0], parserContext);
|
|
977
|
+
if (cdsDefs[actualPath] === undefined) {
|
|
926
978
|
let temp = path[1].split(')');
|
|
927
979
|
let path1 = temp[0].split(',');
|
|
928
980
|
let path2 = path[0].split('.');
|
|
929
981
|
if (cdsDefs[path1[0]]) {
|
|
930
|
-
_checkAnnotatationTerm(annotation, cdsDefs[path1[0]]["actions"][path2[1]], no_of_terms, str);
|
|
982
|
+
_checkAnnotatationTerm(annotation, cdsDefs[path1[0]]["actions"][path2[1]], no_of_terms, str, vocab);
|
|
931
983
|
}
|
|
932
984
|
} else {
|
|
933
985
|
if (path[1].indexOf('/') === -1) {
|
|
934
|
-
_checkAnnotatationTerm(annotation, cdsDefs[path[0]], no_of_terms, str);
|
|
986
|
+
_checkAnnotatationTerm(annotation, cdsDefs[path[0]], no_of_terms, str, vocab);
|
|
935
987
|
} else {
|
|
936
988
|
let path1 = path[1].split('/');
|
|
937
989
|
if (cdsDefs[path[0]] && cdsDefs[path[0]]["params"]) {
|
|
938
|
-
_checkAnnotatationTerm(annotation, cdsDefs[path[0]]["params"][path1[1]], no_of_terms, str);
|
|
990
|
+
_checkAnnotatationTerm(annotation, cdsDefs[path[0]]["params"][path1[1]], no_of_terms, str, vocab);
|
|
939
991
|
}
|
|
940
992
|
}
|
|
941
993
|
}
|
|
942
994
|
}
|
|
943
995
|
}
|
|
944
996
|
|
|
945
|
-
function
|
|
997
|
+
function _replaceSchemaDataAnnotation(vocabAlias, vocabNamespce, schemaDataAnnotation) {
|
|
998
|
+
for (let v in vocabAlias) {
|
|
999
|
+
if (schemaDataAnnotation.includes(vocabAlias[v])) {
|
|
1000
|
+
schemaDataAnnotation = schemaDataAnnotation.split(vocabAlias[v]).join(known_vocabularies[vocabNamespce[v]]);
|
|
1001
|
+
}
|
|
1002
|
+
if (schemaDataAnnotation.includes(vocabNamespce[v])) {
|
|
1003
|
+
schemaDataAnnotation = schemaDataAnnotation.split(vocabNamespce[v]).join(known_vocabularies[vocabNamespce[v]]);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
return JSON.parse(schemaDataAnnotation);
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
function _generateDocumentation(edmxAsJson, schemaData, cdsDefs, parserContext) {
|
|
1010
|
+
let vocabAlias = [];
|
|
1011
|
+
let vocab = [];
|
|
1012
|
+
let vocabNamespce = [];
|
|
946
1013
|
if (schemaData[0].$Annotations) {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
1014
|
+
if (edmxAsJson.$Reference) {
|
|
1015
|
+
Object.entries(edmxAsJson.$Reference).forEach(a => {
|
|
1016
|
+
if (known_vocabularies.hasOwnProperty(a[1].$Include[0].$Namespace)) {
|
|
1017
|
+
vocabAlias.push(a[1].$Include[0].$Alias);
|
|
1018
|
+
vocabNamespce.push(a[1].$Include[0].$Namespace);
|
|
1019
|
+
vocab.push(known_vocabularies[a[1].$Include[0].$Namespace])
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
951
1023
|
|
|
952
|
-
|
|
953
|
-
_checkAnnotationTarget(annotation, cdsDefs, "@Core.Description", no_of_terms);
|
|
954
|
-
}
|
|
955
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
956
|
-
if (annotation[1].hasOwnProperty('@Core.LongDescription')) {
|
|
957
|
-
_checkAnnotationTarget(annotation, cdsDefs, "@Core.LongDescription", no_of_terms);
|
|
1024
|
+
schemaData[0].$Annotations = _replaceSchemaDataAnnotation(vocabAlias, vocabNamespce, JSON.stringify(schemaData[0].$Annotations));
|
|
958
1025
|
|
|
959
|
-
|
|
1026
|
+
Object.entries(schemaData[0].$Annotations).map(annotation => {
|
|
1027
|
+
let no_of_terms;
|
|
1028
|
+
Object.entries(annotation[1]).forEach(anno => {
|
|
1029
|
+
if (vocab.includes(anno[0].substring(anno[0].indexOf('@') + 1, anno[0].lastIndexOf('.')))) {
|
|
1030
|
+
if (annotation[1].hasOwnProperty('@Core.Description')) {
|
|
1031
|
+
no_of_terms = true;
|
|
1032
|
+
}
|
|
1033
|
+
if (annotation[1].hasOwnProperty('@Common.FieldControl')) {
|
|
1034
|
+
annotation[1]["@Common.FieldControl"] = { "#": annotation[1]["@Common.FieldControl"] }
|
|
1035
|
+
}
|
|
1036
|
+
if (annotation[1].hasOwnProperty('@Common.IsUpperCase')) {
|
|
1037
|
+
annotation[1]["@Common.IsUpperCase"] = true;
|
|
1038
|
+
}
|
|
1039
|
+
_checkAnnotationTarget(annotation, cdsDefs, anno[0], no_of_terms, vocab, parserContext);
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
960
1042
|
});
|
|
961
1043
|
}
|
|
962
1044
|
}
|
|
@@ -969,7 +1051,6 @@ function _generateLongDescription(annotation, path, no_of_terms) {
|
|
|
969
1051
|
}
|
|
970
1052
|
}
|
|
971
1053
|
|
|
972
|
-
|
|
973
1054
|
function _generateEDMX2JSON(edmx, name_space, parserContext) {
|
|
974
1055
|
return new Promise(function getJson(resolve, reject) {
|
|
975
1056
|
try {
|
|
@@ -136,7 +136,7 @@ function operations(context, csn, input) {
|
|
|
136
136
|
|
|
137
137
|
if (param.explode && param.style !== "form")
|
|
138
138
|
cdsParam["@openapi.explode"] = true;
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
if (param.explode === false &&
|
|
141
141
|
(param.style === "form" || (!param.style && param.in === "query"))
|
|
142
142
|
)
|
|
@@ -369,11 +369,11 @@ function cdsType(
|
|
|
369
369
|
if (arrayItem && jsonSchema !== "{}") {
|
|
370
370
|
type = anonymousType(context, {
|
|
371
371
|
type: "common.JSON",
|
|
372
|
-
"@
|
|
372
|
+
"@JSON.Schema": jsonSchema,
|
|
373
373
|
});
|
|
374
374
|
} else {
|
|
375
375
|
type.type = "common.JSON";
|
|
376
|
-
if (jsonSchema !== "{}") type["@
|
|
376
|
+
if (jsonSchema !== "{}") type["@JSON.Schema"] = jsonSchema;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
break;
|
package/lib/init/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const os = require('os');
|
|
2
2
|
|
|
3
|
-
const MAVEN_ARCHETYPE_VERSION = '1.
|
|
3
|
+
const MAVEN_ARCHETYPE_VERSION = '1.27.1';
|
|
4
4
|
|
|
5
5
|
const constants = {
|
|
6
6
|
IS_WIN: (os.platform() === 'win32'),
|
|
@@ -16,6 +16,9 @@ const constants = {
|
|
|
16
16
|
OPTION_XSUAA: 'xsuaa',
|
|
17
17
|
OPTION_MTA: 'mta',
|
|
18
18
|
OPTION_MTX: 'mtx',
|
|
19
|
+
OPTION_MULTITENANCY: 'multitenancy',
|
|
20
|
+
OPTION_TOGGLES: 'toggles',
|
|
21
|
+
OPTION_EXTENSIBILITY: 'extensibility',
|
|
19
22
|
OPTION_AUDITLOG: 'auditlog',
|
|
20
23
|
OPTION_APPROUTER: 'approuter',
|
|
21
24
|
OPTION_KIBANA_LOGGING: 'kibana-logging',
|
|
@@ -68,9 +71,12 @@ constants.OPTIONS_PRIORITY = [
|
|
|
68
71
|
constants.OPTION_PIPELINE,
|
|
69
72
|
constants.OPTION_MTA,
|
|
70
73
|
constants.OPTION_CF_MANIFEST,
|
|
71
|
-
constants.OPTION_HANA,
|
|
72
|
-
constants.OPTION_XSUAA,
|
|
73
74
|
constants.OPTION_MTX,
|
|
75
|
+
constants.OPTION_MULTITENANCY,
|
|
76
|
+
constants.OPTION_TOGGLES,
|
|
77
|
+
constants.OPTION_EXTENSIBILITY,
|
|
78
|
+
constants.OPTION_XSUAA,
|
|
79
|
+
constants.OPTION_HANA,
|
|
74
80
|
constants.OPTION_AUDITLOG,
|
|
75
81
|
constants.OPTION_APPROUTER,
|
|
76
82
|
constants.OPTION_SAMPLES,
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
// Registry of sequence matchers in mta.yaml files
|
|
2
|
+
|
|
3
|
+
const srvNode = {
|
|
4
|
+
ref: 'srv',
|
|
5
|
+
in: 'modules',
|
|
6
|
+
where: [{
|
|
7
|
+
property: 'type',
|
|
8
|
+
isEqualTo: 'nodejs'
|
|
9
|
+
}],
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const srvJava = {
|
|
13
|
+
ref: 'srv',
|
|
14
|
+
in: 'modules',
|
|
15
|
+
where: [{
|
|
16
|
+
property: 'type',
|
|
17
|
+
isEqualTo: 'java'
|
|
18
|
+
}],
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const approuter = {
|
|
22
|
+
ref: 'approuter',
|
|
23
|
+
in: 'modules',
|
|
24
|
+
where: [{
|
|
25
|
+
property: 'type',
|
|
26
|
+
isEqualTo: 'approuter.nodejs'
|
|
27
|
+
}]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const xsuaa = {
|
|
31
|
+
ref: 'uaa-resource',
|
|
32
|
+
in: 'resources',
|
|
33
|
+
where: [{
|
|
34
|
+
property: 'type',
|
|
35
|
+
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
36
|
+
}, {
|
|
37
|
+
property: 'parameters.service',
|
|
38
|
+
isEqualTo: 'xsuaa',
|
|
39
|
+
}, {
|
|
40
|
+
property: 'parameters.service-plan',
|
|
41
|
+
isEqualTo: 'application'
|
|
42
|
+
}]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const auditlog = {
|
|
46
|
+
ref: 'auditlog-resource',
|
|
47
|
+
in: 'resources',
|
|
48
|
+
where: [{
|
|
49
|
+
property: 'type',
|
|
50
|
+
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
51
|
+
}, {
|
|
52
|
+
property: 'parameters.service',
|
|
53
|
+
isEqualTo: 'auditlog-api',
|
|
54
|
+
}]
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const kibanaLogging = {
|
|
58
|
+
ref: 'cf-logging',
|
|
59
|
+
in: 'resources',
|
|
60
|
+
where: [{
|
|
61
|
+
property: 'type',
|
|
62
|
+
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
63
|
+
}, {
|
|
64
|
+
property: 'parameters.service',
|
|
65
|
+
isEqualTo: 'application-logs',
|
|
66
|
+
}, {
|
|
67
|
+
property: 'parameters.service-plan',
|
|
68
|
+
isEqualTo: 'lite',
|
|
69
|
+
}]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const hdbDeployer = {
|
|
73
|
+
ref: 'deployer',
|
|
74
|
+
in: 'modules',
|
|
75
|
+
where: [{
|
|
76
|
+
property: 'type',
|
|
77
|
+
isEqualTo: 'hdb'
|
|
78
|
+
}]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const hdiContainer = {
|
|
82
|
+
ref: 'hdi-container-resource',
|
|
83
|
+
in: 'resources',
|
|
84
|
+
where: [{
|
|
85
|
+
property: 'type',
|
|
86
|
+
isEqualTo: 'com.sap.xs.hdi-container',
|
|
87
|
+
}]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const serviceManager = {
|
|
91
|
+
ref: 'service-manager-resource',
|
|
92
|
+
in: 'resources',
|
|
93
|
+
where: [{
|
|
94
|
+
property: 'type',
|
|
95
|
+
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
96
|
+
}, {
|
|
97
|
+
property: 'parameters.service',
|
|
98
|
+
isEqualTo: 'service-manager',
|
|
99
|
+
}, {
|
|
100
|
+
property: 'parameters.service-plan',
|
|
101
|
+
isEqualTo: 'container'
|
|
102
|
+
}]
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const saasRegistry = {
|
|
106
|
+
ref: 'registry-resource',
|
|
107
|
+
in: 'resources',
|
|
108
|
+
where: [{
|
|
109
|
+
property: 'type',
|
|
110
|
+
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
111
|
+
}, {
|
|
112
|
+
property: 'parameters.service',
|
|
113
|
+
isEqualTo: 'saas-registry',
|
|
114
|
+
}, {
|
|
115
|
+
property: 'parameters.service-plan',
|
|
116
|
+
isEqualTo: 'application'
|
|
117
|
+
}]
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const srvAPI = {
|
|
121
|
+
ref: 'srvAPI',
|
|
122
|
+
in: 'provides',
|
|
123
|
+
where: [{
|
|
124
|
+
property: 'name',
|
|
125
|
+
isEqualTo: 'srv-api'
|
|
126
|
+
}, {
|
|
127
|
+
property: 'properties.srv-url',
|
|
128
|
+
isEqualTo: '${default-url}'
|
|
129
|
+
}]
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const mtxSidecar = {
|
|
133
|
+
ref: 'sidecar',
|
|
134
|
+
in: 'modules',
|
|
135
|
+
where: [{
|
|
136
|
+
property: 'type',
|
|
137
|
+
isEqualTo: `nodejs`
|
|
138
|
+
}, {
|
|
139
|
+
property: 'path',
|
|
140
|
+
isEqualTo: `mtx/sidecar`
|
|
141
|
+
}]
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const providedMtxAPI = {
|
|
145
|
+
ref: 'provided-mtx-api',
|
|
146
|
+
in: 'provides',
|
|
147
|
+
where: [{
|
|
148
|
+
property: 'name',
|
|
149
|
+
isEqualTo: 'mtx-api'
|
|
150
|
+
}, {
|
|
151
|
+
property: 'properties.mtx-url',
|
|
152
|
+
isEqualTo: '${default-url}'
|
|
153
|
+
}]
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const requiredMtxAPI = {
|
|
157
|
+
ref: 'required-mtx-api',
|
|
158
|
+
in: [approuter, 'requires'],
|
|
159
|
+
where: [{
|
|
160
|
+
property: 'properties.name',
|
|
161
|
+
isEqualTo: 'mtx-api'
|
|
162
|
+
}, {
|
|
163
|
+
property: 'properties.url',
|
|
164
|
+
isEqualTo: '~{mtx-url}'
|
|
165
|
+
}]
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const providedAppAPI = {
|
|
169
|
+
ref: 'provided-app-api',
|
|
170
|
+
in: [approuter, 'provides'],
|
|
171
|
+
where: [{
|
|
172
|
+
property: 'name',
|
|
173
|
+
isEqualTo: 'app-api'
|
|
174
|
+
}, {
|
|
175
|
+
property: 'properties.app-protocol',
|
|
176
|
+
isEqualTo: '${protocol}'
|
|
177
|
+
}, {
|
|
178
|
+
property: 'properties.app-uri',
|
|
179
|
+
isEqualTo: '${default-uri}'
|
|
180
|
+
}],
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const requiredAppAPI = {
|
|
184
|
+
ref: 'required-app-api',
|
|
185
|
+
in: [srvNode, 'requires'],
|
|
186
|
+
where: [{
|
|
187
|
+
property: 'name',
|
|
188
|
+
isEqualTo: 'app-api'
|
|
189
|
+
}, {
|
|
190
|
+
property: 'properties.SUBSCRIPTION_URL',
|
|
191
|
+
isEqualTo: '~{app-protocol}://\\${tenant_subdomain}-~{app-uri}'
|
|
192
|
+
}]
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const providedMtxSidecarAPI = {
|
|
196
|
+
ref: 'provided-mtx-sidecar-api',
|
|
197
|
+
in: [mtxSidecar, 'provides'],
|
|
198
|
+
where: [{
|
|
199
|
+
property: 'properties.url',
|
|
200
|
+
isEqualTo: '${default-url}'
|
|
201
|
+
}]
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const requiredMtxSidecarAPI = {
|
|
205
|
+
ref: 'required-mtx-sidecar-api',
|
|
206
|
+
in: [srvJava, 'requires'],
|
|
207
|
+
where: [{
|
|
208
|
+
property: 'properties.CDS_MULTITENANCY_SIDECAR_URL',
|
|
209
|
+
isEqualTo: '~{url}'
|
|
210
|
+
}]
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const requiredJavaApprouterAPI = {
|
|
214
|
+
ref: 'required-java-approuter-api',
|
|
215
|
+
in: [srvJava, 'requires'],
|
|
216
|
+
where: [{
|
|
217
|
+
property: 'properties.CDS_MULTITENANCY_APPUI_URL',
|
|
218
|
+
isEqualTo: '~{url}'
|
|
219
|
+
}]
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const providedJavaApprouterAPI = {
|
|
223
|
+
ref: 'provided-java-approuter-api',
|
|
224
|
+
in: [approuter, 'requires'],
|
|
225
|
+
where: [{
|
|
226
|
+
property: 'properties.url',
|
|
227
|
+
isEqualTo: '${default-url}'
|
|
228
|
+
}]
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const approuterExtensibility = {
|
|
232
|
+
ref: 'approuter-extensibility',
|
|
233
|
+
in: 'routes',
|
|
234
|
+
where: [{
|
|
235
|
+
property: 'source',
|
|
236
|
+
isEqualTo: '^/-/cds/.*'
|
|
237
|
+
}, {
|
|
238
|
+
property: 'destination',
|
|
239
|
+
isEqualTo: 'mtx-api',
|
|
240
|
+
}, {
|
|
241
|
+
property: 'authenticationType',
|
|
242
|
+
isEqualTo: 'none',
|
|
243
|
+
}]
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const approuterExtensibilityJava = {
|
|
247
|
+
ref: 'approuter-extensibility-java',
|
|
248
|
+
in: 'routes',
|
|
249
|
+
where: [{
|
|
250
|
+
property: 'source',
|
|
251
|
+
isEqualTo: '^/-/cds/.*'
|
|
252
|
+
}, {
|
|
253
|
+
property: 'destination',
|
|
254
|
+
isEqualTo: 'mtx-api',
|
|
255
|
+
}, {
|
|
256
|
+
property: 'authenticationType',
|
|
257
|
+
isEqualTo: 'none',
|
|
258
|
+
}]
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
module.exports = {
|
|
262
|
+
srvNode,
|
|
263
|
+
srvJava,
|
|
264
|
+
approuter,
|
|
265
|
+
xsuaa,
|
|
266
|
+
auditlog,
|
|
267
|
+
hdbDeployer,
|
|
268
|
+
hdiContainer,
|
|
269
|
+
serviceManager,
|
|
270
|
+
saasRegistry,
|
|
271
|
+
srvAPI,
|
|
272
|
+
mtxSidecar,
|
|
273
|
+
providedMtxAPI,
|
|
274
|
+
requiredMtxAPI,
|
|
275
|
+
providedMtxSidecarAPI,
|
|
276
|
+
requiredMtxSidecarAPI,
|
|
277
|
+
providedAppAPI,
|
|
278
|
+
requiredAppAPI,
|
|
279
|
+
requiredJavaApprouterAPI,
|
|
280
|
+
providedJavaApprouterAPI,
|
|
281
|
+
kibanaLogging,
|
|
282
|
+
approuterExtensibility,
|
|
283
|
+
approuterExtensibilityJava
|
|
284
|
+
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"authenticationMethod": "route",
|
|
3
3
|
"routes": [
|
|
4
|
+
{{#cap.isMultitenant}}
|
|
5
|
+
{
|
|
6
|
+
"source": "^/-/cds/.*",
|
|
7
|
+
"destination": "mtx-api",
|
|
8
|
+
"authenticationType": "none"
|
|
9
|
+
},
|
|
10
|
+
{{/cap.isMultitenant}}
|
|
4
11
|
{
|
|
5
12
|
"source": "^/app/(.*)$",
|
|
6
13
|
"target": "$1",
|
|
@@ -14,13 +21,6 @@
|
|
|
14
21
|
"destination": "srv-api",
|
|
15
22
|
"authenticationType": "xsuaa",
|
|
16
23
|
"csrfProtection": true
|
|
17
|
-
}{{#cap.isMultitenant}},
|
|
18
|
-
{
|
|
19
|
-
"source": "^/extend/(.*)",
|
|
20
|
-
"destination": "mtx-api",
|
|
21
|
-
"target": "$1",
|
|
22
|
-
"authenticationType": "none"
|
|
23
24
|
}
|
|
24
|
-
{{/cap.isMultitenant}}
|
|
25
25
|
]
|
|
26
26
|
}
|