@sap/cds-dk 7.0.2 → 7.1.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/bin/add.js +2 -2
- package/bin/bind.js +5 -7
- package/bin/build.js +2 -7
- package/bin/cds.js +6 -8
- package/bin/deploy/to-hana.js +1 -1
- package/bin/init.js +2 -2
- package/bin/subscribe.js +4 -4
- package/bin/unsubscribe.js +4 -4
- package/bin/upgrade.js +4 -4
- package/lib/bind/cfKeyProvider.js +10 -10
- package/lib/bind/index.js +4 -3
- package/lib/bind/userCdsrcJsonStorageProvider.js +2 -10
- package/lib/build/buildTaskEngine.js +9 -22
- package/lib/build/buildTaskFactory.js +18 -27
- package/lib/build/constants.js +16 -14
- package/lib/build/index.js +12 -3
- package/lib/build/provider/buildTaskProviderInternal.js +23 -15
- package/lib/build/provider/mtx/index.js +8 -2
- package/lib/build/provider/mtx/resourcesTarBuilder.js +2 -6
- package/lib/build/provider/mtx-sidecar/index.js +13 -8
- package/lib/build/util.js +13 -0
- package/lib/client/activate.js +7 -7
- package/lib/client/auth_manager.js +5 -5
- package/lib/client/base_command.js +7 -10
- package/lib/client/extend.js +2 -2
- package/lib/client/helper/logging.js +7 -2
- package/lib/client/params.js +2 -3
- package/lib/client/pull.js +3 -3
- package/lib/client/push.js +3 -3
- package/lib/client/settings_manager.js +7 -8
- package/lib/client/tenant_action.js +3 -3
- package/lib/compile/asyncapi/components/messages/index.js +41 -18
- package/lib/compile/asyncapi/index.js +23 -2
- package/lib/deploy/to-hana/hana.js +1 -2
- package/lib/import/common.js +3 -0
- package/lib/import/message.js +2 -1
- package/lib/import/odata/metadataconverter/MetadataConverter.js +1 -0
- package/lib/import/odata/v4parser.js +85 -95
- package/lib/init/constants.js +1 -1
- package/lib/init/index.js +78 -73
- package/lib/init/template/approuter/index.js +3 -4
- package/lib/init/template/auditlog/index.js +3 -4
- package/lib/init/template/cf-manifest/files/manifest.yml.hbs +15 -23
- package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +22 -17
- package/lib/init/template/cf-manifest/index.js +2 -2
- package/lib/init/template/connectivity/index.js +2 -3
- package/lib/init/template/data/index.js +7 -8
- package/lib/init/template/destination/index.js +3 -5
- package/lib/init/template/enterprise-messaging/index.js +4 -5
- package/lib/init/template/enterprise-messaging-shared/index.js +3 -4
- package/lib/init/template/extensibility/index.js +2 -3
- package/lib/init/template/file-based-messaging/index.js +2 -2
- package/lib/init/template/hana/files/mta.yaml.hbs +1 -1
- package/lib/init/template/hana/index.js +39 -63
- package/lib/init/template/helm/index.js +15 -14
- package/lib/init/template/html5-repo/index.js +3 -7
- package/lib/init/template/java/index.js +3 -3
- package/lib/init/template/kibana/index.js +3 -4
- package/lib/init/template/lint/index.js +13 -13
- package/lib/init/template/mta/index.js +3 -2
- package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +1 -1
- package/lib/init/template/multitenancy/index.js +16 -37
- package/lib/init/template/nodejs/index.js +4 -6
- package/lib/init/template/pipeline/index.js +3 -4
- package/lib/init/template/redis-messaging/index.js +3 -4
- package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +1 -1
- package/lib/init/template/sample/files/app/browse/webapp/manifest.json +1 -1
- package/lib/init/template/sample/files/srv/admin-service.cds +1 -1
- package/lib/init/template/sample/files/srv/cat-service.cds +1 -1
- package/lib/init/template/sample/index.js +6 -5
- package/lib/init/template/sqlite/index.js +1 -1
- package/lib/init/template/templateBase.js +9 -19
- package/lib/init/template/tiny-sample/index.js +5 -5
- package/lib/init/template/toggles/index.js +1 -2
- package/lib/init/template/typer/files/xsconfig.json +0 -1
- package/lib/init/template/typer/index.js +1 -1
- package/lib/init/template/xsuaa/index.js +3 -4
- package/lib/init/util/indent.js +57 -0
- package/lib/init/util/merge.js +72 -16
- package/lib/init/util/mvn.js +40 -31
- package/lib/init/util/projectReader.js +52 -168
- package/lib/init/util/template.js +12 -11
- package/lib/init/util/xml.js +6 -6
- package/lib/util/cfUtil.js +1 -2
- package/lib/util/pruneAxiosErrors.js +22 -0
- package/lib/watch/open.js +6 -3
- package/npm-shrinkwrap.json +356 -309
- package/package.json +1 -2
- package/lib/client/helper/errors.js +0 -26
- package/lib/util/version.js +0 -27
|
@@ -16,11 +16,31 @@ function getHeaderProperties(name) {
|
|
|
16
16
|
return { type: { const: name } };
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
function nestedAnnotation(resObj, asyncapiProperty, keys, value) {
|
|
20
|
+
if (resObj[asyncapiProperty] === undefined) {
|
|
21
|
+
resObj[asyncapiProperty] = {};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let node = resObj[asyncapiProperty];
|
|
25
|
+
|
|
26
|
+
// traverse the annotation property and define the objects if they're not defined
|
|
27
|
+
for (let nestedIndex = 1; nestedIndex < keys.length - 1; nestedIndex++) {
|
|
28
|
+
const nestedElement = keys[nestedIndex];
|
|
29
|
+
if (node[nestedElement] === undefined) {
|
|
30
|
+
node[nestedElement] = {};
|
|
31
|
+
}
|
|
32
|
+
node = node[nestedElement];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// set value annotation property
|
|
36
|
+
node[keys[keys.length - 1]] = value;
|
|
37
|
+
}
|
|
38
|
+
|
|
19
39
|
function readAnnotations(definition, presets) {
|
|
20
40
|
let resObj = {};
|
|
21
41
|
|
|
22
42
|
for (const [key, value] of Object.entries(definition)) {
|
|
23
|
-
if (key.startsWith('@AsyncAPI')) {
|
|
43
|
+
if (key.startsWith('@AsyncAPI') && !key.startsWith('@AsyncAPI.Extensions')) {
|
|
24
44
|
// get annotation value after @AsyncAPI
|
|
25
45
|
const annotationProperties = key.split('@AsyncAPI.')[1];
|
|
26
46
|
const keys = annotationProperties.split('.');
|
|
@@ -35,23 +55,22 @@ function readAnnotations(definition, presets) {
|
|
|
35
55
|
if (keys.length === 1) {
|
|
36
56
|
resObj[asyncapiProperty] = value;
|
|
37
57
|
} else {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
let node = resObj[asyncapiProperty];
|
|
58
|
+
nestedAnnotation(resObj, asyncapiProperty, keys, value)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
43
61
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
node[nestedElement] = {};
|
|
49
|
-
}
|
|
50
|
-
node = node[nestedElement];
|
|
51
|
-
}
|
|
62
|
+
else if (key.startsWith('@AsyncAPI.Extensions')) {
|
|
63
|
+
const annotationProperties = key.split('@AsyncAPI.Extensions.')[1];
|
|
64
|
+
const keys = annotationProperties.split('.');
|
|
65
|
+
keys[0] = "x-" + keys[0];
|
|
52
66
|
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
if (keys.length === 1) {
|
|
68
|
+
// if the key is already present, that means, Annotations have already been considered
|
|
69
|
+
if (resObj[keys[0]]) continue;
|
|
70
|
+
// else we populate
|
|
71
|
+
resObj[keys[0]] = value;
|
|
72
|
+
} else {
|
|
73
|
+
nestedAnnotation(resObj, keys[0], keys, value);
|
|
55
74
|
}
|
|
56
75
|
}
|
|
57
76
|
}
|
|
@@ -142,9 +161,13 @@ function entriesToMessages(definitions, events, presets) {
|
|
|
142
161
|
/**
|
|
143
162
|
* Combining the definition objects from CSN into one schema
|
|
144
163
|
*/
|
|
145
|
-
|
|
164
|
+
function definitionsToMessages(definitions, events, presets) {
|
|
146
165
|
const messages = {};
|
|
147
|
-
|
|
148
166
|
Object.assign(messages, entriesToMessages(definitions, events, presets));
|
|
149
167
|
return messages;
|
|
150
168
|
}
|
|
169
|
+
|
|
170
|
+
module.exports = {
|
|
171
|
+
definitionsToMessages,
|
|
172
|
+
nestedAnnotation
|
|
173
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const csnToJSONSchema = require('./components/schemas');
|
|
2
2
|
const getMessageTraits = require('./components/messageTraits');
|
|
3
|
-
const definitionsToMessages = require('./components/messages');
|
|
3
|
+
const { definitionsToMessages, nestedAnnotation } = require('./components/messages');
|
|
4
4
|
const getChannels = require('./channels');
|
|
5
5
|
const cds = require('../../cds');
|
|
6
6
|
const messages = require("./message");
|
|
@@ -75,13 +75,14 @@ function _getAsyncApi(csn, events, serviceName, applicationNamespace, presets) {
|
|
|
75
75
|
const infoObject = getInfoObject(csn.definitions[serviceName]);
|
|
76
76
|
const stateObj = getStateInfo(csn.definitions[serviceName]);
|
|
77
77
|
const shortTextObj = getShortText(csn.definitions[serviceName]);
|
|
78
|
-
|
|
78
|
+
const extensionAnnotationObj = getExtensions(csn.definitions[serviceName], shortTextObj, stateObj);
|
|
79
79
|
return {
|
|
80
80
|
asyncapi: '2.0.0',
|
|
81
81
|
'x-sap-catalog-spec-version': '1.2',
|
|
82
82
|
'x-sap-application-namespace': applicationNamespace,
|
|
83
83
|
...Object.keys(stateObj).length && { 'x-sap-stateInfo': stateObj },
|
|
84
84
|
...Object.keys(shortTextObj).length && { 'x-sap-shortText': shortTextObj },
|
|
85
|
+
...Object.keys(extensionAnnotationObj).length && extensionAnnotationObj,
|
|
85
86
|
info: infoObject,
|
|
86
87
|
defaultContentType: 'application/json',
|
|
87
88
|
channels: getChannels(csn.definitions, events),
|
|
@@ -89,6 +90,26 @@ function _getAsyncApi(csn, events, serviceName, applicationNamespace, presets) {
|
|
|
89
90
|
};
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
function getExtensions(serviceCsn, shortTextObj, stateObj) {
|
|
94
|
+
let extensionObj = {};
|
|
95
|
+
for (const [key, value] of Object.entries(serviceCsn)) {
|
|
96
|
+
if (key.startsWith('@AsyncAPI.Extensions')) {
|
|
97
|
+
const annotationProperties = key.split('@AsyncAPI.Extensions.')[1];
|
|
98
|
+
const keys = annotationProperties.split('.');
|
|
99
|
+
keys[0] = "x-" + keys[0];
|
|
100
|
+
if ((keys[0] === 'x-sap-shortText' && Object.keys(shortTextObj).length > 0) ||
|
|
101
|
+
(keys[0] === 'x-sap-stateInfo' && Object.keys(stateObj).length > 0)
|
|
102
|
+
) continue;
|
|
103
|
+
if (keys.length === 1) {
|
|
104
|
+
extensionObj[keys[0]] = value;
|
|
105
|
+
} else {
|
|
106
|
+
nestedAnnotation(extensionObj, keys[0], keys, value);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return extensionObj;
|
|
111
|
+
}
|
|
112
|
+
|
|
92
113
|
function getShortText(serviceCsn, presetValue = undefined) {
|
|
93
114
|
let shortTextValue = presetValue || serviceCsn["@AsyncAPI.ShortText"];
|
|
94
115
|
if (shortTextValue) {
|
|
@@ -15,7 +15,6 @@ const gitUtil = require('../../util/gitUtil');
|
|
|
15
15
|
const mtaUtil = require('./mtaUtil');
|
|
16
16
|
|
|
17
17
|
const { bold, info } = require('../../util/term');
|
|
18
|
-
const { CliError } = require('../../client/helper/errors');
|
|
19
18
|
|
|
20
19
|
const { bind } = require('../../bind');
|
|
21
20
|
|
|
@@ -49,7 +48,7 @@ class HanaDeployer {
|
|
|
49
48
|
let { model, serviceName, tunnelAddress, vcapFile, undeployWhitelist, hdiOptions } = options;
|
|
50
49
|
|
|
51
50
|
if (model) {
|
|
52
|
-
throw
|
|
51
|
+
throw 'Specifying a model for hana deployment is not supported.';
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
console.log(`${bold('Starting deploy to SAP HANA ...')}`);
|
package/lib/import/common.js
CHANGED
package/lib/import/message.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const messages = {
|
|
4
4
|
INVALID_EDMX_METADATA: 'The OData model is not valid. Specify the correct OData model.',
|
|
5
|
+
INVALID_EDMX_METADATA_VERSION: 'The OData version is not valid. Specify the correct OData version.',
|
|
5
6
|
INVALID_OUTPUT_FILE: 'Please provide an output file with one of these [cds, csn, json] file extension.',
|
|
6
7
|
SPECIFY_INPUT_FILE: 'Specify an input file that exists.',
|
|
7
8
|
SPECIFY_OUTPUT_FILE: 'Specify an output file or correct the output file path provided.',
|
|
@@ -26,7 +27,7 @@ const messages = {
|
|
|
26
27
|
BOUNDED_ACTION_COLLISION: 'For Bounded Action, combination of action name and binding parameter type should be unique.',
|
|
27
28
|
STREAM_NO_COLLECTION: `'Edm.Stream' cannot be of Collection type.`,
|
|
28
29
|
UNSUPPORTED_PROPERTY_TYPE: 'Property cannot be of EntityType. Check the type: ',
|
|
29
|
-
|
|
30
|
+
UNRESOLVED_SCHEMA_NAMESPACE: `Could not resolve the schema `,
|
|
30
31
|
INVALID_DATATYPE: `Invalid Data Type `,
|
|
31
32
|
ELEMENT_NAME_COLLISION: 'Collision between EntityContainer Element Name and Schema Element Name is currenlty not supported. Please check the element name: '
|
|
32
33
|
};
|
|
@@ -371,6 +371,7 @@ class Expression {
|
|
|
371
371
|
annotate(prefix = '', target, annotationExpressionResult) {
|
|
372
372
|
let _target = target;
|
|
373
373
|
for (const key of Object.keys(annotationExpressionResult)) {
|
|
374
|
+
if (prefix !== '') prefix = prefix + ".";
|
|
374
375
|
_target[prefix + key] = annotationExpressionResult[key];
|
|
375
376
|
}
|
|
376
377
|
return target;
|