@sap/cds-dk 6.7.2 → 6.8.1
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 +27 -0
- package/bin/deploy/index.js +1 -1
- package/bin/import.js +5 -3
- package/bin/login.js +29 -9
- package/bin/watch.js +4 -0
- package/lib/bind/bindingUtil.js +2 -2
- package/lib/bind/userCdsrcJsonStorageProvider.js +1 -1
- package/lib/client/auth_manager.js +3 -1
- package/lib/client/helper/errors.js +6 -1
- package/lib/client/params.js +22 -20
- package/lib/client/settings_manager.js +17 -3
- package/lib/compile/openapi/csdl2openapi.js +2 -1
- package/lib/import/asyncapi/importAsyncAPI.js +32 -0
- package/lib/import/asyncapi/index.js +15 -0
- package/lib/import/asyncapi/parserContext.js +351 -0
- package/lib/import/asyncapi/utils.js +18 -0
- package/lib/import/common.js +21 -67
- package/lib/import/importapi.js +23 -2
- package/lib/import/message.js +11 -1
- package/lib/import/odata/index.js +14 -11
- package/lib/import/odata/metadataconverter/MetadataConverter.js +35 -35
- package/lib/import/odata/util/MultiMap.js +5 -5
- package/lib/import/odata/v2parser.js +1 -0
- package/lib/import/odata/v4parser.js +1281 -1139
- package/lib/init/constants.js +10 -3
- package/lib/init/template/_merging/registry-mta.js +33 -36
- package/lib/init/template/approuter/files/mtxs-configmap-java.yaml +20 -0
- package/lib/init/template/approuter/files/mtxs-configmap-nodejs.yaml +12 -0
- package/lib/init/template/approuter/index.js +24 -33
- package/lib/init/template/auditlog/files/package.json.hbs +27 -0
- package/lib/init/template/auditlog/index.js +12 -6
- package/lib/init/template/cf-manifest/index.js +1 -1
- package/lib/init/template/connectivity/index.js +1 -1
- package/lib/init/template/destinations/index.js +4 -2
- package/lib/init/template/enterprise-messaging/files/package.json.hbs +19 -0
- package/lib/init/template/enterprise-messaging/index.js +15 -13
- package/lib/init/template/enterprise-messaging-shared/files/event-mesh.json.hbs +31 -0
- package/lib/init/template/enterprise-messaging-shared/files/mta.yaml.hbs +15 -0
- package/lib/init/template/enterprise-messaging-shared/files/package.json.hbs +22 -0
- package/lib/init/template/enterprise-messaging-shared/files/values.yaml +7 -0
- package/lib/init/template/enterprise-messaging-shared/index.js +51 -0
- package/lib/init/template/extensibility/files/package.json.hbs +20 -0
- package/lib/init/template/extensibility/index.js +4 -16
- package/lib/init/template/file-based-messaging/files/package.json.hbs +19 -0
- package/lib/init/template/file-based-messaging/index.js +25 -0
- package/lib/init/template/hana/files/package.json.hbs +33 -0
- package/lib/init/template/hana/index.js +38 -65
- package/lib/init/template/helm/chart/templates/_deployment_helpers.tpl +0 -12
- package/lib/init/template/helm/chart/templates/_helpers.tpl +1 -121
- package/lib/init/template/helm/index.js +1 -1
- package/lib/init/template/html5-repo/index.js +1 -1
- package/lib/init/template/java/index.js +2 -2
- package/lib/init/template/kibana-logging/files/package.json.hbs +17 -0
- package/lib/init/template/kibana-logging/index.js +6 -19
- package/lib/init/template/lint/index.js +1 -1
- package/lib/init/template/mta/index.js +2 -2
- package/lib/init/template/multitenancy/files/mtxs-configmap-java.yaml +3 -5
- package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs.yaml +3 -10
- package/lib/init/template/multitenancy/files/package.json.hbs +5 -4
- package/lib/init/template/multitenancy/index.js +22 -19
- package/lib/init/template/nodejs/files/.vscode/launch.json +11 -3
- package/lib/init/template/nodejs/index.js +1 -1
- package/lib/init/template/pipeline/index.js +1 -1
- package/lib/init/template/redis-messaging/files/mta.yaml.hbs +14 -0
- package/lib/init/template/redis-messaging/files/package.json.hbs +22 -0
- package/lib/init/template/redis-messaging/index.js +50 -0
- package/lib/init/template/samples/index.js +3 -3
- package/lib/init/template/sqlite/files/package.json.hbs +12 -4
- package/lib/init/template/sqlite/index.js +5 -1
- package/lib/init/template/toggles/files/package.json.hbs +20 -0
- package/lib/init/template/toggles/index.js +3 -9
- package/lib/init/template/xsuaa/files/package.json.hbs +28 -0
- package/lib/init/template/xsuaa/index.js +8 -23
- package/lib/init/util/{md5Tracking.js → md5.js} +1 -1
- package/lib/init/util/merge.js +4 -9
- package/lib/init/util/{mvnArchetypeUtil.js → mvn.js} +3 -0
- package/lib/init/util/projectReader.js +25 -107
- package/lib/init/util/xml.js +56 -0
- package/lib/lint/checks.js +1 -1
- package/lib/lint/io.js +1 -1
- package/lib/{init/util/commandUtil.js → util/command.js} +4 -2
- package/lib/{init/util/fsUtil.js → util/fs.js} +2 -2
- package/npm-shrinkwrap.json +29 -28
- package/package.json +5 -4
- package/lib/init/template/approuter/files/cds.cdsrc.json +0 -7
- package/lib/init/template/approuter/files/cds.cdsrc.json.hbs +0 -9
- package/lib/init/template/approuter/files/cds.package.json +0 -9
- package/lib/init/template/approuter/files/cds.package.json.hbs +0 -11
- package/lib/init/template/auditlog/files/dependencies.package.json +0 -5
- package/lib/init/template/enterprise-messaging/files/cds.package.json +0 -9
- package/lib/init/template/enterprise-messaging/files/cds.profile.package.json.hbs +0 -11
- package/lib/init/template/enterprise-messaging/files/cdsrc.json +0 -7
- package/lib/init/template/enterprise-messaging/files/cdsrc.json.hbs +0 -9
- package/lib/init/template/extensibility/files/cds.package.json +0 -7
- package/lib/init/template/extensibility/files/cds.package.json.hbs +0 -9
- package/lib/init/template/extensibility/files/cdsrc.json +0 -5
- package/lib/init/template/extensibility/files/cdsrc.json.hbs +0 -7
- package/lib/init/template/hana/files/java/cds.json.hbs +0 -7
- package/lib/init/template/hana/files/java/cds.profile.json.hbs +0 -12
- package/lib/init/template/hana/files/java/cds.shortcut.json.hbs +0 -5
- package/lib/init/template/hana/files/java/cds.shortcut.profile.json.hbs +0 -8
- package/lib/init/template/hana/files/nodejs/cds.json.hbs +0 -9
- package/lib/init/template/hana/files/nodejs/cds.profile.json.hbs +0 -14
- package/lib/init/template/hana/files/nodejs/cds.shortcut.json.hbs +0 -7
- package/lib/init/template/hana/files/nodejs/cds.shortcut.profile.json.hbs +0 -10
- package/lib/init/template/hana/files/nodejs/dependencies.package.json +0 -5
- package/lib/init/template/helm/chart/templates/_sapcp_helpers.tpl +0 -103
- package/lib/init/template/kibana-logging/files/cds.profile.package.json.hbs +0 -9
- package/lib/init/template/toggles/files/cds.package.json +0 -7
- package/lib/init/template/toggles/files/cds.package.json.hbs +0 -9
- package/lib/init/template/toggles/files/cdsrc.json +0 -5
- package/lib/init/template/toggles/files/cdsrc.json.hbs +0 -7
- package/lib/init/template/xsuaa/files/cds.cdsrc.json +0 -7
- package/lib/init/template/xsuaa/files/cds.cdsrc.json.hbs +0 -9
- package/lib/init/template/xsuaa/files/cds.package.json +0 -9
- package/lib/init/template/xsuaa/files/cds.package.json.hbs +0 -11
- package/lib/init/template/xsuaa/files/dependencies.package.json +0 -6
- package/lib/init/util/versionCompare.js +0 -73
- /package/lib/init/template/hana/files/{java/db → db}/package.json +0 -0
- /package/lib/init/template/hana/files/{common/src → src}/.hdiconfig +0 -0
- /package/lib/init/template/hana/files/{common/undeploy.json → undeploy.json} +0 -0
- /package/lib/init/util/{templateUtil.js → template.js} +0 -0
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.34.0';
|
|
4
4
|
|
|
5
5
|
const constants = {
|
|
6
6
|
IS_WIN: (os.platform() === 'win32'),
|
|
@@ -13,6 +13,7 @@ const constants = {
|
|
|
13
13
|
OPTION_NODEJS: 'nodejs',
|
|
14
14
|
OPTION_JAVA: 'java',
|
|
15
15
|
OPTION_HANA: 'hana',
|
|
16
|
+
OPTION_SQLITE: 'sqlite',
|
|
16
17
|
OPTION_XSUAA: 'xsuaa',
|
|
17
18
|
OPTION_DESTINATIONS: 'destinations',
|
|
18
19
|
OPTION_MTA: 'mta',
|
|
@@ -22,6 +23,9 @@ const constants = {
|
|
|
22
23
|
OPTION_EXTENSIBILITY: 'extensibility',
|
|
23
24
|
OPTION_AUDITLOG: 'auditlog',
|
|
24
25
|
OPTION_ENTERPRISE_MESSAGING: 'enterprise-messaging',
|
|
26
|
+
OPTION_ENTERPRISE_MESSAGING_SHARED: 'enterprise-messaging-shared',
|
|
27
|
+
OPTION_FILE_BASED_MESSAGING: 'file-based-messaging',
|
|
28
|
+
OPTION_REDIS_MESSAGING: 'redis-messaging',
|
|
25
29
|
OPTION_APPROUTER: 'approuter',
|
|
26
30
|
OPTION_KIBANA_LOGGING: 'kibana-logging',
|
|
27
31
|
OPTION_CF_MANIFEST: 'cf-manifest',
|
|
@@ -36,10 +40,9 @@ const constants = {
|
|
|
36
40
|
OPTION_JAVA_MVN: 'java:mvn',
|
|
37
41
|
OPTION_HELM: 'helm',
|
|
38
42
|
|
|
39
|
-
// node enum
|
|
40
43
|
PROJECT_TYPE: Object.freeze({ nodejs: 1, java: 2, unknown: 3 }),
|
|
41
44
|
|
|
42
|
-
PYTHON_VENV_NAME:
|
|
45
|
+
PYTHON_VENV_NAME: '.cap-jupyter-nb',
|
|
43
46
|
|
|
44
47
|
REGEX_JAVA_PACKAGE: /^[a-z_][a-z0-9_]*(\.[a-z_][a-z0-9_]*)*$/g,
|
|
45
48
|
REGEX_PROJECT_NAME: /[^0-9a-zA-Z_-]/g,
|
|
@@ -78,8 +81,12 @@ constants.OPTIONS_PRIORITY = [
|
|
|
78
81
|
constants.OPTION_EXTENSIBILITY,
|
|
79
82
|
constants.OPTION_XSUAA,
|
|
80
83
|
constants.OPTION_HANA,
|
|
84
|
+
constants.OPTION_SQLITE,
|
|
81
85
|
constants.OPTION_AUDITLOG,
|
|
82
86
|
constants.OPTION_ENTERPRISE_MESSAGING,
|
|
87
|
+
constants.OPTION_ENTERPRISE_MESSAGING_SHARED,
|
|
88
|
+
constants.OPTION_FILE_BASED_MESSAGING,
|
|
89
|
+
constants.OPTION_REDIS_MESSAGING,
|
|
83
90
|
constants.OPTION_APPROUTER,
|
|
84
91
|
constants.OPTION_DESTINATIONS,
|
|
85
92
|
constants.OPTION_SAMPLES,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Registry of sequence matchers in mta.yaml files
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const srvNode4 = path => ({
|
|
4
4
|
in: 'modules',
|
|
5
5
|
where: [{
|
|
6
6
|
property: 'type',
|
|
@@ -11,7 +11,7 @@ const srvNode = path => ({
|
|
|
11
11
|
}],
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const srvJava4 = path => ({
|
|
15
15
|
in: 'modules',
|
|
16
16
|
where: [{
|
|
17
17
|
property: 'type',
|
|
@@ -55,6 +55,17 @@ const auditlog = {
|
|
|
55
55
|
}]
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
const redis = {
|
|
59
|
+
in: 'resources',
|
|
60
|
+
where: [{
|
|
61
|
+
property: 'type',
|
|
62
|
+
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
63
|
+
}, {
|
|
64
|
+
property: 'parameters.service',
|
|
65
|
+
isEqualTo: 'redis-cache',
|
|
66
|
+
}]
|
|
67
|
+
}
|
|
68
|
+
|
|
58
69
|
const enterpriseMessaging = {
|
|
59
70
|
in: 'resources',
|
|
60
71
|
where: [{
|
|
@@ -121,7 +132,7 @@ const saasRegistry = {
|
|
|
121
132
|
}]
|
|
122
133
|
}
|
|
123
134
|
|
|
124
|
-
const
|
|
135
|
+
const srvApi4 = srv => ({
|
|
125
136
|
in: [srv, 'provides'],
|
|
126
137
|
where: [{
|
|
127
138
|
property: 'name',
|
|
@@ -143,7 +154,7 @@ const mtxSidecar4 = path => ({
|
|
|
143
154
|
}]
|
|
144
155
|
})
|
|
145
156
|
|
|
146
|
-
const
|
|
157
|
+
const providedMtxApiSidecar4 = mtxSidecar => ({
|
|
147
158
|
in: [mtxSidecar, 'provides'],
|
|
148
159
|
where: [{
|
|
149
160
|
property: 'name',
|
|
@@ -154,7 +165,7 @@ const providedMtxAPISidecar4 = mtxSidecar => ({
|
|
|
154
165
|
}]
|
|
155
166
|
})
|
|
156
167
|
|
|
157
|
-
const
|
|
168
|
+
const requiredMtxApi = {
|
|
158
169
|
in: [approuter, 'requires'],
|
|
159
170
|
where: [{
|
|
160
171
|
property: 'properties.name',
|
|
@@ -165,7 +176,7 @@ const requiredMtxAPI = {
|
|
|
165
176
|
}]
|
|
166
177
|
}
|
|
167
178
|
|
|
168
|
-
const
|
|
179
|
+
const providedAppApi = {
|
|
169
180
|
in: [approuter, 'provides'],
|
|
170
181
|
where: [{
|
|
171
182
|
property: 'name',
|
|
@@ -179,7 +190,7 @@ const providedAppAPI = {
|
|
|
179
190
|
}],
|
|
180
191
|
}
|
|
181
192
|
|
|
182
|
-
const
|
|
193
|
+
const requiredAppApi4 = module => ({
|
|
183
194
|
in: [module, 'requires'],
|
|
184
195
|
where: [{
|
|
185
196
|
property: 'name',
|
|
@@ -190,7 +201,7 @@ const requiredAppAPI = module => ({
|
|
|
190
201
|
}]
|
|
191
202
|
})
|
|
192
203
|
|
|
193
|
-
const
|
|
204
|
+
const requiredMtxSidecarApi4 = srv => ({
|
|
194
205
|
in: [srv, 'requires'],
|
|
195
206
|
where: [{
|
|
196
207
|
property: 'properties.CDS_MULTITENANCY_SIDECAR_URL',
|
|
@@ -198,7 +209,7 @@ const requiredMtxSidecarAPI = srv => ({
|
|
|
198
209
|
}]
|
|
199
210
|
})
|
|
200
211
|
|
|
201
|
-
const
|
|
212
|
+
const providedJavaApprouterApi4 = srv => ({
|
|
202
213
|
in: [srv, 'requires'],
|
|
203
214
|
where: [{
|
|
204
215
|
property: 'properties.CDS_MULTITENANCY_APPUI_URL',
|
|
@@ -206,7 +217,7 @@ const requiredJavaApprouterAPI = srv => ({
|
|
|
206
217
|
}]
|
|
207
218
|
})
|
|
208
219
|
|
|
209
|
-
const
|
|
220
|
+
const providedJavaApprouterApi = {
|
|
210
221
|
in: [approuter, 'requires'],
|
|
211
222
|
where: [{
|
|
212
223
|
property: 'properties.url',
|
|
@@ -228,23 +239,9 @@ const approuterExtensibility = {
|
|
|
228
239
|
}]
|
|
229
240
|
}
|
|
230
241
|
|
|
231
|
-
const approuterExtensibilityJava = {
|
|
232
|
-
in: 'routes',
|
|
233
|
-
where: [{
|
|
234
|
-
property: 'source',
|
|
235
|
-
isEqualTo: '^/-/cds/.*'
|
|
236
|
-
}, {
|
|
237
|
-
property: 'destination',
|
|
238
|
-
isEqualTo: 'mtx-api',
|
|
239
|
-
}, {
|
|
240
|
-
property: 'authenticationType',
|
|
241
|
-
isEqualTo: 'none',
|
|
242
|
-
}]
|
|
243
|
-
}
|
|
244
|
-
|
|
245
242
|
module.exports = {
|
|
246
|
-
|
|
247
|
-
|
|
243
|
+
srvNode4,
|
|
244
|
+
srvJava4,
|
|
248
245
|
approuter,
|
|
249
246
|
xsuaa,
|
|
250
247
|
auditlog,
|
|
@@ -253,16 +250,16 @@ module.exports = {
|
|
|
253
250
|
hdiContainer,
|
|
254
251
|
serviceManager,
|
|
255
252
|
saasRegistry,
|
|
256
|
-
|
|
253
|
+
redis,
|
|
254
|
+
srvApi4,
|
|
257
255
|
mtxSidecar4,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
256
|
+
providedMtxApiSidecar4,
|
|
257
|
+
requiredMtxApi,
|
|
258
|
+
requiredMtxSidecarApi4,
|
|
259
|
+
providedAppApi,
|
|
260
|
+
requiredAppApi4,
|
|
261
|
+
providedJavaApprouterApi4,
|
|
262
|
+
providedJavaApprouterApi,
|
|
265
263
|
kibanaLogging,
|
|
266
|
-
approuterExtensibility
|
|
267
|
-
approuterExtensibilityJava
|
|
264
|
+
approuterExtensibility
|
|
268
265
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Please do not modify this file. This file may be overwritten.
|
|
2
|
+
|
|
3
|
+
{{- $approuterDeployment := .Values.approuter }}
|
|
4
|
+
{{- $ := merge (dict "name" "approuter" "deployment" .Values.approuter ) . }}
|
|
5
|
+
{{- $approuterUrl := (include "cap.deploymentHostFull" $ )}}
|
|
6
|
+
|
|
7
|
+
{{- $sidecarDeployment := .Values.sidecar }}
|
|
8
|
+
{{- $ = merge (dict "name" "sidecar" "deployment" .Values.sidecar ) . }}
|
|
9
|
+
{{- $sidecarUrl := (include "cap.deploymentHostFull" $ )}}
|
|
10
|
+
|
|
11
|
+
apiVersion: v1
|
|
12
|
+
kind: ConfigMap
|
|
13
|
+
metadata:
|
|
14
|
+
name: "{{ .Release.Name }}-mtxs-configmap"
|
|
15
|
+
namespace: "{{ .Release.Namespace }}"
|
|
16
|
+
data:
|
|
17
|
+
CDS_MULTITENANCY_APPUI_TENANTSEPARATOR: "-"
|
|
18
|
+
CDS_MULTITENANCY_APPUI_URL: {{ printf "https://%s" $approuterUrl }}
|
|
19
|
+
CDS_MULTITENANCY_MTXS_ENABLED: "true"
|
|
20
|
+
CDS_MULTITENANCY_SIDECAR_URL: {{ printf "https://%s" $sidecarUrl }}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Please do not modify this file. This file may be overwritten.
|
|
2
|
+
|
|
3
|
+
{{- $ := merge (dict "name" "approuter" "deployment" .Values.approuter ) . }}
|
|
4
|
+
{{- $approuterUrl := (include "cap.deploymentHostFull" $ )}}
|
|
5
|
+
|
|
6
|
+
apiVersion: v1
|
|
7
|
+
kind: ConfigMap
|
|
8
|
+
metadata:
|
|
9
|
+
name: "{{ .Release.Name }}-mtxs-configmap"
|
|
10
|
+
namespace: "{{ .Release.Namespace }}"
|
|
11
|
+
data:
|
|
12
|
+
SUBSCRIPTION_URL: {{ printf "https://${tenant_subdomain}-%s" $approuterUrl }}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
const cds = require('../../../cds')
|
|
2
|
+
const { exists } = cds.utils
|
|
1
3
|
const { join } = require('path')
|
|
2
4
|
const { readProject } = require('../../util/projectReader')
|
|
3
5
|
const { mergeJSON, mergeYAML, sortDependencies } = require('../../util/merge')
|
|
4
|
-
const { OPTION_XSUAA
|
|
6
|
+
const { OPTION_XSUAA } = require('../../constants')
|
|
5
7
|
const {
|
|
6
|
-
|
|
8
|
+
srvNode4, srvJava4, mtxSidecar4, approuter, // Modules
|
|
7
9
|
xsuaa, // BTP Services
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
approuterExtensibility
|
|
10
|
+
requiredMtxApi, providedJavaApprouterApi4, providedJavaApprouterApi, // APIs
|
|
11
|
+
requiredAppApi4, providedAppApi,
|
|
12
|
+
approuterExtensibility // xs-app.json config
|
|
11
13
|
} = require('../_merging/registry-mta')
|
|
12
|
-
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/
|
|
14
|
+
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5')
|
|
13
15
|
|
|
14
16
|
module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
15
17
|
|
|
16
18
|
static hasFacet(env) {
|
|
17
|
-
return
|
|
19
|
+
return exists(join(env.folders.app, 'xs-app.json'))
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
getDependencies() {
|
|
@@ -23,31 +25,11 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
23
25
|
|
|
24
26
|
async run() {
|
|
25
27
|
const projectDescriptor = await readProject(this.options)
|
|
26
|
-
const { for: forProfile } = projectDescriptor.cap
|
|
27
28
|
const appPath = projectDescriptor.ui.appPath ?? 'app'
|
|
28
29
|
const appPackageJSONPath = join(appPath, 'package.json')
|
|
29
|
-
|
|
30
30
|
await mergeJSON(appPackageJSONPath, join(__dirname, 'files', 'package.json'))
|
|
31
31
|
await sortDependencies(appPackageJSONPath)
|
|
32
|
-
|
|
33
32
|
await mergeJSON(join(appPath, 'default-env.json'), join(__dirname, 'files', 'default-env.json'))
|
|
34
|
-
|
|
35
|
-
const projectType = this.getProjectType()
|
|
36
|
-
switch (projectType) {
|
|
37
|
-
case PROJECT_TYPE.java: {
|
|
38
|
-
const cdsTemplateFile = forProfile ? 'cds.cdsrc.json.hbs' : 'cds.cdsrc.json'
|
|
39
|
-
const cdsPackageJSONPath = join(__dirname, 'files', cdsTemplateFile)
|
|
40
|
-
await mergeJSON('.cdsrc.json', cdsPackageJSONPath, projectDescriptor)
|
|
41
|
-
break
|
|
42
|
-
}
|
|
43
|
-
case PROJECT_TYPE.nodejs: {
|
|
44
|
-
const cdsTemplateFile = forProfile ? 'cds.package.json.hbs' : 'cds.package.json'
|
|
45
|
-
const cdsPackageJSONPath = join(__dirname, 'files', cdsTemplateFile)
|
|
46
|
-
await mergeJSON('package.json', cdsPackageJSONPath, projectDescriptor)
|
|
47
|
-
break
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
33
|
await this.runDependentMerging()
|
|
52
34
|
}
|
|
53
35
|
|
|
@@ -56,11 +38,11 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
56
38
|
const { isNodejs, isJava, isExtensible, isMultitenant, hasMta, hasHelm, srvPath } = projectDescriptor.cap
|
|
57
39
|
|
|
58
40
|
if (hasMta) {
|
|
59
|
-
const srv = (isNodejs ?
|
|
60
|
-
const apis = isJava ? [
|
|
41
|
+
const srv = (isNodejs ? srvNode4 : srvJava4)(srvPath)
|
|
42
|
+
const apis = isJava ? [providedJavaApprouterApi4(srv), providedJavaApprouterApi] : []
|
|
61
43
|
const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
|
|
62
|
-
if (isNodejs && isMultitenant) apis.push(
|
|
63
|
-
if (isJava && isMultitenant) apis.push(
|
|
44
|
+
if (isNodejs && isMultitenant) apis.push(requiredMtxApi, requiredAppApi4(mtxSidecar), providedAppApi)
|
|
45
|
+
if (isJava && isMultitenant) apis.push(requiredMtxApi)
|
|
64
46
|
const modules = [srv, approuter]
|
|
65
47
|
if (isMultitenant) modules.push(mtxSidecar)
|
|
66
48
|
const additions = [...modules, xsuaa, ...apis]
|
|
@@ -119,12 +101,21 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
119
101
|
{ force: true }
|
|
120
102
|
)
|
|
121
103
|
|
|
104
|
+
if(isMultitenant) {
|
|
105
|
+
const mtxsConfigMapFileName = isNodejs ? 'mtxs-configmap-nodejs.yaml' : 'mtxs-configmap-java.yaml';
|
|
106
|
+
await copyAndTrack(
|
|
107
|
+
join(__dirname, 'files', mtxsConfigMapFileName),
|
|
108
|
+
join('chart', 'templates', 'mtxs-configmap.yaml'),
|
|
109
|
+
context,
|
|
110
|
+
{ force: true }
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
122
114
|
if (isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData);
|
|
123
115
|
}
|
|
124
116
|
|
|
125
117
|
const xsAppPath = join(projectDescriptor.ui.appPath ?? 'app', 'xs-app.json')
|
|
126
|
-
const additions = isExtensible
|
|
127
|
-
isExtensible && isNodejs ? [{ ...approuterExtensibility, at: 0 }] : []
|
|
118
|
+
const additions = isExtensible ? [{ ...approuterExtensibility, at: 0 }] : []
|
|
128
119
|
await mergeJSON(xsAppPath, join(__dirname, 'files', 'xs-app.json.hbs'), projectDescriptor, { additions })
|
|
129
120
|
}
|
|
130
121
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
{{#cap.isNodejs}}
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"@sap/audit-logging": "^5"
|
|
5
|
+
},
|
|
6
|
+
"cds": {
|
|
7
|
+
{{/cap.isNodejs}}
|
|
8
|
+
"requires": {
|
|
9
|
+
{{#cap.for}}
|
|
10
|
+
"[{{cap.for}}]": {
|
|
11
|
+
{{/cap.for}}
|
|
12
|
+
{{#cap.shortcut}}
|
|
13
|
+
"audit-log": "service"
|
|
14
|
+
{{/cap.shortcut}}
|
|
15
|
+
{{^cap.shortcut}}
|
|
16
|
+
"audit-log": {
|
|
17
|
+
"kind": "service"
|
|
18
|
+
}
|
|
19
|
+
{{/cap.shortcut}}
|
|
20
|
+
{{#cap.for}}
|
|
21
|
+
}
|
|
22
|
+
{{/cap.for}}
|
|
23
|
+
}
|
|
24
|
+
{{#cap.isNodejs}}
|
|
25
|
+
}
|
|
26
|
+
{{/cap.isNodejs}}
|
|
27
|
+
}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
+
const cds = require('../../../cds')
|
|
2
|
+
const { read } = cds.utils
|
|
1
3
|
const { join } = require('path')
|
|
2
4
|
const { readProject } = require('../../util/projectReader')
|
|
3
|
-
const { mergeYAML } = require('../../util/merge')
|
|
4
|
-
const { parseMd5File, writeMd5File } = require('../../util/
|
|
5
|
-
const {
|
|
5
|
+
const { mergeJSON, mergeYAML } = require('../../util/merge')
|
|
6
|
+
const { parseMd5File, writeMd5File } = require('../../util/md5')
|
|
7
|
+
const { srvNode4, srvJava4, auditlog } = require('../_merging/registry-mta')
|
|
6
8
|
|
|
7
9
|
module.exports = class AuditlogTemplate extends require('../templateBase') {
|
|
8
10
|
|
|
9
|
-
static hasFacet() {
|
|
10
|
-
return
|
|
11
|
+
static hasFacet(env) {
|
|
12
|
+
return env.requires?.['audit-log']
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
async run() {
|
|
16
|
+
const projectDescriptor = await readProject(this.options)
|
|
17
|
+
const { configFile } = projectDescriptor.cap
|
|
18
|
+
projectDescriptor.cap.shortcut = !(await read(configFile)).cds?.requires?.['audit-log']?.kind
|
|
19
|
+
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), projectDescriptor)
|
|
14
20
|
await this.runDependentMerging()
|
|
15
21
|
}
|
|
16
22
|
|
|
@@ -19,7 +25,7 @@ module.exports = class AuditlogTemplate extends require('../templateBase') {
|
|
|
19
25
|
const { isNodejs, hasMta, hasHelm, srvPath } = projectDescriptor.cap
|
|
20
26
|
|
|
21
27
|
if (hasMta) {
|
|
22
|
-
const srv = (isNodejs ?
|
|
28
|
+
const srv = (isNodejs ? srvNode4 : srvJava4)(srvPath)
|
|
23
29
|
await mergeYAML(
|
|
24
30
|
'mta.yaml',
|
|
25
31
|
join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
@@ -2,7 +2,7 @@ const { join } = require('path')
|
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { exists } = require('../../../cds').utils
|
|
4
4
|
const { readProject } = require('../../util/projectReader')
|
|
5
|
-
const { copyFiles } = require('../../util/
|
|
5
|
+
const { copyFiles } = require('../../util/template')
|
|
6
6
|
const MANIFEST_FILE = 'manifest.yml'
|
|
7
7
|
const SERVICES_MANIFEST_FILE = 'services-manifest.yml'
|
|
8
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const { readProject } = require('../../util/projectReader')
|
|
3
3
|
const { mergeYAML } = require('../../util/merge')
|
|
4
|
-
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/
|
|
4
|
+
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5')
|
|
5
5
|
|
|
6
6
|
module.exports = class ConnectivityTemplate extends require('../templateBase') {
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const { readProject } = require('../../util/projectReader')
|
|
3
3
|
const { mergeYAML } = require('../../util/merge')
|
|
4
|
-
const { parseMd5File, writeMd5File } = require('../../util/
|
|
4
|
+
const { parseMd5File, writeMd5File } = require('../../util/md5')
|
|
5
5
|
|
|
6
6
|
module.exports = class DestinationsTemplate extends require('../templateBase') {
|
|
7
7
|
|
|
@@ -16,7 +16,9 @@ module.exports = class DestinationsTemplate extends require('../templateBase') {
|
|
|
16
16
|
|
|
17
17
|
static hasFacet(env) {
|
|
18
18
|
const kinds = { odata: 1, 'odata-v2': 1, 'odata-v4': 1, rest: 1 }
|
|
19
|
-
|
|
19
|
+
const mtxServices = { 'cds.xt.SaasProvisioningService': 1, 'cds.xt.DeploymentService': 1, 'cds.xt.ModelProviderService': 1, 'cds.xt.ExtensibilityService': 1 }
|
|
20
|
+
const _fromMtx = service => service in mtxServices
|
|
21
|
+
return Object.entries(env.requires).some(([service, require]) => !_fromMtx(service) && !kinds[service] && kinds[require.kind])
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
async run() {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
{{#cap.isNodejs}}
|
|
3
|
+
"cds": {
|
|
4
|
+
{{/cap.isNodejs}}
|
|
5
|
+
"requires": {
|
|
6
|
+
{{#cap.for}}
|
|
7
|
+
"[{{cap.for}}]": {
|
|
8
|
+
{{/cap.for}}
|
|
9
|
+
"messaging": {
|
|
10
|
+
"kind": "enterprise-messaging"
|
|
11
|
+
}
|
|
12
|
+
{{#cap.for}}
|
|
13
|
+
}
|
|
14
|
+
{{/cap.for}}
|
|
15
|
+
}
|
|
16
|
+
{{#cap.isNodejs}}
|
|
17
|
+
}
|
|
18
|
+
{{/cap.isNodejs}}
|
|
19
|
+
}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
|
+
const cds = require('../../../cds')
|
|
3
|
+
const { read } = cds.utils
|
|
2
4
|
const { readProject } = require('../../util/projectReader')
|
|
3
5
|
const { mergeJSON, mergeYAML } = require('../../util/merge')
|
|
4
|
-
const { parseMd5File, writeMd5File } = require('../../util/
|
|
5
|
-
const {
|
|
6
|
+
const { parseMd5File, writeMd5File } = require('../../util/md5')
|
|
7
|
+
const { srvNode4, srvJava4, enterpriseMessaging } = require('../_merging/registry-mta')
|
|
6
8
|
|
|
7
9
|
module.exports = class EnterpriseMessagingTemplate extends require('../templateBase') {
|
|
8
10
|
|
|
11
|
+
async canRun() {
|
|
12
|
+
const projectDescriptor = await readProject(this.options)
|
|
13
|
+
const { isJava } = projectDescriptor.cap
|
|
14
|
+
if (isJava) throw `'cds add enterprise-messaging' is not available for Java yet`
|
|
15
|
+
return true
|
|
16
|
+
}
|
|
9
17
|
|
|
10
18
|
static hasFacet(env) {
|
|
11
19
|
return env.requires?.messaging?.kind === 'enterprise-messaging-http'
|
|
@@ -13,12 +21,9 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
13
21
|
|
|
14
22
|
async run() {
|
|
15
23
|
const projectDescriptor = await readProject(this.options)
|
|
16
|
-
const {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const cdsTemplatePath = join(templatePath, cdsTemplateFile)
|
|
20
|
-
const configPath = isNodejs ? 'package.json' : '.cdsrc.json'
|
|
21
|
-
await mergeJSON(configPath, cdsTemplatePath, projectDescriptor)
|
|
24
|
+
const { configFile } = projectDescriptor.cap
|
|
25
|
+
projectDescriptor.cap.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
|
|
26
|
+
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), projectDescriptor)
|
|
22
27
|
await mergeJSON('event-mesh.json', join(__dirname, 'files', 'event-mesh.json.hbs'), projectDescriptor)
|
|
23
28
|
await this.runDependentMerging()
|
|
24
29
|
}
|
|
@@ -28,7 +33,7 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
28
33
|
const { hasHelm, hasMta, isNodejs, srvPath } = projectDescriptor.cap
|
|
29
34
|
|
|
30
35
|
if (hasMta) {
|
|
31
|
-
const srv = (isNodejs ?
|
|
36
|
+
const srv = (isNodejs ? srvNode4 : srvJava4)(srvPath)
|
|
32
37
|
await mergeYAML(
|
|
33
38
|
'mta.yaml',
|
|
34
39
|
join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
@@ -51,10 +56,7 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
51
56
|
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'))
|
|
52
57
|
}
|
|
53
58
|
|
|
54
|
-
await mergeYAML(
|
|
55
|
-
join('chart', 'values.yaml'),
|
|
56
|
-
join(__dirname, 'files', 'values.yaml')
|
|
57
|
-
)
|
|
59
|
+
await mergeYAML(join('chart', 'values.yaml'), join(__dirname, 'files', 'values.yaml'))
|
|
58
60
|
|
|
59
61
|
// copy service instance chart if it is not present
|
|
60
62
|
const HelmTemplate = require(`../helm`);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"emname": "{{cap.appName}}-emname",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"namespace": "default/sap.myapp/1",
|
|
5
|
+
"options": {
|
|
6
|
+
"management": true,
|
|
7
|
+
"messagingrest": true,
|
|
8
|
+
"messaging": true
|
|
9
|
+
},
|
|
10
|
+
"rules": {
|
|
11
|
+
"topicRules": {
|
|
12
|
+
"publishFilter": [
|
|
13
|
+
"${namespace}/sample"
|
|
14
|
+
],
|
|
15
|
+
"subscribeFilter": [
|
|
16
|
+
"*"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"queueRules": {
|
|
20
|
+
"publishFilter": [
|
|
21
|
+
"${namespace}/*"
|
|
22
|
+
],
|
|
23
|
+
"subscribeFilter": [
|
|
24
|
+
"${namespace}/*"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"authorities": [
|
|
29
|
+
"$ACCEPT_GRANTED_AUTHORITIES"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
modules:
|
|
3
|
+
- name: {{cap.appName}}-srv
|
|
4
|
+
type: {{cap.language}}
|
|
5
|
+
path: {{& cap.srvPath}}
|
|
6
|
+
requires:
|
|
7
|
+
- name: {{cap.appName}}-messaging
|
|
8
|
+
|
|
9
|
+
resources:
|
|
10
|
+
- name: {{cap.appName}}-messaging
|
|
11
|
+
type: org.cloudfoundry.managed-service
|
|
12
|
+
parameters:
|
|
13
|
+
service: enterprise-messaging
|
|
14
|
+
service-plan: default
|
|
15
|
+
path: ./event-mesh.json
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
{{#cap.isNodejs}}
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"@sap/xb-msg-amqp-v100": "^0"
|
|
5
|
+
},
|
|
6
|
+
"cds": {
|
|
7
|
+
{{/cap.isNodejs}}
|
|
8
|
+
"requires": {
|
|
9
|
+
{{#cap.for}}
|
|
10
|
+
"[{{cap.for}}]": {
|
|
11
|
+
{{/cap.for}}
|
|
12
|
+
"messaging": {
|
|
13
|
+
"kind": "enterprise-messaging-shared"
|
|
14
|
+
}
|
|
15
|
+
{{#cap.for}}
|
|
16
|
+
}
|
|
17
|
+
{{/cap.for}}
|
|
18
|
+
}
|
|
19
|
+
{{#cap.isNodejs}}
|
|
20
|
+
}
|
|
21
|
+
{{/cap.isNodejs}}
|
|
22
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const { join } = require('path')
|
|
2
|
+
const cds = require('../../../cds')
|
|
3
|
+
const { read } = cds.utils
|
|
4
|
+
const { readProject } = require('../../util/projectReader')
|
|
5
|
+
const { mergeJSON, mergeYAML } = require('../../util/merge')
|
|
6
|
+
const { srvNode4, srvJava4, enterpriseMessaging } = require('../_merging/registry-mta')
|
|
7
|
+
|
|
8
|
+
module.exports = class EnterpriseMessagingSharedTemplate extends require('../templateBase') {
|
|
9
|
+
|
|
10
|
+
async canRun() {
|
|
11
|
+
const projectDescriptor = await readProject(this.options)
|
|
12
|
+
const { hasMta, hasHelm, isJava } = projectDescriptor.cap
|
|
13
|
+
if (isJava) throw `'cds add enterprise-messaging-shared' is not available for Java yet`
|
|
14
|
+
if (hasHelm && !hasMta) throw `'cds add enterprise-messaging-shared' is not available for Kyma yet`
|
|
15
|
+
return true
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static hasFacet(env) {
|
|
19
|
+
return env.requires?.messaging?.kind === 'enterprise-messaging-shared'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async run() {
|
|
23
|
+
const projectDescriptor = await readProject(this.options)
|
|
24
|
+
const { configFile } = projectDescriptor.cap
|
|
25
|
+
projectDescriptor.cap.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
|
|
26
|
+
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), projectDescriptor)
|
|
27
|
+
await mergeJSON('event-mesh.json', join(__dirname, 'files', 'event-mesh.json.hbs'), projectDescriptor)
|
|
28
|
+
await this.runDependentMerging()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async runDependentMerging() {
|
|
32
|
+
const projectDescriptor = await readProject(this.options)
|
|
33
|
+
const { hasMta, isNodejs, srvPath } = projectDescriptor.cap
|
|
34
|
+
|
|
35
|
+
if (hasMta) {
|
|
36
|
+
const srv = (isNodejs ? srvNode4 : srvJava4)(srvPath)
|
|
37
|
+
await mergeYAML(
|
|
38
|
+
'mta.yaml',
|
|
39
|
+
join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
40
|
+
projectDescriptor,
|
|
41
|
+
{
|
|
42
|
+
additions: [srv, enterpriseMessaging],
|
|
43
|
+
relationships: [{
|
|
44
|
+
insert: [enterpriseMessaging, 'name'],
|
|
45
|
+
into: [srv, 'requires', 'name']
|
|
46
|
+
}]
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|