@sap/cds-dk 9.4.3 → 9.6.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 (168) hide show
  1. package/CHANGELOG.md +115 -0
  2. package/bin/compile/index.js +1 -1
  3. package/bin/env.js +3 -3
  4. package/bin/export.js +1 -1
  5. package/bin/help.js +0 -1
  6. package/bin/import.js +8 -3
  7. package/bin/repl.js +7 -11
  8. package/bin/up.js +159 -23
  9. package/bin/util/containerize.js +79 -25
  10. package/bin/version.js +4 -4
  11. package/lib/bind/k8s.js +1 -1
  12. package/lib/build/plugins/helm/files/templates/_deployment_helpers.tpl +1 -1
  13. package/lib/build/plugins/helm/index.js +1 -1
  14. package/lib/build/provider/hana/2migration.js +16 -24
  15. package/lib/build/provider/hana/index.js +1 -1
  16. package/lib/build/provider/hana/template/.hdiconfig-all +7 -1
  17. package/lib/build/provider/hana/template/package.json +1 -1
  18. package/lib/build/provider/internalBuildPlugin.js +15 -1
  19. package/lib/build/provider/java/index.js +12 -1
  20. package/lib/build/provider/mtx-sidecar/index.js +2 -1
  21. package/lib/build/provider/nodejs/index.js +2 -1
  22. package/lib/build/util.js +36 -19
  23. package/lib/compile/to_openapi.js +1 -5
  24. package/lib/import/common.js +9 -2
  25. package/lib/import/odata/ParserContext.js +1 -0
  26. package/lib/import/odata/v4parser.js +57 -25
  27. package/lib/import/openapi/importOpenAPI.js +6 -1
  28. package/lib/init/constants.js +1 -1
  29. package/lib/init/index.js +20 -6
  30. package/lib/init/merge.js +16 -0
  31. package/lib/init/projectReader.js +34 -8
  32. package/lib/init/registries/mta.js +2 -2
  33. package/lib/init/template/ams/index.js +3 -3
  34. package/lib/init/template/app-frontend/files/app-package.json.hbs +1 -7
  35. package/lib/init/template/app-frontend/files/ui5.yaml.hbs +21 -1
  36. package/lib/init/template/app-frontend/index.js +2 -6
  37. package/lib/init/template/application-logging/index.js +11 -16
  38. package/lib/init/template/approuter/files/mta.yaml.hbs +0 -2
  39. package/lib/init/template/approuter/index.js +13 -10
  40. package/lib/init/template/attachments/index.js +4 -2
  41. package/lib/init/template/audit-logging/index.js +4 -2
  42. package/lib/init/template/cloud-logging/index.js +6 -5
  43. package/lib/init/template/connectivity/index.js +2 -2
  44. package/lib/init/template/console/files/package.json +5 -0
  45. package/lib/init/template/console/index.js +25 -0
  46. package/lib/init/template/containerize/index.js +4 -6
  47. package/lib/init/template/data/as-json.js +18 -20
  48. package/lib/init/template/destination/index.js +4 -2
  49. package/lib/init/template/dynatrace/files/package.json.hbs +2 -2
  50. package/lib/init/template/dynatrace/index.js +4 -4
  51. package/lib/init/template/enterprise-messaging/files/mta.yaml.hbs +3 -1
  52. package/lib/init/template/enterprise-messaging/index.js +4 -2
  53. package/lib/init/template/enterprise-messaging-shared/index.js +4 -2
  54. package/lib/init/template/github-actions/files/workflows/cf.yaml.hbs +16 -1
  55. package/lib/init/template/github-actions/files/workflows/release.yaml.hbs +2 -2
  56. package/lib/init/template/github-actions/files/workflows/test.yaml.hbs +20 -0
  57. package/lib/init/template/github-actions/index.js +7 -10
  58. package/lib/init/template/hana/files/db/package.json +2 -2
  59. package/lib/init/template/hana/files/mta.yaml.hbs +0 -4
  60. package/lib/init/template/hana/index.js +7 -9
  61. package/lib/init/template/helm/index.js +8 -10
  62. package/lib/init/template/helm-unified-runtime/index.js +1 -4
  63. package/lib/init/template/html5-repo/files/app-package.json.hbs +1 -7
  64. package/lib/init/template/html5-repo/files/ui5.yaml.hbs +21 -1
  65. package/lib/init/template/html5-repo/index.js +14 -18
  66. package/lib/init/template/ias/files/values.yaml.hbs +6 -6
  67. package/lib/init/template/ias/index.js +13 -21
  68. package/lib/init/template/java/index.js +14 -0
  69. package/lib/init/template/kafka/index.js +4 -2
  70. package/lib/init/template/{containerize → kyma}/files/containerize.yaml.hbs +17 -2
  71. package/lib/init/template/kyma/index.js +129 -5
  72. package/lib/init/template/malware-scanner/files/mta.yaml.hbs +3 -1
  73. package/lib/init/template/malware-scanner/files/values.yaml +3 -1
  74. package/lib/init/template/malware-scanner/index.js +4 -2
  75. package/lib/init/template/multitenancy/files/mta.yaml.hbs +1 -3
  76. package/lib/init/template/multitenancy/files/values.yaml.hbs +8 -0
  77. package/lib/init/template/multitenancy/index.js +15 -7
  78. package/lib/init/template/nodejs/files/.vscode/extensions.json +0 -3
  79. package/lib/init/template/nodejs/files/package.json.hbs +1 -1
  80. package/lib/init/template/pipeline/files/app-package.json.hbs +1 -7
  81. package/lib/init/template/pipeline/files/ui5.yaml.hbs +21 -1
  82. package/lib/init/template/pipeline/index.js +1 -2
  83. package/lib/init/template/portal/files/mta.yaml.hbs +5 -3
  84. package/lib/init/template/portal/index.js +8 -8
  85. package/lib/init/template/postgres/index.js +2 -2
  86. package/lib/init/template/redis/index.js +2 -3
  87. package/lib/init/template/redis-messaging/index.js +2 -3
  88. package/lib/init/template/sample/files/_i18n/i18n_de.properties +21 -0
  89. package/lib/init/template/sample/files/_i18n/i18n_en.properties +21 -0
  90. package/lib/init/template/sample/files/_i18n/i18n_fr.properties +21 -0
  91. package/lib/init/template/sample/files/_i18n/messages_de.properties +34 -0
  92. package/lib/init/template/sample/files/_i18n/messages_en.properties +34 -0
  93. package/lib/init/template/sample/files/_i18n/messages_fr.properties +34 -0
  94. package/lib/init/template/sample/files/app/_i18n/i18n.properties +13 -25
  95. package/lib/init/template/sample/files/app/_i18n/i18n_de.properties +13 -25
  96. package/lib/init/template/sample/files/app/admin-authors/fiori-service.cds +52 -0
  97. package/lib/init/template/sample/files/app/admin-authors/webapp/Component.js.hbs +3 -0
  98. package/lib/init/template/sample/files/app/admin-authors/webapp/i18n/i18n.properties +3 -0
  99. package/lib/init/template/sample/files/app/admin-authors/webapp/i18n/i18n_de.properties +3 -0
  100. package/lib/init/template/sample/files/app/admin-authors/webapp/i18n/i18n_en.properties +3 -0
  101. package/lib/init/template/sample/files/app/admin-authors/webapp/manifest.json +130 -0
  102. package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +81 -88
  103. package/lib/init/template/sample/files/app/admin-books/webapp/Component.js.hbs +3 -0
  104. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n.properties +3 -3
  105. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_de.properties +3 -3
  106. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_en.properties +3 -3
  107. package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +24 -48
  108. package/lib/init/template/sample/files/app/appconfig/fioriSandboxConfig.json +56 -5
  109. package/lib/init/template/sample/files/app/browse/fiori-service.cds +30 -30
  110. package/lib/init/template/sample/files/app/browse/webapp/Component.js.hbs +3 -0
  111. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n.properties +3 -4
  112. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_de.properties +3 -3
  113. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_en.properties +3 -4
  114. package/lib/init/template/sample/files/app/browse/webapp/manifest.json +19 -24
  115. package/lib/init/template/sample/files/app/common.cds +127 -158
  116. package/lib/init/template/sample/files/app/fiori-apps.html +50 -0
  117. package/lib/init/template/sample/files/app/genres/fiori-service.cds +33 -0
  118. package/lib/init/template/sample/files/app/genres/tree-view.cds +42 -0
  119. package/lib/init/template/sample/files/app/genres/value-help.cds +6 -0
  120. package/lib/init/template/sample/files/app/genres/webapp/Component.js.hbs +3 -0
  121. package/lib/init/template/sample/files/app/genres/webapp/i18n/i18n.properties +3 -0
  122. package/lib/init/template/sample/files/app/genres/webapp/i18n/i18n_de.properties +3 -0
  123. package/lib/init/template/sample/files/app/genres/webapp/i18n/i18n_en.properties +3 -0
  124. package/lib/init/template/sample/files/app/genres/webapp/manifest.json +126 -0
  125. package/lib/init/template/sample/files/app/services.cds +6 -2
  126. package/lib/init/template/sample/files/db/currencies.cds +13 -0
  127. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +5 -5
  128. package/lib/init/template/sample/files/db/data/{sap.capire.bookshop-Books_texts.csv → sap.capire.bookshop-Books.texts.csv} +4 -4
  129. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +42 -15
  130. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.texts.csv +43 -0
  131. package/lib/init/template/sample/files/db/data/sap.common-Currencies.csv +12 -0
  132. package/lib/init/template/sample/files/db/data/sap.common-Currencies.texts.csv +15 -0
  133. package/lib/init/template/sample/files/db/hana/index.cds +10 -0
  134. package/lib/init/template/sample/files/db/schema.cds +35 -22
  135. package/lib/init/template/sample/files/db/sqlite/index.cds +10 -0
  136. package/lib/init/template/sample/files/package.json.hbs +14 -1
  137. package/lib/init/template/sample/files/srv/access-control.cds +3 -0
  138. package/lib/init/template/sample/files/srv/admin-service.cds +3 -2
  139. package/lib/init/template/sample/files/srv/cat-service.cds +7 -11
  140. package/lib/init/template/sample/index.js +40 -18
  141. package/lib/init/template/sqlite/files/package.json.hbs +13 -0
  142. package/lib/init/template/sqlite/index.js +1 -1
  143. package/lib/init/template/telemetry/index.js +1 -3
  144. package/lib/init/template/typescript/files/package.json +1 -1
  145. package/lib/init/template/workzone-standard/files/mta.yaml.hbs +0 -5
  146. package/lib/init/template/workzone-standard/index.js +0 -1
  147. package/lib/init/template/xsuaa/files/mta.yaml.hbs +4 -0
  148. package/lib/init/template/xsuaa/index.js +7 -6
  149. package/lib/lint/Linter.js +10 -4
  150. package/lib/lint/eslintHelp.json +1 -1
  151. package/lib/mtx/tenant_action.js +12 -4
  152. package/lib/util/checksum.js +41 -0
  153. package/lib/util/fs.js +8 -1
  154. package/lib/util/glob.js +26 -13
  155. package/lib/util/question.js +60 -7
  156. package/npm-shrinkwrap.json +141 -118
  157. package/package.json +2 -2
  158. package/lib/init/template/app-frontend/files/ui5-deploy.yaml.hbs +0 -25
  159. package/lib/init/template/github-actions/files/cf-setup/action.yaml +0 -53
  160. package/lib/init/template/html5-repo/files/ui5-deploy.yaml.hbs +0 -25
  161. package/lib/init/template/pipeline/files/ui5-deploy.yaml.hbs +0 -25
  162. package/lib/init/template/sample/files/app/admin-books/webapp/Component.js +0 -8
  163. package/lib/init/template/sample/files/app/browse/webapp/Component.js +0 -7
  164. package/lib/init/template/sample/files/app/index.html +0 -32
  165. package/lib/init/template/sqlite/files/package.json +0 -5
  166. /package/lib/init/template/{helm → kyma}/files/Chart.yaml.hbs +0 -0
  167. /package/lib/init/template/{helm → kyma}/files/values.schema.json +0 -0
  168. /package/lib/init/template/{helm → kyma}/files/values.yaml.hbs +0 -0
@@ -3,18 +3,12 @@
3
3
  "version": "1.0.0",
4
4
  "main": "webapp/index.html",
5
5
  "scripts": {
6
- "build": "ui5 build preload --clean-dest --config ui5-deploy.yaml",
7
- "build-local": "ui5 build preload --clean-dest",
6
+ "build": "ui5 build preload --clean-dest",
8
7
  "start": "ui5 serve"
9
8
  },
10
9
  "devDependencies": {
11
10
  "@ui5/cli": "^4",
12
11
  "ui5-task-zipper": "^3"
13
- },
14
- "ui5": {
15
- "dependencies": [
16
- "ui5-task-zipper"
17
- ]
18
12
  }
19
13
  {{/hasUI5}}
20
14
  }
@@ -1,6 +1,26 @@
1
1
  ---
2
2
  # yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json
3
- specVersion: '3.1'
3
+ specVersion: '4.0'
4
4
  metadata:
5
5
  name: {{app}}
6
6
  type: application
7
+ resources:
8
+ configuration:
9
+ propertiesFileSourceEncoding: UTF-8
10
+ builder:
11
+ resources:
12
+ excludes:
13
+ - "/test/**"
14
+ - "/localService/**"
15
+ customTasks:
16
+ - name: ui5-task-zipper
17
+ afterTask: generateVersionInfo
18
+ configuration:
19
+ archiveName: {{app}}
20
+ relativePaths: true
21
+ additionalFiles:
22
+ - xs-app.json
23
+ {{#isTypescript}}
24
+ - name: ui5-tooling-transpile-task
25
+ afterTask: replaceVersion
26
+ {{/isTypescript}}
@@ -9,8 +9,8 @@ const { renderAndCopy } = require('../../template')
9
9
  module.exports = class Html5RepoTemplate extends require('../../plugin') {
10
10
 
11
11
  requires() {
12
- const { hasHelm, hasHelmUnifiedRuntime } = readProject()
13
- if (hasHelm || hasHelmUnifiedRuntime) return ['destination']
12
+ const { hasKyma } = readProject()
13
+ if (hasKyma) return ['destination']
14
14
  }
15
15
 
16
16
  static help() {
@@ -37,8 +37,8 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
37
37
  const project = readProject()
38
38
  const {
39
39
  isJava, srvPath, appPath, apps,
40
- hasApprouter, addApprouter, addContainerize, addMultitenancy, addWorkzoneStandard,
41
- addSample, hasMta, addMta, hasXsuaa, hasMultitenancy, hasWorkzoneStandard, addHelm, addHelmUnifiedRuntime, hasUI5
40
+ hasApprouter, addApprouter, addContainerize, addKyma, addHelm, addHelmUnifiedRuntime, addMultitenancy, addWorkzoneStandard, addXsuaa,
41
+ addSample, hasMta, addMta, hasXsuaa, hasMultitenancy, hasUI5
42
42
  } = project
43
43
 
44
44
  await Promise.all(apps.map(async ({ app }) => {
@@ -59,17 +59,13 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
59
59
  project.app = app
60
60
  await merge(__dirname, 'files/ui5.yaml.hbs').into(join(appPath, app, 'ui5.yaml'), { project })
61
61
  }
62
- for (const { app } of apps) {
63
- project.app = app
64
- await merge(__dirname, 'files/ui5-deploy.yaml.hbs').into(join(appPath, app, 'ui5-deploy.yaml'), { project })
65
- }
66
62
  }
67
63
 
68
64
  if (addMultitenancy) {
69
65
  await merge({ cds: { requires: { 'html5-repo': true } } }).into('mtx/sidecar/package.json')
70
66
  }
71
67
 
72
- if (addMta || (addApprouter || addWorkzoneStandard || addMultitenancy || addSample) && hasMta) {
68
+ if (addMta || (addXsuaa || addApprouter || addWorkzoneStandard || addMultitenancy || addSample) && hasMta) {
73
69
  const srv = srv4(srvPath)
74
70
  project.apps = apps
75
71
  const relationships = [{
@@ -79,18 +75,12 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
79
75
  const appModules = []
80
76
  for (const { app } of project.apps) {
81
77
  const html5App = { in: 'modules', where: { type: 'html5', path: `${appPath}${app}` } }
82
- appModules.push(html5App)
83
78
  relationships.push({
84
79
  insert: [html5App],
85
80
  into: [appDeployer, 'build-parameters.requires'],
86
81
  })
87
82
  }
88
- const additions = [srv, appDeployer, html5RepoHost, ...appModules]
89
- if (hasApprouter || hasWorkzoneStandard || hasMultitenancy) {
90
- additions.push(html5Runtime)
91
- }
92
83
  if (hasApprouter) {
93
- additions.push(approuter)
94
84
  relationships.push({
95
85
  insert: [html5Runtime, 'name'],
96
86
  into: [approuter, 'requires', 'name'],
@@ -101,6 +91,10 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
101
91
  insert: [html5Runtime, 'name'],
102
92
  into: [isJava ? srv : mtxSidecar4('gen/mtx/sidecar'), 'requires', 'name']
103
93
  })
94
+ relationships.push({
95
+ insert: [html5RepoHost, 'name'],
96
+ into: [isJava ? srv : mtxSidecar4('gen/mtx/sidecar'), 'requires', 'name']
97
+ })
104
98
  }
105
99
  if (hasXsuaa) {
106
100
  relationships.push({
@@ -110,12 +104,14 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
110
104
  }
111
105
  await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
112
106
  with: project,
113
- additions,
107
+ additions: [srv, appDeployer, html5RepoHost, ...appModules],
114
108
  relationships
115
109
  })
116
110
  }
117
111
 
118
- if (addContainerize) {
112
+ // cds10
113
+ // needed because of adding kyma to cli options in case of helm
114
+ if (addContainerize || (addKyma && !addHelm && !addHelmUnifiedRuntime)) {
119
115
  const additions = [{
120
116
  in: 'modules',
121
117
  where: { name: `${project.appName}-html5-deployer` }
@@ -123,7 +119,7 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
123
119
  await merge(__dirname, '/files/containerize.yaml.hbs').into('containerize.yaml', { with: project, additions })
124
120
  }
125
121
 
126
- if (addHelm || addHelmUnifiedRuntime) {
122
+ if (addKyma) {
127
123
  await renderAndCopy(join(__dirname, 'files/html5-deployer.package.json.hbs'), 'app/html5-deployer/package.json', project)
128
124
  await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
129
125
  }
@@ -1,7 +1,7 @@
1
1
  {{#hasMultitenancy}}
2
2
  sidecar:
3
3
  expose:
4
- gateway: default/kyma-mtls-gateway
4
+ gateway: {{#literal}}"{{ .Release.Namespace }}/kyma-mtls-gateway"{{/literal}}
5
5
  host: {{#literal}}"{{ .Release.Name }}-sidecar-{{ .Release.Namespace }}.cert"{{/literal}}
6
6
  bindings:
7
7
  auth:
@@ -13,18 +13,18 @@ sidecar:
13
13
  {{#hasApprouter}}
14
14
  approuter:
15
15
  expose:
16
- gateway: default/kyma-mtls-gateway
16
+ gateway: {{#literal}}"{{ .Release.Namespace }}/kyma-mtls-gateway"{{/literal}}
17
17
  host: {{#literal}}"{{ .Release.Name }}-approuter-{{ .Release.Namespace }}.cert"{{/literal}}
18
18
  bindings:
19
19
  auth:
20
20
  serviceInstanceName: identity
21
- parameters:
22
- credential-type: X509_GENERATED
23
- app-identifier: approuter
21
+ parameters:
22
+ credential-type: X509_GENERATED
23
+ app-identifier: approuter
24
24
  {{/hasApprouter}}
25
25
  srv:
26
26
  expose:
27
- gateway: default/kyma-mtls-gateway
27
+ gateway: {{#literal}}"{{ .Release.Namespace }}/kyma-mtls-gateway"{{/literal}}
28
28
  host: {{#literal}}"{{ .Release.Name }}-srv-{{ .Release.Namespace }}.cert"{{/literal}}
29
29
  bindings:
30
30
  auth:
@@ -1,8 +1,7 @@
1
1
  const { readProject } = require('../../projectReader')
2
2
  const { merge, sort } = require('../../merge')
3
3
  const { srv4, approuter, ias, mtxSidecar4 } = require('../../registries/mta')
4
- const cds = require('../../../cds')
5
- const { exists, read } = cds.utils
4
+ const { exists, read } = require('../../../cds').utils
6
5
 
7
6
  module.exports = class IasTemplate extends require('../../plugin') {
8
7
 
@@ -11,10 +10,7 @@ module.exports = class IasTemplate extends require('../../plugin') {
11
10
  }
12
11
 
13
12
  static hasInProduction(env) {
14
- // REVISIT: Ugly, find more generic solution
15
- return env.requires?.auth?.kind === 'ias' ||
16
- cds.cli.argv?.[0]?.includes('ias') || cds.cli.argv?.[0]?.includes('ams') ||
17
- cds.cli.options?.add?.has('ias') || cds.cli.options?.add?.has('ams') || false
13
+ return env.requires?.auth?.kind === 'ias'
18
14
  }
19
15
 
20
16
  async run() {
@@ -28,7 +24,7 @@ module.exports = class IasTemplate extends require('../../plugin') {
28
24
 
29
25
  async combine() {
30
26
  const project = readProject()
31
- const { isJava, addMta, hasMta, addCfManifest, addHelm, addHelmUnifiedRuntime, addApprouter, addMultitenancy, srvPath } = project
27
+ const { isJava, addMta, hasMta, addCfManifest, addKyma, addMultitenancy, hasApprouter, hasMultitenancy, srvPath } = project
32
28
 
33
29
  if (addMultitenancy) {
34
30
  const conf = exists('mtx/sidecar/package.json') ? await read('mtx/sidecar/package.json') : {}
@@ -43,14 +39,14 @@ module.exports = class IasTemplate extends require('../../plugin') {
43
39
  await merge(__dirname, 'files/sidecar.package.json.hbs').into('mtx/sidecar/package.json')
44
40
  }
45
41
 
46
- if (addMta || (addApprouter || addMultitenancy) && hasMta) {
42
+ if (addMta || (hasApprouter || hasMultitenancy) && hasMta) {
47
43
  const srv = srv4(srvPath)
48
44
  const srvIdentityBinding = { in: [srv, 'requires'], where: { 'parameters.config.app-identifier': 'srv' } }
49
45
  const srvCertUrlApi = { in: [srv, 'provides'], where: { 'name': 'srv-api' } }
50
46
  const additions = [srv, ias, srvIdentityBinding, srvCertUrlApi]
51
47
  const overwrites = []
52
48
 
53
- if (addApprouter) {
49
+ if (hasApprouter) {
54
50
  additions.push(approuter)
55
51
  additions.push({ in: [approuter, 'requires'], where: { 'parameters.config.app-identifier': 'approuter' }})
56
52
  const approuterSrvApi = { in: [approuter, 'requires'], where: { 'name': 'srv-api' } }
@@ -59,7 +55,7 @@ module.exports = class IasTemplate extends require('../../plugin') {
59
55
  overwrites.push({ item: [approuterSrvApi, 'properties.forwardAuthCertificates'], withValue: true })
60
56
  overwrites.push({ item: [approuterSrvApi, 'properties.strictSSL'], withValue: true })
61
57
  }
62
- if (addMultitenancy) {
58
+ if (hasMultitenancy) {
63
59
  const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
64
60
  const mtxIdentityBinding = { in: [mtxSidecar, 'requires'], where: { 'parameters.config.app-identifier': 'mtx' } }
65
61
  additions.push(mtxSidecar, mtxIdentityBinding)
@@ -67,23 +63,19 @@ module.exports = class IasTemplate extends require('../../plugin') {
67
63
  await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { project, additions, overwrites })
68
64
  }
69
65
 
70
- if (addHelm || addHelmUnifiedRuntime) {
66
+ if (addKyma) {
71
67
  const identity = { in: 'dependencies', where: { 'alias': 'identity' } }
72
68
  await merge(__dirname, 'files/Chart.yaml.hbs').into('chart/Chart.yaml', { project, additions: [identity] })
73
69
  await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { project })
74
70
  }
75
71
 
76
72
  if (addCfManifest) {
77
- await this.#combineWithCfManifest(project) // REVISIT: we shouldn't overly promote cf-manifest
78
- }
79
- }
73
+ const srv = { in: 'applications', where: { 'name': `${project.appName}-srv` } }
74
+ const identityBinding = { in: 'services', where: { 'parameters.app-identifier': 'srv' } }
75
+ await merge(__dirname, 'files/manifest.yml.hbs').into('manifest.yml', { project, additions: [srv, identityBinding] })
80
76
 
81
- async #combineWithCfManifest(project) {
82
- const srv = { in: 'applications', where: { 'name': `${project.appName}-srv` } }
83
- const identityBinding = { in: 'services', where: { 'parameters.app-identifier': 'srv' } }
84
- await merge(__dirname, 'files/manifest.yml.hbs').into('manifest.yml', { project, additions: [srv, identityBinding] })
85
-
86
- const identity = { in: 'create-services', where: { 'broker': 'identity' } }
87
- await merge(__dirname, 'files/services-manifest.yml.hbs').into('services-manifest.yml', { project, additions: [identity] })
77
+ const identity = { in: 'create-services', where: { 'broker': 'identity' } }
78
+ await merge(__dirname, 'files/services-manifest.yml.hbs').into('services-manifest.yml', { project, additions: [identity] })
79
+ }
88
80
  }
89
81
  }
@@ -3,6 +3,7 @@ const cds = require('../../../cds')
3
3
  const { exists, copy, rimraf, fs:{promises:{ mkdtemp }}, path } = cds.utils, { join } = path
4
4
  const cmd = require('../../../util/command')
5
5
  const mvn = require('../../mvn')
6
+ const { merge } = require('../../merge')
6
7
  const { bold, info, link } = require('../../../util/term')
7
8
  const { URLS, OPTIONS: { NODEJS, JAVA }, COMMAND_ADD } = require('../../constants')
8
9
  const { command, options } = cds.cli
@@ -33,9 +34,22 @@ module.exports = class JavaTemplate extends require('../../plugin') {
33
34
  console.log(`using Maven archetype version ${archetypeVersion}`)
34
35
 
35
36
  const temp = await mkdtemp(join(os.tmpdir(), `${path.basename(cds.root)}_`))
37
+ // preserve existing package.json (if any)
38
+ let preservedPackageJsonPath
39
+ if (exists('package.json')) {
40
+ preservedPackageJsonPath = join(temp, 'package.json')
41
+ await copy('package.json').to(preservedPackageJsonPath)
42
+ }
36
43
  try {
37
44
  await cmd.spawnCommand('mvn', params, { cwd: temp })
38
45
  await copy(join(temp, artifactId)).to(cds.root)
46
+ if (preservedPackageJsonPath) {
47
+ // merge template package.json into preserved one
48
+ // (not the other way around)
49
+ // to give preserved values precedence
50
+ await merge('package.json').into(preservedPackageJsonPath)
51
+ await copy(preservedPackageJsonPath).to('package.json')
52
+ }
39
53
  } catch (err) {
40
54
  if (err.code === 'ENOENT' && err.path === 'mvn') {
41
55
  throw `Maven executable 'mvn' not found. Follow ${info(URLS.MAVEN_INSTALL_HELP)} and install Maven on your machine.`
@@ -4,6 +4,7 @@ const { readProject } = require('../../projectReader')
4
4
  const { merge } = require('../../merge')
5
5
  const { srv4, kafkaMessaging } = require('../../registries/mta')
6
6
  const mvn = require('../../mvn')
7
+ const KymaTemplate = require('../kyma')
7
8
 
8
9
  module.exports = class KafkaTemplate extends require('../../plugin') {
9
10
 
@@ -28,7 +29,7 @@ module.exports = class KafkaTemplate extends require('../../plugin') {
28
29
 
29
30
  async combine() {
30
31
  const project = readProject()
31
- const { addMta, srvPath, addHelm, addHelmUnifiedRuntime } = project
32
+ const { addMta, srvPath, addKyma } = project
32
33
 
33
34
  if (addMta) {
34
35
  const srv = srv4(srvPath)
@@ -42,8 +43,9 @@ module.exports = class KafkaTemplate extends require('../../plugin') {
42
43
  })
43
44
  }
44
45
 
45
- if (addHelm || addHelmUnifiedRuntime) {
46
+ if (addKyma) {
46
47
  await merge(__dirname, 'files/values.yaml').into('chart/values.yaml')
48
+ await KymaTemplate.mergeDependency("service-instance", "kafka")
47
49
  }
48
50
  }
49
51
  }
@@ -2,10 +2,25 @@
2
2
  _schema-version: '1.0'
3
3
  repository: {{& imageRegistry}}
4
4
  tag: latest
5
- {{#isJava}}
5
+ {{#hasHelmUnifiedRuntime}}
6
+ {{#isJava}}
6
7
  before-all:
8
+ - helm dependency update ./gen/chart
7
9
  - mvn clean package -DskipTests=true --batch-mode
8
- {{/isJava}}
10
+ {{/isJava}}
11
+ {{/hasHelmUnifiedRuntime}}
12
+ {{^hasJava}}
13
+ {{#hasHelmUnifiedRuntime}}
14
+ before-all:
15
+ - helm dependency update ./gen/chart
16
+ {{/hasHelmUnifiedRuntime}}
17
+ {{/hasJava}}
18
+ {{^hasHelmUnifiedRuntime}}
19
+ {{#hasJava}}
20
+ before-all:
21
+ - mvn clean package -DskipTests=true --batch-mode
22
+ {{/hasJava}}
23
+ {{/hasHelmUnifiedRuntime}}
9
24
  modules:
10
25
  - name: {{appName}}-srv
11
26
  build-parameters:
@@ -1,10 +1,134 @@
1
- module.exports = class extends require('../../plugin') {
1
+ const { join } = require('path')
2
+ const cds = require('../../../cds')
3
+ const { exists, rimraf, copy, yaml } = cds.utils
4
+ const { readProject } = require('../../projectReader')
5
+ const { merge } = require('../../merge')
6
+ const { ask4 } = require('../../../util/question')
7
+ const { execSync } = require('child_process')
8
+ const { mvn } = require('../../add')
2
9
 
3
- static help() {
4
- return 'helm + containerize'
10
+ module.exports = class KymaTemplate extends require('../../plugin') {
11
+
12
+ static hasInProduction() {
13
+ return exists('chart/Chart.yaml')
14
+ }
15
+
16
+ async canRun() {
17
+ const hasInProduction = KymaTemplate.hasInProduction()
18
+ if (cds.cli.options.force) {
19
+ await rimraf(join('chart'))
20
+ await rimraf('containerize.yaml')
21
+ return true
22
+ } else if (hasInProduction) {
23
+ throw `Chart already exists. Use --force to overwrite.`
5
24
  }
25
+ return true
26
+ }
27
+
28
+ static help() {
29
+ return 'Kyma deployment using Helm charts'
30
+ }
31
+
32
+ async run() {
33
+ const project = readProject()
34
+
35
+ let imagePullSecret, registry, domain, tag
36
+ if (!KymaTemplate.hasInProduction() && !project.isBas /* don't run this for the BAS Yeoman generator */) {
37
+ try {
38
+ const domainGuess = execSync(`kubectl config view --minify --output jsonpath="{.clusters[*].cluster.server}"`, { stdio: "pipe" }).toString()
39
+ const domainStartIndex = domainGuess.indexOf('api.')
40
+ if (domainStartIndex !== -1) domain = domainGuess.substring(domainStartIndex + 4)
41
+ } catch (error) { /* ignore */ }
42
+
43
+ //REVISIT: remove cds10
44
+ if (exists('containerize.yaml')) {
45
+ const { repository: r, tag: t } = yaml.parse(join(cds.root, 'containerize.yaml'))
46
+ if (r) registry = r
47
+ if (t) tag = t
48
+ }
49
+ if (!cds.cli.options.y && !cds.cli.options.force) {
50
+ registry ??= await ask4([`registry server: `])
51
+ domain ??= await ask4([`cluster domain: `])
52
+ }
53
+ }
54
+ project.registry = registry ?? '<registry-server>'
55
+ project.domain = domain ?? '<cluster-domain>'
56
+ project.imagePullSecret = imagePullSecret ?? 'docker-registry'
57
+ project.tag = tag ?? 'latest'
58
+ await copy(join(__dirname, 'files', 'values.schema.json')).to('chart/values.schema.json')
59
+ await merge(__dirname, 'files/Chart.yaml.hbs').into('chart/Chart.yaml', { with: project })
60
+ await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
61
+ await merge(__dirname, '/files/containerize.yaml.hbs').into('containerize.yaml', { with: project })
62
+ await KymaTemplate.mergeDependency('web-application', 'srv')
63
+ if (project.isJava) await mvn.add('k8s')
64
+
65
+ }
6
66
 
7
- requires() {
8
- return ['helm', 'containerize']
67
+ options() {
68
+ return {
69
+ 'unified-runtime': {
70
+ type: 'boolean'
71
+ },
72
+ 'y': {
73
+ type: 'boolean',
74
+ }
9
75
  }
76
+ }
77
+
78
+ async combine() {
79
+ // REVISIT: This must be moved to the respective plugins
80
+ const {
81
+ addHana, addMultitenancy, addXsuaa,
82
+ addApprouter, addIas, addAms, hasXsuaa, hasMultitenancy,
83
+ addHtml5Repo, hasHtml5Repo,
84
+ } = readProject()
85
+
86
+ if (addHtml5Repo || addApprouter && hasHtml5Repo) {
87
+ if (addHtml5Repo) {
88
+ await KymaTemplate.mergeDependency('service-instance', 'html5-apps-repo-host')
89
+ await KymaTemplate.mergeDependency('content-deployment', 'html5-apps-deployer')
90
+ }
91
+ if (addApprouter) {
92
+ await KymaTemplate.mergeDependency('service-instance', 'html5-apps-repo-runtime')
93
+ }
94
+ }
95
+ if (addMultitenancy || addXsuaa || addIas || addAms) {
96
+ if (addMultitenancy) {
97
+ await KymaTemplate.mergeDependency('web-application', 'sidecar')
98
+ }
99
+ if (hasXsuaa && hasMultitenancy) {
100
+ await KymaTemplate.mergeDependency('service-instance', 'saas-registry')
101
+ } else if (hasMultitenancy) {
102
+ await KymaTemplate.mergeDependency('service-instance', 'subscription-manager')
103
+ }
104
+ }
105
+ if (addHana || addMultitenancy) {
106
+ if (hasMultitenancy) {
107
+ await KymaTemplate.mergeDependency('service-instance', 'service-manager')
108
+ } else {
109
+ await KymaTemplate.mergeDependency('service-instance', 'hana')
110
+ await KymaTemplate.mergeDependency('content-deployment', 'hana-deployer')
111
+ }
112
+ }
113
+ }
114
+
115
+ static async mergeDependency(name, alias) {
116
+ const project = readProject()
117
+
118
+ await merge({
119
+ dependencies: [{
120
+ name,
121
+ alias,
122
+ version: '>0.0.0',
123
+ ...((cds.cli.options["unified-runtime"] || project.hasHelmUnifiedRuntime) && { repository: 'https://int.repositories.cloud.sap/artifactory/virtual-unified-runtime-helm-dmz' })
124
+ }]
125
+ }).into('chart/Chart.yaml', {
126
+ with: project,
127
+ additions: [{
128
+ in: 'dependencies',
129
+ where: { alias }
130
+ }]}
131
+ )
132
+
133
+ }
10
134
  }
@@ -11,4 +11,6 @@ resources:
11
11
  type: org.cloudfoundry.managed-service
12
12
  parameters:
13
13
  service: malware-scanner
14
- service-plan: clamav
14
+ service-plan: clamav
15
+ config:
16
+ auth: mTLS
@@ -4,4 +4,6 @@ srv:
4
4
  serviceInstanceName: malware-scanner
5
5
  malware-scanner:
6
6
  serviceOfferingName: malware-scanner
7
- servicePlanName: clamav
7
+ servicePlanName: clamav
8
+ parameters:
9
+ auth: mTLS
@@ -1,6 +1,7 @@
1
1
  const { readProject } = require('../../projectReader')
2
2
  const { merge } = require('../../merge')
3
3
  const { srv4, malwareScanner } = require('../../registries/mta')
4
+ const KymaTemplate = require('../kyma')
4
5
 
5
6
  module.exports = class MalwareScannerTemplate extends require('../../plugin') {
6
7
 
@@ -22,7 +23,7 @@ module.exports = class MalwareScannerTemplate extends require('../../plugin') {
22
23
 
23
24
  async combine() {
24
25
  const project = readProject()
25
- const { addMta, addHelm, addHelmUnifiedRuntime, srvPath } = project
26
+ const { addMta, addKyma, srvPath } = project
26
27
 
27
28
  if (addMta) {
28
29
  const srv = srv4(srvPath)
@@ -36,8 +37,9 @@ module.exports = class MalwareScannerTemplate extends require('../../plugin') {
36
37
  })
37
38
  }
38
39
 
39
- if (addHelm || addHelmUnifiedRuntime) {
40
+ if (addKyma) {
40
41
  await merge(__dirname, 'files', 'values.yaml').into('chart/values.yaml')
42
+ await KymaTemplate.mergeDependency('service-instance', 'malware-scanner')
41
43
  }
42
44
  }
43
45
  }
@@ -8,7 +8,7 @@ modules:
8
8
  {{#isJava}}
9
9
  - name: mtx-api
10
10
  properties:
11
- CDS_MULTITENANCY_SIDECAR_URL: ~{mtx-url}
11
+ CDS_MULTITENANCY_SIDECAR_URL: {{^hasIas}}~{mtx-url}{{/hasIas}}{{#hasIas}}~{mtx-cert-url}{{/hasIas}}
12
12
  {{/isJava}}
13
13
  provides:
14
14
  - name: srv-api # required by consumers of CAP services (e.g. approuter)
@@ -93,7 +93,6 @@ resources:
93
93
  onUpdateDependenciesAsync: true
94
94
  callbackTimeoutMillis: 300000 # Increase if your deployments are taking longer than that
95
95
 
96
- {{#hasIas}}
97
96
  - name: {{appName}}-sms
98
97
  type: org.cloudfoundry.managed-service
99
98
  parameters:
@@ -119,4 +118,3 @@ resources:
119
118
  requires:
120
119
  - name: {{#isJava}}srv-api{{/isJava}}{{^isJava}}mtx-api{{/isJava}}
121
120
  processed-after: [{{#hasXsuaa}}{{appName}}-registry, {{/hasXsuaa}}{{appName}}-ias]
122
- {{/hasIas}}
@@ -49,10 +49,18 @@ subscription-manager:
49
49
  servicePlanName: provider
50
50
  parameters:
51
51
  appCallbacks:
52
+ {{#isNodejs}}
52
53
  dependenciesCallbacks:
53
54
  {{#literal}}url: https://{{ .Release.Name }}-sidecar-{{ .Release.Namespace }}.cert.{{ .Values.global.domain }}/-/cds/sms-provisioning/dependencies/{app_tid}{{/literal}}
54
55
  subscriptionCallbacks:
55
56
  {{#literal}}url: https://{{ .Release.Name }}-sidecar-{{ .Release.Namespace }}.cert.{{ .Values.global.domain }}/-/cds/sms-provisioning/tenant/{app_tid}{{/literal}}
57
+ {{/isNodejs}}
58
+ {{#isJava}}
59
+ dependenciesCallbacks:
60
+ {{#literal}}url: https://{{ .Release.Name }}-srv-{{ .Release.Namespace }}.cert.{{ .Values.global.domain }}/mt/sms/subscriptions/tenants/{app_tid}/dependencies{{/literal}}
61
+ subscriptionCallbacks:
62
+ {{#literal}}url: https://{{ .Release.Name }}-srv-{{ .Release.Namespace }}.cert.{{ .Values.global.domain }}/mt/sms/subscriptions/tenants/{app_tid}{{/literal}}
63
+ {{/isJava}}
56
64
  appName: {{appName}}
57
65
  applicationType: application
58
66
  category: "CAP Application"
@@ -30,6 +30,7 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
30
30
  if (isJava) {
31
31
  const packageJson = await read('package.json')
32
32
  packageJson.workspaces = ['mtx/sidecar']
33
+ packageJson.devDependencies ??= {}
33
34
  packageJson.devDependencies['@sap/cds-mtxs'] ??= '^3'
34
35
  await write('package.json', packageJson, { spaces: 2 })
35
36
  await sort('package.json', 'devDependencies')
@@ -42,8 +43,8 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
42
43
  async combine() {
43
44
  const project = readProject()
44
45
  const {
45
- isNodejs, isJava, addMta, hasMta, addHelm, addHelmUnifiedRuntime,
46
- addXsuaa, hasXsuaa, addIas, hasIas, hasHana, addContainerize, hasApprouter,
46
+ isNodejs, isJava, addMta, hasMta,
47
+ addXsuaa, hasXsuaa, addIas, hasIas, hasHana, addContainerize, addKyma, addHelm, addHelmUnifiedRuntime, hasApprouter,
47
48
  srvPath, appName
48
49
  } = project
49
50
 
@@ -55,10 +56,13 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
55
56
  if (hasIas) services.push(subscriptionManager)
56
57
  if (!hasIas || hasXsuaa) services.push(saasRegistry)
57
58
  const apis = [srvApi4(srv), providedMtxApiSidecar4(mtxSidecar)]
58
- if (isJava) apis.push(requiredMtxSidecarApi4(srv))
59
+ if (isJava) {
60
+ const name = hasIas ? '~{mtx-cert-url}' : '~{mtx-url}'
61
+ apis.push(requiredMtxSidecarApi4(srv, name))
62
+ }
59
63
  const additions = [...modules, ...services, ...apis]
60
64
  const relationships = []
61
- if (addXsuaa) {
65
+ if (hasXsuaa) {
62
66
  relationships.push({
63
67
  insert: [saasRegistry, 'name'],
64
68
  into: [isJava ? srv : mtxSidecar, 'requires', 'name']
@@ -80,7 +84,7 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
80
84
  await merge(templateMtaPath).into('mta.yaml', { with: project, additions, relationships })
81
85
  }
82
86
 
83
- if (addHelm || addHelmUnifiedRuntime) {
87
+ if (addKyma) {
84
88
  await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
85
89
  const applicationWorkload = hasApprouter ? 'approuter' : 'srv'
86
90
  await merge({
@@ -89,12 +93,16 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
89
93
  }}},
90
94
  ...(isJava) && { srv: { env: {
91
95
  CDS_MULTITENANCY_APPUI_URL: `https://{{ .Release.Name }}-${applicationWorkload}-{{ .Release.Namespace }}.{{ .Values.global.domain }}`,
92
- CDS_MULTITENANCY_SIDECAR_URL: `https://{{ .Release.Name }}-sidecar-{{ .Release.Namespace }}.{{ .Values.global.domain }}`
96
+ CDS_MULTITENANCY_SIDECAR_URL: hasIas ?
97
+ `https://{{ .Release.Name }}-sidecar-{{ .Release.Namespace }}.cert.{{ .Values.global.domain }}` :
98
+ `https://{{ .Release.Name }}-sidecar-{{ .Release.Namespace }}.{{ .Values.global.domain }}`
93
99
  }}}
94
100
  }).into('chart/values.yaml',{ forceOverwrite: true })
95
101
  }
96
102
 
97
- if (addContainerize) {
103
+ // cds10 move to if above
104
+ // needed because of adding kyma to cli options in case of helm
105
+ if (addContainerize || (addKyma && !addHelm && !addHelmUnifiedRuntime)) {
98
106
  const deletions = []
99
107
  if (hasHana) {
100
108
  deletions.push({
@@ -5,8 +5,5 @@
5
5
  "mechatroner.rainbow-csv",
6
6
  "qwtel.sqlite-viewer",
7
7
  "humao.rest-client"
8
- ],
9
- "unwantedRecommendations": [
10
-
11
8
  ]
12
9
  }
@@ -13,4 +13,4 @@
13
13
  "start": "cds-serve"
14
14
  },
15
15
  "private": true
16
- }
16
+ }