@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
@@ -1,6 +1,6 @@
1
1
  const os = require('os');
2
2
 
3
- const MAVEN_ARCHETYPE_VERSION = '1.34.0';
3
+ const MAVEN_ARCHETYPE_VERSION = '2.0.1';
4
4
 
5
5
  const constants = {
6
6
  IS_WIN: (os.platform() === 'win32'),
@@ -10,40 +10,43 @@ const constants = {
10
10
 
11
11
  MAVEN_ARCHETYPE_VERSION,
12
12
 
13
- OPTION_NODEJS: 'nodejs',
14
- OPTION_JAVA: 'java',
15
- OPTION_HANA: 'hana',
16
- OPTION_SQLITE: 'sqlite',
17
- OPTION_XSUAA: 'xsuaa',
18
- OPTION_DESTINATIONS: 'destinations',
19
- OPTION_MTA: 'mta',
20
- OPTION_MTX: 'mtx',
21
- OPTION_MULTITENANCY: 'multitenancy',
22
- OPTION_TOGGLES: 'toggles',
23
- OPTION_EXTENSIBILITY: 'extensibility',
24
- OPTION_AUDITLOG: 'auditlog',
25
- OPTION_ENTERPRISE_MESSAGING: 'enterprise-messaging',
26
- OPTION_ENTERPRISE_MESSAGING_SHARED: 'enterprise-messaging-shared',
27
- OPTION_FILE_BASED_MESSAGING: 'file-based-messaging',
28
- OPTION_REDIS_MESSAGING: 'redis-messaging',
29
- OPTION_APPROUTER: 'approuter',
30
- OPTION_KIBANA_LOGGING: 'kibana-logging',
31
- OPTION_CF_MANIFEST: 'cf-manifest',
32
- OPTION_PIPELINE: 'pipeline',
33
- OPTION_SAMPLES: 'samples',
34
- OPTION_DATA: 'data',
35
- OPTION_NOTEBOOK: 'notebook',
36
- OPTION_LINT: 'lint',
37
- OPTION_LINT_GLOBAL: 'lint:global',
38
- OPTION_LINT_DEV: 'lint:dev',
39
- OPTION_JAVA_PACKAGE: 'java:package',
40
- OPTION_JAVA_MVN: 'java:mvn',
41
- OPTION_HELM: 'helm',
13
+ OPTIONS: Object.freeze({
14
+ JAVA: 'java',
15
+ JAVA_MVN: 'java:mvn',
16
+ JAVA_PACKAGE: 'java:package',
17
+ NODEJS: 'nodejs',
18
+ PIPELINE: 'pipeline',
19
+ MTA: 'mta',
20
+ CONNECTIVITY: 'connectivity',
21
+ CF_MANIFEST: 'cf-manifest',
22
+ MTX: 'mtx',
23
+ MULTITENANCY: 'multitenancy',
24
+ TOGGLES: 'toggles',
25
+ EXTENSIBILITY: 'extensibility',
26
+ XSUAA: 'xsuaa',
27
+ HANA: 'hana',
28
+ SQLITE: 'sqlite',
29
+ AUDITLOG: 'auditlog',
30
+ ENTERPRISE_MESSAGING: 'enterprise-messaging',
31
+ ENTERPRISE_MESSAGING_SHARED: 'enterprise-messaging-shared',
32
+ FILE_BASED_MESSAGING: 'file-based-messaging',
33
+ REDIS_MESSAGING: 'redis-messaging',
34
+ APPROUTER: 'approuter',
35
+ DESTINATION: 'destination',
36
+ SAMPLES: 'samples', // deprecated
37
+ SAMPLE_TINY: 'sample-tiny',
38
+ SAMPLE: 'sample',
39
+ DATA: 'data',
40
+ KIBANA_LOGGING: 'kibana-logging',
41
+ LINT: 'lint',
42
+ LINT_GLOBAL: 'lint:global',
43
+ LINT_DEV: 'lint:dev',
44
+ HELM: 'helm',
45
+ TYPER: 'typer'
46
+ }),
42
47
 
43
48
  PROJECT_TYPE: Object.freeze({ nodejs: 1, java: 2, unknown: 3 }),
44
49
 
45
- PYTHON_VENV_NAME: '.cap-jupyter-nb',
46
-
47
50
  REGEX_JAVA_PACKAGE: /^[a-z_][a-z0-9_]*(\.[a-z_][a-z0-9_]*)*$/g,
48
51
  REGEX_PROJECT_NAME: /[^0-9a-zA-Z_-]/g,
49
52
 
@@ -51,52 +54,14 @@ const constants = {
51
54
  PIPELINE_HELP: 'https://sap.github.io/jenkins-library/',
52
55
  SAMPLES: 'https://github.com/SAP-samples/cloud-cap-samples',
53
56
  CAPIRE: 'https://cap.cloud.sap',
54
- JUPYTERLAB: 'https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html',
55
57
  MAVEN_ARCHETYPE_HELP: `https://cap.cloud.sap/docs/java/development/#the-maven-archetype`,
56
58
  MAVEN_INSTALL_HELP: `https://maven.apache.org/install.html`,
57
- PYTHON: 'https://www.python.org/downloads/',
58
- PYTHON_PIP: 'https://packaging.python.org/en/latest/guides/',
59
59
  VSCODE: 'https://code.visualstudio.com/',
60
60
  VSCODE_NBVIEWER: 'https://marketplace.visualstudio.com/items?itemName=ms-python.python',
61
61
  VSCODE_ESLINT: 'https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint'
62
62
  }),
63
63
 
64
- PROJECT_FILES: ['package.json', 'pom.xml', '.cdsrc.json'],
65
-
66
- KIND_SQL: 'sql',
67
- KIND_HANA: 'hana',
68
- KIND_HANA_CLOUD: 'hana-cloud',
69
- KIND_HANA_MT: 'hana-mt'
64
+ PROJECT_FILES: ['package.json', 'pom.xml', '.cdsrc.json']
70
65
  }
71
66
 
72
- constants.OPTIONS_PRIORITY = [
73
- constants.OPTION_JAVA,
74
- constants.OPTION_NODEJS,
75
- constants.OPTION_PIPELINE,
76
- constants.OPTION_MTA,
77
- constants.OPTION_CF_MANIFEST,
78
- constants.OPTION_MTX,
79
- constants.OPTION_MULTITENANCY,
80
- constants.OPTION_TOGGLES,
81
- constants.OPTION_EXTENSIBILITY,
82
- constants.OPTION_XSUAA,
83
- constants.OPTION_HANA,
84
- constants.OPTION_SQLITE,
85
- constants.OPTION_AUDITLOG,
86
- constants.OPTION_ENTERPRISE_MESSAGING,
87
- constants.OPTION_ENTERPRISE_MESSAGING_SHARED,
88
- constants.OPTION_FILE_BASED_MESSAGING,
89
- constants.OPTION_REDIS_MESSAGING,
90
- constants.OPTION_APPROUTER,
91
- constants.OPTION_DESTINATIONS,
92
- constants.OPTION_SAMPLES,
93
- constants.OPTION_DATA,
94
- constants.OPTION_KIBANA_LOGGING,
95
- constants.OPTION_NOTEBOOK,
96
- constants.OPTION_LINT,
97
- constants.OPTION_LINT_CUSTOM,
98
- constants.OPTION_LINT_EXAMPLE,
99
- constants.OPTION_HELM
100
- ];
101
-
102
67
  module.exports = constants;
package/lib/init/index.js CHANGED
@@ -2,11 +2,8 @@ const path = require('path');
2
2
 
3
3
  const term = require('../util/term');
4
4
 
5
- const { OPTIONS_PRIORITY, COMMAND_ADD, COMMAND_INIT,
6
- // eslint-disable-next-line no-unused-vars
7
- OPTION_XSUAA, OPTION_AUDITLOG, OPTION_HANA, OPTION_MTA, OPTION_MTX, OPTION_APPROUTER, OPTION_KIBANA_LOGGING,
8
- OPTION_NODEJS, OPTION_JAVA, OPTION_HELM,
9
- OPTION_PIPELINE, OPTION_SAMPLES, OPTION_CF_MANIFEST, PROJECT_FILES, REGEX_PROJECT_NAME } = require('./constants');
5
+ const { OPTIONS, COMMAND_ADD, COMMAND_INIT, PROJECT_FILES, REGEX_PROJECT_NAME } = require('./constants')
6
+ const { NODEJS, JAVA, HANA, MTA,PIPELINE, SAMPLES, CF_MANIFEST } = OPTIONS
10
7
 
11
8
  const cds = require('../cds'), { exists, readdir } = cds.utils
12
9
  const LOG = console
@@ -42,10 +39,10 @@ module.exports = class CDSGenerator {
42
39
  {
43
40
  title: `Type`,
44
41
  description: `Select your runtime.`,
45
- default: OPTION_NODEJS,
42
+ default: NODEJS,
46
43
  choices: [
47
- { name: 'Node.js', value: OPTION_NODEJS },
48
- { name: 'Java', value: OPTION_JAVA }
44
+ { name: 'Node.js', value: NODEJS },
45
+ { name: 'Java', value: JAVA }
49
46
  ],
50
47
  multiple: false,
51
48
  target: 'add',
@@ -59,14 +56,13 @@ module.exports = class CDSGenerator {
59
56
  description: `Add features to your project.`,
60
57
  default: '',
61
58
  choices: [
62
- { name: 'CI/CD Pipeline Integration', value: OPTION_PIPELINE },
63
- { name: 'Configuration for SAP HANA Deployment', value: OPTION_HANA },
64
- { name: 'MTA based SAP Business Technology Platform Deployment', value: OPTION_MTA },
65
- // { name: 'Multitenancy', value: OPTION_MTX },
66
- // { name: 'Jupyter base CAP Notebook', value: OPTION_NOTEBOOK },
67
- { name: `Cloud Foundry native Deployment`, value: OPTION_CF_MANIFEST }
68
- // { name: `CDS Linter for custom rules`, value: OPTION_LINT },
69
- // { name: `CDS Linter for custom rules with sample`, value: OPTION_LINT_DEV }
59
+ { name: 'CI/CD Pipeline Integration', value: PIPELINE },
60
+ { name: 'Configuration for SAP HANA Deployment', value: HANA },
61
+ { name: 'MTA based SAP Business Technology Platform Deployment', value: MTA },
62
+ // { name: 'Multitenancy', value: mtx },
63
+ { name: `Cloud Foundry native Deployment`, value: CF_MANIFEST }
64
+ // { name: `CDS Linter for custom rules`, value: lint },
65
+ // { name: `CDS Linter for custom rules with sample`, value: lintDev }
70
66
  ],
71
67
  multiple: true,
72
68
  target: 'add',
@@ -79,47 +75,15 @@ module.exports = class CDSGenerator {
79
75
  description: `Add sample content to your project.`,
80
76
  default: '',
81
77
  choices: [
82
- { name: 'Basic Sample Files', value: OPTION_SAMPLES }
78
+ { name: 'Basic Sample Files', value: SAMPLES }
83
79
  ],
84
80
  multiple: true,
85
81
  target: 'add',
86
82
  guiOptions: {
87
83
  hint: 'Speed up your ramp-up phase with some sample files in your project.'
88
84
  }
89
- },
90
- {
91
- // OPTION_HELM this.config
92
85
  }
93
86
  ]
94
-
95
- // legacy handling for generator-cap-project < 3.0
96
- // does not contain OPTION_NODJES since old Yeoman generator
97
- // cannot handle types correctly
98
- this.config = {
99
- add: {
100
- title: `Features`,
101
- description: `Select the features for the new project.`,
102
- default: '',
103
- // choices: OPTIONS_PRIORITY.filter((currOption) => currOption !== OPTION_NODEJS),
104
- choices: [
105
- OPTION_JAVA,
106
- OPTION_HANA,
107
- OPTION_XSUAA,
108
- OPTION_PIPELINE,
109
- OPTION_CF_MANIFEST,
110
- OPTION_MTA,
111
- OPTION_SAMPLES,
112
- OPTION_KIBANA_LOGGING,
113
- OPTION_HELM,
114
- OPTION_SAMPLES
115
- ],
116
- multiple: true,
117
- promptOrder: 10 // used to identify ui prompts
118
- },
119
- force: {
120
- default: false
121
- }
122
- }
123
87
  }
124
88
 
125
89
  /**
@@ -205,6 +169,7 @@ module.exports = class CDSGenerator {
205
169
  const msg = `Adding feature '${template.name}'...`;
206
170
  LOG.info(msg);
207
171
  await template.run();
172
+ await template.runRelatedMerging();
208
173
  }
209
174
 
210
175
  LOG.info(`Done adding features`);
@@ -251,8 +216,9 @@ module.exports = class CDSGenerator {
251
216
  }
252
217
  }
253
218
 
219
+ const cmds = Object.values(OPTIONS);
254
220
  this.templateList = Array.from(templates.entries()).sort(([a], [b]) => {
255
- return OPTIONS_PRIORITY.indexOf(a) - OPTIONS_PRIORITY.indexOf(b);
221
+ return cmds.indexOf(a) - cmds.indexOf(b);
256
222
  }).map((entry) => entry[1]);
257
223
 
258
224
  // check debug to avoid lengthy computation when not in debug mode
@@ -297,8 +263,8 @@ module.exports = class CDSGenerator {
297
263
  // set is ordered ... always
298
264
  this.options.add = new Set(trimmedTokens);
299
265
 
300
- if (this.options._cmd === COMMAND_INIT && !this.options.add.has(OPTION_JAVA)) {
301
- this.options.add.add(OPTION_NODEJS);
266
+ if (this.options._cmd === COMMAND_INIT && !this.options.add.has(JAVA)) {
267
+ this.options.add.add(NODEJS);
302
268
  }
303
269
 
304
270
  this._checkAdditionalOptions();
@@ -31,16 +31,32 @@ const approuter = {
31
31
  }
32
32
 
33
33
  const xsuaa = {
34
+ in: 'resources',
35
+ where: [{
36
+ property: 'parameters.service',
37
+ isEqualTo: 'xsuaa',
38
+ }]
39
+ }
40
+
41
+ const destination = {
34
42
  in: 'resources',
35
43
  where: [{
36
44
  property: 'type',
37
45
  isEqualTo: 'org.cloudfoundry.managed-service',
38
46
  }, {
39
47
  property: 'parameters.service',
40
- isEqualTo: 'xsuaa',
48
+ isEqualTo: 'destination',
49
+ }]
50
+ }
51
+
52
+ const connectivity = {
53
+ in: 'resources',
54
+ where: [{
55
+ property: 'type',
56
+ isEqualTo: 'org.cloudfoundry.managed-service',
41
57
  }, {
42
- property: 'parameters.service-plan',
43
- isEqualTo: 'application'
58
+ property: 'parameters.service',
59
+ isEqualTo: 'connectivity',
44
60
  }]
45
61
  }
46
62
 
@@ -245,6 +261,8 @@ module.exports = {
245
261
  approuter,
246
262
  xsuaa,
247
263
  auditlog,
264
+ destination,
265
+ connectivity,
248
266
  enterpriseMessaging,
249
267
  hdbDeployer,
250
268
  hdiContainer,
@@ -1,33 +1,33 @@
1
1
  ---
2
2
  modules:
3
- - name: {{cap.appName}}-srv
4
- type: {{cap.language}}
5
- path: {{& cap.srvPath}}
6
- {{#cap.isJava}}
7
- {{#cap.isMultitenant}}
3
+ - name: {{appName}}-srv
4
+ type: {{language}}
5
+ path: {{& srvPath}}
6
+ {{#isJava}}
7
+ {{#isMultitenant}}
8
8
  properties:
9
9
  CDS_MULTITENANCY_APPUI_TENANTSEPARATOR: "-"
10
- {{/cap.isMultitenant}}
11
- {{/cap.isJava}}
10
+ {{/isMultitenant}}
11
+ {{/isJava}}
12
12
  requires:
13
- - name: {{cap.appName}}-auth
14
- {{#cap.isJava}}
13
+ - name: {{appName}}-auth
14
+ {{#isJava}}
15
15
  - name: app-api
16
16
  properties:
17
17
  CDS_MULTITENANCY_APPUI_URL: ~{url}
18
- {{/cap.isJava}}
18
+ {{/isJava}}
19
19
 
20
- - name: {{cap.appName}}
20
+ - name: {{appName}}
21
21
  type: approuter.nodejs
22
- path: {{& ui.appPath}} # from cds.env.folders. Consider also cds.env.build.target -> gen/app
22
+ path: {{& appPath}} # from cds.env.folders. Consider also cds.env.build.target -> gen/app
23
23
  parameters:
24
24
  keep-existing-routes: true
25
25
  disk-quota: 256M
26
26
  memory: 256M
27
- {{#cap.isMultitenant}}
27
+ {{#isMultitenant}}
28
28
  properties:
29
29
  TENANT_HOST_PATTERN: "^(.*)-${default-uri}"
30
- {{/cap.isMultitenant}}
30
+ {{/isMultitenant}}
31
31
  requires:
32
32
  - name: srv-api
33
33
  group: destinations
@@ -35,46 +35,46 @@ 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
- {{#cap.isMultitenant}}
38
+ {{#isMultitenant}}
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
- {{/cap.isMultitenant}}
45
- {{#cap.isMultitenant}}
46
- {{#cap.isNodejs}}
44
+ {{/isMultitenant}}
45
+ {{#isMultitenant}}
46
+ {{#isNodejs}}
47
47
  provides:
48
48
  - name: app-api
49
49
  properties:
50
50
  app-protocol: ${protocol}
51
51
  app-uri: ${default-uri}
52
- {{/cap.isNodejs}}
53
- {{/cap.isMultitenant}}
54
- {{#cap.isJava}}
52
+ {{/isNodejs}}
53
+ {{/isMultitenant}}
54
+ {{#isJava}}
55
55
  provides:
56
56
  - name: app-api
57
57
  properties:
58
58
  url: ${default-url}
59
- {{/cap.isJava}}
59
+ {{/isJava}}
60
60
 
61
- {{#cap.isMultitenant}}
62
- - name: {{cap.appName}}-mtx
61
+ {{#isMultitenant}}
62
+ - name: {{appName}}-mtx
63
63
  type: nodejs
64
- path: {{#cap.isNodejs}}gen/{{/cap.isNodejs}}mtx/sidecar
64
+ path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
65
65
  requires:
66
66
  - name: app-api
67
67
  properties:
68
68
  SUBSCRIPTION_URL: ~{app-protocol}://\${tenant_subdomain}-~{app-uri}
69
- {{/cap.isMultitenant}}
69
+ {{/isMultitenant}}
70
70
 
71
71
  resources:
72
- - name: {{cap.appName}}-auth
72
+ - name: {{appName}}-auth
73
73
  type: org.cloudfoundry.managed-service
74
74
  parameters:
75
75
  service: xsuaa
76
76
  service-plan: application
77
77
  path: ./xs-security.json
78
78
  config:
79
- xsappname: {{cap.appName}}-${org}-${space}
80
- tenant-mode: {{#cap.isMultitenant}}shared{{/cap.isMultitenant}}{{^cap.isMultitenant}}dedicated{{/cap.isMultitenant}}
79
+ xsappname: {{appName}}-${org}-${space}
80
+ tenant-mode: {{#isMultitenant}}shared{{/isMultitenant}}{{^isMultitenant}}dedicated{{/isMultitenant}}
@@ -1,19 +1,19 @@
1
1
  ---
2
- {{#cap.hasXsuaa}}
2
+ {{#hasXsuaa}}
3
3
  xsuaa:
4
4
  parameters:
5
5
  oauth2-configuration:
6
6
  redirect-uris:
7
7
  - https://*.<your-cluster-domain>/**
8
- {{/cap.hasXsuaa}}
8
+ {{/hasXsuaa}}
9
9
  approuter:
10
- {{#cap.hasXsuaa}}
10
+ {{#hasXsuaa}}
11
11
  bindings:
12
12
  auth:
13
13
  serviceInstanceName: xsuaa
14
- {{/cap.hasXsuaa}}
14
+ {{/hasXsuaa}}
15
15
  image:
16
- repository: <your-container-registry>/{{cap.appName}}-approuter
16
+ repository: <your-container-registry>/{{appName}}-approuter
17
17
  tag: latest
18
18
  resources:
19
19
  limits:
@@ -1,18 +1,24 @@
1
1
  {
2
+ "welcomeFile": "app/index.html",
2
3
  "routes": [
3
- {{#cap.isExtensible}}
4
+ {{#isExtensible}}
4
5
  {
5
6
  "source": "^/-/cds/.*",
6
7
  "destination": "mtx-api",
7
8
  "authenticationType": "none"
8
9
  },
9
- {{/cap.isExtensible}}
10
+ {{/isExtensible}}
10
11
  {
11
12
  "source": "^/app/(.*)$",
12
13
  "target": "$1",
13
14
  "localDir": ".",
14
15
  "cacheControl": "no-cache, no-store, must-revalidate"
15
16
  },
17
+ {
18
+ "source": "^/appconfig/",
19
+ "localDir": ".",
20
+ "cacheControl": "no-cache, no-store, must-revalidate"
21
+ },
16
22
  {
17
23
  "source": "^/(.*)$",
18
24
  "target": "$1",
@@ -2,8 +2,8 @@ const cds = require('../../../cds')
2
2
  const { exists } = cds.utils
3
3
  const { join } = require('path')
4
4
  const { readProject } = require('../../util/projectReader')
5
- const { mergeJSON, mergeYAML, sortDependencies } = require('../../util/merge')
6
- const { OPTION_XSUAA } = require('../../constants')
5
+ const { mergeJSON, mergeYAML, sort } = require('../../util/merge')
6
+ const { XSUAA } = require('../../constants').OPTIONS
7
7
  const {
8
8
  srvNode4, srvJava4, mtxSidecar4, approuter, // Modules
9
9
  xsuaa, // BTP Services
@@ -20,22 +20,21 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
20
20
  }
21
21
 
22
22
  getDependencies() {
23
- return [OPTION_XSUAA]
23
+ return [XSUAA]
24
24
  }
25
25
 
26
26
  async run() {
27
- const projectDescriptor = await readProject(this.options)
28
- const appPath = projectDescriptor.ui.appPath ?? 'app'
27
+ const { appPath = 'app' } = await readProject(this.options)
29
28
  const appPackageJSONPath = join(appPath, 'package.json')
30
29
  await mergeJSON(appPackageJSONPath, join(__dirname, 'files', 'package.json'))
31
- await sortDependencies(appPackageJSONPath)
30
+ await sort(appPackageJSONPath, 'dependencies')
32
31
  await mergeJSON(join(appPath, 'default-env.json'), join(__dirname, 'files', 'default-env.json'))
33
32
  await this.runDependentMerging()
34
33
  }
35
34
 
36
35
  async runDependentMerging(context = {}) {
37
36
  const projectDescriptor = await readProject(this.options)
38
- const { isNodejs, isJava, isExtensible, isMultitenant, hasMta, hasHelm, srvPath } = projectDescriptor.cap
37
+ const { isNodejs, isJava, isExtensible, isMultitenant, hasMta, hasHelm, srvPath } = projectDescriptor
39
38
 
40
39
  if (hasMta) {
41
40
  const srv = (isNodejs ? srvNode4 : srvJava4)(srvPath)
@@ -114,7 +113,7 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
114
113
  if (isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData);
115
114
  }
116
115
 
117
- const xsAppPath = join(projectDescriptor.ui.appPath ?? 'app', 'xs-app.json')
116
+ const xsAppPath = join(projectDescriptor.appPath ?? 'app', 'xs-app.json')
118
117
  const additions = isExtensible ? [{ ...approuterExtensibility, at: 0 }] : []
119
118
  await mergeJSON(xsAppPath, join(__dirname, 'files', 'xs-app.json.hbs'), projectDescriptor, { additions })
120
119
  }
@@ -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}}-auditlog
7
+ - name: {{appName}}-auditlog
8
8
 
9
9
  resources:
10
- - name: {{cap.appName}}-auditlog
10
+ - name: {{appName}}-auditlog
11
11
  type: org.cloudfoundry.managed-service
12
12
  parameters:
13
13
  service: auditlog-api
@@ -1,27 +1,27 @@
1
1
  {
2
- {{#cap.isNodejs}}
2
+ {{#isNodejs}}
3
3
  "dependencies": {
4
4
  "@sap/audit-logging": "^5"
5
5
  },
6
6
  "cds": {
7
- {{/cap.isNodejs}}
7
+ {{/isNodejs}}
8
8
  "requires": {
9
- {{#cap.for}}
10
- "[{{cap.for}}]": {
11
- {{/cap.for}}
12
- {{#cap.shortcut}}
9
+ {{#profile}}
10
+ "[{{profile}}]": {
11
+ {{/profile}}
12
+ {{#shortcut}}
13
13
  "audit-log": "service"
14
- {{/cap.shortcut}}
15
- {{^cap.shortcut}}
14
+ {{/shortcut}}
15
+ {{^shortcut}}
16
16
  "audit-log": {
17
17
  "kind": "service"
18
18
  }
19
- {{/cap.shortcut}}
20
- {{#cap.for}}
19
+ {{/shortcut}}
20
+ {{#profile}}
21
21
  }
22
- {{/cap.for}}
22
+ {{/profile}}
23
23
  }
24
- {{#cap.isNodejs}}
24
+ {{#isNodejs}}
25
25
  }
26
- {{/cap.isNodejs}}
26
+ {{/isNodejs}}
27
27
  }
@@ -14,15 +14,15 @@ module.exports = class AuditlogTemplate extends require('../templateBase') {
14
14
 
15
15
  async run() {
16
16
  const projectDescriptor = await readProject(this.options)
17
- const { configFile } = projectDescriptor.cap
18
- projectDescriptor.cap.shortcut = !(await read(configFile)).cds?.requires?.['audit-log']?.kind
17
+ const { configFile } = projectDescriptor
18
+ projectDescriptor.shortcut = !(await read(configFile)).cds?.requires?.['audit-log']?.kind
19
19
  await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), projectDescriptor)
20
20
  await this.runDependentMerging()
21
21
  }
22
22
 
23
23
  async runDependentMerging(context = {}) {
24
24
  const projectDescriptor = await readProject(this.options)
25
- const { isNodejs, hasMta, hasHelm, srvPath } = projectDescriptor.cap
25
+ const { isNodejs, hasMta, hasHelm, srvPath } = projectDescriptor
26
26
 
27
27
  if (hasMta) {
28
28
  const srv = (isNodejs ? srvNode4 : srvJava4)(srvPath)