@sap/cds-dk 7.4.1 → 7.5.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/bin/activate.js +1 -1
- package/bin/add.js +6 -4
- package/bin/build.js +4 -6
- package/bin/cds.js +4 -1
- package/bin/deploy/index.js +5 -2
- package/bin/eval.js +1 -1
- package/bin/extend.js +3 -3
- package/bin/login.js +2 -2
- package/bin/logout.js +1 -1
- package/bin/pull.js +1 -1
- package/bin/push.js +2 -2
- package/bin/subscribe.js +2 -2
- package/bin/unsubscribe.js +2 -2
- package/bin/upgrade.js +2 -2
- package/bin/version.js +2 -2
- package/bin/watch.js +1 -1
- package/lib/bind/bindingUtil.js +2 -1
- package/lib/bind/cfKeyProvider.js +2 -2
- package/lib/bind/userCdsrcJsonStorageProvider.js +1 -1
- package/lib/build/buildPlugin.js +6 -12
- package/lib/build/buildTaskEngine.js +24 -19
- package/lib/build/buildTaskFactory.js +27 -33
- package/lib/build/buildTaskProvider.js +1 -1
- package/lib/build/buildTaskProviderFactory.js +26 -41
- package/lib/build/constants.js +0 -1
- package/lib/build/index.js +3 -3
- package/lib/build/plugins.js +15 -15
- package/lib/build/provider/edmxBuildPlugin.js +6 -7
- package/lib/build/provider/fiori/index.js +8 -8
- package/lib/build/provider/hana/2migration.js +12 -16
- package/lib/build/provider/hana/index.js +5 -7
- package/lib/build/provider/hana/template/package.json +1 -1
- package/lib/build/provider/internalBuildPlugin.js +0 -8
- package/lib/build/provider/internalBuildTaskProvider.js +17 -21
- package/lib/build/provider/java/index.js +2 -1
- package/lib/build/provider/mtx-extension/index.js +5 -4
- package/lib/build/provider/mtx-sidecar/index.js +2 -1
- package/lib/build/provider/nodejs/index.js +6 -5
- package/lib/compile/openapi/csdl2openapi.js +28 -14
- package/lib/compile/openapi/index.js +6 -6
- package/lib/deploy/to-hana/hana.js +2 -2
- package/lib/env/schema.js +2 -3
- package/lib/index.js +68 -28
- package/lib/init/add.js +17 -0
- package/lib/init/constants.js +5 -3
- package/lib/init/index.js +39 -25
- package/lib/init/{util/merge.js → merge.js} +32 -20
- package/lib/init/{util/mvn.js → mvn.js} +5 -5
- package/lib/init/plugin.js +85 -0
- package/lib/init/projectReader.js +145 -0
- package/lib/init/registries/mta.js +151 -0
- package/lib/init/template/{kibana → application-logging}/files/mta.yaml.hbs +3 -3
- package/lib/init/template/application-logging/index.js +49 -0
- package/lib/init/template/approuter/files/mta.yaml.hbs +11 -11
- package/lib/init/template/approuter/files/xs-app.json.hbs +2 -2
- package/lib/init/template/approuter/index.js +36 -81
- package/lib/init/template/cf-manifest/files/manifest.yml.hbs +3 -3
- package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +4 -4
- package/lib/init/template/cf-manifest/index.js +4 -4
- package/lib/init/template/connectivity/index.js +22 -35
- package/lib/init/template/data/index.js +3 -2
- package/lib/init/template/destination/files/values.yaml +9 -0
- package/lib/init/template/destination/index.js +15 -47
- package/lib/init/template/enterprise-messaging/index.js +26 -58
- package/lib/init/template/enterprise-messaging-shared/index.js +23 -39
- package/lib/init/template/extensibility/index.js +16 -30
- package/lib/init/template/file-based-messaging/index.js +7 -8
- package/lib/init/template/h2/index.js +4 -4
- package/lib/init/template/hana/files/mta.yaml.hbs +8 -8
- package/lib/init/template/hana/index.js +29 -115
- package/lib/init/template/helm/files/chart/templates/NOTES.txt +12 -0
- package/lib/init/template/helm/files/chart/templates/_deployment_helpers.tpl +82 -0
- package/lib/init/template/helm/files/chart/templates/_helpers.tpl +28 -0
- package/lib/init/template/helm/files/chart/values.root.schema.json +61 -0
- package/lib/init/template/helm/files/chart/values.schema.json +366 -0
- package/lib/init/template/helm/{subcharts → files}/web-application/Chart.yaml +1 -1
- package/lib/init/template/helm/{subcharts → files}/web-application/templates/_api.tpl +1 -1
- package/lib/init/template/helm/{subcharts → files}/web-application/values.yaml +1 -1
- package/lib/init/template/helm/index.js +84 -85
- package/lib/init/template/helm-unified-runtime/files/Chart.yaml.hbs +10 -0
- package/lib/init/template/helm-unified-runtime/files/values.yaml.hbs +26 -0
- package/lib/init/template/helm-unified-runtime/index.js +91 -0
- package/lib/init/template/helm-unified-runtime/lib/build.js +0 -0
- package/lib/init/template/helm-unified-runtime/package.json +4 -0
- package/lib/init/template/html5-repo/files/values.yaml.hbs +28 -0
- package/lib/init/template/html5-repo/index.js +23 -97
- package/lib/init/template/java/index.js +3 -3
- package/lib/init/template/lint/index.js +2 -2
- package/lib/init/template/liquibase/index.js +16 -0
- package/lib/init/template/local-messaging/index.js +7 -8
- package/lib/init/template/mta/index.js +7 -19
- package/lib/init/template/mtx/index.js +2 -2
- package/lib/init/template/multitenancy/index.js +38 -89
- package/lib/init/template/nodejs/index.js +5 -4
- package/lib/init/template/notebook/index.js +1 -1
- package/lib/init/template/notifications/index.js +16 -19
- package/lib/init/template/pipeline/index.js +1 -1
- package/lib/init/template/postgres/index.js +25 -31
- package/lib/init/template/redis-messaging/index.js +23 -27
- package/lib/init/template/sample/index.js +4 -4
- package/lib/init/template/samples/index.js +2 -2
- package/lib/init/template/sqlite/files/{package.json.hbs → package.json} +0 -2
- package/lib/init/template/sqlite/index.js +6 -10
- package/lib/init/template/tiny-sample/index.js +6 -6
- package/lib/init/template/toggles/index.js +7 -8
- package/lib/init/template/typer/index.js +6 -6
- package/lib/init/template/xsuaa/files/mta.yaml.hbs +3 -3
- package/lib/init/template/xsuaa/files/values.yaml.hbs +3 -3
- package/lib/init/template/xsuaa/index.js +27 -52
- package/lib/init/{util/template.js → template.js} +1 -1
- package/lib/{client → mtx}/activate.js +15 -11
- package/lib/{client → mtx}/auth_manager.js +5 -4
- package/lib/{client → mtx}/download_legacy.js +6 -4
- package/lib/{client → mtx}/extend.js +14 -9
- package/lib/{client → mtx}/index.js +1 -1
- package/lib/{client → mtx}/params.js +3 -1
- package/lib/{client → mtx}/pull.js +6 -4
- package/lib/{client → mtx}/push.js +10 -9
- package/lib/{client → mtx}/settings_manager.js +8 -6
- package/lib/{client → mtx}/tenant_action.js +9 -8
- package/lib/{client/helper/cf_helper.js → mtx/util/cf.js} +4 -3
- package/lib/{client/helper/dependency_helper.js → mtx/util/dependencies.js} +1 -0
- package/lib/mtx/util/errors.js +27 -0
- package/lib/mtx/util/legacy_ext.js +16 -0
- package/lib/{client/helper/url_helper.js → mtx/util/urls.js} +12 -1
- package/lib/util/axios.js +84 -0
- package/lib/util/fs.js +5 -1
- package/lib/util/write.js +1 -1
- package/npm-shrinkwrap.json +363 -157
- package/package.json +1 -1
- package/lib/client/base_command.js +0 -54
- package/lib/init/template/_merging/registry-mta.js +0 -304
- package/lib/init/template/helm/Model.d.ts +0 -53
- package/lib/init/template/kibana/files/package.json.hbs +0 -17
- package/lib/init/template/kibana/index.js +0 -54
- package/lib/init/template/templateBase.js +0 -100
- package/lib/init/util/md5.js +0 -86
- package/lib/init/util/projectReader.js +0 -94
- package/lib/util/pruneAxiosErrors.js +0 -39
- /package/lib/init/{util/indent.js → indent.js} +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/Chart.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/_helpers.tpl +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/job.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/secret.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/service-account.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/service-binding.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/values.schema.json +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/values.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/Chart.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/templates/_helpers.tpl +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/templates/serviceinstance.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/values.schema.json +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/values.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/NOTES.txt +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/_helpers.tpl +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/api-rule.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/deployment.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/network-policy.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/pod-disruption-budget.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/rbac.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/secret.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/service-account.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/service-binding.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/service.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/virtual-service.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/values.schema.json +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/templates/NOTES.txt +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/templates/_deployment_helpers.tpl +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/templates/_helpers.tpl +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/values.root.schema.json +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/values.schema.json +0 -0
- /package/lib/init/template/postgres/files/{mta.yaml.hbs → mta.yml.hbs} +0 -0
- /package/lib/init/{util/xml.js → xml.js} +0 -0
- /package/lib/{client/helper/env_helper.js → mtx/util/env.js} +0 -0
- /package/lib/{client/helper/fs_helper.js → mtx/util/fs.js} +0 -0
- /package/lib/{client/helper → mtx/util}/logging.js +0 -0
- /package/lib/{client/helper → mtx/util}/question.js +0 -0
- /package/lib/{client/helper/string_helper.js → mtx/util/strings.js} +0 -0
- /package/lib/util/{cfUtil.js → cf.js} +0 -0
- /package/lib/util/{gitUtil.js → git.js} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"welcomeFile": "app/index.html",
|
|
3
3
|
"routes": [
|
|
4
|
-
{{#
|
|
4
|
+
{{#hasExtensibility}}
|
|
5
5
|
{
|
|
6
6
|
"source": "^/-/cds/.*",
|
|
7
7
|
"destination": "mtx-api",
|
|
8
8
|
"authenticationType": "none"
|
|
9
9
|
},
|
|
10
|
-
{{/
|
|
10
|
+
{{/hasExtensibility}}
|
|
11
11
|
{
|
|
12
12
|
"source": "^/app/(.*)$",
|
|
13
13
|
"target": "$1",
|
|
@@ -1,54 +1,49 @@
|
|
|
1
1
|
const cds = require('../../../cds')
|
|
2
|
-
const { exists } = cds.utils
|
|
2
|
+
const { exists, copy } = cds.utils
|
|
3
3
|
const { join } = require('path')
|
|
4
|
-
const { readProject } = require('../../
|
|
5
|
-
const {
|
|
6
|
-
const { XSUAA, KIBANA, HTML5_REPO } = require('../../constants').OPTIONS
|
|
4
|
+
const { readProject } = require('../../projectReader')
|
|
5
|
+
const { sort, merge } = require('../../merge')
|
|
7
6
|
const {
|
|
8
|
-
|
|
7
|
+
srv4, mtxSidecar4, approuter, // Modules
|
|
9
8
|
xsuaa, // BTP Services
|
|
10
9
|
requiredMtxApi, providedJavaApprouterApi4, providedJavaApprouterApi, // APIs
|
|
11
10
|
requiredAppApi4, providedAppApi,
|
|
12
11
|
approuterExtensibility // xs-app.json config
|
|
13
|
-
} = require('
|
|
14
|
-
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5')
|
|
12
|
+
} = require('../../registries/mta')
|
|
15
13
|
|
|
16
|
-
module.exports = class ApprouterTemplate extends require('
|
|
14
|
+
module.exports = class ApprouterTemplate extends require('../../plugin') {
|
|
17
15
|
|
|
18
|
-
static
|
|
19
|
-
return exists(join(env.folders.app, 'xs-app.json'))
|
|
16
|
+
static hasInProduction(env) {
|
|
17
|
+
return exists(join(env.folders.app, 'xs-app.json')) || exists(join(env.folders.app, 'router', 'xs-app.json'))
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
return [
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
getRelatedFacets() {
|
|
27
|
-
return [KIBANA, HTML5_REPO]
|
|
20
|
+
requires() {
|
|
21
|
+
return ['xsuaa']
|
|
28
22
|
}
|
|
29
23
|
|
|
30
24
|
async run() {
|
|
31
|
-
const { appPath
|
|
25
|
+
const { appPath } = readProject()
|
|
32
26
|
const appPackageJSONPath = join(appPath, 'package.json')
|
|
33
|
-
await
|
|
27
|
+
await merge(__dirname, 'files/package.json').into(appPackageJSONPath)
|
|
34
28
|
await sort(appPackageJSONPath, 'dependencies')
|
|
35
|
-
await
|
|
29
|
+
await merge(__dirname, 'files/default-env.json').into(appPath + '/default-env.json')
|
|
36
30
|
}
|
|
37
31
|
|
|
38
|
-
async
|
|
39
|
-
const project =
|
|
40
|
-
const { isNodejs, isJava,
|
|
32
|
+
async combine() {
|
|
33
|
+
const project = readProject(this.options)
|
|
34
|
+
const { isNodejs, isJava, hasExtensibility, hasMultitenancy, hasMta, hasHelm, hasHelmUnifiedRuntime, srvPath, appPath } = project
|
|
41
35
|
|
|
42
36
|
if (hasMta) {
|
|
43
|
-
const srv = (
|
|
37
|
+
const srv = srv4(srvPath)
|
|
44
38
|
const apis = isJava ? [providedJavaApprouterApi4(srv), providedJavaApprouterApi] : []
|
|
45
39
|
const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
|
|
46
|
-
if (isNodejs &&
|
|
47
|
-
if (isJava &&
|
|
40
|
+
if (isNodejs && hasMultitenancy) apis.push(requiredMtxApi, requiredAppApi4(mtxSidecar), providedAppApi)
|
|
41
|
+
if (isJava && hasMultitenancy) apis.push(requiredMtxApi)
|
|
48
42
|
const modules = [srv, approuter]
|
|
49
|
-
if (
|
|
43
|
+
if (hasMultitenancy) modules.push(mtxSidecar)
|
|
50
44
|
const additions = [...modules, xsuaa, ...apis]
|
|
51
|
-
await
|
|
45
|
+
await merge(__dirname, 'files', 'mta.yaml.hbs').into('mta.yaml', {
|
|
46
|
+
with: project,
|
|
52
47
|
additions,
|
|
53
48
|
relationships: [{
|
|
54
49
|
insert: [xsuaa, 'name'],
|
|
@@ -60,65 +55,25 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
|
|
|
60
55
|
})
|
|
61
56
|
}
|
|
62
57
|
|
|
63
|
-
if (hasHelm) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
await mergeYAML(
|
|
71
|
-
join('chart', 'values.yaml'),
|
|
72
|
-
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
73
|
-
project
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
// add dependency entry in chart.yaml
|
|
77
|
-
const HelmTemplate = require(`../helm`);
|
|
78
|
-
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
79
|
-
await helmTemplate.addDependency('web-application', 'approuter');
|
|
58
|
+
if (hasHelm || hasHelmUnifiedRuntime) {
|
|
59
|
+
await merge(__dirname, 'files', 'values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
60
|
+
await merge({ approuter: { envFrom: [{
|
|
61
|
+
configMapRef: {
|
|
62
|
+
name: "{{ .Release.Name }}-approuter-configmap"
|
|
63
|
+
}
|
|
64
|
+
}]}}).into('chart/values.yaml', { with: project })
|
|
80
65
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
approuter: {
|
|
85
|
-
envFrom: [
|
|
86
|
-
{
|
|
87
|
-
configMapRef: {
|
|
88
|
-
name: "{{ .Release.Name }}-approuter-configmap"
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
project
|
|
95
|
-
)
|
|
66
|
+
const fileName = hasMultitenancy ? 'approuter-mtxs-configmap.yaml' : 'approuter-configmap.yaml'
|
|
67
|
+
await copy(join(__dirname, 'files', fileName)).to('chart', 'templates', 'approuter-configmap.yaml')
|
|
96
68
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
join(__dirname, 'files', fileName),
|
|
101
|
-
join('chart', 'templates', 'approuter-configmap.yaml'),
|
|
102
|
-
context,
|
|
103
|
-
{ force: true }
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
if(isMultitenant) {
|
|
107
|
-
const mtxsConfigMapFileName = isNodejs ? 'mtxs-configmap-nodejs.yaml' : 'mtxs-configmap-java.yaml';
|
|
108
|
-
await copyAndTrack(
|
|
109
|
-
join(__dirname, 'files', mtxsConfigMapFileName),
|
|
110
|
-
join('chart', 'templates', 'mtxs-configmap.yaml'),
|
|
111
|
-
context,
|
|
112
|
-
{ force: true }
|
|
113
|
-
)
|
|
69
|
+
if (hasMultitenancy) {
|
|
70
|
+
const mtxsConfigMapFileName = isNodejs ? 'mtxs-configmap-nodejs.yaml' : 'mtxs-configmap-java.yaml'
|
|
71
|
+
await copy(join(__dirname, 'files', mtxsConfigMapFileName)).to('chart', 'templates', 'mtxs-configmap.yaml')
|
|
114
72
|
}
|
|
115
|
-
|
|
116
|
-
if (isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData);
|
|
117
|
-
|
|
118
73
|
}
|
|
119
74
|
|
|
120
75
|
const xsAppPath = join(appPath, 'xs-app.json')
|
|
121
|
-
const additions =
|
|
122
|
-
await
|
|
76
|
+
const additions = hasExtensibility ? [{ ...approuterExtensibility, at: 0 }] : []
|
|
77
|
+
await merge(__dirname, 'files/xs-app.json.hbs').into(xsAppPath, { project, additions })
|
|
123
78
|
}
|
|
124
79
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Generated manifest.yml based on template version 0.1.0
|
|
2
2
|
# appName = {{appName}}
|
|
3
3
|
# language={{language}}
|
|
4
|
-
# multitenancy={{
|
|
4
|
+
# multitenancy={{hasMultitenancy}}
|
|
5
5
|
---
|
|
6
6
|
applications:
|
|
7
7
|
# -----------------------------------------------------------------------------------
|
|
@@ -31,7 +31,7 @@ applications:
|
|
|
31
31
|
{{/hasXsuaa}}
|
|
32
32
|
|
|
33
33
|
{{#hasHana}}
|
|
34
|
-
{{^
|
|
34
|
+
{{^hasMultitenancy}}
|
|
35
35
|
# -----------------------------------------------------------------------------------
|
|
36
36
|
# HANA Database Content Deployer App
|
|
37
37
|
# -----------------------------------------------------------------------------------
|
|
@@ -44,5 +44,5 @@ applications:
|
|
|
44
44
|
buildpack: nodejs_buildpack
|
|
45
45
|
services:
|
|
46
46
|
- {{appName}}-db
|
|
47
|
-
{{/
|
|
47
|
+
{{/hasMultitenancy}}
|
|
48
48
|
{{/hasHana}}
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
---
|
|
4
4
|
create-services:
|
|
5
5
|
{{#hasHana}}
|
|
6
|
-
{{#
|
|
6
|
+
{{#hasMultitenancy}}
|
|
7
7
|
- name: {{appName}}-db
|
|
8
8
|
broker: service-manager
|
|
9
9
|
plan: container
|
|
10
|
-
{{/
|
|
11
|
-
{{^
|
|
10
|
+
{{/hasMultitenancy}}
|
|
11
|
+
{{^hasMultitenancy}}
|
|
12
12
|
- name: {{appName}}-db
|
|
13
13
|
broker: hana
|
|
14
14
|
plan: hdi-shared
|
|
15
|
-
{{/
|
|
15
|
+
{{/hasMultitenancy}}
|
|
16
16
|
{{/hasHana}}
|
|
17
17
|
{{#hasXsuaa}}
|
|
18
18
|
- name: {{appName}}-auth
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { exists } = require('../../../cds').utils
|
|
4
|
-
const { readProject } = require('../../
|
|
5
|
-
const { renderAndCopy } = require('../../
|
|
4
|
+
const { readProject } = require('../../projectReader')
|
|
5
|
+
const { renderAndCopy } = require('../../template')
|
|
6
6
|
const MANIFEST_FILE = 'manifest.yml'
|
|
7
7
|
const SERVICES_MANIFEST_FILE = 'services-manifest.yml'
|
|
8
8
|
|
|
9
|
-
module.exports = class CfManifestTemplate extends require('
|
|
9
|
+
module.exports = class CfManifestTemplate extends require('../../plugin') {
|
|
10
10
|
|
|
11
11
|
async canRun() {
|
|
12
12
|
if (cds.cli.options.force) {
|
|
@@ -19,7 +19,7 @@ module.exports = class CfManifestTemplate extends require('../templateBase') {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
async run() {
|
|
22
|
-
const project =
|
|
22
|
+
const project = readProject()
|
|
23
23
|
await renderAndCopy(join(__dirname, 'files'), cds.root, project)
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,59 +1,46 @@
|
|
|
1
|
+
const cds = require('../../../cds')
|
|
2
|
+
const { copy } = cds.utils
|
|
1
3
|
const { join } = require('path')
|
|
2
|
-
const { readProject } = require('../../
|
|
3
|
-
const {
|
|
4
|
-
const {
|
|
5
|
-
const { srvJava4, srvNode4, connectivity } = require('../_merging/registry-mta')
|
|
4
|
+
const { readProject } = require('../../projectReader')
|
|
5
|
+
const { merge } = require('../../merge')
|
|
6
|
+
const { srv4, connectivity } = require('../../registries/mta')
|
|
6
7
|
|
|
7
|
-
module.exports = class ConnectivityTemplate extends require('
|
|
8
|
+
module.exports = class ConnectivityTemplate extends require('../../plugin') {
|
|
8
9
|
|
|
9
|
-
static
|
|
10
|
-
return env.requires.connectivity
|
|
10
|
+
static hasInProduction(env) {
|
|
11
|
+
return !!env.requires.connectivity
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
async run() {
|
|
14
15
|
// Disable setting cds.requires.connectivity for now.
|
|
15
|
-
// const project =
|
|
16
|
+
// const project = readProject()
|
|
16
17
|
// const { configFile } = project
|
|
17
|
-
// await
|
|
18
|
+
// await merge(__dirname, 'files', 'package.json.hbs').into(configFile, { with: project })
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
async
|
|
21
|
-
const project =
|
|
22
|
-
const {
|
|
21
|
+
async combine() {
|
|
22
|
+
const project = readProject()
|
|
23
|
+
const { srvPath, hasHelm, hasHelmUnifiedRuntime, hasMta } = project
|
|
23
24
|
|
|
24
25
|
if (hasMta) {
|
|
25
|
-
const srv = (
|
|
26
|
+
const srv = srv4(srvPath)
|
|
26
27
|
const additions = [srv, connectivity]
|
|
27
28
|
const relationships = [{
|
|
28
29
|
insert: [connectivity, 'name'],
|
|
29
30
|
into: [srv, 'requires', 'name']
|
|
30
31
|
}]
|
|
31
|
-
await
|
|
32
|
+
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { project, additions, relationships })
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
if (hasHelm) {
|
|
35
|
-
|
|
36
|
-
let isIndependentCommand = false
|
|
37
|
-
if(Object.keys(context).length == 0){
|
|
38
|
-
isIndependentCommand = true
|
|
39
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'))
|
|
40
|
-
}
|
|
41
|
-
await mergeYAML(
|
|
42
|
-
join('chart', 'values.yaml'),
|
|
43
|
-
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
35
|
+
if (hasHelm || hasHelmUnifiedRuntime) {
|
|
36
|
+
await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', {
|
|
44
37
|
project,
|
|
45
|
-
|
|
38
|
+
additions: [{
|
|
46
39
|
in: 'srv.additionalVolumes',
|
|
47
|
-
where:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}]}
|
|
52
|
-
)
|
|
53
|
-
const filesPath = join(__dirname, 'files')
|
|
54
|
-
const templatesPath = join('chart', 'templates')
|
|
55
|
-
await copyAndTrack(join(filesPath, 'connectivity-proxy-info.yaml'), join(templatesPath, 'connectivity-proxy-info.yaml'), context)
|
|
56
|
-
if(isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
40
|
+
where: { name: 'connectivity-secret' }
|
|
41
|
+
}]
|
|
42
|
+
})
|
|
43
|
+
await copy(join(__dirname, 'files', 'connectivity-proxy-info.yaml')).to('chart', 'templates', 'connectivity-proxy-info.yaml') // REVISIT: Move to build
|
|
57
44
|
}
|
|
58
45
|
}
|
|
59
46
|
}
|
|
@@ -3,15 +3,16 @@ const cds = require('../../../cds')
|
|
|
3
3
|
const { exists, fs } = cds.utils
|
|
4
4
|
const { resolve, join, relative } = require('path');
|
|
5
5
|
const DEBUG = cds.debug('cli')
|
|
6
|
+
const { env4 } = require('../../projectReader')
|
|
6
7
|
|
|
7
|
-
module.exports = class DataTemplate extends require('
|
|
8
|
+
module.exports = class DataTemplate extends require('../../plugin') {
|
|
8
9
|
|
|
9
10
|
async run() {
|
|
10
11
|
if (cds.cli.options.for) {
|
|
11
12
|
throw `\nError: Did you mean \`... --data:for\` ?`
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const env =
|
|
15
|
+
const env = env4('production')
|
|
15
16
|
|
|
16
17
|
let dest = (typeof cds.cli.options.out === 'string') // target folder
|
|
17
18
|
? cds.cli.options.out
|
|
@@ -1,71 +1,39 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const {
|
|
3
|
-
const {
|
|
4
|
-
const { srvJava4, srvNode4, destination } = require('../_merging/registry-mta')
|
|
5
|
-
const { parseMd5File, writeMd5File } = require('../../util/md5')
|
|
1
|
+
const { readProject } = require('../../projectReader')
|
|
2
|
+
const { merge } = require('../../merge')
|
|
3
|
+
const { srv4, destination } = require('../../registries/mta')
|
|
6
4
|
|
|
7
|
-
module.exports = class DestinationTemplate extends require('
|
|
5
|
+
module.exports = class DestinationTemplate extends require('../../plugin') {
|
|
8
6
|
|
|
9
|
-
static
|
|
7
|
+
static hasInProduction(env) {
|
|
10
8
|
const kinds = { odata: 1, 'odata-v2': 1, 'odata-v4': 1, rest: 1 }
|
|
11
9
|
const mtxServices = { 'cds.xt.SaasProvisioningService': 1, 'cds.xt.DeploymentService': 1, 'cds.xt.ModelProviderService': 1, 'cds.xt.ExtensibilityService': 1 }
|
|
12
10
|
const _fromMtx = service => service in mtxServices
|
|
13
11
|
const hasDestination = Object.entries(env.requires).some(([service, require]) => !_fromMtx(service) && !kinds[service] && kinds[require.kind])
|
|
14
|
-
return hasDestination || env.requires.destinations
|
|
12
|
+
return hasDestination || !!env.requires.destinations
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
async run() {
|
|
18
|
-
const project =
|
|
16
|
+
const project = readProject()
|
|
19
17
|
const { configFile } = project
|
|
20
|
-
await
|
|
18
|
+
await merge(__dirname, 'files', 'package.json.hbs').into(configFile, { with: project })
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
async
|
|
24
|
-
const project =
|
|
25
|
-
const {
|
|
21
|
+
async combine() {
|
|
22
|
+
const project = readProject()
|
|
23
|
+
const { hasHelm, hasHelmUnifiedRuntime, hasMta, srvPath } = project
|
|
26
24
|
|
|
27
25
|
if (hasMta) {
|
|
28
|
-
const srv = (
|
|
26
|
+
const srv = srv4(srvPath)
|
|
29
27
|
const additions = [srv, destination]
|
|
30
28
|
const relationships = [{
|
|
31
29
|
insert: [destination, 'name'],
|
|
32
30
|
into: [srv, 'requires', 'name']
|
|
33
31
|
}]
|
|
34
|
-
await
|
|
32
|
+
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { with: project, additions, relationships })
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
if (hasHelm) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
//in case facet is being added to the already exisiting charts folder
|
|
41
|
-
let isIndependentCommand = false
|
|
42
|
-
if(Object.keys(context).length == 0){
|
|
43
|
-
isIndependentCommand = true
|
|
44
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'))
|
|
45
|
-
}
|
|
46
|
-
await mergeYAML(
|
|
47
|
-
join('chart', 'values.yaml'),
|
|
48
|
-
{
|
|
49
|
-
...binding,
|
|
50
|
-
destination: {
|
|
51
|
-
serviceOfferingName: 'destination',
|
|
52
|
-
servicePlanName: 'lite',
|
|
53
|
-
parameters: {
|
|
54
|
-
version: '1.0.0'
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
// copy service instance chart if it is not present
|
|
61
|
-
const HelmTemplate = require(`../helm`);
|
|
62
|
-
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
63
|
-
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
64
|
-
|
|
65
|
-
// add dependency entry in chart.yaml
|
|
66
|
-
await helmTemplate.addDependency('service-instance', 'destination');
|
|
67
|
-
|
|
68
|
-
if(isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
35
|
+
if (hasHelm || hasHelmUnifiedRuntime) {
|
|
36
|
+
await merge(__dirname, 'files/values.yaml').into('chart/values.yaml')
|
|
69
37
|
}
|
|
70
38
|
}
|
|
71
39
|
}
|
|
@@ -1,49 +1,43 @@
|
|
|
1
1
|
const YAML = require('@sap/cds-foss')('yaml')
|
|
2
|
-
const { join } = require('path')
|
|
3
2
|
const cds = require('../../../cds')
|
|
4
3
|
const { read } = cds.utils
|
|
5
|
-
const { readProject } = require('../../
|
|
6
|
-
const {
|
|
7
|
-
const {
|
|
8
|
-
const { srvNode4, srvJava4, enterpriseMessaging } = require('../_merging/registry-mta')
|
|
4
|
+
const { readProject } = require('../../projectReader')
|
|
5
|
+
const { merge } = require('../../merge')
|
|
6
|
+
const { srv4, enterpriseMessaging } = require('../../registries/mta')
|
|
9
7
|
|
|
10
|
-
module.exports = class EnterpriseMessagingTemplate extends require('
|
|
8
|
+
module.exports = class EnterpriseMessagingTemplate extends require('../../plugin') {
|
|
11
9
|
|
|
12
10
|
async canRun() {
|
|
13
|
-
const { isJava } =
|
|
11
|
+
const { isJava } = readProject()
|
|
14
12
|
if (isJava) throw `'cds add enterprise-messaging' is not available for Java yet`
|
|
15
13
|
return true
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
static
|
|
16
|
+
static hasInProduction(env) {
|
|
19
17
|
return env.requires?.messaging?.kind === 'enterprise-messaging-http'
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
async run() {
|
|
23
|
-
const project =
|
|
21
|
+
const project = readProject()
|
|
24
22
|
const { configFile } = project
|
|
25
|
-
await
|
|
26
|
-
await
|
|
23
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
|
|
24
|
+
await merge(__dirname, 'files/event-mesh.json.hbs').into('event-mesh.json', { with: project })
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
async
|
|
30
|
-
const project =
|
|
31
|
-
const { hasXsuaa, hasHelm,
|
|
27
|
+
async combine() {
|
|
28
|
+
const project = readProject()
|
|
29
|
+
const { hasXsuaa, hasHelm, hasHelmUnifiedRuntime, hasMta, srvPath, appName } = project
|
|
32
30
|
|
|
33
31
|
if (hasMta) {
|
|
34
|
-
const srv = (
|
|
35
|
-
await
|
|
36
|
-
'mta.yaml',
|
|
37
|
-
join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
32
|
+
const srv = srv4(srvPath)
|
|
33
|
+
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
|
|
38
34
|
project,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
)
|
|
35
|
+
additions: [srv, enterpriseMessaging],
|
|
36
|
+
relationships: [{
|
|
37
|
+
insert: [enterpriseMessaging, 'name'],
|
|
38
|
+
into: [srv, 'requires', 'name']
|
|
39
|
+
}]
|
|
40
|
+
})
|
|
47
41
|
}
|
|
48
42
|
|
|
49
43
|
if (hasXsuaa) {
|
|
@@ -52,41 +46,15 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
52
46
|
} else {
|
|
53
47
|
project['em-service-name'] = `${appName}-messaging`
|
|
54
48
|
}
|
|
55
|
-
await
|
|
56
|
-
'xs-security.json',
|
|
57
|
-
join(__dirname, 'files', 'xs-security.json.hbs'),
|
|
49
|
+
await merge(__dirname, 'files/xs-security.json.hbs').into('xs-security.json', {
|
|
58
50
|
project,
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
where: [{ property: 'name', isEqualTo: '$XSAPPNAME.emcallback' }],
|
|
63
|
-
}, {
|
|
64
|
-
in: 'scopes',
|
|
65
|
-
where: [{ property: 'name', isEqualTo: '$XSAPPNAME.emmanagement' }],
|
|
66
|
-
}]
|
|
67
|
-
}
|
|
68
|
-
)
|
|
51
|
+
additions: [{ in: 'scopes', where: { name: '$XSAPPNAME.emcallback' }},
|
|
52
|
+
{ in: 'scopes', where: { name: '$XSAPPNAME.emmanagement' }}]
|
|
53
|
+
})
|
|
69
54
|
}
|
|
70
55
|
|
|
71
|
-
if (hasHelm) {
|
|
72
|
-
|
|
73
|
-
let isIndependentCommand = false
|
|
74
|
-
if(Object.keys(context).length == 0){
|
|
75
|
-
isIndependentCommand = true
|
|
76
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'))
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
await mergeYAML(join('chart', 'values.yaml'), join(__dirname, 'files', 'values.yaml'))
|
|
80
|
-
|
|
81
|
-
// copy service instance chart if it is not present
|
|
82
|
-
const HelmTemplate = require(`../helm`);
|
|
83
|
-
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
84
|
-
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
85
|
-
|
|
86
|
-
// add dependency entry in chart.yaml
|
|
87
|
-
await helmTemplate.addDependency('service-instance', 'event-mesh');
|
|
88
|
-
|
|
89
|
-
if(isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
56
|
+
if (hasHelm || hasHelmUnifiedRuntime) {
|
|
57
|
+
await merge(__dirname, 'files', 'values.yaml').into('chart/values.yaml')
|
|
90
58
|
}
|
|
91
59
|
}
|
|
92
60
|
}
|