@sap/cds-dk 7.4.1 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/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 +1 -1
- 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 +3 -3
- 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 +29 -15
- 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/fs.js +5 -1
- package/lib/util/pruneAxiosErrors.js +35 -18
- package/lib/util/write.js +1 -1
- package/npm-shrinkwrap.json +310 -270
- 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/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,18 +1,21 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const {
|
|
3
|
-
const { mergeJSON, mergeYAML } = require('../../util/merge')
|
|
1
|
+
const { readProject } = require('../../projectReader')
|
|
2
|
+
const { merge } = require('../../merge')
|
|
4
3
|
const { DESTINATION } = require('../../constants').OPTIONS
|
|
5
4
|
|
|
6
|
-
const { notificationTypesDeployer } = require('
|
|
5
|
+
const { notificationTypesDeployer } = require('../../registries/mta')
|
|
7
6
|
|
|
8
|
-
module.exports = class NotificationsTemplate extends require('
|
|
7
|
+
module.exports = class NotificationsTemplate extends require('../../plugin') {
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
return
|
|
9
|
+
requires() {
|
|
10
|
+
return [DESTINATION]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static hasInProduction(env) {
|
|
14
|
+
return !!env.requires?.notifications
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
async canRun() {
|
|
15
|
-
const project =
|
|
18
|
+
const project = readProject()
|
|
16
19
|
const { isJava } = project
|
|
17
20
|
if (isJava) {
|
|
18
21
|
throw `'cds add notifications' is not available for Java yet`
|
|
@@ -20,24 +23,18 @@ module.exports = class NotificationsTemplate extends require('../templateBase')
|
|
|
20
23
|
return true
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
getDependencies() {
|
|
24
|
-
return [DESTINATION]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
26
|
async run() {
|
|
28
|
-
const project =
|
|
27
|
+
const project = readProject()
|
|
29
28
|
const { configFile } = project
|
|
30
|
-
await
|
|
29
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
async
|
|
34
|
-
const project =
|
|
32
|
+
async combine() {
|
|
33
|
+
const project = readProject()
|
|
35
34
|
const { hasMta } = project
|
|
36
35
|
|
|
37
36
|
if (hasMta) {
|
|
38
|
-
await
|
|
39
|
-
additions: [notificationTypesDeployer]
|
|
40
|
-
})
|
|
37
|
+
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { project, additions: [notificationTypesDeployer] })
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
}
|
|
@@ -3,7 +3,7 @@ const cds = require('../../../cds')
|
|
|
3
3
|
const { exists, copy } = cds.utils
|
|
4
4
|
const { URLS } = require('../../constants')
|
|
5
5
|
|
|
6
|
-
module.exports = class PipelineTemplate extends require('
|
|
6
|
+
module.exports = class PipelineTemplate extends require('../../plugin') {
|
|
7
7
|
|
|
8
8
|
async canRun() {
|
|
9
9
|
if (cds.cli.options.force) {
|
|
@@ -1,53 +1,47 @@
|
|
|
1
|
-
const { join } = require('path')
|
|
2
1
|
const cds = require('../../../cds')
|
|
3
2
|
const { read } = cds.utils
|
|
4
|
-
const { readProject } = require('../../
|
|
5
|
-
const {
|
|
6
|
-
const mvn = require('../../
|
|
7
|
-
const {
|
|
3
|
+
const { readProject } = require('../../projectReader')
|
|
4
|
+
const { merge } = require('../../merge')
|
|
5
|
+
const mvn = require('../../mvn')
|
|
6
|
+
const { srv4, postgres, postgresDeployer } = require('../../registries/mta')
|
|
8
7
|
|
|
9
|
-
module.exports = class PostgresTemplate extends require('
|
|
8
|
+
module.exports = class PostgresTemplate extends require('../../plugin') {
|
|
10
9
|
|
|
11
10
|
async canRun() {
|
|
12
|
-
const { hasMta, hasHelm } =
|
|
13
|
-
if (hasHelm && !hasMta) throw `'cds add postgres' is not available for Kyma yet`
|
|
11
|
+
const { hasMta, hasHelm, hasHelmUnifiedRuntime } = readProject()
|
|
12
|
+
if ((hasHelm || hasHelmUnifiedRuntime) && !hasMta) throw `'cds add postgres' is not available for Kyma yet`
|
|
14
13
|
return true
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
static
|
|
16
|
+
static hasInProduction(env) {
|
|
18
17
|
return env.requires?.db?.kind === 'postgres'
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
async run() {
|
|
22
|
-
const project =
|
|
21
|
+
const project = readProject()
|
|
23
22
|
const { configFile, isJava } = project
|
|
24
23
|
project.shortcut = !(await read(configFile)).cds?.requires?.db?.kind
|
|
25
|
-
await
|
|
24
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
|
|
26
25
|
if (isJava) await mvn.add('postgresql')
|
|
27
|
-
await this.runDependentMerging()
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
async
|
|
31
|
-
const project =
|
|
32
|
-
const { hasMta,
|
|
28
|
+
async combine() {
|
|
29
|
+
const project = readProject()
|
|
30
|
+
const { hasMta, srvPath } = project
|
|
33
31
|
|
|
34
32
|
if (hasMta) {
|
|
35
|
-
const srv = (
|
|
36
|
-
await
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
into: [postgresDeployer, 'requires', 'name']
|
|
48
|
-
}]
|
|
49
|
-
}
|
|
50
|
-
)
|
|
33
|
+
const srv = srv4(srvPath)
|
|
34
|
+
await merge(__dirname, 'files/mta.yml.hbs').into('mta.yaml', {
|
|
35
|
+
project,
|
|
36
|
+
additions: [srv, postgres, postgresDeployer],
|
|
37
|
+
relationships: [{
|
|
38
|
+
insert: [postgres, 'name'],
|
|
39
|
+
into: [srv, 'requires', 'name']
|
|
40
|
+
}, {
|
|
41
|
+
insert: [postgres, 'name'],
|
|
42
|
+
into: [postgresDeployer, 'requires', 'name']
|
|
43
|
+
}]
|
|
44
|
+
})
|
|
51
45
|
}
|
|
52
46
|
}
|
|
53
47
|
}
|
|
@@ -1,48 +1,44 @@
|
|
|
1
|
-
const { join } = require('path')
|
|
2
1
|
const cds = require('../../../cds')
|
|
3
2
|
const { read } = cds.utils
|
|
4
|
-
const { readProject } = require('../../
|
|
5
|
-
const {
|
|
6
|
-
const {
|
|
3
|
+
const { readProject } = require('../../projectReader')
|
|
4
|
+
const { merge } = require('../../merge')
|
|
5
|
+
const { srv4, redis } = require('../../registries/mta')
|
|
7
6
|
|
|
8
|
-
module.exports = class RedisMessagingTemplate extends require('
|
|
7
|
+
module.exports = class RedisMessagingTemplate extends require('../../plugin') {
|
|
9
8
|
|
|
10
9
|
async canRun() {
|
|
11
|
-
const { hasMta, hasHelm, isJava } =
|
|
12
|
-
|
|
13
|
-
if (
|
|
10
|
+
const { hasMta, hasHelm, hasHelmUnifiedRuntime, isJava } = readProject()
|
|
11
|
+
const onlyHelm = !hasMta && (hasHelmUnifiedRuntime || hasHelm)
|
|
12
|
+
if (isJava) throw `'cds add redis-messaging' is not available for Java yet`
|
|
13
|
+
if (onlyHelm) throw `'cds add redis-messaging' is not available for Kyma yet`
|
|
14
14
|
return true
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
static
|
|
17
|
+
static hasInProduction(env) {
|
|
18
18
|
return env.requires?.messaging?.kind === 'redis-messaging'
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
async run() {
|
|
22
|
-
const project =
|
|
22
|
+
const project = readProject()
|
|
23
23
|
const { configFile } = project
|
|
24
24
|
project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
|
|
25
|
-
await
|
|
25
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
async
|
|
29
|
-
const project =
|
|
30
|
-
const { hasMta,
|
|
28
|
+
async combine() {
|
|
29
|
+
const project = readProject()
|
|
30
|
+
const { hasMta, srvPath } = project
|
|
31
31
|
|
|
32
32
|
if (hasMta) {
|
|
33
|
-
const srv = (
|
|
34
|
-
await
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
into: [srv, 'requires', 'name']
|
|
43
|
-
}]
|
|
44
|
-
}
|
|
45
|
-
)
|
|
33
|
+
const srv = srv4(srvPath)
|
|
34
|
+
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
|
|
35
|
+
project,
|
|
36
|
+
additions: [srv, redis],
|
|
37
|
+
relationships: [{
|
|
38
|
+
insert: [redis, 'name'],
|
|
39
|
+
into: [srv, 'requires', 'name']
|
|
40
|
+
}]
|
|
41
|
+
})
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
44
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../cds'), { exists, copy } = cds.utils
|
|
3
|
-
const { readProject } = require('../../
|
|
3
|
+
const { env4, readProject } = require('../../projectReader')
|
|
4
4
|
|
|
5
|
-
module.exports = class SampleTemplate extends require('
|
|
5
|
+
module.exports = class SampleTemplate extends require('../../plugin') {
|
|
6
6
|
|
|
7
7
|
async canRun() {
|
|
8
|
-
const { isJava } =
|
|
8
|
+
const { isJava } = readProject()
|
|
9
9
|
if (isJava) throw `'cds add sample' is not available for Java yet`
|
|
10
10
|
return true
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
async run() {
|
|
14
|
-
const { db, srv, app } = (
|
|
14
|
+
const { db, srv, app } = env4('production').folders
|
|
15
15
|
const language = exists('pom.xml') ? 'java' : 'nodejs'
|
|
16
16
|
await Promise.all([
|
|
17
17
|
copy(join(__dirname, 'files', 'db')).to(db),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const term = require('../../../util/term')
|
|
2
2
|
const { TINY_SAMPLE } = require('../../constants').OPTIONS
|
|
3
3
|
|
|
4
|
-
module.exports = class SamplesTemplate extends require('
|
|
5
|
-
|
|
4
|
+
module.exports = class SamplesTemplate extends require('../../plugin') {
|
|
5
|
+
requires() {
|
|
6
6
|
console.warn(term.warn(`'cds add samples' is deprecated and will be removed in future versions. Please use 'cds add tiny-sample' instead.\n`))
|
|
7
7
|
return [TINY_SAMPLE]
|
|
8
8
|
}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const {
|
|
4
|
-
const mvn = require('../../util/mvn')
|
|
5
|
-
const { readProject } = require('../../util/projectReader')
|
|
6
|
-
const { mergeJSON } = require('../../util/merge')
|
|
1
|
+
const mvn = require('../../mvn')
|
|
2
|
+
const { readProject } = require('../../projectReader')
|
|
3
|
+
const { merge } = require('../../merge')
|
|
7
4
|
|
|
8
|
-
module.exports = class SQLiteTemplate extends require('
|
|
5
|
+
module.exports = class SQLiteTemplate extends require('../../plugin') {
|
|
9
6
|
|
|
10
7
|
async run() {
|
|
11
|
-
const project =
|
|
8
|
+
const project = readProject()
|
|
12
9
|
const { isNodejs, isJava, configFile } = project
|
|
13
10
|
if (isNodejs) {
|
|
14
|
-
|
|
15
|
-
await mergeJSON(configFile, join(__dirname, 'files', `package.json.hbs`), project)
|
|
11
|
+
await merge(__dirname, 'files/package.json').into(configFile)
|
|
16
12
|
} else if (isJava) {
|
|
17
13
|
await mvn.add('sqlite')
|
|
18
14
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../../lib/cds'), { copy } = cds.utils
|
|
3
|
-
const { renderAndCopy } = require('../../
|
|
4
|
-
const mvn = require('../../
|
|
5
|
-
const { readProject } = require('../../
|
|
3
|
+
const { renderAndCopy } = require('../../template')
|
|
4
|
+
const mvn = require('../../mvn')
|
|
5
|
+
const { env4, readProject } = require('../../projectReader')
|
|
6
6
|
const { JAVA } = require('../../constants')
|
|
7
7
|
|
|
8
|
-
module.exports = class TinySampleTemplate extends require('
|
|
8
|
+
module.exports = class TinySampleTemplate extends require('../../plugin') {
|
|
9
9
|
|
|
10
10
|
async run() {
|
|
11
|
-
const { isJava } =
|
|
11
|
+
const { isJava } = readProject()
|
|
12
12
|
if (isJava) {
|
|
13
13
|
if (!cds.cli.options.add.has(JAVA)) {
|
|
14
14
|
await mvn.execMvn(mvn.getAddSamplesCmdArgs())
|
|
15
15
|
await mvn.execMvn(mvn.getAddTestsCmdArgs())
|
|
16
16
|
}
|
|
17
17
|
} else {
|
|
18
|
-
const { db, srv } = (
|
|
18
|
+
const { db, srv } = env4('production').folders
|
|
19
19
|
await Promise.all([
|
|
20
20
|
copy(join(__dirname, 'files', 'nodejs', 'db')).to(db),
|
|
21
21
|
renderAndCopy(join(__dirname, 'files', 'nodejs', 'srv'), srv, { dbFolder: db.replace(/[\\/]+$/, '') })
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const {
|
|
3
|
-
const { mergeJSON, sort } = require('../../util/merge')
|
|
1
|
+
const { readProject } = require('../../projectReader')
|
|
2
|
+
const { merge, sort } = require('../../merge')
|
|
4
3
|
|
|
5
|
-
module.exports = class TogglesTemplate extends require('
|
|
4
|
+
module.exports = class TogglesTemplate extends require('../../plugin') {
|
|
6
5
|
|
|
7
|
-
static
|
|
6
|
+
static hasInProduction(env) {
|
|
8
7
|
return !!env.requires?.toggles
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
async run() {
|
|
12
|
-
const project =
|
|
13
|
-
const { isNodejs
|
|
14
|
-
await
|
|
11
|
+
const project = readProject()
|
|
12
|
+
const { isNodejs, configFile } = project
|
|
13
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
|
|
15
14
|
if (isNodejs) await sort('package.json', 'dependencies')
|
|
16
15
|
}
|
|
17
16
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
|
-
const { readProject } = require('../../
|
|
3
|
-
const {
|
|
2
|
+
const { readProject } = require('../../projectReader')
|
|
3
|
+
const { merge, mergeGitignore } = require('../../merge')
|
|
4
4
|
const { warn, secondary } = require('../../../util/term')
|
|
5
5
|
const { TYPER } = require('../../constants').OPTIONS
|
|
6
6
|
const { exists, read } = require('../../../cds').utils
|
|
7
7
|
|
|
8
|
-
module.exports = class TyperTemplate extends require('
|
|
8
|
+
module.exports = class TyperTemplate extends require('../../plugin') {
|
|
9
9
|
async canRun() {
|
|
10
|
-
const { isJava } =
|
|
10
|
+
const { isJava } = readProject()
|
|
11
11
|
if (isJava) {
|
|
12
12
|
console.warn(warn(`This appears to be a Java project. 'cds add ${TYPER}' is intended to be used in Node.js projects. Proceeding anyway.\n`))
|
|
13
13
|
}
|
|
@@ -23,11 +23,11 @@ module.exports = class TyperTemplate extends require('../templateBase') {
|
|
|
23
23
|
source.compilerOptions.paths["#cds-models/*"][0] += '/index.ts'
|
|
24
24
|
target = 'tsconfig.json'
|
|
25
25
|
}
|
|
26
|
-
await
|
|
26
|
+
await merge(template('package.json')).into('package.json')
|
|
27
27
|
await mergeGitignore('.gitignore', template('gitignore'))
|
|
28
28
|
console.log(secondary(` > Adding '@cds-models' to .gitignore to ignore generated types`)) // REVISIT: other facets are silent wrt. what they change
|
|
29
29
|
try {
|
|
30
|
-
await
|
|
30
|
+
await merge(source).into(target)
|
|
31
31
|
} catch (e) {
|
|
32
32
|
throw e instanceof SyntaxError
|
|
33
33
|
? `SyntaxError in ${target}. This could indicate a JSON file with comments, which is not supported at this time. Remove all comments from ${target} and rerun or add the following entries manually:\n${JSON.stringify(source, null, 2)}`
|
|
@@ -6,13 +6,13 @@ modules:
|
|
|
6
6
|
requires:
|
|
7
7
|
- name: {{appName}}-auth
|
|
8
8
|
|
|
9
|
-
{{#
|
|
9
|
+
{{#hasMultitenancy}}
|
|
10
10
|
- name: {{appName}}-mtx
|
|
11
11
|
type: nodejs
|
|
12
12
|
path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
|
|
13
13
|
requires:
|
|
14
14
|
- name: {{appName}}-auth
|
|
15
|
-
{{/
|
|
15
|
+
{{/hasMultitenancy}}
|
|
16
16
|
|
|
17
17
|
resources:
|
|
18
18
|
- name: {{appName}}-auth
|
|
@@ -23,4 +23,4 @@ resources:
|
|
|
23
23
|
path: ./xs-security.json
|
|
24
24
|
config:
|
|
25
25
|
xsappname: {{appName}}-${org}-${space}
|
|
26
|
-
tenant-mode: {{#
|
|
26
|
+
tenant-mode: {{#hasMultitenancy}}shared{{/hasMultitenancy}}{{^hasMultitenancy}}dedicated{{/hasMultitenancy}}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
{{#
|
|
2
|
+
{{#hasMultitenancy}}
|
|
3
3
|
sidecar:
|
|
4
4
|
bindings:
|
|
5
5
|
auth:
|
|
6
6
|
serviceInstanceName: xsuaa
|
|
7
|
-
{{/
|
|
7
|
+
{{/hasMultitenancy}}
|
|
8
8
|
{{#hasApprouter}}
|
|
9
9
|
approuter:
|
|
10
10
|
bindings:
|
|
@@ -20,7 +20,7 @@ xsuaa:
|
|
|
20
20
|
servicePlanName: application
|
|
21
21
|
parameters:
|
|
22
22
|
xsappname: {{appName}}
|
|
23
|
-
tenant-mode: {{#
|
|
23
|
+
tenant-mode: {{#hasMultitenancy}}shared{{/hasMultitenancy}}{{^hasMultitenancy}}dedicated{{/hasMultitenancy}}
|
|
24
24
|
{{#hasApprouter}}
|
|
25
25
|
oauth2-configuration:
|
|
26
26
|
redirect-uris:
|
|
@@ -1,87 +1,62 @@
|
|
|
1
|
-
const { join } = require('path')
|
|
2
1
|
const cds = require('../../../cds')
|
|
3
2
|
const { read } = cds.utils
|
|
4
|
-
const
|
|
5
|
-
const {
|
|
6
|
-
const {
|
|
7
|
-
const {
|
|
3
|
+
const term = require('../../../util/term')
|
|
4
|
+
const { readProject } = require('../../projectReader')
|
|
5
|
+
const { merge } = require('../../merge')
|
|
6
|
+
const { srv4, xsuaa, mtxSidecar4 } = require('../../registries/mta')
|
|
8
7
|
|
|
9
|
-
module.exports = class XsuaaTemplate extends require('
|
|
8
|
+
module.exports = class XsuaaTemplate extends require('../../plugin') {
|
|
10
9
|
|
|
11
|
-
static
|
|
10
|
+
static hasInProduction(env) {
|
|
12
11
|
return env.requires?.auth?.kind === 'xsuaa'
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
getRelatedFacets() {
|
|
16
|
-
return ['multitenancy', 'extensibility', 'enterprise-messaging']
|
|
17
|
-
}
|
|
18
|
-
|
|
19
14
|
async run() {
|
|
20
|
-
const project =
|
|
15
|
+
const project = readProject()
|
|
21
16
|
const { configFile } = project
|
|
22
17
|
project.shortcut = !(await read(configFile)).cds?.requires?.auth?.kind
|
|
23
|
-
await
|
|
18
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { project, forceOverwrite: true })
|
|
24
19
|
}
|
|
25
20
|
|
|
26
|
-
async
|
|
27
|
-
const project =
|
|
28
|
-
const {
|
|
21
|
+
async combine() {
|
|
22
|
+
const project = readProject()
|
|
23
|
+
const { hasMultitenancy, hasMta, hasHelm, hasHelmUnifiedRuntime, isJava, srvPath } = project
|
|
29
24
|
|
|
30
25
|
const cds = require('../../../../lib')
|
|
31
26
|
const xsSecurity = await (async () => { try {
|
|
32
27
|
const models = await cds.load(cds.env.folders.srv)
|
|
33
28
|
return cds.compile.to.xsuaa(models)
|
|
34
|
-
} catch (error) { /* ignore */ }
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
where: [{
|
|
39
|
-
property: 'name',
|
|
40
|
-
isEqualTo: scope.name
|
|
41
|
-
}],
|
|
42
|
-
}))}
|
|
43
|
-
await mergeJSON('xs-security.json', xsSecurity, project, mergingSemantics)
|
|
29
|
+
} catch (error) { /* ignore */ }})() ?? { scopes: [], attributes: [], 'role-templates': [], 'authorities-inheritance': false }
|
|
30
|
+
|
|
31
|
+
const additions = xsSecurity.scopes.map(scope => ({ in: 'scopes', where: { name: scope.name } }))
|
|
32
|
+
await merge(xsSecurity).into('xs-security.json', { project, additions })
|
|
44
33
|
|
|
45
34
|
if (hasMta) {
|
|
46
|
-
const srv = (
|
|
35
|
+
const srv = srv4(srvPath)
|
|
47
36
|
const additions = [srv, xsuaa]
|
|
48
37
|
const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
|
|
49
|
-
if (
|
|
38
|
+
if (hasMultitenancy && isJava) additions.push(mtxSidecar)
|
|
50
39
|
|
|
51
40
|
const relationships = [{
|
|
52
41
|
insert: [xsuaa, 'name'],
|
|
53
42
|
into: [srv, 'requires', 'name']
|
|
54
43
|
}]
|
|
55
|
-
if (
|
|
44
|
+
if (hasMultitenancy) relationships.push({
|
|
56
45
|
insert: [xsuaa, 'name'],
|
|
57
46
|
into: [mtxSidecar, 'requires', 'name']
|
|
58
47
|
})
|
|
59
|
-
|
|
60
|
-
await mergeYAML('mta.yaml', join(__dirname, 'files', 'mta.yaml.hbs'), project, { additions, relationships })
|
|
48
|
+
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { project, additions, relationships })
|
|
61
49
|
}
|
|
62
50
|
|
|
63
|
-
if (hasHelm) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
isIndependentCommand = true;
|
|
68
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// copy service-instance chart
|
|
72
|
-
const HelmTemplate = require(`../helm`);
|
|
73
|
-
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
74
|
-
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
75
|
-
|
|
76
|
-
// add dependency entry in chart.yaml
|
|
77
|
-
await helmTemplate.addDependency('service-instance', 'xsuaa');
|
|
51
|
+
if (hasHelm || hasHelmUnifiedRuntime) {
|
|
52
|
+
await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
53
|
+
}
|
|
54
|
+
}
|
|
78
55
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
)
|
|
84
|
-
if(isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData);
|
|
56
|
+
finalize() {
|
|
57
|
+
const { hasUI, hasApprouter } = readProject()
|
|
58
|
+
if (hasUI && !hasApprouter) {
|
|
59
|
+
console.log(`\nAlso run ${term.bold('cds add approuter --for production')} to route and authenticate the paths accessed via the UI.`)
|
|
85
60
|
}
|
|
86
61
|
}
|
|
87
62
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const Mustache = require('mustache')
|
|
2
|
-
const cds = require('
|
|
2
|
+
const cds = require('../cds')
|
|
3
3
|
const { copy, read, write, exists, readdir, path, isdir } = cds.utils
|
|
4
4
|
|
|
5
5
|
async function renderAndCopy(from, into, replacements, overwrite = cds.cli.options.force) {
|
|
@@ -3,12 +3,16 @@ const path = require('path');
|
|
|
3
3
|
const axios = require('axios');
|
|
4
4
|
|
|
5
5
|
const cds = require('../cds');
|
|
6
|
-
const DEBUG = cds.debug('cli');
|
|
7
|
-
const { collectFileContent, collectFiles, toUnixPath } = require('./helper/fs_helper');
|
|
8
|
-
const { getMessage } = require('./helper/logging');
|
|
9
|
-
|
|
10
6
|
const AuthManager = require('./auth_manager');
|
|
11
|
-
|
|
7
|
+
|
|
8
|
+
require('../util/pruneAxiosErrors');
|
|
9
|
+
const { collectFileContent, collectFiles, toUnixPath } = require('./util/fs');
|
|
10
|
+
const { getMessage } = require('./util/logging');
|
|
11
|
+
const { handleHttpError } = require('./util/errors');
|
|
12
|
+
const { concatUrls } = require('./util/urls');
|
|
13
|
+
const { checkProject, getMtxApiUrl } = require('./util/legacy_ext');
|
|
14
|
+
|
|
15
|
+
const DEBUG = cds.debug('cli');
|
|
12
16
|
|
|
13
17
|
const COMMAND_URL_SUFFIX = 'asyncActivate';
|
|
14
18
|
const COMMAND_URL_SUFFIX_SYNC = 'activate';
|
|
@@ -37,7 +41,7 @@ async function checkFinished(jobId, statusUrl, params, finisher) {
|
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
43
|
|
|
40
|
-
module.exports = class Activate
|
|
44
|
+
module.exports = class Activate {
|
|
41
45
|
|
|
42
46
|
static get COMMAND_URL_SUFFIX() { return COMMAND_URL_SUFFIX; }
|
|
43
47
|
static get COMMAND_URL_SUFFIX_SYNC() { return COMMAND_URL_SUFFIX_SYNC; }
|
|
@@ -57,7 +61,7 @@ module.exports = class Activate extends BaseCommand {
|
|
|
57
61
|
console.log('Activating extension located at', params.get('projectFolder'), 'to URL', params.get('appUrl'));
|
|
58
62
|
}
|
|
59
63
|
|
|
60
|
-
if (!await
|
|
64
|
+
if (!await checkProject(params.get('projectFolder'))) {
|
|
61
65
|
throw params.get('projectFolder') + ' is not a valid extension project';
|
|
62
66
|
}
|
|
63
67
|
|
|
@@ -67,7 +71,7 @@ module.exports = class Activate extends BaseCommand {
|
|
|
67
71
|
await this.runCustomFileUpload(params);
|
|
68
72
|
}
|
|
69
73
|
} catch (error) {
|
|
70
|
-
|
|
74
|
+
handleHttpError(error, params, { command: 'activate' });
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
|
|
@@ -163,7 +167,7 @@ module.exports = class Activate extends BaseCommand {
|
|
|
163
167
|
console.log('Activating extension...');
|
|
164
168
|
|
|
165
169
|
const urlSuffix = isSync ? this.COMMAND_URL_SUFFIX_SYNC : this.COMMAND_URL_SUFFIX;
|
|
166
|
-
activationUrl =
|
|
170
|
+
activationUrl = getMtxApiUrl(params.get('appUrl'), urlSuffix);
|
|
167
171
|
const requestOptions = Object.assign({
|
|
168
172
|
headers: {}
|
|
169
173
|
}, params.get('reqAuth'));
|
|
@@ -192,7 +196,7 @@ module.exports = class Activate extends BaseCommand {
|
|
|
192
196
|
DEBUG?.(`Job ID: ${jobId}`);
|
|
193
197
|
|
|
194
198
|
return new Promise((resolve, reject) => {
|
|
195
|
-
const statusUrl =
|
|
199
|
+
const statusUrl = concatUrls(params.get('appUrl'), statusPath);
|
|
196
200
|
const finisher = {
|
|
197
201
|
resolve,
|
|
198
202
|
reject,
|
|
@@ -218,7 +222,7 @@ module.exports = class Activate extends BaseCommand {
|
|
|
218
222
|
});
|
|
219
223
|
});
|
|
220
224
|
|
|
221
|
-
const customFileUrl =
|
|
225
|
+
const customFileUrl = getMtxApiUrl(params.get('appUrl'), this.UPDATE_CUSTOM_FILE_URL_SUFFIX);
|
|
222
226
|
const requestOptions = Object.assign({
|
|
223
227
|
headers: {},
|
|
224
228
|
}, params.get('reqAuth'));
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
const axios = require('axios');
|
|
2
2
|
|
|
3
|
-
require('../util/pruneAxiosErrors');
|
|
4
|
-
|
|
5
3
|
const cds = require('../cds');
|
|
6
|
-
const DEBUG = cds.debug('cli');
|
|
7
4
|
const { SettingsManager } = require('./settings_manager');
|
|
8
5
|
const { ParamCollection } = require('./params');
|
|
9
|
-
|
|
6
|
+
|
|
7
|
+
require('../util/pruneAxiosErrors');
|
|
8
|
+
const { getMessage } = require('./util/logging');
|
|
9
|
+
|
|
10
|
+
const DEBUG = cds.debug('cli');
|
|
10
11
|
|
|
11
12
|
function addTokenInfo(params, authData) {
|
|
12
13
|
params.set('token', authData.access_token);
|