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