@sap/cds-dk 6.6.2 → 6.7.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 +36 -1
- package/bin/add.js +5 -3
- package/bin/build/all.js +1 -1
- package/bin/cds.js +10 -8
- package/bin/env.js +4 -6
- package/bin/login.js +6 -4
- package/bin/migrate.js +0 -1
- package/bin/repl.js +1 -1
- package/bin/serve.js +7 -0
- package/bin/subscribe.js +5 -5
- package/bin/unsubscribe.js +4 -5
- package/bin/upgrade.js +67 -0
- package/bin/watch.js +8 -5
- package/lib/bind/bindingManager.js +3 -2
- package/lib/bind/cfKeyProvider.js +7 -6
- package/lib/bind/userCdsrcJsonStorageProvider.js +5 -4
- package/lib/cds.js +12 -0
- package/lib/client/activate.js +4 -3
- package/lib/client/auth_manager.js +4 -3
- package/lib/client/base_command.js +7 -2
- package/lib/client/helper/cf_helper.js +12 -11
- package/lib/client/helper/dependency_helper.js +3 -2
- package/lib/client/helper/logging.js +0 -7
- package/lib/client/params.js +4 -2
- package/lib/client/settings_manager.js +35 -34
- package/lib/client/tenant_action.js +78 -0
- package/lib/init/constants.js +1 -1
- package/lib/init/index.js +4 -4
- package/lib/init/template/_merging/registry-mta.js +31 -46
- package/lib/init/template/approuter/files/mta.yaml.hbs +12 -8
- package/lib/init/template/approuter/files/xs-app.json.hbs +0 -3
- package/lib/init/template/approuter/index.js +26 -34
- package/lib/init/template/auditlog/files/mta.yaml.hbs +2 -1
- package/lib/init/template/auditlog/index.js +8 -21
- package/lib/init/template/cf-manifest/files/manifest.yml.hbs +4 -4
- package/lib/init/template/cf-manifest/index.js +2 -1
- package/lib/init/template/connectivity/index.js +4 -5
- package/lib/init/template/data/index.js +19 -22
- package/lib/init/template/destinations/index.js +5 -17
- package/lib/init/template/enterprise-messaging/files/mta.yaml.hbs +2 -1
- package/lib/init/template/enterprise-messaging/index.js +7 -19
- package/lib/init/template/extensibility/index.js +3 -1
- package/lib/init/template/hana/files/mta.yaml.hbs +4 -5
- package/lib/init/template/hana/index.js +49 -84
- package/lib/init/template/helm/chart/templates/_helpers.tpl +4 -1
- package/lib/init/template/helm/files/Chart.yaml.hbs +1 -4
- package/lib/init/template/helm/index.js +45 -13
- package/lib/init/template/helm/subcharts/web-application/templates/_helpers.tpl +21 -31
- package/lib/init/template/helm/subcharts/web-application/templates/api-rule.yaml +3 -12
- package/lib/init/template/helm/subcharts/web-application/templates/deployment.yaml +12 -14
- package/lib/init/template/helm/subcharts/web-application/templates/network-policy.yaml +27 -4
- package/lib/init/template/helm/subcharts/web-application/templates/pod-disruption-budget.yaml +0 -2
- package/lib/init/template/helm/subcharts/web-application/templates/secret.yaml +2 -2
- package/lib/init/template/helm/subcharts/web-application/templates/service-account.yaml +2 -2
- package/lib/init/template/helm/subcharts/web-application/templates/service-binding.yaml +16 -13
- package/lib/init/template/helm/subcharts/web-application/templating.md +16 -9
- package/lib/init/template/helm/subcharts/web-application/values.md +317 -379
- package/lib/init/template/helm/subcharts/web-application/values.schema.json +87 -107
- package/lib/init/template/helm/subcharts/web-application/values.yaml +28 -2
- package/lib/init/template/html5-repo/index.js +6 -29
- package/lib/init/template/java/index.js +1 -1
- package/lib/init/template/kibana-logging/files/mta.yaml.hbs +2 -1
- package/lib/init/template/kibana-logging/index.js +5 -8
- package/lib/init/template/lint/index.js +8 -8
- package/lib/init/template/mta/files/mta.yaml.hbs +3 -2
- package/lib/init/template/mta/index.js +3 -2
- package/lib/init/template/multitenancy/files/mta.yaml.hbs +25 -31
- package/lib/init/template/multitenancy/files/{java/mtxs-configmap.yaml → mtxs-configmap-java.yaml} +1 -1
- package/lib/init/template/multitenancy/files/{mtxs-configmap.yaml → mtxs-configmap-nodejs.yaml} +5 -1
- package/lib/init/template/multitenancy/files/package.json.hbs +28 -0
- package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +21 -0
- package/lib/init/template/multitenancy/files/values.yaml.hbs +16 -9
- package/lib/init/template/multitenancy/index.js +51 -99
- package/lib/init/template/nodejs/files/.vscode/extensions.json +1 -2
- package/lib/init/template/nodejs/files/.vscode/launch.json +2 -2
- package/lib/init/template/nodejs/files/.vscode/tasks.json +2 -2
- package/lib/init/template/nodejs/files/package.json.hbs +2 -2
- package/lib/init/template/nodejs/index.js +4 -3
- package/lib/init/template/pipeline/index.js +3 -2
- package/lib/init/template/samples/index.js +5 -4
- package/lib/init/template/sqlite/files/package.json.hbs +19 -0
- package/lib/init/template/sqlite/index.js +11 -0
- package/lib/init/template/toggles/index.js +3 -5
- package/lib/init/template/xsuaa/files/mta.yaml.hbs +4 -5
- package/lib/init/template/xsuaa/files/values.yaml.hbs +0 -2
- package/lib/init/template/xsuaa/index.js +14 -35
- package/lib/init/util/commandUtil.js +3 -2
- package/lib/init/util/fsUtil.js +19 -2
- package/lib/init/util/md5Tracking.js +36 -63
- package/lib/init/util/projectReader.js +12 -26
- package/lib/lint/Linter.js +0 -3
- package/lib/util/exec.js +2 -1
- package/lib/util/term.js +1 -1
- package/lib/watch/livereload-connect.js +5 -4
- package/lib/watch/livereload-server.js +3 -6
- package/lib/watch/node-watch.js +1 -1
- package/npm-shrinkwrap.json +569 -479
- package/package.json +4 -4
- package/readme.md +1 -1
- package/lib/client/subscription.js +0 -84
- package/lib/init/template/approuter/files/chart.yaml +0 -4
- package/lib/init/template/auditlog/files/auditlog.yaml +0 -4
- package/lib/init/template/destinations/files/destination.yaml +0 -4
- package/lib/init/template/enterprise-messaging/files/event-mesh.yaml +0 -4
- package/lib/init/template/hana/files/hana-deployer.yaml +0 -4
- package/lib/init/template/hana/files/hana.yaml +0 -4
- package/lib/init/template/html5-repo/files/html5-apps-deployer.yaml +0 -4
- package/lib/init/template/html5-repo/files/html5-apps-repo-host.yaml +0 -4
- package/lib/init/template/multitenancy/files/cds.package.json +0 -7
- package/lib/init/template/multitenancy/files/cds.package.json.hbs +0 -9
- package/lib/init/template/multitenancy/files/dependencies.package.json +0 -5
- package/lib/init/template/multitenancy/files/java/.cdsrc.json +0 -22
- package/lib/init/template/multitenancy/files/java/package.json +0 -33
- package/lib/init/template/multitenancy/files/saas-registry.yaml +0 -4
- package/lib/init/template/multitenancy/files/service-manager.yaml +0 -4
- package/lib/init/template/multitenancy/files/sidecar.yaml +0 -4
- package/lib/init/template/xsuaa/files/xsuaa.yaml +0 -4
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
// Registry of sequence matchers in mta.yaml files
|
|
2
2
|
|
|
3
|
-
const srvNode = {
|
|
3
|
+
const srvNode = path => ({
|
|
4
4
|
in: 'modules',
|
|
5
5
|
where: [{
|
|
6
6
|
property: 'type',
|
|
7
|
-
isEqualTo: 'nodejs'
|
|
7
|
+
isEqualTo: 'nodejs',
|
|
8
|
+
}, {
|
|
9
|
+
property: 'path',
|
|
10
|
+
isEqualTo: path
|
|
8
11
|
}],
|
|
9
|
-
}
|
|
12
|
+
})
|
|
10
13
|
|
|
11
|
-
const srvJava = {
|
|
14
|
+
const srvJava = path => ({
|
|
12
15
|
in: 'modules',
|
|
13
16
|
where: [{
|
|
14
17
|
property: 'type',
|
|
15
18
|
isEqualTo: 'java'
|
|
19
|
+
}, {
|
|
20
|
+
property: 'path',
|
|
21
|
+
isEqualTo: path
|
|
16
22
|
}],
|
|
17
|
-
}
|
|
23
|
+
})
|
|
18
24
|
|
|
19
25
|
const approuter = {
|
|
20
26
|
in: 'modules',
|
|
@@ -115,8 +121,8 @@ const saasRegistry = {
|
|
|
115
121
|
}]
|
|
116
122
|
}
|
|
117
123
|
|
|
118
|
-
const srvAPI = {
|
|
119
|
-
in: 'provides',
|
|
124
|
+
const srvAPI = srv => ({
|
|
125
|
+
in: [srv, 'provides'],
|
|
120
126
|
where: [{
|
|
121
127
|
property: 'name',
|
|
122
128
|
isEqualTo: 'srv-api'
|
|
@@ -124,31 +130,20 @@ const srvAPI = {
|
|
|
124
130
|
property: 'properties.srv-url',
|
|
125
131
|
isEqualTo: '${default-url}'
|
|
126
132
|
}]
|
|
127
|
-
}
|
|
133
|
+
})
|
|
128
134
|
|
|
129
|
-
const
|
|
135
|
+
const mtxSidecar4 = path => ({
|
|
130
136
|
in: 'modules',
|
|
131
137
|
where: [{
|
|
132
138
|
property: 'type',
|
|
133
139
|
isEqualTo: `nodejs`
|
|
134
140
|
}, {
|
|
135
141
|
property: 'path',
|
|
136
|
-
isEqualTo:
|
|
137
|
-
}]
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const providedMtxAPISrv = {
|
|
141
|
-
in: [srvNode, 'provides'],
|
|
142
|
-
where: [{
|
|
143
|
-
property: 'name',
|
|
144
|
-
isEqualTo: 'mtx-api'
|
|
145
|
-
}, {
|
|
146
|
-
property: 'properties.mtx-url',
|
|
147
|
-
isEqualTo: '${default-url}'
|
|
142
|
+
isEqualTo: path // 'gen/mtx/sidecar' REVISIT: Same build destination for Java/Node.js would simplify this a lot
|
|
148
143
|
}]
|
|
149
|
-
}
|
|
144
|
+
})
|
|
150
145
|
|
|
151
|
-
const
|
|
146
|
+
const providedMtxAPISidecar4 = mtxSidecar => ({
|
|
152
147
|
in: [mtxSidecar, 'provides'],
|
|
153
148
|
where: [{
|
|
154
149
|
property: 'name',
|
|
@@ -157,7 +152,7 @@ const providedMtxAPISidecar = {
|
|
|
157
152
|
property: 'properties.mtx-url',
|
|
158
153
|
isEqualTo: '${default-url}'
|
|
159
154
|
}]
|
|
160
|
-
}
|
|
155
|
+
})
|
|
161
156
|
|
|
162
157
|
const requiredMtxAPI = {
|
|
163
158
|
in: [approuter, 'requires'],
|
|
@@ -184,8 +179,8 @@ const providedAppAPI = {
|
|
|
184
179
|
}],
|
|
185
180
|
}
|
|
186
181
|
|
|
187
|
-
const requiredAppAPI = {
|
|
188
|
-
in: [
|
|
182
|
+
const requiredAppAPI = module => ({
|
|
183
|
+
in: [module, 'requires'],
|
|
189
184
|
where: [{
|
|
190
185
|
property: 'name',
|
|
191
186
|
isEqualTo: 'app-api'
|
|
@@ -193,31 +188,23 @@ const requiredAppAPI = {
|
|
|
193
188
|
property: 'properties.SUBSCRIPTION_URL',
|
|
194
189
|
isEqualTo: '~{app-protocol}://\\${tenant_subdomain}-~{app-uri}'
|
|
195
190
|
}]
|
|
196
|
-
}
|
|
191
|
+
})
|
|
197
192
|
|
|
198
|
-
const
|
|
199
|
-
in: [
|
|
200
|
-
where: [{
|
|
201
|
-
property: 'properties.url',
|
|
202
|
-
isEqualTo: '${default-url}'
|
|
203
|
-
}]
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
const requiredMtxSidecarAPI = {
|
|
207
|
-
in: [srvJava, 'requires'],
|
|
193
|
+
const requiredMtxSidecarAPI = srv => ({
|
|
194
|
+
in: [srv, 'requires'],
|
|
208
195
|
where: [{
|
|
209
196
|
property: 'properties.CDS_MULTITENANCY_SIDECAR_URL',
|
|
210
|
-
isEqualTo: '~{url}'
|
|
197
|
+
isEqualTo: '~{mtx-url}'
|
|
211
198
|
}]
|
|
212
|
-
}
|
|
199
|
+
})
|
|
213
200
|
|
|
214
|
-
const requiredJavaApprouterAPI = {
|
|
215
|
-
in: [
|
|
201
|
+
const requiredJavaApprouterAPI = srv => ({
|
|
202
|
+
in: [srv, 'requires'],
|
|
216
203
|
where: [{
|
|
217
204
|
property: 'properties.CDS_MULTITENANCY_APPUI_URL',
|
|
218
205
|
isEqualTo: '~{url}'
|
|
219
206
|
}]
|
|
220
|
-
}
|
|
207
|
+
})
|
|
221
208
|
|
|
222
209
|
const providedJavaApprouterAPI = {
|
|
223
210
|
in: [approuter, 'requires'],
|
|
@@ -267,11 +254,9 @@ module.exports = {
|
|
|
267
254
|
serviceManager,
|
|
268
255
|
saasRegistry,
|
|
269
256
|
srvAPI,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
providedMtxAPISidecar,
|
|
257
|
+
mtxSidecar4,
|
|
258
|
+
providedMtxAPISidecar4,
|
|
273
259
|
requiredMtxAPI,
|
|
274
|
-
providedMtxSidecarAPI,
|
|
275
260
|
requiredMtxSidecarAPI,
|
|
276
261
|
providedAppAPI,
|
|
277
262
|
requiredAppAPI,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
modules:
|
|
3
3
|
- name: {{cap.appName}}-srv
|
|
4
|
-
type: {{cap.
|
|
4
|
+
type: {{cap.language}}
|
|
5
|
+
path: {{& cap.srvPath}}
|
|
5
6
|
{{#cap.isJava}}
|
|
6
7
|
{{#cap.isMultitenant}}
|
|
7
8
|
properties:
|
|
@@ -10,13 +11,6 @@ modules:
|
|
|
10
11
|
{{/cap.isJava}}
|
|
11
12
|
requires:
|
|
12
13
|
- name: {{cap.appName}}-auth
|
|
13
|
-
{{#cap.isNodejs}}
|
|
14
|
-
{{#cap.isMultitenant}}
|
|
15
|
-
- name: app-api
|
|
16
|
-
properties:
|
|
17
|
-
SUBSCRIPTION_URL: ~{app-protocol}://\${tenant_subdomain}-~{app-uri}
|
|
18
|
-
{{/cap.isMultitenant}}
|
|
19
|
-
{{/cap.isNodejs}}
|
|
20
14
|
{{#cap.isJava}}
|
|
21
15
|
- name: app-api
|
|
22
16
|
properties:
|
|
@@ -64,6 +58,16 @@ modules:
|
|
|
64
58
|
url: ${default-url}
|
|
65
59
|
{{/cap.isJava}}
|
|
66
60
|
|
|
61
|
+
{{#cap.isMultitenant}}
|
|
62
|
+
- name: {{cap.appName}}-mtx
|
|
63
|
+
type: nodejs
|
|
64
|
+
path: {{#cap.isNodejs}}gen/{{/cap.isNodejs}}mtx/sidecar
|
|
65
|
+
requires:
|
|
66
|
+
- name: app-api
|
|
67
|
+
properties:
|
|
68
|
+
SUBSCRIPTION_URL: ~{app-protocol}://\${tenant_subdomain}-~{app-uri}
|
|
69
|
+
{{/cap.isMultitenant}}
|
|
70
|
+
|
|
67
71
|
resources:
|
|
68
72
|
- name: {{cap.appName}}-auth
|
|
69
73
|
type: org.cloudfoundry.managed-service
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"authenticationMethod": "route",
|
|
3
2
|
"routes": [
|
|
4
3
|
{{#cap.isExtensible}}
|
|
5
4
|
{
|
|
@@ -12,14 +11,12 @@
|
|
|
12
11
|
"source": "^/app/(.*)$",
|
|
13
12
|
"target": "$1",
|
|
14
13
|
"localDir": ".",
|
|
15
|
-
"authenticationType": "xsuaa",
|
|
16
14
|
"cacheControl": "no-cache, no-store, must-revalidate"
|
|
17
15
|
},
|
|
18
16
|
{
|
|
19
17
|
"source": "^/(.*)$",
|
|
20
18
|
"target": "$1",
|
|
21
19
|
"destination": "srv-api",
|
|
22
|
-
"authenticationType": "xsuaa",
|
|
23
20
|
"csrfProtection": true
|
|
24
21
|
}
|
|
25
22
|
]
|
|
@@ -3,7 +3,7 @@ const { readProject } = require('../../util/projectReader')
|
|
|
3
3
|
const { mergeJSON, mergeYAML, sortDependencies } = require('../../util/merge')
|
|
4
4
|
const { OPTION_XSUAA, PROJECT_TYPE } = require('../../constants')
|
|
5
5
|
const {
|
|
6
|
-
srvNode, srvJava, approuter, // Modules
|
|
6
|
+
srvNode, srvJava, mtxSidecar4, approuter, // Modules
|
|
7
7
|
xsuaa, // BTP Services
|
|
8
8
|
requiredMtxAPI, requiredJavaApprouterAPI, providedJavaApprouterAPI, // APIs
|
|
9
9
|
requiredAppAPI, providedAppAPI,
|
|
@@ -24,7 +24,7 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
24
24
|
async run() {
|
|
25
25
|
const projectDescriptor = await readProject(this.options)
|
|
26
26
|
const { for: forProfile } = projectDescriptor.cap
|
|
27
|
-
const appPath =
|
|
27
|
+
const appPath = projectDescriptor.ui.appPath ?? 'app'
|
|
28
28
|
const appPackageJSONPath = join(appPath, 'package.json')
|
|
29
29
|
|
|
30
30
|
await mergeJSON(appPackageJSONPath, join(__dirname, 'files', 'package.json'))
|
|
@@ -35,17 +35,15 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
35
35
|
const projectType = this.getProjectType()
|
|
36
36
|
switch (projectType) {
|
|
37
37
|
case PROJECT_TYPE.java: {
|
|
38
|
-
const cdsrcJSONPath = join(this.projectPath, '.cdsrc.json')
|
|
39
38
|
const cdsTemplateFile = forProfile ? 'cds.cdsrc.json.hbs' : 'cds.cdsrc.json'
|
|
40
39
|
const cdsPackageJSONPath = join(__dirname, 'files', cdsTemplateFile)
|
|
41
|
-
await mergeJSON(
|
|
40
|
+
await mergeJSON('.cdsrc.json', cdsPackageJSONPath, projectDescriptor)
|
|
42
41
|
break
|
|
43
42
|
}
|
|
44
43
|
case PROJECT_TYPE.nodejs: {
|
|
45
|
-
const packageJSONPath = join(this.projectPath, 'package.json')
|
|
46
44
|
const cdsTemplateFile = forProfile ? 'cds.package.json.hbs' : 'cds.package.json'
|
|
47
45
|
const cdsPackageJSONPath = join(__dirname, 'files', cdsTemplateFile)
|
|
48
|
-
await mergeJSON(
|
|
46
|
+
await mergeJSON('package.json', cdsPackageJSONPath, projectDescriptor)
|
|
49
47
|
break
|
|
50
48
|
}
|
|
51
49
|
}
|
|
@@ -55,16 +53,18 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
55
53
|
|
|
56
54
|
async runDependentMerging(context = {}) {
|
|
57
55
|
const projectDescriptor = await readProject(this.options)
|
|
58
|
-
const { isNodejs, isJava, isExtensible, isMultitenant, hasMta, hasHelm } = projectDescriptor.cap
|
|
56
|
+
const { isNodejs, isJava, isExtensible, isMultitenant, hasMta, hasHelm, srvPath } = projectDescriptor.cap
|
|
59
57
|
|
|
60
58
|
if (hasMta) {
|
|
61
|
-
const srv = isNodejs ? srvNode : srvJava
|
|
62
|
-
const apis = isJava ? [requiredJavaApprouterAPI, providedJavaApprouterAPI] : []
|
|
63
|
-
|
|
59
|
+
const srv = (isNodejs ? srvNode : srvJava)(srvPath)
|
|
60
|
+
const apis = isJava ? [requiredJavaApprouterAPI(srv), providedJavaApprouterAPI] : []
|
|
61
|
+
const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
|
|
62
|
+
if (isNodejs && isMultitenant) apis.push(requiredMtxAPI, requiredAppAPI(mtxSidecar), providedAppAPI)
|
|
64
63
|
if (isJava && isMultitenant) apis.push(requiredMtxAPI)
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
const modules = [srv, approuter]
|
|
65
|
+
if (isMultitenant) modules.push(mtxSidecar)
|
|
66
|
+
const additions = [...modules, xsuaa, ...apis]
|
|
67
|
+
await mergeYAML('mta.yaml', join(__dirname, 'files', 'mta.yaml.hbs'), projectDescriptor, {
|
|
68
68
|
additions,
|
|
69
69
|
relationships: [{
|
|
70
70
|
insert: [xsuaa, 'name'],
|
|
@@ -80,30 +80,22 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
80
80
|
let isIndependentCommand = false;
|
|
81
81
|
if (Object.keys(context).length == 0) {
|
|
82
82
|
isIndependentCommand = true;
|
|
83
|
-
context.
|
|
84
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'));
|
|
83
|
+
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'));
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
await mergeYAML(
|
|
88
|
-
join(
|
|
87
|
+
join('chart', 'values.yaml'),
|
|
89
88
|
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
90
89
|
projectDescriptor
|
|
91
90
|
)
|
|
92
91
|
|
|
92
|
+
// add dependency entry in chart.yaml
|
|
93
|
+
const HelmTemplate = require(`../helm`);
|
|
94
|
+
const helmTemplate = new HelmTemplate(this.generator, context.oldTrackingData, context.newTrackingData);
|
|
95
|
+
await helmTemplate.addDependency('web-application', 'approuter');
|
|
96
|
+
|
|
93
97
|
await mergeYAML(
|
|
94
|
-
join(
|
|
95
|
-
join(__dirname, 'files', 'chart.yaml'),
|
|
96
|
-
projectDescriptor,
|
|
97
|
-
{ additions: [{
|
|
98
|
-
in: `dependencies`,
|
|
99
|
-
where: [{
|
|
100
|
-
property: 'alias',
|
|
101
|
-
isEqualTo: 'approuter'
|
|
102
|
-
}]
|
|
103
|
-
}]}
|
|
104
|
-
)
|
|
105
|
-
await mergeYAML(
|
|
106
|
-
join(this.projectPath, 'chart', 'values.yaml'),
|
|
98
|
+
join('chart', 'values.yaml'),
|
|
107
99
|
{
|
|
108
100
|
approuter: {
|
|
109
101
|
envFrom: [
|
|
@@ -122,17 +114,17 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
122
114
|
|
|
123
115
|
await copyAndTrack(
|
|
124
116
|
join(__dirname, 'files', fileName),
|
|
125
|
-
join(
|
|
117
|
+
join('chart', 'templates', 'approuter-configmap.yaml'),
|
|
126
118
|
context,
|
|
127
|
-
true
|
|
119
|
+
{ force: true }
|
|
128
120
|
)
|
|
129
121
|
|
|
130
|
-
if (isIndependentCommand) await writeMd5File(join(
|
|
122
|
+
if (isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData);
|
|
131
123
|
}
|
|
132
124
|
|
|
133
|
-
const
|
|
125
|
+
const xsAppPath = join(projectDescriptor.ui.appPath ?? 'app', 'xs-app.json')
|
|
134
126
|
const additions = isExtensible && isJava ? [{ ...approuterExtensibilityJava, at: 0 }] :
|
|
135
127
|
isExtensible && isNodejs ? [{ ...approuterExtensibility, at: 0 }] : []
|
|
136
|
-
await mergeJSON(
|
|
128
|
+
await mergeJSON(xsAppPath, join(__dirname, 'files', 'xs-app.json.hbs'), projectDescriptor, { additions })
|
|
137
129
|
}
|
|
138
130
|
}
|
|
@@ -16,13 +16,12 @@ module.exports = class AuditlogTemplate extends require('../templateBase') {
|
|
|
16
16
|
|
|
17
17
|
async runDependentMerging(context = {}) {
|
|
18
18
|
const projectDescriptor = await readProject(this.options)
|
|
19
|
-
const { isNodejs, hasMta, hasHelm } = projectDescriptor.cap
|
|
19
|
+
const { isNodejs, hasMta, hasHelm, srvPath } = projectDescriptor.cap
|
|
20
20
|
|
|
21
21
|
if (hasMta) {
|
|
22
|
-
const
|
|
23
|
-
const srv = isNodejs ? srvNode : srvJava
|
|
22
|
+
const srv = (isNodejs ? srvNode : srvJava)(srvPath)
|
|
24
23
|
await mergeYAML(
|
|
25
|
-
|
|
24
|
+
'mta.yaml',
|
|
26
25
|
join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
27
26
|
projectDescriptor,
|
|
28
27
|
{
|
|
@@ -40,12 +39,11 @@ module.exports = class AuditlogTemplate extends require('../templateBase') {
|
|
|
40
39
|
let isIndependentCommand = false
|
|
41
40
|
if(Object.keys(context).length == 0){
|
|
42
41
|
isIndependentCommand = true
|
|
43
|
-
context.
|
|
44
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'))
|
|
42
|
+
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'))
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
await mergeYAML(
|
|
48
|
-
join(
|
|
46
|
+
join('chart', 'values.yaml'),
|
|
49
47
|
{
|
|
50
48
|
srv: { bindings: {
|
|
51
49
|
auditlog: { serviceInstanceName: 'auditlog' }
|
|
@@ -56,27 +54,16 @@ module.exports = class AuditlogTemplate extends require('../templateBase') {
|
|
|
56
54
|
}
|
|
57
55
|
}
|
|
58
56
|
)
|
|
59
|
-
|
|
57
|
+
|
|
60
58
|
// copy service instance chart if it is not present
|
|
61
59
|
const HelmTemplate = require(`../helm`);
|
|
62
60
|
const helmTemplate = new HelmTemplate(this.generator, context.oldTrackingData, context.newTrackingData);
|
|
63
61
|
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
64
62
|
|
|
65
63
|
// add dependency entry in chart.yaml
|
|
66
|
-
await
|
|
67
|
-
join(this.projectPath, 'chart', 'Chart.yaml'),
|
|
68
|
-
join(__dirname, 'files', 'auditlog.yaml'),
|
|
69
|
-
projectDescriptor,
|
|
70
|
-
{ additions: [{
|
|
71
|
-
in: `dependencies`,
|
|
72
|
-
where: [{
|
|
73
|
-
property: 'alias',
|
|
74
|
-
isEqualTo: 'auditlog'
|
|
75
|
-
}]
|
|
76
|
-
}]}
|
|
77
|
-
)
|
|
64
|
+
await helmTemplate.addDependency('service-instance', 'auditlog');
|
|
78
65
|
|
|
79
|
-
if(isIndependentCommand) await writeMd5File(join(
|
|
66
|
+
if(isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
80
67
|
}
|
|
81
68
|
}
|
|
82
69
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# Generated manifest.yml based on template version 0.1.0
|
|
2
2
|
# appName = {{cap.appName}}
|
|
3
|
-
# language={{cap.
|
|
3
|
+
# language={{cap.language}}
|
|
4
4
|
# multitenancy={{cap.isMultitenant}}
|
|
5
5
|
---
|
|
6
6
|
applications:
|
|
7
7
|
# -----------------------------------------------------------------------------------
|
|
8
8
|
# Backend Service
|
|
9
9
|
# -----------------------------------------------------------------------------------
|
|
10
|
-
- name: {{cap.appName}}-{{cap.
|
|
10
|
+
- name: {{cap.appName}}-{{cap.srvName}}
|
|
11
11
|
random-route: true # for development only
|
|
12
12
|
{{#cap.isNodejs}}
|
|
13
|
-
path: {{& cap.
|
|
13
|
+
path: {{& cap.srvPath}}
|
|
14
14
|
memory: 256M
|
|
15
15
|
buildpack: nodejs_buildpack
|
|
16
16
|
{{/cap.isNodejs}}
|
|
17
17
|
{{#cap.isJava}}
|
|
18
|
-
path: {{& cap.
|
|
18
|
+
path: {{& cap.srvPath}}/target/{{cap.srvExt.archiveName}}
|
|
19
19
|
memory: 1G
|
|
20
20
|
disk_quota: 512M
|
|
21
21
|
env:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
|
+
const cds = require('../../../cds')
|
|
2
3
|
const { exists } = require('../../../cds').utils
|
|
3
4
|
const { readProject } = require('../../util/projectReader')
|
|
4
5
|
const { copyFiles } = require('../../util/templateUtil')
|
|
@@ -19,6 +20,6 @@ module.exports = class CfManifestTemplate extends require('../templateBase') {
|
|
|
19
20
|
|
|
20
21
|
async run() {
|
|
21
22
|
const projectDescriptor = await readProject()
|
|
22
|
-
await copyFiles(join(__dirname, 'files'),
|
|
23
|
+
await copyFiles(join(__dirname, 'files'), cds.root, projectDescriptor, this.options.force);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
@@ -18,12 +18,11 @@ module.exports = class ConnectivityTemplate extends require('../templateBase') {
|
|
|
18
18
|
let isIndependentCommand = false
|
|
19
19
|
if(Object.keys(context).length == 0){
|
|
20
20
|
isIndependentCommand = true
|
|
21
|
-
context.
|
|
22
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'))
|
|
21
|
+
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'))
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
await mergeYAML(
|
|
26
|
-
join(
|
|
25
|
+
join('chart', 'values.yaml'),
|
|
27
26
|
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
28
27
|
projectDescriptor,
|
|
29
28
|
{ additions: [{
|
|
@@ -35,9 +34,9 @@ module.exports = class ConnectivityTemplate extends require('../templateBase') {
|
|
|
35
34
|
}]}
|
|
36
35
|
)
|
|
37
36
|
const filesPath = join(__dirname, 'files')
|
|
38
|
-
const templatesPath = join(
|
|
37
|
+
const templatesPath = join('chart', 'templates')
|
|
39
38
|
await copyAndTrack(join(filesPath, 'connectivity-proxy-info.yaml'), join(templatesPath, 'connectivity-proxy-info.yaml'), context)
|
|
40
|
-
if(isIndependentCommand) await writeMd5File(join(
|
|
39
|
+
if(isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
}
|
|
@@ -3,7 +3,7 @@ const cds = require('../../../cds')
|
|
|
3
3
|
const { exists, fs } = cds.utils
|
|
4
4
|
const { resolve, join, relative } = require('path');
|
|
5
5
|
const LOG = console
|
|
6
|
-
const DEBUG =
|
|
6
|
+
const DEBUG = cds.debug('cli')
|
|
7
7
|
|
|
8
8
|
module.exports = class DataTemplate extends require('../templateBase') {
|
|
9
9
|
|
|
@@ -12,13 +12,16 @@ module.exports = class DataTemplate extends require('../templateBase') {
|
|
|
12
12
|
|
|
13
13
|
let dest = (typeof this.options.out === 'string') // target folder
|
|
14
14
|
? this.options.out
|
|
15
|
-
: getDefaultTargetFolder(env
|
|
16
|
-
dest = resolve(
|
|
15
|
+
: getDefaultTargetFolder(env);
|
|
16
|
+
dest = resolve(cds.root, dest);
|
|
17
17
|
|
|
18
18
|
const nameFilter = asRegex(this.options['data:for'] || this.options.for)
|
|
19
19
|
const force = this.options.force;
|
|
20
20
|
|
|
21
|
-
let csn = await cds.compile.to.csn(cds.env.roots)
|
|
21
|
+
let csn = await cds.compile.to.csn(cds.env.roots) // normal CSN
|
|
22
|
+
|
|
23
|
+
// Skip of unused reuse entities like Language, Country, Currency
|
|
24
|
+
csn = cds.minify(csn)
|
|
22
25
|
|
|
23
26
|
// Also include 'external' entities w/ cds.persistence.skip (similar to 'mocked' option of serve).
|
|
24
27
|
// Could be too much sometimes, but don't want to bother users w/ a separate option for this.
|
|
@@ -31,7 +34,7 @@ module.exports = class DataTemplate extends require('../templateBase') {
|
|
|
31
34
|
.filter (e => e.name.match(nameFilter)) // --for prefix|regex
|
|
32
35
|
.filter (e => !e.query) // exclude entities with queries (projection on, select from ...)
|
|
33
36
|
.filter (e => e.name !== 'DRAFT.DraftAdministrativeData' && !e.name.endsWith('.drafts')) // exclude draft stuff
|
|
34
|
-
.forEach(e => processEntity(e, dest,
|
|
37
|
+
.forEach(e => processEntity(e, dest, csn, force));
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
|
|
@@ -39,7 +42,7 @@ function includeExternalEntities(model) {
|
|
|
39
42
|
for (let each in model.definitions) {
|
|
40
43
|
const def = model.definitions[each]
|
|
41
44
|
if (def['@cds.persistence.skip'] === true) {
|
|
42
|
-
DEBUG
|
|
45
|
+
DEBUG?.('Including skipped entity '+each)
|
|
43
46
|
delete def['@cds.persistence.skip']
|
|
44
47
|
}
|
|
45
48
|
}
|
|
@@ -62,7 +65,7 @@ function asRegex(spec) {
|
|
|
62
65
|
return /.*/
|
|
63
66
|
}
|
|
64
67
|
|
|
65
|
-
function processEntity (entity, dest,
|
|
68
|
+
function processEntity (entity, dest, csn, force) {
|
|
66
69
|
let dataFileName;
|
|
67
70
|
const namespace = getNamespace(csn, entity.name);
|
|
68
71
|
if (!namespace || namespace == entity.name) {
|
|
@@ -80,34 +83,28 @@ function processEntity (entity, dest, projectPath, csn, force) {
|
|
|
80
83
|
const dataFileNameOldFormat = dataFileName.replace('.texts.csv','_texts.csv');
|
|
81
84
|
const dataFilePathOldFormat = join(dest, dataFileNameOldFormat);
|
|
82
85
|
if (exists(dataFilePathOldFormat)) {
|
|
83
|
-
createDataFile(true, dataFilePathOldFormat, dest,
|
|
86
|
+
createDataFile(true, dataFilePathOldFormat, dest, force, entity);
|
|
84
87
|
return;
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
const dataFilePath = join(dest, dataFileName);
|
|
89
|
-
createDataFile(exists(dataFilePath), dataFilePath, dest,
|
|
92
|
+
createDataFile(exists(dataFilePath), dataFilePath, dest, force, entity);
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
function getDefaultTargetFolder (env
|
|
93
|
-
const
|
|
95
|
+
function getDefaultTargetFolder (env) {
|
|
96
|
+
const { db } = env.folders
|
|
94
97
|
// csv files should be located in the 'db/data' folder unless a 'db/csv' folder already exists
|
|
95
|
-
|
|
96
|
-
if (exists(join(projectPath, dbFolder, 'csv'))) {
|
|
97
|
-
mockDataFolder = 'csv';
|
|
98
|
-
} else {
|
|
99
|
-
mockDataFolder = 'data';
|
|
100
|
-
}
|
|
101
|
-
return join(dbFolder, mockDataFolder);
|
|
98
|
+
return join(db, exists(join(db, 'csv')) ? 'csv' : 'data')
|
|
102
99
|
}
|
|
103
100
|
|
|
104
101
|
|
|
105
|
-
function createDataFile (isFileExists, dataFilePath, dest,
|
|
102
|
+
function createDataFile (isFileExists, dataFilePath, dest, force, entity) {
|
|
106
103
|
let relFilePath = dataFilePath;
|
|
107
|
-
if (dataFilePath.indexOf(
|
|
104
|
+
if (dataFilePath.indexOf(cds.root) === 0) {
|
|
108
105
|
// use relative path in log (for readability), only when data files are added within the project
|
|
109
106
|
// (potentially can be located anywhere using the --out parameter)
|
|
110
|
-
relFilePath = relative(
|
|
107
|
+
relFilePath = relative(cds.root, dataFilePath);
|
|
111
108
|
}
|
|
112
109
|
if (isFileExists && !force) {
|
|
113
110
|
LOG.info(`Skipping ${relFilePath}`);
|
|
@@ -134,7 +131,7 @@ function prepareDataFileContent (entity) {
|
|
|
134
131
|
if (!persistenceKeyNames.includes(k1) && persistenceKeyNames.includes(k2)) return 1
|
|
135
132
|
return 0 // preserve original order otherwise
|
|
136
133
|
})
|
|
137
|
-
.join('
|
|
134
|
+
.join(',') // using comma as csv separator by default
|
|
138
135
|
}
|
|
139
136
|
|
|
140
137
|
// Logic is taken from cds-compile
|
|
@@ -36,11 +36,10 @@ module.exports = class DestinationsTemplate extends require('../templateBase') {
|
|
|
36
36
|
let isIndependentCommand = false
|
|
37
37
|
if(Object.keys(context).length == 0){
|
|
38
38
|
isIndependentCommand = true
|
|
39
|
-
context.
|
|
40
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'))
|
|
39
|
+
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'))
|
|
41
40
|
}
|
|
42
41
|
await mergeYAML(
|
|
43
|
-
join(
|
|
42
|
+
join('chart', 'values.yaml'),
|
|
44
43
|
{
|
|
45
44
|
...binding,
|
|
46
45
|
...html5Binding,
|
|
@@ -54,27 +53,16 @@ module.exports = class DestinationsTemplate extends require('../templateBase') {
|
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
)
|
|
57
|
-
|
|
56
|
+
|
|
58
57
|
// copy service instance chart if it is not present
|
|
59
58
|
const HelmTemplate = require(`../helm`);
|
|
60
59
|
const helmTemplate = new HelmTemplate(this.generator, context.oldTrackingData, context.newTrackingData);
|
|
61
60
|
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
62
61
|
|
|
63
62
|
// add dependency entry in chart.yaml
|
|
64
|
-
await
|
|
65
|
-
join(this.projectPath, 'chart', 'Chart.yaml'),
|
|
66
|
-
join(__dirname, 'files', 'destination.yaml'),
|
|
67
|
-
projectDescriptor,
|
|
68
|
-
{ additions: [{
|
|
69
|
-
in: `dependencies`,
|
|
70
|
-
where: [{
|
|
71
|
-
property: 'alias',
|
|
72
|
-
isEqualTo: 'destination'
|
|
73
|
-
}]
|
|
74
|
-
}]}
|
|
75
|
-
)
|
|
63
|
+
await helmTemplate.addDependency('service-instance', 'destination');
|
|
76
64
|
|
|
77
|
-
if(isIndependentCommand) await writeMd5File(join(
|
|
65
|
+
if(isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
78
66
|
}
|
|
79
67
|
}
|
|
80
68
|
}
|