@sap/cds-dk 6.8.2 → 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.
Files changed (218) hide show
  1. package/bin/activate.js +15 -7
  2. package/bin/add.js +29 -15
  3. package/bin/bind.js +49 -116
  4. package/bin/build.js +114 -0
  5. package/bin/cds.js +67 -24
  6. package/bin/compile/index.js +2 -2
  7. package/bin/deploy/index.js +46 -39
  8. package/bin/deploy/to-hana.js +11 -8
  9. package/bin/deploy/to-postgres.js +8 -2
  10. package/bin/deploy/to-sqlite.js +0 -1
  11. package/bin/env.js +75 -41
  12. package/bin/eval.js +3 -3
  13. package/bin/extend.js +17 -10
  14. package/bin/help.js +22 -21
  15. package/bin/import.js +10 -7
  16. package/bin/init.js +38 -17
  17. package/bin/login.js +69 -55
  18. package/bin/logout.js +12 -9
  19. package/bin/migrate.js +10 -4
  20. package/bin/pull.js +12 -5
  21. package/bin/push.js +24 -13
  22. package/bin/repl.js +1 -0
  23. package/bin/run.js +25 -0
  24. package/bin/subscribe.js +13 -8
  25. package/bin/unsubscribe.js +15 -8
  26. package/bin/upgrade.js +15 -9
  27. package/bin/util/log.js +24 -0
  28. package/bin/version.js +124 -0
  29. package/bin/watch.js +1 -35
  30. package/bin/watched.js +39 -0
  31. package/lib/bind/KubernetesApiAccessor.js +2 -2
  32. package/lib/bind/bindingManager.js +1 -1
  33. package/lib/bind/bindingUtil.js +0 -9
  34. package/lib/bind/cfKeyProvider.js +10 -72
  35. package/lib/bind/index.js +114 -0
  36. package/lib/bind/kubernetesCredentialsProvider.js +2 -2
  37. package/lib/bind/userCdsrcJsonStorageProvider.js +7 -44
  38. package/lib/build/buildTaskEngine.js +355 -0
  39. package/lib/build/buildTaskFactory.js +284 -0
  40. package/lib/build/buildTaskHandler.js +240 -0
  41. package/lib/build/buildTaskProvider.js +22 -0
  42. package/lib/build/buildTaskProviderFactory.js +182 -0
  43. package/lib/build/constants.js +56 -0
  44. package/lib/build/index.js +21 -0
  45. package/lib/build/provider/buildTaskHandlerEdmx.js +83 -0
  46. package/lib/build/provider/buildTaskHandlerFeatureToggles.js +132 -0
  47. package/lib/build/provider/buildTaskHandlerInternal.js +228 -0
  48. package/lib/build/provider/buildTaskProviderInternal.js +370 -0
  49. package/lib/build/provider/fiori/index.js +167 -0
  50. package/lib/build/provider/hana/2migration.js +179 -0
  51. package/lib/build/provider/hana/index.js +522 -0
  52. package/lib/build/provider/hana/migrationtable.js +472 -0
  53. package/lib/build/provider/hana/template/.hdiconfig-all +163 -0
  54. package/lib/build/provider/hana/template/.hdiconfig-cloud +137 -0
  55. package/lib/build/provider/hana/template/.hdinamespace +4 -0
  56. package/lib/build/provider/hana/template/package.json +12 -0
  57. package/lib/build/provider/hana/template/undeploy.json +5 -0
  58. package/lib/build/provider/java/index.js +93 -0
  59. package/lib/build/provider/java-cf/index.js +1 -0
  60. package/lib/build/provider/mtx/index.js +37 -0
  61. package/lib/build/provider/mtx/resourcesTarBuilder.js +94 -0
  62. package/lib/build/provider/mtx-extension/index.js +131 -0
  63. package/lib/build/provider/mtx-sidecar/index.js +138 -0
  64. package/lib/build/provider/node-cf/index.js +1 -0
  65. package/lib/build/provider/nodejs/index.js +178 -0
  66. package/lib/build/util.js +263 -0
  67. package/lib/cds.js +9 -21
  68. package/lib/client/auth_manager.js +39 -16
  69. package/lib/client/helper/dependency_helper.js +7 -6
  70. package/lib/client/push.js +2 -1
  71. package/lib/client/settings_manager.js +10 -39
  72. package/lib/deploy/to-hana/hana.js +273 -0
  73. package/lib/deploy/to-hana/hdiDeployUtil.js +68 -0
  74. package/lib/deploy/to-hana/mtaUtil.js +171 -0
  75. package/lib/import/asyncapi/importAsyncAPI.js +3 -2
  76. package/lib/import/asyncapi/index.js +5 -2
  77. package/lib/import/asyncapi/parserContext.js +67 -26
  78. package/lib/import/asyncapi/utils.js +34 -3
  79. package/lib/import/common.js +40 -30
  80. package/lib/import/importapi.js +36 -35
  81. package/lib/index.js +12 -17
  82. package/lib/init/constants.js +36 -71
  83. package/lib/init/index.js +18 -52
  84. package/lib/init/template/_merging/registry-mta.js +21 -3
  85. package/lib/init/template/approuter/files/mta.yaml.hbs +29 -29
  86. package/lib/init/template/approuter/files/values.yaml.hbs +5 -5
  87. package/lib/init/template/approuter/files/xs-app.json.hbs +8 -2
  88. package/lib/init/template/approuter/index.js +7 -8
  89. package/lib/init/template/auditlog/files/mta.yaml.hbs +5 -5
  90. package/lib/init/template/auditlog/files/package.json.hbs +13 -13
  91. package/lib/init/template/auditlog/index.js +3 -3
  92. package/lib/init/template/cf-manifest/files/manifest.yml.hbs +22 -22
  93. package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +3 -3
  94. package/lib/init/template/connectivity/files/mta.yaml.hbs +14 -0
  95. package/lib/init/template/connectivity/files/package.json.hbs +17 -0
  96. package/lib/init/template/connectivity/index.js +21 -4
  97. package/lib/init/template/data/index.js +5 -1
  98. package/lib/init/template/destination/files/mta.yaml.hbs +14 -0
  99. package/lib/init/template/destination/files/package.json.hbs +17 -0
  100. package/lib/init/template/{destinations → destination}/index.js +19 -13
  101. package/lib/init/template/enterprise-messaging/files/event-mesh.json.hbs +3 -3
  102. package/lib/init/template/enterprise-messaging/files/mta.yaml.hbs +5 -5
  103. package/lib/init/template/enterprise-messaging/files/package.json.hbs +9 -9
  104. package/lib/init/template/enterprise-messaging/files/xs-security.json.hbs +19 -0
  105. package/lib/init/template/enterprise-messaging/index.js +27 -6
  106. package/lib/init/template/enterprise-messaging-shared/files/event-mesh.json.hbs +3 -3
  107. package/lib/init/template/enterprise-messaging-shared/files/mta.yaml.hbs +5 -5
  108. package/lib/init/template/enterprise-messaging-shared/files/package.json.hbs +9 -9
  109. package/lib/init/template/enterprise-messaging-shared/index.js +4 -5
  110. package/lib/init/template/extensibility/files/package.json.hbs +10 -10
  111. package/lib/init/template/extensibility/index.js +8 -9
  112. package/lib/init/template/file-based-messaging/files/package.json.hbs +9 -9
  113. package/lib/init/template/file-based-messaging/index.js +3 -4
  114. package/lib/init/template/hana/files/db/package.json +1 -1
  115. package/lib/init/template/hana/files/mta.yaml.hbs +21 -21
  116. package/lib/init/template/hana/files/package.json.hbs +16 -22
  117. package/lib/init/template/hana/files/values.yaml.hbs +1 -1
  118. package/lib/init/template/hana/index.js +5 -15
  119. package/lib/init/template/helm/files/Chart.yaml.hbs +4 -4
  120. package/lib/init/template/helm/files/values.yaml.hbs +6 -6
  121. package/lib/init/template/helm/index.js +5 -10
  122. package/lib/init/template/helm/subcharts/content-deployment/Chart.yaml +2 -0
  123. package/lib/init/template/helm/subcharts/content-deployment/templates/_helpers.tpl +37 -31
  124. package/lib/init/template/helm/subcharts/content-deployment/templates/job.yaml +13 -14
  125. package/lib/init/template/helm/subcharts/content-deployment/templates/secret.yaml +2 -2
  126. package/lib/init/template/helm/subcharts/content-deployment/templates/service-account.yaml +1 -1
  127. package/lib/init/template/helm/subcharts/content-deployment/templates/service-binding.yaml +3 -3
  128. package/lib/init/template/helm/subcharts/content-deployment/values.md +116 -116
  129. package/lib/init/template/helm/subcharts/service-instance/Chart.yaml +2 -0
  130. package/lib/init/template/helm/subcharts/service-instance/templates/_helpers.tpl +9 -9
  131. package/lib/init/template/helm/subcharts/service-instance/templates/serviceinstance.yaml +2 -2
  132. package/lib/init/template/helm/subcharts/service-instance/values.md +15 -15
  133. package/lib/init/template/helm/subcharts/web-application/Chart.yaml +2 -0
  134. package/lib/init/template/helm/subcharts/web-application/templates/NOTES.txt +15 -0
  135. package/lib/init/template/helm/subcharts/web-application/templates/_helpers.tpl +23 -23
  136. package/lib/init/template/helm/subcharts/web-application/templates/api-rule.yaml +4 -4
  137. package/lib/init/template/helm/subcharts/web-application/templates/deployment.yaml +17 -17
  138. package/lib/init/template/helm/subcharts/web-application/templates/network-policy.yaml +24 -3
  139. package/lib/init/template/helm/subcharts/web-application/templates/pod-disruption-budget.yaml +3 -3
  140. package/lib/init/template/helm/subcharts/web-application/templates/secret.yaml +2 -2
  141. package/lib/init/template/helm/subcharts/web-application/templates/service-account.yaml +1 -1
  142. package/lib/init/template/helm/subcharts/web-application/templates/service-binding.yaml +3 -3
  143. package/lib/init/template/helm/subcharts/web-application/templates/service.yaml +3 -3
  144. package/lib/init/template/helm/subcharts/web-application/values.md +141 -123
  145. package/lib/init/template/helm/subcharts/web-application/values.schema.json +7 -0
  146. package/lib/init/template/helm/subcharts/web-application/values.yaml +1 -0
  147. package/lib/init/template/html5-repo/index.js +4 -5
  148. package/lib/init/template/java/index.js +5 -5
  149. package/lib/init/template/kibana-logging/files/mta.yaml.hbs +5 -5
  150. package/lib/init/template/kibana-logging/files/package.json.hbs +9 -9
  151. package/lib/init/template/kibana-logging/index.js +3 -4
  152. package/lib/init/template/lint/index.js +3 -3
  153. package/lib/init/template/mta/files/mta.yaml.hbs +14 -14
  154. package/lib/init/template/mta/files/package.json +5 -0
  155. package/lib/init/template/mta/index.js +12 -13
  156. package/lib/init/template/mtx/index.js +2 -2
  157. package/lib/init/template/multitenancy/files/mta.yaml.hbs +29 -27
  158. package/lib/init/template/multitenancy/files/package.json.hbs +17 -14
  159. package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +7 -7
  160. package/lib/init/template/multitenancy/files/values.yaml.hbs +19 -19
  161. package/lib/init/template/multitenancy/index.js +14 -16
  162. package/lib/init/template/nodejs/files/package.json.hbs +1 -1
  163. package/lib/init/template/nodejs/index.js +5 -8
  164. package/lib/init/template/redis-messaging/files/mta.yaml.hbs +5 -5
  165. package/lib/init/template/redis-messaging/files/package.json.hbs +9 -9
  166. package/lib/init/template/redis-messaging/index.js +4 -5
  167. package/lib/init/template/sample/files/app/_i18n/i18n.properties +43 -0
  168. package/lib/init/template/sample/files/app/_i18n/i18n_de.properties +14 -0
  169. package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +114 -0
  170. package/lib/init/template/sample/files/app/admin-books/webapp/Component.js +8 -0
  171. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n.properties +11 -0
  172. package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +129 -0
  173. package/lib/init/template/sample/files/app/appconfig/fioriSandboxConfig.json +57 -0
  174. package/lib/init/template/sample/files/app/common.cds +263 -0
  175. package/lib/init/template/sample/files/app/index.html +30 -0
  176. package/lib/init/template/sample/files/app/services.cds +5 -0
  177. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +5 -0
  178. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +6 -0
  179. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books_texts.csv +5 -0
  180. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +16 -0
  181. package/lib/init/template/sample/files/db/schema.cds +31 -0
  182. package/lib/init/template/sample/files/nodejs/admin-service.js +12 -0
  183. package/lib/init/template/sample/files/nodejs/cat-service.js +26 -0
  184. package/lib/init/template/sample/files/srv/admin-service.cds +5 -0
  185. package/lib/init/template/sample/files/srv/cat-service.cds +16 -0
  186. package/lib/init/template/sample/index.js +24 -0
  187. package/lib/init/template/sample-tiny/index.js +39 -0
  188. package/lib/init/template/samples/index.js +5 -56
  189. package/lib/init/template/sqlite/files/package.json.hbs +13 -13
  190. package/lib/init/template/sqlite/index.js +2 -2
  191. package/lib/init/template/templateBase.js +24 -1
  192. package/lib/init/template/toggles/files/package.json.hbs +10 -10
  193. package/lib/init/template/toggles/index.js +3 -3
  194. package/lib/init/template/typer/files/gitignore +1 -0
  195. package/lib/init/template/typer/files/package.json +8 -0
  196. package/lib/init/template/typer/files/xsconfig.json +9 -0
  197. package/lib/init/template/typer/index.js +36 -0
  198. package/lib/init/template/xsuaa/files/mta.yaml.hbs +12 -12
  199. package/lib/init/template/xsuaa/files/package.json.hbs +13 -13
  200. package/lib/init/template/xsuaa/files/values.yaml.hbs +8 -8
  201. package/lib/init/template/xsuaa/index.js +8 -19
  202. package/lib/init/util/merge.js +73 -59
  203. package/lib/init/util/mvn.js +21 -17
  204. package/lib/init/util/projectReader.js +49 -87
  205. package/lib/init/util/xml.js +14 -23
  206. package/lib/util/cfUtil.js +366 -0
  207. package/lib/util/command.js +3 -3
  208. package/lib/util/gitUtil.js +55 -0
  209. package/lib/util/version.js +27 -0
  210. package/npm-shrinkwrap.json +339 -277
  211. package/package.json +6 -6
  212. package/CHANGELOG.md +0 -1453
  213. package/bin/build/all.js +0 -88
  214. package/bin/build/index.js +0 -82
  215. package/lib/compile/index.js +0 -14
  216. /package/lib/init/template/{samples → sample-tiny}/files/nodejs/db/data/my.bookshop-Books.csv +0 -0
  217. /package/lib/init/template/{samples → sample-tiny}/files/nodejs/db/data-model.cds +0 -0
  218. /package/lib/init/template/{samples → sample-tiny}/files/nodejs/srv/cat-service.cds.hbs +0 -0
@@ -668,6 +668,13 @@
668
668
  "allowNamespaceInternal": {
669
669
  "type": "boolean"
670
670
  },
671
+ "additionalPorts": {
672
+ "type": "array",
673
+ "default": [],
674
+ "items": {
675
+ "type": "integer"
676
+ }
677
+ },
671
678
  "ingress": {
672
679
  "type": "array",
673
680
  "default": [],
@@ -106,6 +106,7 @@ expose:
106
106
  networkSecurity:
107
107
  enabled: true
108
108
  # allowNamespaceInternal: true
109
+ additionalPorts: []
109
110
  ingress: []
110
111
  # - namespace: my-namespace
111
112
  # podLabelsSelector:
@@ -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 { OPTION_DESTINATIONS } = require('../../constants')
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 [OPTION_DESTINATIONS]
12
+ return [DESTINATION]
13
13
  }
14
14
 
15
15
  async canRun() {
16
16
  const projectDescriptor = await readProject(this.options)
17
- const { hasMta, hasHelm } = projectDescriptor.cap
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 projectDescriptor = await readProject(this.options)
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, OPTION_JAVA, OPTION_NODEJS } = require('../../constants');
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(OPTION_NODEJS)) {
26
- throw new Error(`Only one runtime per project is supported. Specify either ${OPTION_JAVA} or ${OPTION_NODEJS}.`);
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 fs.rm(tempFolder, { force: true, recursive: true });
51
+ await rimraf(tempFolder);
52
52
  }
53
53
  }
54
54
 
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  modules:
3
- - name: {{cap.appName}}-srv
4
- type: {{cap.language}}
5
- path: {{& cap.srvPath}}
3
+ - name: {{appName}}-srv
4
+ type: {{language}}
5
+ path: {{& srvPath}}
6
6
  requires:
7
- - name: {{cap.appName}}-cf-logging
7
+ - name: {{appName}}-cf-logging
8
8
 
9
9
  resources:
10
- - name: {{cap.appName}}-cf-logging
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
- {{#cap.isNodejs}}
2
+ {{#isNodejs}}
3
3
  "cds": {
4
- {{/cap.isNodejs}}
4
+ {{/isNodejs}}
5
5
  "features": {
6
- {{#cap.for}}
7
- "[{{cap.for}}]": {
8
- {{/cap.for}}
6
+ {{#profile}}
7
+ "[{{profile}}]": {
8
+ {{/profile}}
9
9
  "kibana_formatter": true
10
- {{#cap.for}}
10
+ {{#profile}}
11
11
  }
12
- {{/cap.for}}
12
+ {{/profile}}
13
13
  }
14
- {{#cap.isNodejs}}
14
+ {{#isNodejs}}
15
15
  }
16
- {{/cap.isNodejs}}
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 projectDescriptor = await readProject(this.options)
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.cap
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.cap
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 { OPTION_LINT_DEV, OPTION_LINT_GLOBAL } = require("../../constants");
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(OPTION_LINT_DEV)) {
38
+ if (this.options.lint.has(LINT_DEV)) {
39
39
  this.customRuleExample = true;
40
40
  }
41
- if (this.options.lint.has(OPTION_LINT_GLOBAL)) {
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: {{cap.appId}}
4
- version: {{cap.appVersion}}
5
- description: "{{cap.appDescription}}"
3
+ ID: {{appId}}
4
+ version: {{appVersion}}
5
+ description: "{{appDescription}}"
6
6
  parameters:
7
7
  enable-parallel-deployments: true
8
- {{#cap.isNodejs}}
8
+ {{#isNodejs}}
9
9
  build-parameters:
10
10
  before-all:
11
11
  - builder: custom
12
12
  commands:
13
- - npx -p @sap/cds-dk cds build --production
14
- {{/cap.isNodejs}}
13
+ - npx cds build --production
14
+ {{/isNodejs}}
15
15
  modules:
16
- - name: {{cap.appName}}-srv
17
- type: {{cap.language}}
18
- path: {{& cap.srvPath}}
19
- {{#cap.isNodejs}}
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-ci
24
- {{/cap.isNodejs}}
25
- {{#cap.isJava}}
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
- {{/cap.isJava}}
37
+ {{/isJava}}
38
38
  provides:
39
39
  - name: srv-api # required by consumers of CAP services (e.g. approuter)
40
40
  properties:
@@ -0,0 +1,5 @@
1
+ {
2
+ "devDependencies": {
3
+ "@sap/cds-dk": "^7"
4
+ }
5
+ }
@@ -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 { copyFiles } = require('../../util/template')
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 projectDescriptor = await readProject()
20
+ const project = await readProject(this.options)
16
21
  if (!exists('mta.yaml')) {
17
- await copyFiles(join(__dirname, 'files'), cds.root, projectDescriptor);
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 { OPTION_MULTITENANCY, OPTION_TOGGLES, OPTION_EXTENSIBILITY } = require('../../constants')
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 [OPTION_MULTITENANCY, OPTION_TOGGLES, OPTION_EXTENSIBILITY]
6
+ return [MULTITENANCY, TOGGLES, EXTENSIBILITY]
7
7
  }
8
8
  }
@@ -1,35 +1,37 @@
1
1
  ---
2
2
  modules:
3
- - name: {{cap.appName}}-srv
4
- type: {{cap.language}}
5
- path: {{& cap.srvPath}}
3
+ - name: {{appName}}-srv
4
+ type: {{language}}
5
+ path: {{& srvPath}}
6
6
  requires:
7
- - name: {{cap.appName}}-registry
8
- {{#cap.isJava}}
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
- {{/cap.isJava}}
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: {{cap.appName}}-mtx
19
+ - name: {{appName}}-mtx
20
20
  type: nodejs
21
- path: {{#cap.isNodejs}}gen/{{/cap.isNodejs}}mtx/sidecar
22
- {{#cap.isNodejs}}
21
+ path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
22
+ {{#isNodejs}}
23
23
  build-parameters:
24
24
  builder: npm-ci
25
- {{/cap.isNodejs}}
26
- {{#cap.isJava}}
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
- {{/cap.isJava}}
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
- {{#cap.hasXsuaa}}
42
+ {{#hasXsuaa}}
41
43
  requires:
42
- - name: {{cap.appName}}-auth
43
- {{/cap.hasXsuaa}}
44
+ - name: {{appName}}-auth
45
+ {{/hasXsuaa}}
44
46
 
45
47
  resources:
46
- - name: {{cap.appName}}-registry
48
+ - name: {{appName}}-registry
47
49
  type: org.cloudfoundry.managed-service
48
50
  requires:
49
- {{#cap.isNodejs}}
51
+ {{#isNodejs}}
50
52
  - name: mtx-api
51
- {{/cap.isNodejs}}
52
- {{#cap.isJava}}
53
+ {{/isNodejs}}
54
+ {{#isJava}}
53
55
  - name: srv-api
54
- {{/cap.isJava}}
56
+ {{/isJava}}
55
57
  parameters:
56
58
  service: saas-registry
57
59
  service-plan: application
58
60
  config:
59
- xsappname: {{cap.appName}}-${org}-${space}
60
- appName: {{cap.appName}}-${org}-${space}
61
- displayName: {{cap.appName}}
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
- {{#cap.isNodejs}}
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
- {{/cap.isNodejs}}
69
- {{#cap.isJava}}
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
- {{/cap.isJava}}
74
+ {{/isJava}}
73
75
  onSubscriptionAsync: true
74
76
  onUnSubscriptionAsync: true
75
77
  onUpdateDependenciesAsync: true
@@ -1,29 +1,32 @@
1
1
  {
2
- {{#cap.isNodejs}}
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
- {{/cap.isNodejs}}
8
- {{#cap.isJava}}
10
+ {{/isNodejs}}
11
+ {{#isJava}}
9
12
  "profiles": ["with-mtx-sidecar", "java"],
10
13
  "build": {
11
14
  "target": "."
12
15
  },
13
- {{/cap.isJava}}
14
- {{#cap.isNodejs}}
16
+ {{/isJava}}
17
+ {{#isNodejs}}
15
18
  "profile": "with-mtx-sidecar",
16
- {{/cap.isNodejs}}
19
+ {{/isNodejs}}
17
20
  "requires": {
18
- {{#cap.for}}
19
- "[{{cap.for}}]": {
20
- {{/cap.for}}
21
+ {{#profile}}
22
+ "[{{profile}}]": {
23
+ {{/profile}}
21
24
  "multitenancy": true
22
- {{#cap.for}}
25
+ {{#profile}}
23
26
  }
24
- {{/cap.for}}
27
+ {{/profile}}
25
28
  }
26
- {{#cap.isNodejs}}
29
+ {{#isNodejs}}
27
30
  }
28
- {{/cap.isNodejs}}
31
+ {{/isNodejs}}
29
32
  }
@@ -1,19 +1,19 @@
1
1
  {
2
- "name": "{{cap.appName}}-mtx",
2
+ "name": "{{appName}}-mtx",
3
3
  "dependencies": {
4
- "@sap/cds": "^6",
5
- "@sap/cds-mtxs": "^1",
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
- "hdb": "^0",
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"{{#cap.isJava}},
16
- "build": "npm ci && npx -p @sap/cds-dk@^6 cds build ../.. --for mtx-sidecar --production && cd gen && npm ci"{{/cap.isJava}}
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
- {{#cap.isJava}}
4
+ {{#isJava}}
5
5
  saas-registry:
6
6
  serviceInstanceName: saas-registry
7
- {{/cap.isJava}}
7
+ {{/isJava}}
8
8
  service-manager:
9
9
  serviceInstanceName: service-manager
10
- {{#cap.hasXsuaa}}
10
+ {{#hasXsuaa}}
11
11
  xsuaa:
12
12
  parameters:
13
13
  tenant-mode: shared
14
- {{/cap.hasXsuaa}}
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: {{cap.appName}}
23
- appName: {{cap.appName}}
24
- displayName: {{cap.appName}}
25
- description: {{cap.appDescription}}
22
+ xsappname: {{appName}}
23
+ appName: {{appName}}
24
+ displayName: {{appName}}
25
+ description: {{appDescription}}
26
26
  category: "CAP Application"
27
- {{#cap.isNodejs}}
27
+ {{#isNodejs}}
28
28
  bindSidecar: true
29
- {{/cap.isNodejs}}
29
+ {{/isNodejs}}
30
30
  appUrls:
31
- {{#cap.isNodejs}}
31
+ {{#isNodejs}}
32
32
  getDependencies: "/-/cds/saas-provisioning/dependencies"
33
33
  onSubscription: "/-/cds/saas-provisioning/tenant/{tenantId}"
34
- {{/cap.isNodejs}}
35
- {{#cap.isJava}}
34
+ {{/isNodejs}}
35
+ {{#isJava}}
36
36
  getDependencies: "/mt/v1.0/subscriptions/dependencies"
37
37
  onSubscription: "/mt/v1.0/subscriptions/tenants/{tenantId}"
38
- {{/cap.isJava}}
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
- {{#cap.hasXsuaa}}
45
+ {{#hasXsuaa}}
46
46
  auth:
47
47
  serviceInstanceName: xsuaa
48
- {{/cap.hasXsuaa}}
49
- {{#cap.isNodejs}}
48
+ {{/hasXsuaa}}
49
+ {{#isNodejs}}
50
50
  saas-registry:
51
51
  serviceInstanceName: saas-registry
52
- {{/cap.isNodejs}}
52
+ {{/isNodejs}}
53
53
  service-manager:
54
54
  serviceInstanceName: service-manager
55
55
  image:
56
- repository: <your-container-registry>/{{cap.appName}}-sidecar
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, sortDependencies } = require('../../util/merge')
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.cap
30
+ const { isNodejs, configFile } = projectDescriptor
27
31
  await mergeJSON(configFile, join(__dirname, 'files', `package.json.hbs`), projectDescriptor)
28
- if (isNodejs) await sortDependencies('package.json')
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, hasApprouter, hasXsuaa, hasHana, srvPath } = projectDescriptor.cap
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',
@@ -6,7 +6,7 @@
6
6
  "license": "UNLICENSED",
7
7
  "private": true,
8
8
  "dependencies": {
9
- "@sap/cds": "^6",
9
+ "@sap/cds": "^7",
10
10
  "express": "^4"
11
11
  },
12
12
  "devDependencies": {