@sap/cds-dk 6.8.3 → 7.0.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 +15 -7
- package/bin/add.js +29 -15
- package/bin/bind.js +49 -116
- package/bin/build.js +114 -0
- package/bin/cds.js +67 -24
- package/bin/compile/index.js +2 -2
- package/bin/deploy/index.js +46 -39
- package/bin/deploy/to-hana.js +11 -8
- package/bin/deploy/to-postgres.js +8 -2
- package/bin/deploy/to-sqlite.js +0 -1
- package/bin/env.js +75 -41
- package/bin/eval.js +3 -3
- package/bin/extend.js +17 -10
- package/bin/help.js +22 -21
- package/bin/import.js +10 -7
- package/bin/init.js +38 -17
- package/bin/login.js +69 -55
- package/bin/logout.js +12 -9
- package/bin/migrate.js +10 -4
- package/bin/pull.js +12 -5
- package/bin/push.js +24 -13
- package/bin/repl.js +1 -0
- package/bin/run.js +25 -0
- package/bin/subscribe.js +13 -8
- package/bin/unsubscribe.js +15 -8
- package/bin/upgrade.js +15 -9
- package/bin/util/log.js +24 -0
- package/bin/version.js +124 -0
- package/bin/watch.js +1 -35
- package/bin/watched.js +39 -0
- package/lib/bind/KubernetesApiAccessor.js +2 -2
- package/lib/bind/bindingManager.js +1 -1
- package/lib/bind/bindingUtil.js +0 -9
- package/lib/bind/cfKeyProvider.js +10 -72
- package/lib/bind/index.js +114 -0
- package/lib/bind/kubernetesCredentialsProvider.js +2 -2
- package/lib/bind/userCdsrcJsonStorageProvider.js +7 -44
- package/lib/build/buildTaskEngine.js +355 -0
- package/lib/build/buildTaskFactory.js +284 -0
- package/lib/build/buildTaskHandler.js +240 -0
- package/lib/build/buildTaskProvider.js +22 -0
- package/lib/build/buildTaskProviderFactory.js +182 -0
- package/lib/build/constants.js +56 -0
- package/lib/build/index.js +21 -0
- package/lib/build/provider/buildTaskHandlerEdmx.js +83 -0
- package/lib/build/provider/buildTaskHandlerFeatureToggles.js +132 -0
- package/lib/build/provider/buildTaskHandlerInternal.js +228 -0
- package/lib/build/provider/buildTaskProviderInternal.js +370 -0
- package/lib/build/provider/fiori/index.js +167 -0
- package/lib/build/provider/hana/2migration.js +179 -0
- package/lib/build/provider/hana/index.js +522 -0
- package/lib/build/provider/hana/migrationtable.js +472 -0
- package/lib/build/provider/hana/template/.hdiconfig-all +163 -0
- package/lib/build/provider/hana/template/.hdiconfig-cloud +137 -0
- package/lib/build/provider/hana/template/.hdinamespace +4 -0
- package/lib/build/provider/hana/template/package.json +12 -0
- package/lib/build/provider/hana/template/undeploy.json +5 -0
- package/lib/build/provider/java/index.js +93 -0
- package/lib/build/provider/java-cf/index.js +1 -0
- package/lib/build/provider/mtx/index.js +37 -0
- package/lib/build/provider/mtx/resourcesTarBuilder.js +94 -0
- package/lib/build/provider/mtx-extension/index.js +131 -0
- package/lib/build/provider/mtx-sidecar/index.js +138 -0
- package/lib/build/provider/node-cf/index.js +1 -0
- package/lib/build/provider/nodejs/index.js +178 -0
- package/lib/build/util.js +263 -0
- package/lib/cds.js +9 -21
- package/lib/client/auth_manager.js +39 -16
- package/lib/client/helper/dependency_helper.js +7 -6
- package/lib/client/push.js +2 -1
- package/lib/client/settings_manager.js +10 -39
- package/lib/deploy/to-hana/hana.js +273 -0
- package/lib/deploy/to-hana/hdiDeployUtil.js +68 -0
- package/lib/deploy/to-hana/mtaUtil.js +171 -0
- package/lib/import/asyncapi/importAsyncAPI.js +3 -2
- package/lib/import/asyncapi/index.js +5 -2
- package/lib/import/asyncapi/parserContext.js +67 -26
- package/lib/import/asyncapi/utils.js +34 -3
- package/lib/import/common.js +40 -30
- package/lib/import/importapi.js +36 -35
- package/lib/index.js +12 -17
- package/lib/init/constants.js +36 -71
- package/lib/init/index.js +18 -52
- package/lib/init/template/_merging/registry-mta.js +21 -3
- package/lib/init/template/approuter/files/mta.yaml.hbs +29 -29
- package/lib/init/template/approuter/files/values.yaml.hbs +5 -5
- package/lib/init/template/approuter/files/xs-app.json.hbs +8 -2
- package/lib/init/template/approuter/index.js +7 -8
- package/lib/init/template/auditlog/files/mta.yaml.hbs +5 -5
- package/lib/init/template/auditlog/files/package.json.hbs +13 -13
- package/lib/init/template/auditlog/index.js +3 -3
- package/lib/init/template/cf-manifest/files/manifest.yml.hbs +22 -22
- package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +3 -3
- package/lib/init/template/connectivity/files/mta.yaml.hbs +14 -0
- package/lib/init/template/connectivity/files/package.json.hbs +17 -0
- package/lib/init/template/connectivity/index.js +21 -4
- package/lib/init/template/data/index.js +5 -1
- package/lib/init/template/destination/files/mta.yaml.hbs +14 -0
- package/lib/init/template/destination/files/package.json.hbs +17 -0
- package/lib/init/template/{destinations → destination}/index.js +19 -13
- package/lib/init/template/enterprise-messaging/files/event-mesh.json.hbs +3 -3
- package/lib/init/template/enterprise-messaging/files/mta.yaml.hbs +5 -5
- package/lib/init/template/enterprise-messaging/files/package.json.hbs +9 -9
- package/lib/init/template/enterprise-messaging/files/xs-security.json.hbs +19 -0
- package/lib/init/template/enterprise-messaging/index.js +27 -6
- package/lib/init/template/enterprise-messaging-shared/files/event-mesh.json.hbs +3 -3
- package/lib/init/template/enterprise-messaging-shared/files/mta.yaml.hbs +5 -5
- package/lib/init/template/enterprise-messaging-shared/files/package.json.hbs +9 -9
- package/lib/init/template/enterprise-messaging-shared/index.js +4 -5
- package/lib/init/template/extensibility/files/package.json.hbs +10 -10
- package/lib/init/template/extensibility/index.js +8 -9
- package/lib/init/template/file-based-messaging/files/package.json.hbs +9 -9
- package/lib/init/template/file-based-messaging/index.js +3 -4
- package/lib/init/template/hana/files/db/package.json +1 -1
- package/lib/init/template/hana/files/mta.yaml.hbs +21 -21
- package/lib/init/template/hana/files/package.json.hbs +16 -22
- package/lib/init/template/hana/files/values.yaml.hbs +1 -1
- package/lib/init/template/hana/index.js +5 -15
- package/lib/init/template/helm/files/Chart.yaml.hbs +4 -4
- package/lib/init/template/helm/files/values.yaml.hbs +6 -6
- package/lib/init/template/helm/index.js +5 -10
- package/lib/init/template/helm/subcharts/content-deployment/Chart.yaml +2 -0
- package/lib/init/template/helm/subcharts/content-deployment/templates/_helpers.tpl +37 -31
- package/lib/init/template/helm/subcharts/content-deployment/templates/job.yaml +13 -14
- package/lib/init/template/helm/subcharts/content-deployment/templates/secret.yaml +2 -2
- package/lib/init/template/helm/subcharts/content-deployment/templates/service-account.yaml +1 -1
- package/lib/init/template/helm/subcharts/content-deployment/templates/service-binding.yaml +3 -3
- package/lib/init/template/helm/subcharts/content-deployment/values.md +116 -116
- package/lib/init/template/helm/subcharts/service-instance/Chart.yaml +2 -0
- package/lib/init/template/helm/subcharts/service-instance/templates/_helpers.tpl +9 -9
- package/lib/init/template/helm/subcharts/service-instance/templates/serviceinstance.yaml +2 -2
- package/lib/init/template/helm/subcharts/service-instance/values.md +15 -15
- package/lib/init/template/helm/subcharts/web-application/Chart.yaml +2 -0
- package/lib/init/template/helm/subcharts/web-application/templates/NOTES.txt +15 -0
- package/lib/init/template/helm/subcharts/web-application/templates/_helpers.tpl +23 -23
- package/lib/init/template/helm/subcharts/web-application/templates/api-rule.yaml +4 -4
- package/lib/init/template/helm/subcharts/web-application/templates/deployment.yaml +17 -17
- package/lib/init/template/helm/subcharts/web-application/templates/network-policy.yaml +24 -3
- package/lib/init/template/helm/subcharts/web-application/templates/pod-disruption-budget.yaml +3 -3
- package/lib/init/template/helm/subcharts/web-application/templates/secret.yaml +2 -2
- package/lib/init/template/helm/subcharts/web-application/templates/service-account.yaml +1 -1
- package/lib/init/template/helm/subcharts/web-application/templates/service-binding.yaml +3 -3
- package/lib/init/template/helm/subcharts/web-application/templates/service.yaml +3 -3
- package/lib/init/template/helm/subcharts/web-application/values.md +141 -123
- package/lib/init/template/helm/subcharts/web-application/values.schema.json +7 -0
- package/lib/init/template/helm/subcharts/web-application/values.yaml +1 -0
- package/lib/init/template/html5-repo/index.js +4 -5
- package/lib/init/template/java/index.js +5 -5
- package/lib/init/template/kibana-logging/files/mta.yaml.hbs +5 -5
- package/lib/init/template/kibana-logging/files/package.json.hbs +9 -9
- package/lib/init/template/kibana-logging/index.js +3 -4
- package/lib/init/template/lint/index.js +3 -3
- package/lib/init/template/mta/files/mta.yaml.hbs +14 -14
- package/lib/init/template/mta/files/package.json +5 -0
- package/lib/init/template/mta/index.js +12 -13
- package/lib/init/template/mtx/index.js +2 -2
- package/lib/init/template/multitenancy/files/mta.yaml.hbs +29 -27
- package/lib/init/template/multitenancy/files/package.json.hbs +17 -14
- package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +7 -7
- package/lib/init/template/multitenancy/files/values.yaml.hbs +19 -19
- package/lib/init/template/multitenancy/index.js +14 -16
- package/lib/init/template/nodejs/files/package.json.hbs +1 -1
- package/lib/init/template/nodejs/index.js +5 -8
- package/lib/init/template/redis-messaging/files/mta.yaml.hbs +5 -5
- package/lib/init/template/redis-messaging/files/package.json.hbs +9 -9
- package/lib/init/template/redis-messaging/index.js +4 -5
- package/lib/init/template/sample/files/app/_i18n/i18n.properties +43 -0
- package/lib/init/template/sample/files/app/_i18n/i18n_de.properties +14 -0
- package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +114 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/Component.js +8 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n.properties +11 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +129 -0
- package/lib/init/template/sample/files/app/appconfig/fioriSandboxConfig.json +57 -0
- package/lib/init/template/sample/files/app/common.cds +263 -0
- package/lib/init/template/sample/files/app/index.html +30 -0
- package/lib/init/template/sample/files/app/services.cds +5 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +5 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +6 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books_texts.csv +5 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +16 -0
- package/lib/init/template/sample/files/db/schema.cds +31 -0
- package/lib/init/template/sample/files/nodejs/admin-service.js +12 -0
- package/lib/init/template/sample/files/nodejs/cat-service.js +26 -0
- package/lib/init/template/sample/files/srv/admin-service.cds +5 -0
- package/lib/init/template/sample/files/srv/cat-service.cds +16 -0
- package/lib/init/template/sample/index.js +24 -0
- package/lib/init/template/sample-tiny/index.js +39 -0
- package/lib/init/template/samples/index.js +5 -56
- package/lib/init/template/sqlite/files/package.json.hbs +13 -13
- package/lib/init/template/sqlite/index.js +2 -2
- package/lib/init/template/templateBase.js +24 -1
- package/lib/init/template/toggles/files/package.json.hbs +10 -10
- package/lib/init/template/toggles/index.js +3 -3
- package/lib/init/template/typer/files/gitignore +1 -0
- package/lib/init/template/typer/files/package.json +8 -0
- package/lib/init/template/typer/files/xsconfig.json +9 -0
- package/lib/init/template/typer/index.js +36 -0
- package/lib/init/template/xsuaa/files/mta.yaml.hbs +12 -12
- package/lib/init/template/xsuaa/files/package.json.hbs +13 -13
- package/lib/init/template/xsuaa/files/values.yaml.hbs +8 -8
- package/lib/init/template/xsuaa/index.js +8 -19
- package/lib/init/util/merge.js +73 -59
- package/lib/init/util/mvn.js +21 -17
- package/lib/init/util/projectReader.js +49 -87
- package/lib/init/util/xml.js +14 -23
- package/lib/util/cfUtil.js +366 -0
- package/lib/util/command.js +3 -3
- package/lib/util/gitUtil.js +55 -0
- package/lib/util/version.js +27 -0
- package/npm-shrinkwrap.json +337 -275
- package/package.json +6 -6
- package/CHANGELOG.md +0 -1460
- package/bin/build/all.js +0 -88
- package/bin/build/index.js +0 -82
- package/lib/compile/index.js +0 -14
- /package/lib/init/template/{samples → sample-tiny}/files/nodejs/db/data/my.bookshop-Books.csv +0 -0
- /package/lib/init/template/{samples → sample-tiny}/files/nodejs/db/data-model.cds +0 -0
- /package/lib/init/template/{samples → sample-tiny}/files/nodejs/srv/cat-service.cds.hbs +0 -0
|
@@ -3,18 +3,18 @@ const { exists } = require('../../../cds').utils
|
|
|
3
3
|
const { readProject } = require('../../util/projectReader')
|
|
4
4
|
const { mergeYAML } = require('../../util/merge')
|
|
5
5
|
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5')
|
|
6
|
-
const {
|
|
6
|
+
const { DESTINATION } = require('../../constants').OPTIONS
|
|
7
7
|
|
|
8
8
|
module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
getDependencies() {
|
|
12
|
-
return [
|
|
12
|
+
return [DESTINATION]
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
async canRun() {
|
|
16
16
|
const projectDescriptor = await readProject(this.options)
|
|
17
|
-
const { hasMta, hasHelm } = projectDescriptor
|
|
17
|
+
const { hasMta, hasHelm } = projectDescriptor
|
|
18
18
|
if (!hasHelm && hasMta) {
|
|
19
19
|
throw `'cds add html5-repo' is not available for Cloud Foundry yet`
|
|
20
20
|
}
|
|
@@ -31,8 +31,7 @@ module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
async runDependentMerging(context = {}) {
|
|
34
|
-
const
|
|
35
|
-
const { appName, hasHelm } = projectDescriptor.cap
|
|
34
|
+
const { appName, hasHelm } = await readProject(this.options)
|
|
36
35
|
|
|
37
36
|
if (hasHelm) {
|
|
38
37
|
//in case facet is being added to the already exisiting charts folder
|
|
@@ -6,10 +6,10 @@ const commandUtil = require('../../../util/command');
|
|
|
6
6
|
const mvnArchetypeUtil = require('../../util/mvn');
|
|
7
7
|
const term = require('../../../util/term');
|
|
8
8
|
const cds = require('../../../cds')
|
|
9
|
-
const { exists, copy } = cds.utils
|
|
9
|
+
const { exists, copy, rimraf } = cds.utils
|
|
10
10
|
const LOG = console
|
|
11
11
|
|
|
12
|
-
const { COMMAND_ADD, URLS,
|
|
12
|
+
const { COMMAND_ADD, URLS, OPTIONS: { NODEJS, JAVA } } = require('../../constants');
|
|
13
13
|
|
|
14
14
|
module.exports = class JavaTemplate extends require('../templateBase') {
|
|
15
15
|
|
|
@@ -22,8 +22,8 @@ module.exports = class JavaTemplate extends require('../templateBase') {
|
|
|
22
22
|
throw new Error(`You can't change the type of an existing project.`);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
if (this.options.add.has(
|
|
26
|
-
throw new Error(`Only one runtime per project is supported. Specify either ${
|
|
25
|
+
if (this.options.add.has(NODEJS)) {
|
|
26
|
+
throw new Error(`Only one runtime per project is supported. Specify either ${JAVA} or ${NODEJS}.`);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
return true;
|
|
@@ -48,7 +48,7 @@ module.exports = class JavaTemplate extends require('../templateBase') {
|
|
|
48
48
|
}
|
|
49
49
|
throw err;
|
|
50
50
|
} finally {
|
|
51
|
-
await
|
|
51
|
+
await rimraf(tempFolder);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
modules:
|
|
3
|
-
- name: {{
|
|
4
|
-
type: {{
|
|
5
|
-
path: {{&
|
|
3
|
+
- name: {{appName}}-srv
|
|
4
|
+
type: {{language}}
|
|
5
|
+
path: {{& srvPath}}
|
|
6
6
|
requires:
|
|
7
|
-
- name: {{
|
|
7
|
+
- name: {{appName}}-cf-logging
|
|
8
8
|
|
|
9
9
|
resources:
|
|
10
|
-
- name: {{
|
|
10
|
+
- name: {{appName}}-cf-logging
|
|
11
11
|
type: org.cloudfoundry.managed-service
|
|
12
12
|
parameters:
|
|
13
13
|
service: application-logs
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
{{#
|
|
2
|
+
{{#isNodejs}}
|
|
3
3
|
"cds": {
|
|
4
|
-
{{/
|
|
4
|
+
{{/isNodejs}}
|
|
5
5
|
"features": {
|
|
6
|
-
{{#
|
|
7
|
-
"[{{
|
|
8
|
-
{{/
|
|
6
|
+
{{#profile}}
|
|
7
|
+
"[{{profile}}]": {
|
|
8
|
+
{{/profile}}
|
|
9
9
|
"kibana_formatter": true
|
|
10
|
-
{{#
|
|
10
|
+
{{#profile}}
|
|
11
11
|
}
|
|
12
|
-
{{/
|
|
12
|
+
{{/profile}}
|
|
13
13
|
}
|
|
14
|
-
{{#
|
|
14
|
+
{{#isNodejs}}
|
|
15
15
|
}
|
|
16
|
-
{{/
|
|
16
|
+
{{/isNodejs}}
|
|
17
17
|
}
|
|
@@ -7,8 +7,7 @@ const { srvNode4, srvJava4, kibanaLogging } = require('../_merging/registry-mta'
|
|
|
7
7
|
module.exports = class KibanaLoggingTemplate extends require('../templateBase') {
|
|
8
8
|
|
|
9
9
|
async canRun() {
|
|
10
|
-
const
|
|
11
|
-
const { hasMta, hasHelm } = projectDescriptor.cap
|
|
10
|
+
const { hasMta, hasHelm } = await readProject(this.options)
|
|
12
11
|
if (hasHelm && !hasMta) {
|
|
13
12
|
throw `'cds add kibana-logging' is not available for Kyma yet`
|
|
14
13
|
}
|
|
@@ -17,7 +16,7 @@ module.exports = class KibanaLoggingTemplate extends require('../templateBase')
|
|
|
17
16
|
|
|
18
17
|
async run() {
|
|
19
18
|
const projectDescriptor = await readProject(this.options)
|
|
20
|
-
const { isJava } = projectDescriptor
|
|
19
|
+
const { isJava } = projectDescriptor
|
|
21
20
|
if (isJava) cds.error(`kibana-logging is not implemented for project type Java yet`)
|
|
22
21
|
await mergeJSON('package.json', join(__dirname, 'files', 'package.json.hbs'), projectDescriptor)
|
|
23
22
|
await this.runDependentMerging()
|
|
@@ -25,7 +24,7 @@ module.exports = class KibanaLoggingTemplate extends require('../templateBase')
|
|
|
25
24
|
|
|
26
25
|
async runDependentMerging() {
|
|
27
26
|
const projectDescriptor = await readProject(this.options)
|
|
28
|
-
const { hasMta, isNodejs, srvPath } = projectDescriptor
|
|
27
|
+
const { hasMta, isNodejs, srvPath } = projectDescriptor
|
|
29
28
|
|
|
30
29
|
if (hasMta) {
|
|
31
30
|
const srv = (isNodejs ? srvNode4 : srvJava4)(srvPath)
|
|
@@ -6,7 +6,7 @@ const checks = require("../../../lint/checks");
|
|
|
6
6
|
const io = require("../../../lint/io");
|
|
7
7
|
const readline = require("readline");
|
|
8
8
|
const { copyFiles } = require('../../util/template')
|
|
9
|
-
const {
|
|
9
|
+
const { LINT_DEV, LINT_GLOBAL } = require("../../constants").OPTIONS;
|
|
10
10
|
const { getConfigPath, getFileExtensions } = require("@sap/eslint-plugin-cds/lib/api");
|
|
11
11
|
const cds = require("../../../cds");
|
|
12
12
|
const { mkdirp, exists } = cds.utils;
|
|
@@ -35,10 +35,10 @@ module.exports = class LintTemplate extends require('../templateBase') {
|
|
|
35
35
|
if (this.options.lint) {
|
|
36
36
|
// If custom rule example is requested, also trigger
|
|
37
37
|
// "custom" rule type of setup
|
|
38
|
-
if (this.options.lint.has(
|
|
38
|
+
if (this.options.lint.has(LINT_DEV)) {
|
|
39
39
|
this.customRuleExample = true;
|
|
40
40
|
}
|
|
41
|
-
if (this.options.lint.has(
|
|
41
|
+
if (this.options.lint.has(LINT_GLOBAL)) {
|
|
42
42
|
this.lintType = "global";
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
_schema-version: '3.1'
|
|
3
|
-
ID: {{
|
|
4
|
-
version: {{
|
|
5
|
-
description: "{{
|
|
3
|
+
ID: {{appId}}
|
|
4
|
+
version: {{appVersion}}
|
|
5
|
+
description: "{{appDescription}}"
|
|
6
6
|
parameters:
|
|
7
7
|
enable-parallel-deployments: true
|
|
8
|
-
{{#
|
|
8
|
+
{{#isNodejs}}
|
|
9
9
|
build-parameters:
|
|
10
10
|
before-all:
|
|
11
11
|
- builder: custom
|
|
12
12
|
commands:
|
|
13
|
-
- npx
|
|
14
|
-
{{/
|
|
13
|
+
- npx cds build --production
|
|
14
|
+
{{/isNodejs}}
|
|
15
15
|
modules:
|
|
16
|
-
- name: {{
|
|
17
|
-
type: {{
|
|
18
|
-
path: {{&
|
|
19
|
-
{{#
|
|
16
|
+
- name: {{appName}}-srv
|
|
17
|
+
type: {{language}}
|
|
18
|
+
path: {{& srvPath}}
|
|
19
|
+
{{#isNodejs}}
|
|
20
20
|
parameters:
|
|
21
21
|
buildpack: nodejs_buildpack
|
|
22
22
|
build-parameters:
|
|
23
|
-
builder: npm
|
|
24
|
-
{{/
|
|
25
|
-
{{#
|
|
23
|
+
builder: npm
|
|
24
|
+
{{/isNodejs}}
|
|
25
|
+
{{#isJava}}
|
|
26
26
|
parameters:
|
|
27
27
|
buildpack: sap_java_buildpack
|
|
28
28
|
properties:
|
|
@@ -34,7 +34,7 @@ modules:
|
|
|
34
34
|
commands:
|
|
35
35
|
- mvn clean package -DskipTests=true
|
|
36
36
|
build-result: target/*-exec.jar
|
|
37
|
-
{{/
|
|
37
|
+
{{/isJava}}
|
|
38
38
|
provides:
|
|
39
39
|
- name: srv-api # required by consumers of CAP services (e.g. approuter)
|
|
40
40
|
properties:
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
const { join } = require('path')
|
|
1
|
+
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { exists } = cds.utils
|
|
4
|
-
const {
|
|
5
|
-
const { readProject } = require('../../util/projectReader')
|
|
4
|
+
const { copyRenderedYAML } = require('../../../util/fs')
|
|
5
|
+
const { readProject } = require('../../util/projectReader')
|
|
6
|
+
const { mergeJSON, sort } = require('../../util/merge')
|
|
6
7
|
|
|
7
8
|
module.exports = class MtaTemplate extends require('../templateBase') {
|
|
8
9
|
|
|
@@ -11,18 +12,16 @@ module.exports = class MtaTemplate extends require('../templateBase') {
|
|
|
11
12
|
return exists('mta.yaml')
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
getRelatedFacets() {
|
|
16
|
+
return ['approuter', 'xsuaa', 'multitenancy', 'hana', 'extensibility', 'enterprise-messaging', 'enterprise-messaging-shared', 'redis-messaging', 'connectivity', 'destination']
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
async run() {
|
|
15
|
-
const
|
|
20
|
+
const project = await readProject(this.options)
|
|
16
21
|
if (!exists('mta.yaml')) {
|
|
17
|
-
await
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Re-applying the dependent merging part of other facets if necessary.
|
|
21
|
-
const dependentFacets = ['approuter', 'hana', 'xsuaa', 'multitenancy', 'extensibility', 'enterprise-messaging', 'enterprise-messaging-shared', 'redis-messaging']
|
|
22
|
-
for (const facet of dependentFacets) {
|
|
23
|
-
const Template = require('../'+facet)
|
|
24
|
-
const template = new Template(this.generator)
|
|
25
|
-
if (Template.hasFacet(await this.getEnv(), this.options)) await template.runDependentMerging()
|
|
22
|
+
await copyRenderedYAML(join(__dirname, 'files', 'mta.yaml.hbs'), 'mta.yaml', project)
|
|
26
23
|
}
|
|
24
|
+
await mergeJSON('package.json', join(__dirname, 'files', 'package.json'))
|
|
25
|
+
await sort('package.json', 'devDependencies')
|
|
27
26
|
}
|
|
28
27
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { MULTITENANCY, TOGGLES, EXTENSIBILITY } = require('../../constants').OPTIONS
|
|
2
2
|
|
|
3
3
|
module.exports = class MtxTemplate extends require('../templateBase') {
|
|
4
4
|
|
|
5
5
|
getDependencies() {
|
|
6
|
-
return [
|
|
6
|
+
return [MULTITENANCY, TOGGLES, EXTENSIBILITY]
|
|
7
7
|
}
|
|
8
8
|
}
|
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
---
|
|
2
2
|
modules:
|
|
3
|
-
- name: {{
|
|
4
|
-
type: {{
|
|
5
|
-
path: {{&
|
|
3
|
+
- name: {{appName}}-srv
|
|
4
|
+
type: {{language}}
|
|
5
|
+
path: {{& srvPath}}
|
|
6
6
|
requires:
|
|
7
|
-
- name: {{
|
|
8
|
-
{{#
|
|
7
|
+
- name: {{appName}}-registry
|
|
8
|
+
{{#isJava}}
|
|
9
9
|
- name: mtx-api
|
|
10
10
|
properties:
|
|
11
11
|
CDS_MULTITENANCY_MTXS_ENABLED: true
|
|
12
12
|
CDS_MULTITENANCY_SIDECAR_URL: ~{mtx-url}
|
|
13
|
-
{{/
|
|
13
|
+
{{/isJava}}
|
|
14
14
|
provides:
|
|
15
15
|
- name: srv-api # required by consumers of CAP services (e.g. approuter)
|
|
16
16
|
properties:
|
|
17
17
|
srv-url: ${default-url}
|
|
18
18
|
|
|
19
|
-
- name: {{
|
|
19
|
+
- name: {{appName}}-mtx
|
|
20
20
|
type: nodejs
|
|
21
|
-
path: {{#
|
|
22
|
-
{{#
|
|
21
|
+
path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
|
|
22
|
+
{{#isNodejs}}
|
|
23
23
|
build-parameters:
|
|
24
24
|
builder: npm-ci
|
|
25
|
-
{{/
|
|
26
|
-
{{#
|
|
25
|
+
{{/isNodejs}}
|
|
26
|
+
{{#isJava}}
|
|
27
27
|
build-parameters:
|
|
28
28
|
builder: custom
|
|
29
29
|
build-result: gen
|
|
30
30
|
commands:
|
|
31
31
|
- npm run build
|
|
32
|
-
|
|
32
|
+
requires:
|
|
33
|
+
[]
|
|
34
|
+
{{/isJava}}
|
|
33
35
|
parameters:
|
|
34
36
|
memory: 256M
|
|
35
37
|
disk-quota: 512M
|
|
@@ -37,39 +39,39 @@ modules:
|
|
|
37
39
|
- name: mtx-api
|
|
38
40
|
properties:
|
|
39
41
|
mtx-url: ${default-url}
|
|
40
|
-
{{#
|
|
42
|
+
{{#hasXsuaa}}
|
|
41
43
|
requires:
|
|
42
|
-
- name: {{
|
|
43
|
-
{{/
|
|
44
|
+
- name: {{appName}}-auth
|
|
45
|
+
{{/hasXsuaa}}
|
|
44
46
|
|
|
45
47
|
resources:
|
|
46
|
-
- name: {{
|
|
48
|
+
- name: {{appName}}-registry
|
|
47
49
|
type: org.cloudfoundry.managed-service
|
|
48
50
|
requires:
|
|
49
|
-
{{#
|
|
51
|
+
{{#isNodejs}}
|
|
50
52
|
- name: mtx-api
|
|
51
|
-
{{/
|
|
52
|
-
{{#
|
|
53
|
+
{{/isNodejs}}
|
|
54
|
+
{{#isJava}}
|
|
53
55
|
- name: srv-api
|
|
54
|
-
{{/
|
|
56
|
+
{{/isJava}}
|
|
55
57
|
parameters:
|
|
56
58
|
service: saas-registry
|
|
57
59
|
service-plan: application
|
|
58
60
|
config:
|
|
59
|
-
xsappname: {{
|
|
60
|
-
appName: {{
|
|
61
|
-
displayName: {{
|
|
61
|
+
xsappname: {{appName}}-${org}-${space}
|
|
62
|
+
appName: {{appName}}-${org}-${space}
|
|
63
|
+
displayName: {{appName}}
|
|
62
64
|
description: A simple CAP project.
|
|
63
65
|
category: 'Category'
|
|
64
66
|
appUrls:
|
|
65
|
-
{{#
|
|
67
|
+
{{#isNodejs}}
|
|
66
68
|
getDependencies: ~{mtx-api/mtx-url}/-/cds/saas-provisioning/dependencies
|
|
67
69
|
onSubscription: ~{mtx-api/mtx-url}/-/cds/saas-provisioning/tenant/{tenantId}
|
|
68
|
-
{{/
|
|
69
|
-
{{#
|
|
70
|
+
{{/isNodejs}}
|
|
71
|
+
{{#isJava}}
|
|
70
72
|
getDependencies: ~{srv-api/srv-url}/mt/v1.0/subscriptions/dependencies
|
|
71
73
|
onSubscription: ~{srv-api/srv-url}/mt/v1.0/subscriptions/tenants/{tenantId}
|
|
72
|
-
{{/
|
|
74
|
+
{{/isJava}}
|
|
73
75
|
onSubscriptionAsync: true
|
|
74
76
|
onUnSubscriptionAsync: true
|
|
75
77
|
onUpdateDependenciesAsync: true
|
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
{
|
|
2
|
-
{{#
|
|
2
|
+
{{#isNodejs}}
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@sap/cds-mtxs": "^1"
|
|
4
|
+
"@sap/cds-mtxs": "^1.9"
|
|
5
5
|
},
|
|
6
|
+
{{#cap.isJava}}
|
|
7
|
+
"workspaces": [ "mtx/sidecar" ],
|
|
8
|
+
{{/cap.isJava}}
|
|
6
9
|
"cds": {
|
|
7
|
-
{{/
|
|
8
|
-
{{#
|
|
10
|
+
{{/isNodejs}}
|
|
11
|
+
{{#isJava}}
|
|
9
12
|
"profiles": ["with-mtx-sidecar", "java"],
|
|
10
13
|
"build": {
|
|
11
14
|
"target": "."
|
|
12
15
|
},
|
|
13
|
-
{{/
|
|
14
|
-
{{#
|
|
16
|
+
{{/isJava}}
|
|
17
|
+
{{#isNodejs}}
|
|
15
18
|
"profile": "with-mtx-sidecar",
|
|
16
|
-
{{/
|
|
19
|
+
{{/isNodejs}}
|
|
17
20
|
"requires": {
|
|
18
|
-
{{#
|
|
19
|
-
"[{{
|
|
20
|
-
{{/
|
|
21
|
+
{{#profile}}
|
|
22
|
+
"[{{profile}}]": {
|
|
23
|
+
{{/profile}}
|
|
21
24
|
"multitenancy": true
|
|
22
|
-
{{#
|
|
25
|
+
{{#profile}}
|
|
23
26
|
}
|
|
24
|
-
{{/
|
|
27
|
+
{{/profile}}
|
|
25
28
|
}
|
|
26
|
-
{{#
|
|
29
|
+
{{#isNodejs}}
|
|
27
30
|
}
|
|
28
|
-
{{/
|
|
31
|
+
{{/isNodejs}}
|
|
29
32
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{
|
|
2
|
+
"name": "{{appName}}-mtx",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@sap/cds": "^
|
|
5
|
-
"@sap/cds-
|
|
4
|
+
"@sap/cds": "^7",
|
|
5
|
+
"@sap/cds-hana": "^2",
|
|
6
|
+
"@sap/cds-mtxs": "^1.9",
|
|
6
7
|
"@sap/xssec": "^3",
|
|
7
8
|
"express": "^4",
|
|
8
|
-
"
|
|
9
|
-
"passport": "^0.6.0"
|
|
9
|
+
"passport": ">=0.6.0"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"sqlite3": "^5"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"start": "cds-serve"{{#
|
|
16
|
-
"build": "
|
|
15
|
+
"start": "cds-serve"{{#isJava}},
|
|
16
|
+
"build": "cds build ../.. --for mtx-sidecar --production && cd gen && npm ci"{{/isJava}}
|
|
17
17
|
},
|
|
18
18
|
"cds": {
|
|
19
19
|
"profile": "mtx-sidecar"
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
srv:
|
|
3
3
|
bindings:
|
|
4
|
-
{{#
|
|
4
|
+
{{#isJava}}
|
|
5
5
|
saas-registry:
|
|
6
6
|
serviceInstanceName: saas-registry
|
|
7
|
-
{{/
|
|
7
|
+
{{/isJava}}
|
|
8
8
|
service-manager:
|
|
9
9
|
serviceInstanceName: service-manager
|
|
10
|
-
{{#
|
|
10
|
+
{{#hasXsuaa}}
|
|
11
11
|
xsuaa:
|
|
12
12
|
parameters:
|
|
13
13
|
tenant-mode: shared
|
|
14
|
-
{{/
|
|
14
|
+
{{/hasXsuaa}}
|
|
15
15
|
service-manager:
|
|
16
16
|
serviceOfferingName: service-manager
|
|
17
17
|
servicePlanName: container
|
|
@@ -19,41 +19,41 @@ saas-registry:
|
|
|
19
19
|
serviceOfferingName: saas-registry
|
|
20
20
|
servicePlanName: application
|
|
21
21
|
saasRegistryParameters:
|
|
22
|
-
xsappname: {{
|
|
23
|
-
appName: {{
|
|
24
|
-
displayName: {{
|
|
25
|
-
description: {{
|
|
22
|
+
xsappname: {{appName}}
|
|
23
|
+
appName: {{appName}}
|
|
24
|
+
displayName: {{appName}}
|
|
25
|
+
description: {{appDescription}}
|
|
26
26
|
category: "CAP Application"
|
|
27
|
-
{{#
|
|
27
|
+
{{#isNodejs}}
|
|
28
28
|
bindSidecar: true
|
|
29
|
-
{{/
|
|
29
|
+
{{/isNodejs}}
|
|
30
30
|
appUrls:
|
|
31
|
-
{{#
|
|
31
|
+
{{#isNodejs}}
|
|
32
32
|
getDependencies: "/-/cds/saas-provisioning/dependencies"
|
|
33
33
|
onSubscription: "/-/cds/saas-provisioning/tenant/{tenantId}"
|
|
34
|
-
{{/
|
|
35
|
-
{{#
|
|
34
|
+
{{/isNodejs}}
|
|
35
|
+
{{#isJava}}
|
|
36
36
|
getDependencies: "/mt/v1.0/subscriptions/dependencies"
|
|
37
37
|
onSubscription: "/mt/v1.0/subscriptions/tenants/{tenantId}"
|
|
38
|
-
{{/
|
|
38
|
+
{{/isJava}}
|
|
39
39
|
onSubscriptionAsync: true
|
|
40
40
|
onUnSubscriptionAsync: true
|
|
41
41
|
onUpdateDependenciesAsync: true
|
|
42
42
|
callbackTimeoutMillis: 300000
|
|
43
43
|
sidecar:
|
|
44
44
|
bindings:
|
|
45
|
-
{{#
|
|
45
|
+
{{#hasXsuaa}}
|
|
46
46
|
auth:
|
|
47
47
|
serviceInstanceName: xsuaa
|
|
48
|
-
{{/
|
|
49
|
-
{{#
|
|
48
|
+
{{/hasXsuaa}}
|
|
49
|
+
{{#isNodejs}}
|
|
50
50
|
saas-registry:
|
|
51
51
|
serviceInstanceName: saas-registry
|
|
52
|
-
{{/
|
|
52
|
+
{{/isNodejs}}
|
|
53
53
|
service-manager:
|
|
54
54
|
serviceInstanceName: service-manager
|
|
55
55
|
image:
|
|
56
|
-
repository: <your-container-registry>/{{
|
|
56
|
+
repository: <your-container-registry>/{{appName}}-sidecar
|
|
57
57
|
tag: latest
|
|
58
58
|
resources:
|
|
59
59
|
limits:
|
|
@@ -2,7 +2,7 @@ const { join } = require('path')
|
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { exists } = cds.utils
|
|
4
4
|
const { readProject } = require('../../util/projectReader')
|
|
5
|
-
const { mergeJSON, mergeYAML,
|
|
5
|
+
const { mergeJSON, mergeYAML, sort } = require('../../util/merge')
|
|
6
6
|
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5')
|
|
7
7
|
const { copyRenderedJSON } = require('../../../util/fs')
|
|
8
8
|
const {
|
|
@@ -21,18 +21,22 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
21
21
|
exists(join('mtx', 'sidecar')) || false
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
getRelatedFacets() {
|
|
25
|
+
return ['approuter', 'hana']
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
async run() {
|
|
25
29
|
const projectDescriptor = await readProject(this.options)
|
|
26
|
-
const { isNodejs, configFile } = projectDescriptor
|
|
30
|
+
const { isNodejs, configFile } = projectDescriptor
|
|
27
31
|
await mergeJSON(configFile, join(__dirname, 'files', `package.json.hbs`), projectDescriptor)
|
|
28
|
-
if (isNodejs) await
|
|
32
|
+
if (isNodejs) await sort('package.json', 'dependencies')
|
|
29
33
|
await copyRenderedJSON(join(__dirname, 'files', 'package.sidecar.json.hbs'), join('mtx', 'sidecar', 'package.json'), projectDescriptor)
|
|
30
34
|
await this.runDependentMerging()
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
async runDependentMerging(context = {}) {
|
|
34
38
|
const projectDescriptor = await readProject(this.options)
|
|
35
|
-
const { isNodejs, isJava, hasMta, hasHelm,
|
|
39
|
+
const { isNodejs, isJava, hasMta, hasHelm, hasXsuaa, hasHana, srvPath } = projectDescriptor
|
|
36
40
|
|
|
37
41
|
if (hasMta) {
|
|
38
42
|
const srv = (isNodejs ? srvNode4 : srvJava4)(srvPath)
|
|
@@ -50,6 +54,12 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
50
54
|
insert: [saasRegistry, 'name'],
|
|
51
55
|
into: [isJava ? srv : mtxSidecar, 'requires', 'name']
|
|
52
56
|
}]
|
|
57
|
+
if (isJava) {
|
|
58
|
+
relationships.push({
|
|
59
|
+
insert: [srv, 'name'],
|
|
60
|
+
into: [mtxSidecar, 'build-parameters.requires', 'name']
|
|
61
|
+
})
|
|
62
|
+
}
|
|
53
63
|
if (hasXsuaa) {
|
|
54
64
|
relationships.push({
|
|
55
65
|
insert: [xsuaa, 'name'],
|
|
@@ -142,18 +152,6 @@ module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
|
142
152
|
if (isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
143
153
|
}
|
|
144
154
|
|
|
145
|
-
if (hasApprouter) {
|
|
146
|
-
const ApprouterTemplate = require(`../approuter`)
|
|
147
|
-
const template = new ApprouterTemplate(this.generator)
|
|
148
|
-
await template.runDependentMerging(context)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (hasHana) {
|
|
152
|
-
const HanaTemplate = require(`../hana`)
|
|
153
|
-
const template = new HanaTemplate(this.generator)
|
|
154
|
-
await template.runDependentMerging(context)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
155
|
if (hasXsuaa) {
|
|
158
156
|
await mergeJSON(
|
|
159
157
|
'xs-security.json',
|