@sap/cds-dk 7.9.5 → 8.0.2

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 (283) hide show
  1. package/CHANGELOG.md +2116 -0
  2. package/bin/add.js +18 -52
  3. package/bin/bind.js +2 -2
  4. package/bin/build.js +29 -4
  5. package/bin/cds.js +23 -11
  6. package/bin/compile/index.js +7 -6
  7. package/bin/completion/index.js +70 -46
  8. package/bin/completion/scripts/cds-bash.sh +4 -1
  9. package/bin/completion/scripts/cds-fish.fish +13 -0
  10. package/bin/completion/scripts/cds-ps.ps1 +2 -1
  11. package/bin/completion/scripts/cds-zsh.sh +2 -1
  12. package/bin/deploy/index.js +6 -5
  13. package/bin/deploy/to-sqlite.js +2 -2
  14. package/bin/extend.js +19 -50
  15. package/bin/help.js +2 -2
  16. package/bin/init.js +10 -77
  17. package/bin/login.js +13 -5
  18. package/bin/migrate.js +1 -1
  19. package/bin/pull.js +11 -0
  20. package/bin/repl.js +3 -0
  21. package/bin/test.js +5 -0
  22. package/bin/version.js +7 -7
  23. package/bin/watch.js +1 -10
  24. package/lib/bind/KubernetesApiAccessor.js +10 -9
  25. package/lib/build/buildTaskEngine.js +11 -7
  26. package/lib/build/buildTaskFactory.js +15 -43
  27. package/lib/build/buildTaskProviderFactory.js +16 -44
  28. package/lib/build/constants.js +3 -3
  29. package/lib/build/index.js +2 -2
  30. package/lib/build/{buildPlugin.js → plugin.js} +65 -46
  31. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/Chart.yaml +1 -1
  32. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/values.yaml +1 -1
  33. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/Chart.yaml +1 -1
  34. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/templates/_helpers.tpl +7 -0
  35. package/lib/build/plugins/helm/files/subcharts/service-instance/templates/servicebinding.yaml +32 -0
  36. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/templates/serviceinstance.yaml +3 -0
  37. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/values.schema.json +63 -0
  38. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/values.yaml +23 -1
  39. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/Chart.yaml +1 -1
  40. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/deployment.yaml +2 -0
  41. package/lib/build/plugins/helm/files/subcharts/web-application/templates/hpa.yaml +22 -0
  42. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/pod-disruption-budget.yaml +1 -0
  43. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/values.schema.json +49 -0
  44. package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/values.yaml +8 -2
  45. package/lib/{init/template/helm/files/chart → build/plugins/helm/files}/templates/_deployment_helpers.tpl +5 -0
  46. package/lib/build/plugins/helm/files/templates/_helpers.tpl +13 -0
  47. package/lib/build/plugins/helm/index.js +81 -0
  48. package/lib/build/plugins.js +12 -15
  49. package/lib/build/provider/featureToggleBuildPlugin.js +7 -39
  50. package/lib/build/provider/hana/2migration.js +168 -124
  51. package/lib/build/provider/hana/index.js +20 -25
  52. package/lib/build/provider/hana/template/package.json +4 -3
  53. package/lib/build/provider/internalBuildPlugin.js +32 -97
  54. package/lib/build/provider/internalBuildTaskProvider.js +10 -46
  55. package/lib/build/provider/java/index.js +2 -3
  56. package/lib/build/provider/mtx/index.js +5 -4
  57. package/lib/build/provider/mtx-extension/index.js +5 -2
  58. package/lib/build/provider/mtx-sidecar/index.js +2 -2
  59. package/lib/build/util.js +83 -12
  60. package/lib/compile/to-mermaid.js +108 -0
  61. package/lib/compile/to_asyncapi.js +7 -0
  62. package/lib/compile/to_openapi.js +7 -0
  63. package/lib/deploy/to-hana/hana.js +37 -34
  64. package/lib/deploy/to-hana/hdiDeployUtil.js +8 -6
  65. package/lib/env/schemas/cds-rc.js +1 -1
  66. package/lib/import/common.js +2 -2
  67. package/lib/import/odata/metadataconverter/MetadataConverter.js +4 -4
  68. package/lib/import/odata/v2parser.js +83 -197
  69. package/lib/import/odata/v4parser.js +1 -38
  70. package/lib/import/openapi/importOpenAPI.js +164 -42
  71. package/lib/index.js +10 -12
  72. package/lib/init/bas.js +91 -0
  73. package/lib/init/constants.js +16 -10
  74. package/lib/init/index.js +72 -150
  75. package/lib/init/merge.js +12 -20
  76. package/lib/init/mvn.js +103 -150
  77. package/lib/init/plugin.js +11 -7
  78. package/lib/init/projectReader.js +53 -19
  79. package/lib/init/registries/mta.js +51 -6
  80. package/lib/init/template/application-logging/files/package.json.hbs +7 -0
  81. package/lib/init/template/application-logging/index.js +13 -1
  82. package/lib/init/template/approuter/files/containerize.yaml.hbs +10 -0
  83. package/lib/init/template/approuter/files/mta.yaml.hbs +1 -2
  84. package/lib/init/template/approuter/files/values.yaml.hbs +19 -4
  85. package/lib/init/template/approuter/files/xs-app.json.hbs +12 -3
  86. package/lib/init/template/approuter/index.js +29 -25
  87. package/lib/init/template/attachments/files/mta.yaml.hbs +14 -0
  88. package/lib/init/template/attachments/files/package.json.hbs +5 -0
  89. package/lib/init/template/attachments/files/values.yaml +7 -0
  90. package/lib/init/template/attachments/index.js +53 -0
  91. package/lib/init/template/audit-logging/files/mta.yaml.hbs +14 -0
  92. package/lib/init/template/audit-logging/files/package.json.hbs +7 -0
  93. package/lib/init/template/audit-logging/index.js +66 -0
  94. package/lib/init/template/cf-manifest/index.js +4 -0
  95. package/lib/init/template/completion/completionSetup.js +54 -33
  96. package/lib/init/template/completion/index.js +7 -1
  97. package/lib/init/template/connectivity/index.js +4 -4
  98. package/lib/init/template/containerize/files/containerize.yaml.hbs +26 -0
  99. package/lib/init/template/containerize/index.js +24 -0
  100. package/lib/init/template/data/index.js +4 -0
  101. package/lib/init/template/destination/files/mta.yaml.hbs +25 -1
  102. package/lib/init/template/destination/index.js +12 -2
  103. package/lib/init/template/enterprise-messaging/index.js +6 -3
  104. package/lib/init/template/enterprise-messaging-shared/index.js +5 -1
  105. package/lib/init/template/extensibility/files/package.json.hbs +1 -1
  106. package/lib/init/template/extensibility/files/xs-security.json.hbs +2 -8
  107. package/lib/init/template/extensibility/index.js +3 -1
  108. package/lib/init/template/file-based-messaging/index.js +4 -0
  109. package/lib/init/template/h2/index.js +4 -0
  110. package/lib/init/template/hana/files/containerize.yaml.hbs +10 -0
  111. package/lib/init/template/hana/files/db/package.json +3 -2
  112. package/lib/init/template/hana/files/package.json.hbs +4 -7
  113. package/lib/init/template/hana/files/values.yaml.hbs +1 -2
  114. package/lib/init/template/hana/index.js +15 -7
  115. package/lib/init/template/helm/files/Chart.yaml.hbs +2 -3
  116. package/lib/init/template/helm/files/values.schema.json +2173 -0
  117. package/lib/init/template/helm/files/values.yaml.hbs +11 -6
  118. package/lib/init/template/helm/index.js +77 -18
  119. package/lib/init/template/helm-unified-runtime/index.js +19 -56
  120. package/lib/init/template/html5-repo/files/app-package.json.hbs +11 -7
  121. package/lib/init/template/html5-repo/files/manifest.json +13 -0
  122. package/lib/init/template/html5-repo/files/mta.yaml.hbs +41 -8
  123. package/lib/init/template/html5-repo/files/ui5-deploy.yaml.hbs +21 -0
  124. package/lib/init/template/html5-repo/files/ui5.yaml.hbs +2 -29
  125. package/lib/init/template/html5-repo/files/values.yaml.hbs +6 -2
  126. package/lib/init/template/html5-repo/files/xs-app.json.hbs +21 -8
  127. package/lib/init/template/html5-repo/index.js +33 -30
  128. package/lib/init/template/http/index.js +36 -12
  129. package/lib/init/template/java/index.js +18 -12
  130. package/lib/init/template/kafka/index.js +4 -0
  131. package/lib/init/template/lint/index.js +7 -2
  132. package/lib/init/template/liquibase/index.js +4 -0
  133. package/lib/init/template/local-messaging/index.js +4 -0
  134. package/lib/init/template/malware-scanner/files/mta.yaml.hbs +14 -0
  135. package/lib/init/template/malware-scanner/files/package.json.hbs +17 -0
  136. package/lib/init/template/malware-scanner/files/values.yaml +7 -0
  137. package/lib/init/template/malware-scanner/index.js +47 -0
  138. package/lib/init/template/mta/files/mta.yaml.hbs +3 -3
  139. package/lib/init/template/mta/files/package.json +1 -1
  140. package/lib/init/template/mta/index.js +4 -0
  141. package/lib/init/template/mtx/index.js +4 -0
  142. package/lib/init/template/multitenancy/files/containerize.yaml.hbs +10 -0
  143. package/lib/init/template/multitenancy/files/mta.yaml.hbs +0 -1
  144. package/lib/init/template/multitenancy/files/package.json.hbs +1 -1
  145. package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +6 -5
  146. package/lib/init/template/multitenancy/files/values.yaml.hbs +14 -24
  147. package/lib/init/template/multitenancy/index.js +50 -28
  148. package/lib/init/template/nodejs/files/eslint.config.mjs +2 -0
  149. package/lib/init/template/nodejs/files/package.json.hbs +2 -3
  150. package/lib/init/template/nodejs/index.js +4 -0
  151. package/lib/init/template/notifications/files/mta.yaml.hbs +2 -2
  152. package/lib/init/template/notifications/index.js +4 -0
  153. package/lib/init/template/pipeline/files/.pipeline/config.yml +1 -1
  154. package/lib/init/template/pipeline/files/Jenkinsfile +1 -1
  155. package/lib/init/template/pipeline/index.js +4 -0
  156. package/lib/init/template/portal/files/mta.yaml.hbs +52 -0
  157. package/lib/init/template/portal/files/package.json.hbs +11 -0
  158. package/lib/init/template/portal/files/package.sidecar.json +7 -0
  159. package/lib/init/template/portal/files/portal-site/CommonDataModel.json.hbs +97 -0
  160. package/lib/init/template/portal/files/portal-site/i18n/catalog.properties +1 -0
  161. package/lib/init/template/portal/files/portal-site/i18n/catalog_de.properties +1 -0
  162. package/lib/init/template/portal/files/portal-site/i18n/group.properties +1 -0
  163. package/lib/init/template/portal/files/portal-site/i18n/group_de.properties +1 -0
  164. package/lib/init/template/portal/index.js +84 -0
  165. package/lib/init/template/postgres/index.js +5 -1
  166. package/lib/init/template/redis-messaging/index.js +4 -0
  167. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_de.properties +3 -0
  168. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_en.properties +3 -0
  169. package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +13 -1
  170. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n.properties +2 -2
  171. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_de.properties +3 -0
  172. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_en.properties +4 -0
  173. package/lib/init/template/sample/files/app/browse/webapp/manifest.json +3 -3
  174. package/lib/init/template/sample/files/app/index.html +1 -1
  175. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +5 -5
  176. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +6 -6
  177. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books_texts.csv +5 -5
  178. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +16 -16
  179. package/lib/init/template/sample/files/nodejs/cat-service.js +2 -2
  180. package/lib/init/template/sample/files/package.json.hbs +3 -0
  181. package/lib/init/template/sample/index.js +16 -9
  182. package/lib/init/template/sqlite/index.js +4 -0
  183. package/lib/init/template/tiny-sample/files/nodejs/db/data/my.bookshop-Books.csv +3 -3
  184. package/lib/init/template/tiny-sample/files/nodejs/srv/cat-service.cds.hbs +1 -1
  185. package/lib/init/template/tiny-sample/index.js +4 -0
  186. package/lib/init/template/toggles/files/package.json.hbs +1 -1
  187. package/lib/init/template/toggles/index.js +4 -0
  188. package/lib/init/template/typer/index.js +4 -0
  189. package/lib/init/template/typescript/files/package.json +12 -0
  190. package/lib/init/template/typescript/files/tsconfig.json +13 -0
  191. package/lib/init/template/typescript/index.js +39 -0
  192. package/lib/init/template/workzone/index.js +5 -0
  193. package/lib/init/template/workzone-standard/files/manifest.json.hbs +6 -0
  194. package/lib/init/template/workzone-standard/index.js +30 -0
  195. package/lib/init/template/xsuaa/files/package.json.hbs +1 -1
  196. package/lib/init/template/xsuaa/files/values.yaml.hbs +3 -2
  197. package/lib/init/template/xsuaa/index.js +11 -7
  198. package/lib/init/validate.js +27 -0
  199. package/lib/lint/generators.js +1 -1
  200. package/lib/lint/io.js +25 -7
  201. package/lib/mtx/auth_manager.js +64 -30
  202. package/lib/mtx/download_legacy.js +2 -2
  203. package/lib/mtx/index.js +0 -4
  204. package/lib/mtx/params.js +32 -38
  205. package/lib/mtx/pull.js +151 -43
  206. package/lib/mtx/push.js +3 -3
  207. package/lib/mtx/settings_manager.js +75 -35
  208. package/lib/mtx/tenant_action.js +1 -1
  209. package/lib/mtx/util/cf.js +1 -1
  210. package/lib/mtx/util/fs.js +26 -1
  211. package/lib/mtx/util/logging.js +7 -3
  212. package/lib/util/command.js +0 -2
  213. package/lib/util/fs.js +2 -3
  214. package/lib/util/question.js +28 -0
  215. package/lib/util/term.js +5 -3
  216. package/npm-shrinkwrap.json +226 -1087
  217. package/package.json +13 -8
  218. package/bin/activate.js +0 -77
  219. package/lib/compile/asyncapi/channels.js +0 -22
  220. package/lib/compile/asyncapi/components/messageTraits/index.js +0 -89
  221. package/lib/compile/asyncapi/components/messages/index.js +0 -173
  222. package/lib/compile/asyncapi/components/schemas/annotations.js +0 -33
  223. package/lib/compile/asyncapi/components/schemas/array.js +0 -8
  224. package/lib/compile/asyncapi/components/schemas/cache.js +0 -14
  225. package/lib/compile/asyncapi/components/schemas/definition.js +0 -187
  226. package/lib/compile/asyncapi/components/schemas/enum.js +0 -16
  227. package/lib/compile/asyncapi/components/schemas/examples.js +0 -10
  228. package/lib/compile/asyncapi/components/schemas/index.js +0 -14
  229. package/lib/compile/asyncapi/components/schemas/localized.js +0 -29
  230. package/lib/compile/asyncapi/components/schemas/primitiveElement.js +0 -41
  231. package/lib/compile/asyncapi/components/schemas/ref.js +0 -45
  232. package/lib/compile/asyncapi/components/schemas/utils.js +0 -108
  233. package/lib/compile/asyncapi/index.js +0 -247
  234. package/lib/compile/asyncapi/message.js +0 -13
  235. package/lib/compile/asyncapi/utils.js +0 -27
  236. package/lib/compile/openapi/csdl2openapi.js +0 -2448
  237. package/lib/compile/openapi/index.js +0 -68
  238. package/lib/init/template/helm/files/chart/templates/NOTES.txt +0 -14
  239. package/lib/init/template/helm/files/chart/templates/_helpers.tpl +0 -28
  240. package/lib/init/template/helm/files/chart/values.root.schema.json +0 -61
  241. package/lib/init/template/helm/files/chart/values.schema.json +0 -366
  242. package/lib/init/template/helm-unified-runtime/files/Chart.yaml.hbs +0 -10
  243. package/lib/init/template/helm-unified-runtime/files/templates/_deployment_helpers.tpl +0 -90
  244. package/lib/init/template/helm-unified-runtime/files/templates/_helpers.tpl +0 -28
  245. package/lib/init/template/helm-unified-runtime/files/values.root.schema.json +0 -61
  246. package/lib/init/template/helm-unified-runtime/files/values.schema.json +0 -366
  247. package/lib/init/template/helm-unified-runtime/files/values.yaml.hbs +0 -26
  248. package/lib/init/template/helm-unified-runtime/package.json +0 -4
  249. package/lib/init/template/multitenancy/files/mtxs-configmap-java-approuter.yaml +0 -20
  250. package/lib/init/template/multitenancy/files/mtxs-configmap-java.yaml +0 -18
  251. package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs-approuter.yaml +0 -12
  252. package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs.yaml +0 -12
  253. package/lib/init/template/multitenancy/files/saas-registry-secret.yaml +0 -9
  254. package/lib/init/template/nodejs/files/eslint.config.js +0 -13
  255. package/lib/init/template/notebook/index.js +0 -11
  256. package/lib/init/template/samples/index.js +0 -9
  257. package/lib/mtx/activate.js +0 -238
  258. package/lib/mtx/extend.js +0 -173
  259. package/lib/util/exec.d.ts +0 -54
  260. package/lib/util/exec.js +0 -211
  261. /package/lib/{init/template/approuter/files → build/plugins/helm/files/plugins/approuter}/approuter-configmap.yaml +0 -0
  262. /package/lib/{init/template/connectivity/files → build/plugins/helm/files/plugins/connectivity}/connectivity-proxy-info.yaml +0 -0
  263. /package/lib/{init/template/html5-repo/files → build/plugins/helm/files/plugins/html5-repo}/html5-apps-deployer-configmap.yaml +0 -0
  264. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/_helpers.tpl +0 -0
  265. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/job.yaml +0 -0
  266. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/secret.yaml +0 -0
  267. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-account.yaml +0 -0
  268. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-binding.yaml +0 -0
  269. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/values.schema.json +0 -0
  270. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/NOTES.txt +0 -0
  271. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_api.tpl +0 -0
  272. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_helpers.tpl +0 -0
  273. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/api-rule.yaml +0 -0
  274. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/network-policy.yaml +0 -0
  275. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/rbac.yaml +0 -0
  276. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/secret.yaml +0 -0
  277. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-account.yaml +0 -0
  278. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-binding.yaml +0 -0
  279. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service.yaml +0 -0
  280. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/virtual-service.yaml +0 -0
  281. /package/lib/{init/template/helm-unified-runtime → build/plugins/helm}/files/templates/NOTES.txt +0 -0
  282. /package/lib/init/template/{nodejs/files → java}/.cdsrc.json +0 -0
  283. /package/lib/init/template/tiny-sample/files/nodejs/db/{data-model.cds → schema.cds} +0 -0
package/lib/init/mvn.js CHANGED
@@ -1,179 +1,132 @@
1
+ const util = require('util')
2
+ const { exec } = require('child_process')
3
+ const execAsync = util.promisify(exec)
1
4
 
2
- const { URLS, MAVEN_ARCHETYPE_VERSION, OPTIONS: { JAVA_MVN, JAVA_PACKAGE, HANA }, REGEX_JAVA_PACKAGE } = require('./constants');
5
+ const term = require('../util/term')
6
+ const cmd = require('../util/command')
3
7
 
4
- const cp = require('child_process');
5
- const util = require('util');
6
- const execAsync = util.promisify(cp.exec);
7
- const term = require('../util/term');
8
- const cmd = require('../util/command');
9
-
10
- const DEFAULT_GROUP_ID = 'customer';
11
-
12
- const LOG = console
13
8
  const cds = require('../cds')
14
- const DEBUG = cds.debug('cli')
15
-
16
- class MvnArchetypeUtil {
17
-
18
- _scanMvnParams(mvnParams, params) {
19
- // need to create new regex every call since a constant
20
- // would keep the match state
21
-
22
- const quoteRegex = /([\w\-.]+)=([\w\-.]+|\[([\w.\-,]+)\])/g;
23
- // captures a=1 => a:1
24
- // -Da=[x,y,z] => -Da:x,y,z (Maven specific)
25
- // a=[x,y,z] => a:x,y,z
26
-
27
- let match = quoteRegex.exec(mvnParams);
28
- while (match != null) {
29
- const key = (match[1].startsWith('-D') ? match[1] : `-D${match[1]}`);
30
- params.set(key, match[3] || match[2]);
31
- match = quoteRegex.exec(mvnParams);
32
- }
33
- }
34
-
35
- _finalize(params) {
36
- params.set(`-Dstyle.color`, `always`);
37
-
38
- params.set('-B');
39
-
40
- if (DEBUG) {
41
- params.set('-X'); params.set('-e');
42
- }
43
- if (process.env.CI) {
44
- params.set('--batch-mode');
45
- }
46
-
47
- return Array.from(params, ([arg, val]) => val !== null && val !== undefined ? `${arg}=${val}` : arg)
48
- }
9
+ const DEBUG = cds.debug('cli|init|add|mvn')
49
10
 
50
- // REVISIT: make this only public API once mvn:addSample etc. have been moved to generic mvn:add
51
- async add(feature) {
52
- return this.execMvn(this.getAddArgs(feature))
53
- }
11
+ const { URLS, MAVEN_ARCHETYPE_VERSION, OPTIONS: { JAVA_PACKAGE, HANA }, REGEX_JAVA_PACKAGE } = require('./constants')
54
12
 
55
- getAddArgs(feature) {
56
- const params = new Map();
13
+ module.exports.add = async function (feature) {
14
+ const params = new Map()
57
15
 
58
- params.set(`com.sap.cds:cds-maven-plugin:${MAVEN_ARCHETYPE_VERSION}:add`);
16
+ const { 'java:mvn': javaMvn, force } = cds.cli.options
17
+ if (javaMvn) _scan(javaMvn).forEach(([k,v]) => params.set(k,v))
18
+ const archetypeVersion = params.get('-DarchetypeVersion') ?? MAVEN_ARCHETYPE_VERSION
19
+ if (feature === HANA) { // REVISIT: compat for HANA when -Dfeature HANA is provided by Java
20
+ params.set(`com.sap.cds:cds-maven-plugin:${archetypeVersion}:addTargetPlatform`)
21
+ params.set(`-DtargetPlatform`, `cloudfoundry`) // REVISIT: No special handling for HANA
22
+ } else {
23
+ params.set(`com.sap.cds:cds-maven-plugin:${archetypeVersion}:add`)
59
24
  params.set(`-Dfeature`, feature)
60
25
  const profile = cds.cli.options.for
61
26
  params.set(`-Dprofile`, profile === 'production' ? 'cloud' : profile ?? 'default')
62
-
63
- const { options } = cds.cli
64
- if (options[JAVA_MVN]) {
65
- this._scanMvnParams(options[JAVA_MVN], params);
66
- }
67
-
68
- if (options.force) {
69
- params.set(`-Doverwrite`, true);
70
- }
71
-
72
- return this._finalize(params);
73
27
  }
74
28
 
75
- getAddHanaCmdArgs() {
76
- const params = new Map();
77
-
78
- params.set(`com.sap.cds:cds-maven-plugin:${MAVEN_ARCHETYPE_VERSION}:addTargetPlatform`);
79
- params.set(`-DtargetPlatform`, `cloudfoundry`);
80
-
81
- const javaMvn = cds.cli.options[JAVA_MVN]
82
- if (javaMvn) {
83
- this._scanMvnParams(javaMvn, params);
29
+ if (force) params.set(`-Doverwrite`, true)
30
+ try {
31
+ await cmd.spawnCommand('mvn', _finalize(params), { cwd: cds.root })
32
+ } catch (err) {
33
+ if (err.code === 'ENOENT' && err.path === 'mvn') {
34
+ throw `Maven executable 'mvn' not found. Follow ${term.info(URLS.MAVEN_INSTALL_HELP)} and install Maven on your machine.`
84
35
  }
85
-
86
- return this._finalize(params);
87
- }
88
-
89
- sanitizePackageName(packageName) {
90
- return packageName.toLowerCase().replace(/-/g, '_').replace(/\.([0-9])/g, '._$1').replace(/^([0-9])/, '_$1').replace(/\.+/g, '.');
36
+ throw err
91
37
  }
38
+ }
92
39
 
93
- async getGenerateCmdArgs(projectName, options = cds.cli.options) {
94
- const params = new Map();
40
+ module.exports.init = async function (projectName, options = cds.cli.options) {
41
+ const params = new Map()
95
42
 
96
- // set header
97
- params.set(`archetype:generate`);
98
- params.set(`-DarchetypeArtifactId`, `cds-services-archetype`);
99
- params.set(`-DarchetypeGroupId`, `com.sap.cds`);
100
- params.set(`-DarchetypeVersion`, MAVEN_ARCHETYPE_VERSION);
101
- params.set('-DinteractiveMode', false);
43
+ // set header
44
+ params.set(`archetype:generate`);
45
+ params.set(`-DarchetypeArtifactId`, `cds-services-archetype`);
46
+ params.set(`-DarchetypeGroupId`, `com.sap.cds`);
47
+ params.set(`-DarchetypeVersion`, MAVEN_ARCHETYPE_VERSION);
48
+ params.set('-DinteractiveMode', false);
102
49
 
103
- // set defaults, might be changed by java:mvn param
104
- params.set(`-DartifactId`, projectName);
105
- params.set(`-DgroupId`, DEFAULT_GROUP_ID);
50
+ // set defaults, might be changed by java:mvn param
51
+ params.set(`-DartifactId`, projectName);
52
+ params.set(`-DgroupId`, 'customer');
106
53
 
107
- const hasHana = !!(options.add && options.add.has(HANA));
108
- if (hasHana) {
109
- params.set(`-DtargetPlatform`, `cloudfoundry`);
110
- }
54
+ const { 'java:mvn': javaMvn } = options
55
+ if (javaMvn) _scan(javaMvn).forEach(([k,v]) => params.set(k,v))
111
56
 
112
- if (options[JAVA_MVN]) {
113
- this._scanMvnParams(options[JAVA_MVN], params);
57
+ // -DjdkVersion=[11|17]
58
+ if (!params.get('-DjdkVersion')) {
59
+ let javaVersion
60
+ try {
61
+ javaVersion = await execAsync('java -version');
62
+ } catch (err) {
63
+ DEBUG?.(err);
114
64
  }
115
-
116
- // -DjdkVersion=[11|17]
117
- if (!params.get('-DjdkVersion')) {
118
- let javaVersion
119
- try {
120
- javaVersion = await execAsync('java -version');
121
- } catch (err) {
122
- DEBUG?.(err);
123
- }
124
- const [,version] = javaVersion?.stderr?.match(/version\s*"?(\d+\.\d+\.\d+)"?/) ?? [];
125
- if (version) {
126
- const [major] = version.split('.').map(Number);
127
- if (major < 17) {
128
- if (process.env.WS_BASE_URL) {
129
- throw `Java version ${version} is not supported. Use Java 17 or higher. You can use command 'Java: Set Default JDK' to switch to Java 17.`
130
- }
131
- throw `Java version ${version} is not supported. Use Java 17 or higher.`
65
+ const [,version] = javaVersion?.stderr?.match(/version\s*"?(\d+\.\d+\.\d+)"?/) ?? [];
66
+ if (version) {
67
+ const [major] = version.split('.').map(Number);
68
+ if (major < 17) {
69
+ if (process.env.WS_BASE_URL) {
70
+ throw `Java version ${version} is not supported. Use Java 17 or higher. You can use command 'Java: Set Default JDK' to switch to Java 17.`
132
71
  }
72
+ throw `Java version ${version} is not supported. Use Java 17 or higher.`
133
73
  }
134
74
  }
75
+ }
135
76
 
136
- if (options[JAVA_PACKAGE]) {
137
- params.set(`-Dpackage`, options[JAVA_PACKAGE]);
138
- }
139
-
140
- const artifactId = params.get('-DartifactId');
141
-
142
- const packageFromParam = params.get(`-Dpackage`);
143
- if (packageFromParam) {
144
- // explicitly specified, so do not modify
145
- if (!options.force && !packageFromParam.match(REGEX_JAVA_PACKAGE)) {
146
- throw `Package '${packageFromParam}' is an invalid Java package name. Use --force to use it anyway.`
147
- }
148
- } else {
149
- // potentially overwritten by mvn param
150
- const groupId = params.get(`-DgroupId`);
151
- let packageName = `${groupId}.${projectName}`;
152
-
153
- if (!packageName.match(REGEX_JAVA_PACKAGE)) {
154
- packageName = this.sanitizePackageName(packageName);
155
- LOG.warn(`The derived package name '${groupId}.${projectName}' is not a valid Java package name. Using '${packageName}' instead.`);
156
- }
157
- params.set(`-Dpackage`, packageName);
158
- }
159
-
160
- return {
161
- cmdLine: this._finalize(params),
162
- archetypeVersion: params.get('-DarchetypeVersion'),
163
- artifactId
164
- };
77
+ if (options[JAVA_PACKAGE]) {
78
+ params.set(`-Dpackage`, options[JAVA_PACKAGE]);
165
79
  }
166
80
 
167
- async execMvn(args) {
168
- try {
169
- await cmd.spawnCommand('mvn', args, { cwd: cds.root });
170
- } catch (err) {
171
- if (err.code === 'ENOENT' && err.path === 'mvn') {
172
- throw `Maven executable 'mvn' not found, follow ${term.info(URLS.MAVEN_INSTALL_HELP)} and install Maven on your machine.`;
173
- }
174
- throw err;
81
+ const packageFromParam = params.get(`-Dpackage`);
82
+ if (packageFromParam) {
83
+ // explicitly specified, so do not modify
84
+ if (!options.force && !packageFromParam.match(REGEX_JAVA_PACKAGE)) {
85
+ throw `Package '${packageFromParam}' is an invalid Java package name. Use --force to use it anyway.`
86
+ }
87
+ } else {
88
+ // potentially overwritten by mvn param
89
+ const groupId = params.get(`-DgroupId`);
90
+ let packageName = `${groupId}.${projectName}`;
91
+
92
+ if (!packageName.match(REGEX_JAVA_PACKAGE)) {
93
+ packageName = sanitize(packageName);
94
+ console.warn(`The derived package name '${groupId}.${projectName}' is not a valid Java package name. Using '${packageName}' instead.`);
175
95
  }
96
+ params.set(`-Dpackage`, packageName);
176
97
  }
98
+
99
+ const artifactId = params.get('-DartifactId')
100
+ const archetypeVersion = params.get('-DarchetypeVersion')
101
+ return { params: _finalize(params), archetypeVersion, artifactId }
177
102
  }
178
103
 
179
- module.exports = new MvnArchetypeUtil();
104
+ const sanitize = module.exports.sanitize = name => name
105
+ .toLowerCase()
106
+ .replace(/-/g, '_')
107
+ .replace(/\.([0-9])/g, '._$1')
108
+ .replace(/^([0-9])/, '_$1')
109
+ .replace(/\.+/g, '.')
110
+
111
+ function _scan(mvnParams) {
112
+ // need to create new regex every call since a constant
113
+ // would keep the match state
114
+ // captures a=1 => a:1
115
+ // -Da=[x,y,z] => -Da:x,y,z (Maven specific)
116
+ // a=[x,y,z] => a:x,y,z
117
+ const quoteRegex = /([\w\-.]+)=([\w\-.]+|\[([\w.\-,]+)\])/g
118
+ return [...mvnParams.matchAll(quoteRegex)].map(([,key,value,listValues]) => {
119
+ key = key.startsWith('-D') ? key : `-D${key}`
120
+ return [key, listValues || value]
121
+ })
122
+ }
123
+
124
+ function _finalize(params) {
125
+ params.set(`-Dstyle.color`, `always`)
126
+ if (DEBUG) params.set('-X')
127
+ if (DEBUG) params.set('-e')
128
+ if (process.env.CI) params.set('--batch-mode')
129
+ const final = Array.from(params, ([arg, val]) => val !== null && val !== undefined ? `${arg}=${val}` : arg)
130
+ DEBUG?.(term.highlight('mvn' + final.join(' ')))
131
+ return final
132
+ }
@@ -1,8 +1,7 @@
1
1
  const { join } = require('path')
2
2
  const cds = require('../cds')
3
3
  const { readdir } = cds.utils
4
- const DEBUG = cds.debug('add')
5
- const { env4 } = require('./projectReader')
4
+ const DEBUG = cds.debug('cli|add')
6
5
 
7
6
  module.exports = class Plugin {
8
7
 
@@ -28,13 +27,20 @@ module.exports = class Plugin {
28
27
  */
29
28
  async canRun() { return true }
30
29
 
30
+ /**
31
+ * Gets a brief help text for the plugin.
32
+ * Displayed when all plugins are listed with `cds add`.
33
+ * @returns {string} The help text.
34
+ */
35
+ static help() { return '' }
36
+
31
37
  /**
32
38
  * Determines if the plugin has already been added to the project.
33
39
  * @param {import('@sap/cds').env} env - The env for the 'production' profile.
34
40
  * @returns {boolean} - Returns `true` if the template has been added, otherwise `false`.
35
41
  */
36
42
  static hasInProduction(env) { // eslint-disable-line no-unused-vars
37
- return false
43
+ return true
38
44
  }
39
45
 
40
46
  /**
@@ -48,9 +54,6 @@ module.exports = class Plugin {
48
54
  async combine() { }
49
55
 
50
56
 
51
-
52
-
53
-
54
57
  /* ––––––––––––
55
58
  Yeoman Generator
56
59
  –––––––––––– */
@@ -58,7 +61,7 @@ module.exports = class Plugin {
58
61
  /**
59
62
  * Runs the finalize operations.
60
63
  */
61
- async finalize() { } // REVISIT: Required for yo-generator, check if needed any more?
64
+ async finalize() { }
62
65
 
63
66
  /* ––––––––––––
64
67
  Private APIs
@@ -69,6 +72,7 @@ module.exports = class Plugin {
69
72
  DEBUG && console.log('Plugins active for production:')
70
73
  const fromDk = await readdir(join(__dirname, './template'))
71
74
  const { registered } = require('./add')
75
+ const { env4 } = require('./projectReader')
72
76
  const processPlugins = async (plugins) => {
73
77
  for (const plugin of plugins) {
74
78
  const Plugin = registered.get(plugin) ?? require('./template/' + plugin)
@@ -9,7 +9,9 @@ module.exports = new class ProjectReader {
9
9
 
10
10
  constructor() {
11
11
  this.readProject = this.readProject.bind(this)
12
+ }
12
13
 
14
+ #setPackageInfo() {
13
15
  // 1. Use project name and static default values
14
16
  this.appVersion = cds.cli.options.add?.has('java') ? '1.0.0-SNAPSHOT' : '1.0.0'
15
17
  this.appName = this.appId = basename(cds.root)
@@ -69,6 +71,8 @@ module.exports = new class ProjectReader {
69
71
  * @property {boolean} hasUIEmbedded Indicates if the project uses an embedded UI.
70
72
  * @property {boolean} hasUIModule Indicates if the project is using a modular UI.
71
73
  * @property {boolean} hasUI Indicates if the project has a UI.
74
+ * @property {boolean} hasUI5 Indicates if the project is a UI5 project.
75
+ * @property {boolean} isUI5 Indicates if the project is a UI5 project.
72
76
  * @property {boolean} isJava Indicates if the project is using Java.
73
77
  * @property {boolean} isNodejs Indicates if the project is using Node.js.
74
78
  * @property {boolean} hasHelmUnifiedRuntime Indicates if the project uses Unified Runtime Helm deployment.
@@ -82,9 +86,14 @@ module.exports = new class ProjectReader {
82
86
  * @property {boolean} hasHana Indicates if the project uses HANA.
83
87
  * @property {boolean} hasPostgres Indicates if the project uses PostgreSQL.
84
88
  * @property {boolean} hasEnterpriseMessaging Indicates if the project uses SAP BTP Event Mesh.
89
+ * @property {boolean} hasAttachments Indicates if the project uses SAP BTP Object Store Service.
85
90
  * @property {boolean} hasApprouter Indicates if the project uses the SAP Application Router.
86
91
  * @property {boolean} hasHtml5Repo Indicates if the project uses the SAP BTP HTML5 Application Repository.
92
+ * @property {boolean} hasPortal Indicates if the project uses the SAP Cloud Portal serivce.
87
93
  * @property {boolean} hasDestination Indicates if the project uses the SAP BTP Destination service.
94
+ * @property {boolean} hasMTXRoute Indicates if the approuter should have a multitenant route.
95
+ * @property {boolean} hasMTXRouteJava Indicates if the approuter should have a multitenant subscription route (java).
96
+ * @property {boolean} hasMalwareScanner Indicates if the project uses the SAP Malware Scanning service.
88
97
  *
89
98
  */
90
99
 
@@ -95,22 +104,30 @@ module.exports = new class ProjectReader {
95
104
  * @returns {ProjectConfig} An object representing the project configuration.
96
105
  */
97
106
  readProject() {
107
+ if (!this.appName) this.#setPackageInfo()
98
108
  const env = this.env4('production')
99
109
  const { appVersion, appName, appId, appDescription, jdkVersion } = this
100
110
  DEBUG?.({ env })
101
111
 
102
112
  const _inProd = plugin => require(`./template/${plugin}`).hasInProduction(env)
113
+ const _ui5 = () => exists('package.json') && !!JSON.parse(fs.readFileSync(path.resolve(cds.root, 'package.json'))).sapux
114
+ const _uiEmbedded = () => exists(join(env.folders.app, 'xs-app.json'))
115
+ const _uiModule = () => !_uiEmbedded() && isdir(env.folders.app) && fs.readdirSync(resolve(cds.root, env.folders.app)).length > 0
116
+ const _isJava = () => exists('pom.xml') || cds.cli.options?.add?.has('java')
117
+ const isApp = name => name !== 'appconfig' && !name.startsWith('_') && name !== 'router' && name !== 'portal'
103
118
  const reserved = {
104
119
  has: x => _inProd(x),
105
120
  shortcut: () => true,
106
121
  profile: () => cds.cli.options?.for,
107
122
  language: () => exists('pom.xml') ? 'java' : 'nodejs',
108
- isJava: () => exists('pom.xml') || cds.cli.options?.add?.has('java'),
109
- isNodejs: () => !exists('pom.xml') && !cds.cli.options?.add?.has('java'),
123
+ isJava: () => _isJava(),
124
+ isNodejs: () => !_isJava(),
110
125
  srvPath: () => join(env.build.target, env.folders.srv.replace(/\/$/, '')).replace(/\\/g, '/'),
111
126
  archiveName: () => {
112
- const pom = parseXml(resolve(cds.root, env.folders.srv, 'pom.xml'))
113
- return (pom?.artifactId?.[0] ?? basename(cds.root)) + '-exec.' + pom?.packaging?.[0]
127
+ const pomXmlPath = resolve(cds.root, env.folders.srv, 'pom.xml')
128
+ const pom = exists(pomXmlPath) ? parseXml(pomXmlPath) : {}
129
+ const { artifactId = [basename(cds.root)], packaging = ['jar'] } = pom
130
+ return artifactId[0] + '-exec.' + packaging[0]
114
131
  },
115
132
  db: () => {
116
133
  const folder = env.folders.db
@@ -119,27 +136,51 @@ module.exports = new class ProjectReader {
119
136
  return { folder, name, path }
120
137
  },
121
138
  configFile: () => exists('pom.xml') ? '.cdsrc.json' : 'package.json',
122
- apps: () => (fs.readdirSync(path.resolve(cds.root, cds.env.folders.app))).filter(e =>
123
- isdir(join(cds.root, cds.env.folders.app, e)) && e !== 'appconfig' && e !== '_i18n' && e !== 'router'
124
- ).map(app => ({ app })),
139
+ apps: () => {
140
+ const apps = fs.readdirSync(path.resolve(cds.root, cds.env.folders.app)).filter(e =>
141
+ isdir(path.join(cds.root, cds.env.folders.app, e)) && isApp(e)
142
+ )
143
+ return apps.map((app, i) => {
144
+ const manifestPath = path.resolve(cds.root, cds.env.folders.app, app, 'webapp/manifest.json')
145
+ const manifest = exists(manifestPath) ? JSON.parse(fs.readFileSync(manifestPath, 'utf-8')) : {}
146
+ const inbounds = manifest?.['sap.app']?.crossNavigation?.inbounds
147
+ const [firstInbound] = Object.values(inbounds ?? { intent: { semanticObject: 'Books', action: 'display' }})
148
+ const vizId = firstInbound.semanticObject + '-' + firstInbound.action
149
+ return { app, strippedApp: app.replace(/-/g, ''), vizId, isNotLast: i < apps.length - 1 }
150
+ })
151
+ },
125
152
  appUIPaths: () => (fs.readdirSync(path.resolve(cds.root, cds.env.folders.app))).filter(e =>
126
- isdir(join(cds.root, cds.env.folders.app, e)) && e !== 'appconfig' && e !== '_i18n' && e !== 'router'
153
+ isdir(join(cds.root, cds.env.folders.app, e)) && isApp(e)
127
154
  ),
128
155
  appPath: () => env.folders.app,
129
156
  appVersion: () => appVersion,
130
157
  jdkVersion: () => jdkVersion,
131
- approuterPath: () => join(env.folders.app, 'router'),
158
+ approuterPath: () => _uiEmbedded() ? join(env.folders.app) : join(env.folders.app, 'router'),
132
159
  appName: () => appName,
133
160
  cleanedAppName: () => appName.replaceAll('_', '-'),
161
+ strippedAppName: () => appName.replace(/-/g, ''),
134
162
  appId: () => appId,
135
163
  appDescription: () => appDescription,
136
- hasUIEmbedded: () => exists(join(env.folders.app, 'xs-app.json')),
137
- hasUIModule: () => !this.hasUIEmbedded && isdir(env.folders.app) && fs.readdirSync(resolve(cds.root, env.folders.app)).length > 0,
138
- hasUI: () => this.hasUIEmbedded || this.hasUIModule
164
+ hasUIEmbedded: _uiEmbedded,
165
+ hasUIModule: _uiModule,
166
+ hasUI: () => _uiEmbedded() || _uiModule(),
167
+ isUI5: _ui5,
168
+ hasUI5: _ui5,
169
+ hasMTXRoute: () => _inProd('extensibility') || (_inProd('multitenancy') && !_isJava()),
170
+ hasMTXRouteJava: () => (_inProd('helm-unified-runtime') || _inProd('helm')) && _isJava() && _inProd('multitenancy'),
139
171
  }
140
172
 
173
+ // Automatically creates availability checks for `cds add` commands.
174
+ // Maps to the `hasInProduction` implemented in the command.
175
+ // E.g. `cds add hana` can be checked using `hasHana` or `isHana`
141
176
  const project = (() => {
142
177
  const defined = {}
178
+ const _get = property => { const p = property
179
+ if (p in reserved) return reserved[p]()
180
+ for (const prefix of ['has', 'is']) if (p.startsWith(prefix) && p.length > prefix.length) {
181
+ return _inProd(p.slice(prefix.length).replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase())
182
+ }
183
+ }
143
184
  return new Proxy({}, {
144
185
  get(_, p) { return _get(p) ?? defined[p] },
145
186
  set(_, p, value) { defined[p] = value; return true },
@@ -147,13 +188,6 @@ module.exports = new class ProjectReader {
147
188
  })
148
189
  })()
149
190
 
150
- const _get = property => { const p = property
151
- if (p in reserved) return reserved[p]()
152
- for (const prefix of ['has', 'is']) if (p.startsWith(prefix) && p.length > prefix.length) {
153
- return _inProd(p.slice(prefix.length).replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase())
154
- }
155
- }
156
-
157
191
  DEBUG?.({ project })
158
192
  return project
159
193
  }
@@ -3,7 +3,10 @@ const cds = require('../../cds')
3
3
 
4
4
  const srvNode4 = path => ({ in: 'modules', where: { type: 'nodejs', path } })
5
5
  const srvJava4 = path => ({ in: 'modules', where: { type: 'java', path } })
6
- const srv4 = cds.env['project-nature'] === 'java' || cds.cli.options?.add?.has('java') ? srvJava4 : srvNode4
6
+
7
+ // REVISIT: Clean up
8
+ const isJava = process.argv[process.argv.indexOf('--add') + 1].split(',').includes('java') || cds.env['project-nature'] === 'java' || cds.cli.options?.add?.has('java')
9
+ const srv4 = isJava ? srvJava4 : srvNode4
7
10
 
8
11
  const approuter = { in: 'modules', where: { type: 'approuter.nodejs' } }
9
12
 
@@ -17,6 +20,11 @@ const destination = {
17
20
  where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'destination' }
18
21
  }
19
22
 
23
+ const destinations = {
24
+ in: 'modules',
25
+ where: { type: 'com.sap.application.content', 'build-parameters.no-source': true }
26
+ }
27
+
20
28
  const connectivity = {
21
29
  in: 'resources',
22
30
  where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'connectivity' }
@@ -42,6 +50,16 @@ const applicationLogging = {
42
50
  where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'application-logs' }
43
51
  }
44
52
 
53
+ const attachments = {
54
+ in: 'resources',
55
+ where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'objectstore' }
56
+ }
57
+
58
+ const malwareScanner = {
59
+ in: 'resources',
60
+ where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'malware-scanner' }
61
+ }
62
+
45
63
  const hdbDeployer = {
46
64
  in: 'modules',
47
65
  where: { type: 'hdb' }
@@ -122,11 +140,16 @@ const providedJavaApprouterApi = {
122
140
  where: { 'properties.url': '${default-url}' }
123
141
  }
124
142
 
125
- const approuterExtensibility = {
143
+ const approuterMTXRoute = {
126
144
  in: 'routes',
127
145
  where: { source: '^/-/cds/.*', destination: 'mtx-api', authenticationType: 'none' }
128
146
  }
129
147
 
148
+ const approuterMTXRouteJava = {
149
+ in: 'routes',
150
+ where: { source: '^/mt/.*', destination: 'srv-api', authenticationType: 'none' }
151
+ }
152
+
130
153
  const html5RepoHost = {
131
154
  in: 'resources',
132
155
  where: { 'parameters.service': 'html5-apps-repo', 'parameters.service-plan': 'app-host' }
@@ -137,9 +160,24 @@ const html5Runtime = {
137
160
  where: { 'parameters.service': 'html5-apps-repo', 'parameters.service-plan': 'app-runtime' }
138
161
  }
139
162
 
140
- const appContent = {
163
+ const appDeployer = {
141
164
  in: 'modules',
142
- where: { type: 'com.sap.application.content' }
165
+ where: { type: 'com.sap.application.content', path: isJava ? '.' : 'gen' }
166
+ }
167
+
168
+ const portal = {
169
+ in: 'resources',
170
+ where: { 'parameters.service': 'portal' },
171
+ }
172
+
173
+ const portalDeployer = {
174
+ in: 'modules',
175
+ where: { type: 'com.sap.application.content', path: 'app/portal' }
176
+ }
177
+
178
+ const auditlog = {
179
+ in: 'resources',
180
+ where: { type: 'org.cloudfoundry.managed-service', 'parameters.service': 'auditlog' }
143
181
  }
144
182
 
145
183
  module.exports = {
@@ -147,6 +185,7 @@ module.exports = {
147
185
  approuter,
148
186
  xsuaa,
149
187
  destination,
188
+ destinations,
150
189
  connectivity,
151
190
  enterpriseMessaging,
152
191
  kafkaMessaging,
@@ -168,8 +207,14 @@ module.exports = {
168
207
  providedJavaApprouterApi4,
169
208
  providedJavaApprouterApi,
170
209
  applicationLogging,
171
- approuterExtensibility,
210
+ approuterMTXRoute,
211
+ approuterMTXRouteJava,
172
212
  html5RepoHost,
173
213
  html5Runtime,
174
- appContent
214
+ appDeployer,
215
+ portal,
216
+ portalDeployer,
217
+ auditlog,
218
+ attachments,
219
+ malwareScanner,
175
220
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "cds": {
3
+ "requires": {
4
+ "application-logging": true
5
+ }
6
+ }
7
+ }
@@ -4,8 +4,12 @@ const { srv4, mtxSidecar4, applicationLogging, approuter } = require('../../regi
4
4
 
5
5
  module.exports = class ApplicationLoggingTemplate extends require('../../plugin') {
6
6
 
7
+ static help() {
8
+ return 'SAP BTP Application Logging Service'
9
+ }
10
+
7
11
  static hasInProduction(env) {
8
- return !!env.features.kibana_formatter
12
+ return !!env.requires?.['application-logging']
9
13
  }
10
14
 
11
15
  async canRun() {
@@ -14,6 +18,14 @@ module.exports = class ApplicationLoggingTemplate extends require('../../plugin'
14
18
  return true
15
19
  }
16
20
 
21
+ async run() {
22
+ const project = readProject()
23
+ const { isNodejs } = project
24
+ if (isNodejs) {
25
+ await merge(__dirname, 'files/package.json.hbs').into('package.json')
26
+ }
27
+ }
28
+
17
29
  async combine() {
18
30
  const project = readProject()
19
31
  const { hasMta, hasApprouter, isJava, hasMultitenancy, srvPath } = project
@@ -0,0 +1,10 @@
1
+ ---
2
+ modules:
3
+ - name: {{appName}}-approuter
4
+ build-parameters:
5
+ buildpack:
6
+ type: nodejs
7
+ builder: builder-jammy-base
8
+ path: app/router
9
+ env:
10
+ BP_NODE_RUN_SCRIPTS: ""
@@ -61,8 +61,7 @@ modules:
61
61
  {{#hasMultitenancy}}
62
62
  - name: {{appName}}-mtx
63
63
  type: nodejs
64
- path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
65
- {{#isNodejs}}
64
+ path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar{{#isNodejs}}
66
65
  requires:
67
66
  - name: app-api
68
67
  properties: