@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
package/package.json
CHANGED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const fs = require('fs').promises;
|
|
3
|
-
|
|
4
|
-
require('../util/pruneAxiosErrors');
|
|
5
|
-
|
|
6
|
-
const { getMessage } = require('./helper/logging');
|
|
7
|
-
|
|
8
|
-
const MTX_URL_PATH_PREFIX = 'mtx/v1/model/';
|
|
9
|
-
const CUSTOM_FILE_URL_SUFFIX = 'customTenantContent';
|
|
10
|
-
|
|
11
|
-
module.exports = class BaseCommand {
|
|
12
|
-
|
|
13
|
-
static get CUSTOM_FILE_URL_SUFFIX() { return CUSTOM_FILE_URL_SUFFIX; }
|
|
14
|
-
|
|
15
|
-
static async checkProject(folder) {
|
|
16
|
-
const exists = await fs.access(path.join(folder, 'package.json')).then(() => true).catch(() => false)
|
|
17
|
-
return exists;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static handleHttpError(error, params, { url, command } = {}) {
|
|
21
|
-
url = url ?? params.get('appUrl');
|
|
22
|
-
const prefix = `Request to ${url} failed`;
|
|
23
|
-
switch (error.status) {
|
|
24
|
-
case 401:
|
|
25
|
-
throw getMessage(`${prefix}: invalid authentication.\nRetry with valid passcode${
|
|
26
|
-
params.has('passcodeUrl') ? ` from ${params.get('passcodeUrl')}` : ''
|
|
27
|
-
} or username/password (required if SaaS app is configured with mocked-auth).`, { error, command });
|
|
28
|
-
case 403:
|
|
29
|
-
throw getMessage(prefix + ': insufficient authorization. Ensure client has all necessary roles.', { error, command });
|
|
30
|
-
case 404:
|
|
31
|
-
throw getMessage(prefix + ': resource not found.', { error, command });
|
|
32
|
-
case 422:
|
|
33
|
-
// Compilation or native-extension error.
|
|
34
|
-
throw getMessage(prefix + '.', { error, command });
|
|
35
|
-
default:
|
|
36
|
-
// Unexpected error should be transparent to user.
|
|
37
|
-
throw error;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
static concatUrls(...parts) {
|
|
42
|
-
return parts
|
|
43
|
-
.map((p, i) => i === 0
|
|
44
|
-
? p.replace(/\/$/ /*end slash*/, '')
|
|
45
|
-
: i === parts.length - 1
|
|
46
|
-
? p.replace(/^\// /*begin slash*/, '')
|
|
47
|
-
: p.replace(/^\/|\/$/g /*both*/, ''))
|
|
48
|
-
.join('/');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
static getMtxApiUrl(url, action) {
|
|
52
|
-
return BaseCommand.concatUrls(url, MTX_URL_PATH_PREFIX, action);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
// Registry of sequence matchers in mta.yaml files
|
|
2
|
-
|
|
3
|
-
const srvNode4 = path => ({
|
|
4
|
-
in: 'modules',
|
|
5
|
-
where: [{
|
|
6
|
-
property: 'type',
|
|
7
|
-
isEqualTo: 'nodejs',
|
|
8
|
-
}, {
|
|
9
|
-
property: 'path',
|
|
10
|
-
isEqualTo: path
|
|
11
|
-
}],
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
const srvJava4 = path => ({
|
|
15
|
-
in: 'modules',
|
|
16
|
-
where: [{
|
|
17
|
-
property: 'type',
|
|
18
|
-
isEqualTo: 'java'
|
|
19
|
-
}, {
|
|
20
|
-
property: 'path',
|
|
21
|
-
isEqualTo: path
|
|
22
|
-
}],
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
const approuter = {
|
|
26
|
-
in: 'modules',
|
|
27
|
-
where: [{
|
|
28
|
-
property: 'type',
|
|
29
|
-
isEqualTo: 'approuter.nodejs'
|
|
30
|
-
}]
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const xsuaa = {
|
|
34
|
-
in: 'resources',
|
|
35
|
-
where: [{
|
|
36
|
-
property: 'parameters.service',
|
|
37
|
-
isEqualTo: 'xsuaa',
|
|
38
|
-
}]
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const destination = {
|
|
42
|
-
in: 'resources',
|
|
43
|
-
where: [{
|
|
44
|
-
property: 'type',
|
|
45
|
-
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
46
|
-
}, {
|
|
47
|
-
property: 'parameters.service',
|
|
48
|
-
isEqualTo: 'destination',
|
|
49
|
-
}]
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const connectivity = {
|
|
53
|
-
in: 'resources',
|
|
54
|
-
where: [{
|
|
55
|
-
property: 'type',
|
|
56
|
-
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
57
|
-
}, {
|
|
58
|
-
property: 'parameters.service',
|
|
59
|
-
isEqualTo: 'connectivity',
|
|
60
|
-
}]
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const redis = {
|
|
64
|
-
in: 'resources',
|
|
65
|
-
where: [{
|
|
66
|
-
property: 'type',
|
|
67
|
-
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
68
|
-
}, {
|
|
69
|
-
property: 'parameters.service',
|
|
70
|
-
isEqualTo: 'redis-cache',
|
|
71
|
-
}]
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const enterpriseMessaging = {
|
|
75
|
-
in: 'resources',
|
|
76
|
-
where: [{
|
|
77
|
-
property: 'type',
|
|
78
|
-
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
79
|
-
}, {
|
|
80
|
-
property: 'parameters.service',
|
|
81
|
-
isEqualTo: 'enterprise-messaging',
|
|
82
|
-
}]
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const kibana = {
|
|
86
|
-
in: 'resources',
|
|
87
|
-
where: [{
|
|
88
|
-
property: 'type',
|
|
89
|
-
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
90
|
-
}, {
|
|
91
|
-
property: 'parameters.service',
|
|
92
|
-
isEqualTo: 'application-logs',
|
|
93
|
-
}, {
|
|
94
|
-
property: 'parameters.service-plan',
|
|
95
|
-
isEqualTo: 'lite',
|
|
96
|
-
}]
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const hdbDeployer = {
|
|
100
|
-
in: 'modules',
|
|
101
|
-
where: [{
|
|
102
|
-
property: 'type',
|
|
103
|
-
isEqualTo: 'hdb'
|
|
104
|
-
}]
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const hdiContainer = {
|
|
108
|
-
in: 'resources',
|
|
109
|
-
where: [{
|
|
110
|
-
property: 'type',
|
|
111
|
-
isEqualTo: 'com.sap.xs.hdi-container',
|
|
112
|
-
}]
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const notificationTypesDeployer = {
|
|
116
|
-
in: 'modules',
|
|
117
|
-
where: [{
|
|
118
|
-
property: 'name',
|
|
119
|
-
isEqualTo: 'notification-content-deployment'
|
|
120
|
-
}, {
|
|
121
|
-
property: 'type',
|
|
122
|
-
isEqualTo: 'nodejs'
|
|
123
|
-
}]
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const serviceManager = {
|
|
127
|
-
in: 'resources',
|
|
128
|
-
where: [{
|
|
129
|
-
property: 'type',
|
|
130
|
-
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
131
|
-
}, {
|
|
132
|
-
property: 'parameters.service',
|
|
133
|
-
isEqualTo: 'service-manager',
|
|
134
|
-
}, {
|
|
135
|
-
property: 'parameters.service-plan',
|
|
136
|
-
isEqualTo: 'container'
|
|
137
|
-
}]
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const postgres = {
|
|
141
|
-
in: 'resources',
|
|
142
|
-
where: [{
|
|
143
|
-
property: 'parameters.service',
|
|
144
|
-
isEqualTo: 'postgresql-db',
|
|
145
|
-
}]
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const postgresDeployer = {
|
|
149
|
-
in: 'modules',
|
|
150
|
-
where: [{
|
|
151
|
-
property: 'type',
|
|
152
|
-
isEqualTo: 'nodejs',
|
|
153
|
-
}, {
|
|
154
|
-
property: 'path',
|
|
155
|
-
isEqualTo: 'gen/pg',
|
|
156
|
-
}]
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const saasRegistry = {
|
|
160
|
-
in: 'resources',
|
|
161
|
-
where: [{
|
|
162
|
-
property: 'type',
|
|
163
|
-
isEqualTo: 'org.cloudfoundry.managed-service',
|
|
164
|
-
}, {
|
|
165
|
-
property: 'parameters.service',
|
|
166
|
-
isEqualTo: 'saas-registry',
|
|
167
|
-
}]
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const srvApi4 = srv => ({
|
|
171
|
-
in: [srv, 'provides'],
|
|
172
|
-
where: [{
|
|
173
|
-
property: 'name',
|
|
174
|
-
isEqualTo: 'srv-api'
|
|
175
|
-
}, {
|
|
176
|
-
property: 'properties.srv-url',
|
|
177
|
-
isEqualTo: '${default-url}'
|
|
178
|
-
}]
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
const mtxSidecar4 = path => ({
|
|
182
|
-
in: 'modules',
|
|
183
|
-
where: [{
|
|
184
|
-
property: 'type',
|
|
185
|
-
isEqualTo: `nodejs`
|
|
186
|
-
}, {
|
|
187
|
-
property: 'path',
|
|
188
|
-
isEqualTo: path // 'gen/mtx/sidecar' REVISIT: Same build destination for Java/Node.js would simplify this a lot
|
|
189
|
-
}]
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
const providedMtxApiSidecar4 = mtxSidecar => ({
|
|
193
|
-
in: [mtxSidecar, 'provides'],
|
|
194
|
-
where: [{
|
|
195
|
-
property: 'name',
|
|
196
|
-
isEqualTo: 'mtx-api'
|
|
197
|
-
}, {
|
|
198
|
-
property: 'properties.mtx-url',
|
|
199
|
-
isEqualTo: '${default-url}'
|
|
200
|
-
}]
|
|
201
|
-
})
|
|
202
|
-
|
|
203
|
-
const requiredMtxApi = {
|
|
204
|
-
in: [approuter, 'requires'],
|
|
205
|
-
where: [{
|
|
206
|
-
property: 'properties.name',
|
|
207
|
-
isEqualTo: 'mtx-api'
|
|
208
|
-
}, {
|
|
209
|
-
property: 'properties.url',
|
|
210
|
-
isEqualTo: '~{mtx-url}'
|
|
211
|
-
}]
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const providedAppApi = {
|
|
215
|
-
in: [approuter, 'provides'],
|
|
216
|
-
where: [{
|
|
217
|
-
property: 'name',
|
|
218
|
-
isEqualTo: 'app-api'
|
|
219
|
-
}, {
|
|
220
|
-
property: 'properties.app-protocol',
|
|
221
|
-
isEqualTo: '${protocol}'
|
|
222
|
-
}, {
|
|
223
|
-
property: 'properties.app-uri',
|
|
224
|
-
isEqualTo: '${default-uri}'
|
|
225
|
-
}],
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
const requiredAppApi4 = module => ({
|
|
229
|
-
in: [module, 'requires'],
|
|
230
|
-
where: [{
|
|
231
|
-
property: 'name',
|
|
232
|
-
isEqualTo: 'app-api'
|
|
233
|
-
}, {
|
|
234
|
-
property: 'properties.SUBSCRIPTION_URL',
|
|
235
|
-
isEqualTo: '~{app-protocol}://\\${tenant_subdomain}-~{app-uri}'
|
|
236
|
-
}]
|
|
237
|
-
})
|
|
238
|
-
|
|
239
|
-
const requiredMtxSidecarApi4 = srv => ({
|
|
240
|
-
in: [srv, 'requires'],
|
|
241
|
-
where: [{
|
|
242
|
-
property: 'properties.CDS_MULTITENANCY_SIDECAR_URL',
|
|
243
|
-
isEqualTo: '~{mtx-url}'
|
|
244
|
-
}]
|
|
245
|
-
})
|
|
246
|
-
|
|
247
|
-
const providedJavaApprouterApi4 = srv => ({
|
|
248
|
-
in: [srv, 'requires'],
|
|
249
|
-
where: [{
|
|
250
|
-
property: 'properties.CDS_MULTITENANCY_APPUI_URL',
|
|
251
|
-
isEqualTo: '~{url}'
|
|
252
|
-
}]
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
const providedJavaApprouterApi = {
|
|
256
|
-
in: [approuter, 'requires'],
|
|
257
|
-
where: [{
|
|
258
|
-
property: 'properties.url',
|
|
259
|
-
isEqualTo: '${default-url}'
|
|
260
|
-
}]
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
const approuterExtensibility = {
|
|
264
|
-
in: 'routes',
|
|
265
|
-
where: [{
|
|
266
|
-
property: 'source',
|
|
267
|
-
isEqualTo: '^/-/cds/.*'
|
|
268
|
-
}, {
|
|
269
|
-
property: 'destination',
|
|
270
|
-
isEqualTo: 'mtx-api',
|
|
271
|
-
}, {
|
|
272
|
-
property: 'authenticationType',
|
|
273
|
-
isEqualTo: 'none',
|
|
274
|
-
}]
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
module.exports = {
|
|
278
|
-
srvNode4,
|
|
279
|
-
srvJava4,
|
|
280
|
-
approuter,
|
|
281
|
-
xsuaa,
|
|
282
|
-
destination,
|
|
283
|
-
connectivity,
|
|
284
|
-
enterpriseMessaging,
|
|
285
|
-
hdbDeployer,
|
|
286
|
-
hdiContainer,
|
|
287
|
-
notificationTypesDeployer,
|
|
288
|
-
serviceManager,
|
|
289
|
-
postgres,
|
|
290
|
-
postgresDeployer,
|
|
291
|
-
saasRegistry,
|
|
292
|
-
redis,
|
|
293
|
-
srvApi4,
|
|
294
|
-
mtxSidecar4,
|
|
295
|
-
providedMtxApiSidecar4,
|
|
296
|
-
requiredMtxApi,
|
|
297
|
-
requiredMtxSidecarApi4,
|
|
298
|
-
providedAppApi,
|
|
299
|
-
requiredAppApi4,
|
|
300
|
-
providedJavaApprouterApi4,
|
|
301
|
-
providedJavaApprouterApi,
|
|
302
|
-
kibana,
|
|
303
|
-
approuterExtensibility
|
|
304
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* CDS Kubernetes Configuration
|
|
4
|
-
*/
|
|
5
|
-
interface BaseConfig {
|
|
6
|
-
/** image prefix */
|
|
7
|
-
image: string,
|
|
8
|
-
cloudService: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface RegistryConfig {
|
|
12
|
-
imageRegistry: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface DeployConfig {
|
|
16
|
-
releaseName: string,
|
|
17
|
-
namespace: string,
|
|
18
|
-
imagePullSecret: string,
|
|
19
|
-
dbSecret: string,
|
|
20
|
-
domain: string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface Service {
|
|
24
|
-
binding: string;
|
|
25
|
-
name: string;
|
|
26
|
-
label: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface ApplicationModel {
|
|
30
|
-
isJava: boolean;
|
|
31
|
-
destinations: Map<string,string>; // Unfortunately today needed at build time
|
|
32
|
-
services: Service[]; // Need to know if destination service is required?
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface BuildModel extends BaseConfig, ApplicationModel {
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Data required at image push and deploy time
|
|
40
|
-
*/
|
|
41
|
-
interface PushModel extends BaseConfig, RegistryConfig {
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Data required at chart add time
|
|
46
|
-
*/
|
|
47
|
-
interface AddChartModel extends BaseConfig, ApplicationModel {
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface Model extends BaseConfig, ApplicationModel {
|
|
51
|
-
registry : RegistryConfig,
|
|
52
|
-
deployment : DeployConfig
|
|
53
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
const { join } = require('path')
|
|
2
|
-
const { readProject } = require('../../util/projectReader')
|
|
3
|
-
const { mergeJSON, mergeYAML } = require('../../util/merge')
|
|
4
|
-
const { srvNode4, srvJava4, mtxSidecar4, kibana, approuter } = require('../_merging/registry-mta')
|
|
5
|
-
|
|
6
|
-
module.exports = class KibanaTemplate extends require('../templateBase') {
|
|
7
|
-
|
|
8
|
-
static hasFacet(env) {
|
|
9
|
-
return env.features.kibana_formatter
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async canRun() {
|
|
13
|
-
const { hasMta, hasHelm, isJava } = await readProject()
|
|
14
|
-
if (hasHelm && !hasMta) throw `'cds add kibana' is not available for Kyma yet`
|
|
15
|
-
if (isJava) throw `'cds add kibana' is not available for Java yet`
|
|
16
|
-
return true
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async run() {
|
|
20
|
-
const project = await readProject()
|
|
21
|
-
const { configFile } = project
|
|
22
|
-
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async runDependentMerging() {
|
|
26
|
-
const project = await readProject()
|
|
27
|
-
const { hasMta, hasApprouter, isJava, isMultitenant, srvPath } = project
|
|
28
|
-
|
|
29
|
-
if (hasMta) {
|
|
30
|
-
const srv = (isJava ? srvJava4 : srvNode4)(srvPath)
|
|
31
|
-
const additions = [srv, kibana]
|
|
32
|
-
const relationships = [{
|
|
33
|
-
insert: [kibana, 'name'],
|
|
34
|
-
into: [srv, 'requires', 'name']
|
|
35
|
-
}]
|
|
36
|
-
if (isMultitenant) {
|
|
37
|
-
const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
|
|
38
|
-
additions.push(mtxSidecar)
|
|
39
|
-
relationships.push({
|
|
40
|
-
insert: [kibana, 'name'],
|
|
41
|
-
into: [mtxSidecar, 'requires', 'name']
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
if (hasApprouter) {
|
|
45
|
-
additions.push(approuter)
|
|
46
|
-
relationships.push({
|
|
47
|
-
insert: [kibana, 'name'],
|
|
48
|
-
into: [approuter, 'requires', 'name']
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
await mergeYAML('mta.yaml', join(__dirname, 'files', 'mta.yaml.hbs'), project, { additions, relationships })
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
const cds = require('../../cds')
|
|
2
|
-
|
|
3
|
-
module.exports = class TemplateBase {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @constructor
|
|
7
|
-
*/
|
|
8
|
-
constructor() {
|
|
9
|
-
this.name = this.constructor.name.replace(/template/i, '').replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Returns an array of required templates. These templates will also be added if not already included.
|
|
14
|
-
* @function getDependencies
|
|
15
|
-
* @returns {Array} Dependent facets. Default is an empty array.
|
|
16
|
-
*/
|
|
17
|
-
getDependencies() {
|
|
18
|
-
return []
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Returns an array of related facets that might change the result of applying the current facet.
|
|
23
|
-
* Important: there must not be circular relationships between facets.
|
|
24
|
-
* @function getRelatedFacets()
|
|
25
|
-
* @returns {Array} Related facets. Default is an empty array.
|
|
26
|
-
*/
|
|
27
|
-
getRelatedFacets() {
|
|
28
|
-
return []
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Checks whether the given template should handle this request
|
|
33
|
-
* @returns true, if template should handle this request, false otherwise
|
|
34
|
-
* @throws Error, if request is invalid, e.g. a file exists already
|
|
35
|
-
*/
|
|
36
|
-
async canRun() {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// eslint-disable-next-line no-unused-vars
|
|
41
|
-
static hasFacet(env) {
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* calls cds env and caches result
|
|
47
|
-
* @returns {object} the current cds env
|
|
48
|
-
*/
|
|
49
|
-
async getEnv(profile = 'production') {
|
|
50
|
-
const cdsEnvVar = process.env.CDS_ENV
|
|
51
|
-
process.env.CDS_ENV = profile
|
|
52
|
-
try {
|
|
53
|
-
return cds.env.for('cds');
|
|
54
|
-
} finally {
|
|
55
|
-
cdsEnvVar ? process.env.CDS_ENV = cdsEnvVar : delete process.env.CDS_ENV
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @abstract
|
|
61
|
-
* Executes the given template's merging steps which are dependent on another template.
|
|
62
|
-
* The separation from `run()` is necessary to preserve templating associativity,
|
|
63
|
-
* i.e. the order in which you apply them does not matter.
|
|
64
|
-
* Ex.: Assume `cds add hana` is called before `cds add mta`. We want `cds add mta`
|
|
65
|
-
* to create the base mta.yaml template and merge the hana mta.yaml in, but _don't_
|
|
66
|
-
* want any other steps from the hana template performed (e.g. creating the .hdiconfig).
|
|
67
|
-
* Separating the two let's us run this _only_ the merging part of the template.
|
|
68
|
-
* In addition, this partial merging avoids cyclic template dependencies.
|
|
69
|
-
*/
|
|
70
|
-
async runDependentMerging() {
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @abstract
|
|
76
|
-
* Executes steps for related facets that are set up for the project.
|
|
77
|
-
*/
|
|
78
|
-
async runRelatedMerging() {
|
|
79
|
-
for (const facet of this.getRelatedFacets()) {
|
|
80
|
-
const Template = require('./'+facet)
|
|
81
|
-
const template = new Template()
|
|
82
|
-
if (Template.hasFacet(await this.getEnv())) await template.runDependentMerging()
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* @abstract
|
|
88
|
-
* Executes the given template.
|
|
89
|
-
* @throws Error, if handling failed.
|
|
90
|
-
*/
|
|
91
|
-
async run() {
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @abstract
|
|
96
|
-
* Called when generation is finished
|
|
97
|
-
*/
|
|
98
|
-
async finalize() {
|
|
99
|
-
}
|
|
100
|
-
}
|
package/lib/init/util/md5.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
const cds = require('../../cds')
|
|
2
|
-
const { exists, mkdirp, isdir, readdir, read, write, copy, path } = cds.utils;
|
|
3
|
-
const { dirname, join } = path
|
|
4
|
-
|
|
5
|
-
const crypto = require('crypto');
|
|
6
|
-
const os = require('os');
|
|
7
|
-
const { copyRenderedYAML } = require('../../util/fs');
|
|
8
|
-
|
|
9
|
-
async function copyAndTrack(source, dest, context = {}, { force = false, project } = {}) {
|
|
10
|
-
await mkdirp(dirname(dest));
|
|
11
|
-
if (isdir(source)) {
|
|
12
|
-
const dirents = await readdir(source);
|
|
13
|
-
return Promise.all(dirents.map(each => copyAndTrack(join(source, each), join(dest, each), context)))
|
|
14
|
-
} else {
|
|
15
|
-
const data = exists(source) ? await read(source, 'utf-8') : undefined
|
|
16
|
-
if (!force && await _isChartFileModified(dest, context)) {
|
|
17
|
-
console.log('Chart file ' + dest + ' has been modified and will not be updated.');
|
|
18
|
-
} else {
|
|
19
|
-
_track(dest, data, context);
|
|
20
|
-
if (project) return copyRenderedYAML(source, dest, project)
|
|
21
|
-
return copy(source).to(dest);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Takes path of md5 file as an argument and returns a JSON object containing hashes of files stored in MD5 file.
|
|
29
|
-
* @param {String} file
|
|
30
|
-
* @returns {Promise<JSON>}
|
|
31
|
-
*/
|
|
32
|
-
async function parseMd5File(file) {
|
|
33
|
-
const md5 = exists(file) ? await read(file) : undefined
|
|
34
|
-
if (!md5) return {}
|
|
35
|
-
return Object.fromEntries(md5.split(os.EOL).map(line => line.split(' ').reverse()))
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Takes json object containing key as filename and value as MD5 hash and generates a md5sum format file.
|
|
40
|
-
* @param {String} file
|
|
41
|
-
* @param {Promise<JSON>} data
|
|
42
|
-
*/
|
|
43
|
-
async function writeMd5File(file, data) {
|
|
44
|
-
await write(Object.entries(data).map(([filename, hash]) =>
|
|
45
|
-
`${hash} ${filename}` + os.EOL
|
|
46
|
-
).join('')).to(file)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// REVISIT: Why pass entire 'context' if we're only interested in one key in the old tracking data? -> decrease coupling
|
|
51
|
-
async function _isChartFileModified(file, context = {}) {
|
|
52
|
-
const data = exists(file) ? await read(file, 'utf-8') : undefined
|
|
53
|
-
if (!data) return false;
|
|
54
|
-
const key = _pathKey(join(cds.root, 'chart'), file);
|
|
55
|
-
const hashedContent = _hash(data);
|
|
56
|
-
return context.newTrackingData[key] ? context.newTrackingData[key] !== hashedContent : context.oldTrackingData?.[key] !== hashedContent;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function _hash(data) {
|
|
60
|
-
return crypto.createHash('md5').update(data).digest('base64');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function _pathKey(basePath, cPath) {
|
|
64
|
-
return path.posix.normalize(_toPosix(path.relative(basePath, cPath)))
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function _toPosix(path) {
|
|
68
|
-
return path.replace(/\\/g, '/');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// REVISIT: Replace inout parameter 'context' by return value of new tracking data
|
|
72
|
-
async function _track(filePath, data, context = {}) {
|
|
73
|
-
const key = _pathKey(path.join(cds.root, 'chart'), filePath);
|
|
74
|
-
const hashedContent = _hash(data);
|
|
75
|
-
if (context.oldTrackingData != undefined && context.oldTrackingData[key] != undefined) {
|
|
76
|
-
context.oldTrackingData[key] = hashedContent;
|
|
77
|
-
}
|
|
78
|
-
context.newTrackingData[key] = hashedContent;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// REVISIT: Can we make copyAndTrack the only public API?
|
|
82
|
-
module.exports = {
|
|
83
|
-
copyAndTrack,
|
|
84
|
-
parseMd5File,
|
|
85
|
-
writeMd5File
|
|
86
|
-
}
|