@sap/cds-dk 7.9.4 → 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 (286) 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 +2 -11
  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/.hdiconfig-all +3 -0
  53. package/lib/build/provider/hana/template/.hdiconfig-cloud +3 -0
  54. package/lib/build/provider/hana/template/package.json +4 -3
  55. package/lib/build/provider/internalBuildPlugin.js +32 -97
  56. package/lib/build/provider/internalBuildTaskProvider.js +10 -46
  57. package/lib/build/provider/java/index.js +2 -3
  58. package/lib/build/provider/mtx/index.js +5 -4
  59. package/lib/build/provider/mtx-extension/index.js +5 -2
  60. package/lib/build/provider/mtx-sidecar/index.js +2 -2
  61. package/lib/build/util.js +83 -12
  62. package/lib/compile/to-mermaid.js +108 -0
  63. package/lib/compile/to_asyncapi.js +7 -0
  64. package/lib/compile/to_openapi.js +7 -0
  65. package/lib/deploy/to-hana/hana.js +37 -34
  66. package/lib/deploy/to-hana/hdiDeployUtil.js +8 -6
  67. package/lib/env/schemas/cds-rc.js +1 -1
  68. package/lib/import/common.js +2 -2
  69. package/lib/import/odata/metadataconverter/MetadataConverter.js +4 -4
  70. package/lib/import/odata/v2parser.js +83 -197
  71. package/lib/import/odata/v4parser.js +1 -38
  72. package/lib/import/openapi/importOpenAPI.js +164 -42
  73. package/lib/index.js +10 -12
  74. package/lib/init/bas.js +91 -0
  75. package/lib/init/constants.js +16 -10
  76. package/lib/init/index.js +74 -150
  77. package/lib/init/merge.js +12 -20
  78. package/lib/init/mvn.js +103 -150
  79. package/lib/init/plugin.js +11 -7
  80. package/lib/init/projectReader.js +53 -19
  81. package/lib/init/registries/mta.js +51 -6
  82. package/lib/init/template/application-logging/files/package.json.hbs +7 -0
  83. package/lib/init/template/application-logging/index.js +13 -1
  84. package/lib/init/template/approuter/files/containerize.yaml.hbs +10 -0
  85. package/lib/init/template/approuter/files/mta.yaml.hbs +1 -2
  86. package/lib/init/template/approuter/files/values.yaml.hbs +19 -4
  87. package/lib/init/template/approuter/files/xs-app.json.hbs +12 -3
  88. package/lib/init/template/approuter/index.js +29 -25
  89. package/lib/init/template/attachments/files/mta.yaml.hbs +14 -0
  90. package/lib/init/template/attachments/files/package.json.hbs +5 -0
  91. package/lib/init/template/attachments/files/values.yaml +7 -0
  92. package/lib/init/template/attachments/index.js +53 -0
  93. package/lib/init/template/audit-logging/files/mta.yaml.hbs +14 -0
  94. package/lib/init/template/audit-logging/files/package.json.hbs +7 -0
  95. package/lib/init/template/audit-logging/index.js +66 -0
  96. package/lib/init/template/cf-manifest/index.js +4 -0
  97. package/lib/init/template/completion/completionSetup.js +54 -33
  98. package/lib/init/template/completion/index.js +7 -1
  99. package/lib/init/template/connectivity/index.js +4 -4
  100. package/lib/init/template/containerize/files/containerize.yaml.hbs +26 -0
  101. package/lib/init/template/containerize/index.js +24 -0
  102. package/lib/init/template/data/index.js +4 -0
  103. package/lib/init/template/destination/files/mta.yaml.hbs +25 -1
  104. package/lib/init/template/destination/index.js +12 -2
  105. package/lib/init/template/enterprise-messaging/index.js +6 -3
  106. package/lib/init/template/enterprise-messaging-shared/index.js +5 -1
  107. package/lib/init/template/extensibility/files/package.json.hbs +1 -1
  108. package/lib/init/template/extensibility/files/xs-security.json.hbs +2 -8
  109. package/lib/init/template/extensibility/index.js +3 -1
  110. package/lib/init/template/file-based-messaging/index.js +4 -0
  111. package/lib/init/template/h2/index.js +4 -0
  112. package/lib/init/template/hana/files/containerize.yaml.hbs +10 -0
  113. package/lib/init/template/hana/files/db/package.json +3 -2
  114. package/lib/init/template/hana/files/package.json.hbs +4 -7
  115. package/lib/init/template/hana/files/src/.hdiconfig +3 -0
  116. package/lib/init/template/hana/files/values.yaml.hbs +1 -2
  117. package/lib/init/template/hana/index.js +15 -7
  118. package/lib/init/template/helm/files/Chart.yaml.hbs +2 -3
  119. package/lib/init/template/helm/files/values.schema.json +2173 -0
  120. package/lib/init/template/helm/files/values.yaml.hbs +11 -6
  121. package/lib/init/template/helm/index.js +77 -18
  122. package/lib/init/template/helm-unified-runtime/index.js +19 -56
  123. package/lib/init/template/html5-repo/files/app-package.json.hbs +11 -7
  124. package/lib/init/template/html5-repo/files/manifest.json +13 -0
  125. package/lib/init/template/html5-repo/files/mta.yaml.hbs +41 -8
  126. package/lib/init/template/html5-repo/files/ui5-deploy.yaml.hbs +21 -0
  127. package/lib/init/template/html5-repo/files/ui5.yaml.hbs +2 -29
  128. package/lib/init/template/html5-repo/files/values.yaml.hbs +6 -2
  129. package/lib/init/template/html5-repo/files/xs-app.json.hbs +21 -8
  130. package/lib/init/template/html5-repo/index.js +33 -30
  131. package/lib/init/template/http/index.js +36 -12
  132. package/lib/init/template/java/index.js +18 -12
  133. package/lib/init/template/kafka/index.js +4 -0
  134. package/lib/init/template/lint/index.js +7 -2
  135. package/lib/init/template/liquibase/index.js +4 -0
  136. package/lib/init/template/local-messaging/index.js +4 -0
  137. package/lib/init/template/malware-scanner/files/mta.yaml.hbs +14 -0
  138. package/lib/init/template/malware-scanner/files/package.json.hbs +17 -0
  139. package/lib/init/template/malware-scanner/files/values.yaml +7 -0
  140. package/lib/init/template/malware-scanner/index.js +47 -0
  141. package/lib/init/template/mta/files/mta.yaml.hbs +3 -3
  142. package/lib/init/template/mta/files/package.json +1 -1
  143. package/lib/init/template/mta/index.js +4 -0
  144. package/lib/init/template/mtx/index.js +4 -0
  145. package/lib/init/template/multitenancy/files/containerize.yaml.hbs +10 -0
  146. package/lib/init/template/multitenancy/files/mta.yaml.hbs +0 -1
  147. package/lib/init/template/multitenancy/files/package.json.hbs +1 -1
  148. package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +6 -5
  149. package/lib/init/template/multitenancy/files/values.yaml.hbs +14 -24
  150. package/lib/init/template/multitenancy/index.js +50 -28
  151. package/lib/init/template/nodejs/files/eslint.config.mjs +2 -0
  152. package/lib/init/template/nodejs/files/package.json.hbs +2 -3
  153. package/lib/init/template/nodejs/index.js +4 -0
  154. package/lib/init/template/notifications/files/mta.yaml.hbs +2 -2
  155. package/lib/init/template/notifications/index.js +4 -0
  156. package/lib/init/template/pipeline/files/.pipeline/config.yml +1 -1
  157. package/lib/init/template/pipeline/files/Jenkinsfile +1 -1
  158. package/lib/init/template/pipeline/index.js +4 -0
  159. package/lib/init/template/portal/files/mta.yaml.hbs +52 -0
  160. package/lib/init/template/portal/files/package.json.hbs +11 -0
  161. package/lib/init/template/portal/files/package.sidecar.json +7 -0
  162. package/lib/init/template/portal/files/portal-site/CommonDataModel.json.hbs +97 -0
  163. package/lib/init/template/portal/files/portal-site/i18n/catalog.properties +1 -0
  164. package/lib/init/template/portal/files/portal-site/i18n/catalog_de.properties +1 -0
  165. package/lib/init/template/portal/files/portal-site/i18n/group.properties +1 -0
  166. package/lib/init/template/portal/files/portal-site/i18n/group_de.properties +1 -0
  167. package/lib/init/template/portal/index.js +84 -0
  168. package/lib/init/template/postgres/index.js +5 -1
  169. package/lib/init/template/redis-messaging/index.js +4 -0
  170. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_de.properties +3 -0
  171. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_en.properties +3 -0
  172. package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +13 -1
  173. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n.properties +2 -2
  174. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_de.properties +3 -0
  175. package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_en.properties +4 -0
  176. package/lib/init/template/sample/files/app/browse/webapp/manifest.json +3 -3
  177. package/lib/init/template/sample/files/app/index.html +1 -1
  178. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +5 -5
  179. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +6 -6
  180. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books_texts.csv +5 -5
  181. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +16 -16
  182. package/lib/init/template/sample/files/nodejs/cat-service.js +2 -2
  183. package/lib/init/template/sample/files/package.json.hbs +3 -0
  184. package/lib/init/template/sample/index.js +16 -9
  185. package/lib/init/template/sqlite/index.js +4 -0
  186. package/lib/init/template/tiny-sample/files/nodejs/db/data/my.bookshop-Books.csv +3 -3
  187. package/lib/init/template/tiny-sample/files/nodejs/srv/cat-service.cds.hbs +1 -1
  188. package/lib/init/template/tiny-sample/index.js +4 -0
  189. package/lib/init/template/toggles/files/package.json.hbs +1 -1
  190. package/lib/init/template/toggles/index.js +4 -0
  191. package/lib/init/template/typer/index.js +4 -0
  192. package/lib/init/template/typescript/files/package.json +12 -0
  193. package/lib/init/template/typescript/files/tsconfig.json +13 -0
  194. package/lib/init/template/typescript/index.js +39 -0
  195. package/lib/init/template/workzone/index.js +5 -0
  196. package/lib/init/template/workzone-standard/files/manifest.json.hbs +6 -0
  197. package/lib/init/template/workzone-standard/index.js +30 -0
  198. package/lib/init/template/xsuaa/files/package.json.hbs +1 -1
  199. package/lib/init/template/xsuaa/files/values.yaml.hbs +3 -2
  200. package/lib/init/template/xsuaa/index.js +11 -7
  201. package/lib/init/validate.js +27 -0
  202. package/lib/lint/generators.js +1 -1
  203. package/lib/lint/io.js +25 -7
  204. package/lib/mtx/auth_manager.js +64 -30
  205. package/lib/mtx/download_legacy.js +2 -2
  206. package/lib/mtx/index.js +0 -4
  207. package/lib/mtx/params.js +32 -38
  208. package/lib/mtx/pull.js +151 -43
  209. package/lib/mtx/push.js +3 -3
  210. package/lib/mtx/settings_manager.js +75 -35
  211. package/lib/mtx/tenant_action.js +1 -1
  212. package/lib/mtx/util/cf.js +1 -1
  213. package/lib/mtx/util/fs.js +26 -1
  214. package/lib/mtx/util/logging.js +7 -3
  215. package/lib/util/command.js +0 -2
  216. package/lib/util/fs.js +2 -3
  217. package/lib/util/question.js +28 -0
  218. package/lib/util/term.js +5 -3
  219. package/npm-shrinkwrap.json +231 -1089
  220. package/package.json +13 -8
  221. package/bin/activate.js +0 -77
  222. package/lib/compile/asyncapi/channels.js +0 -22
  223. package/lib/compile/asyncapi/components/messageTraits/index.js +0 -89
  224. package/lib/compile/asyncapi/components/messages/index.js +0 -173
  225. package/lib/compile/asyncapi/components/schemas/annotations.js +0 -33
  226. package/lib/compile/asyncapi/components/schemas/array.js +0 -8
  227. package/lib/compile/asyncapi/components/schemas/cache.js +0 -14
  228. package/lib/compile/asyncapi/components/schemas/definition.js +0 -187
  229. package/lib/compile/asyncapi/components/schemas/enum.js +0 -16
  230. package/lib/compile/asyncapi/components/schemas/examples.js +0 -10
  231. package/lib/compile/asyncapi/components/schemas/index.js +0 -14
  232. package/lib/compile/asyncapi/components/schemas/localized.js +0 -29
  233. package/lib/compile/asyncapi/components/schemas/primitiveElement.js +0 -41
  234. package/lib/compile/asyncapi/components/schemas/ref.js +0 -45
  235. package/lib/compile/asyncapi/components/schemas/utils.js +0 -108
  236. package/lib/compile/asyncapi/index.js +0 -247
  237. package/lib/compile/asyncapi/message.js +0 -13
  238. package/lib/compile/asyncapi/utils.js +0 -27
  239. package/lib/compile/openapi/csdl2openapi.js +0 -2448
  240. package/lib/compile/openapi/index.js +0 -68
  241. package/lib/init/template/helm/files/chart/templates/NOTES.txt +0 -14
  242. package/lib/init/template/helm/files/chart/templates/_helpers.tpl +0 -28
  243. package/lib/init/template/helm/files/chart/values.root.schema.json +0 -61
  244. package/lib/init/template/helm/files/chart/values.schema.json +0 -366
  245. package/lib/init/template/helm-unified-runtime/files/Chart.yaml.hbs +0 -10
  246. package/lib/init/template/helm-unified-runtime/files/templates/_deployment_helpers.tpl +0 -90
  247. package/lib/init/template/helm-unified-runtime/files/templates/_helpers.tpl +0 -28
  248. package/lib/init/template/helm-unified-runtime/files/values.root.schema.json +0 -61
  249. package/lib/init/template/helm-unified-runtime/files/values.schema.json +0 -366
  250. package/lib/init/template/helm-unified-runtime/files/values.yaml.hbs +0 -26
  251. package/lib/init/template/helm-unified-runtime/package.json +0 -4
  252. package/lib/init/template/multitenancy/files/mtxs-configmap-java-approuter.yaml +0 -20
  253. package/lib/init/template/multitenancy/files/mtxs-configmap-java.yaml +0 -18
  254. package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs-approuter.yaml +0 -12
  255. package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs.yaml +0 -12
  256. package/lib/init/template/multitenancy/files/saas-registry-secret.yaml +0 -9
  257. package/lib/init/template/nodejs/files/eslint.config.js +0 -13
  258. package/lib/init/template/notebook/index.js +0 -11
  259. package/lib/init/template/samples/index.js +0 -9
  260. package/lib/mtx/activate.js +0 -238
  261. package/lib/mtx/extend.js +0 -173
  262. package/lib/util/exec.d.ts +0 -54
  263. package/lib/util/exec.js +0 -211
  264. /package/lib/{init/template/approuter/files → build/plugins/helm/files/plugins/approuter}/approuter-configmap.yaml +0 -0
  265. /package/lib/{init/template/connectivity/files → build/plugins/helm/files/plugins/connectivity}/connectivity-proxy-info.yaml +0 -0
  266. /package/lib/{init/template/html5-repo/files → build/plugins/helm/files/plugins/html5-repo}/html5-apps-deployer-configmap.yaml +0 -0
  267. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/_helpers.tpl +0 -0
  268. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/job.yaml +0 -0
  269. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/secret.yaml +0 -0
  270. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-account.yaml +0 -0
  271. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-binding.yaml +0 -0
  272. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/values.schema.json +0 -0
  273. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/NOTES.txt +0 -0
  274. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_api.tpl +0 -0
  275. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_helpers.tpl +0 -0
  276. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/api-rule.yaml +0 -0
  277. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/network-policy.yaml +0 -0
  278. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/rbac.yaml +0 -0
  279. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/secret.yaml +0 -0
  280. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-account.yaml +0 -0
  281. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-binding.yaml +0 -0
  282. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service.yaml +0 -0
  283. /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/virtual-service.yaml +0 -0
  284. /package/lib/{init/template/helm-unified-runtime → build/plugins/helm}/files/templates/NOTES.txt +0 -0
  285. /package/lib/init/template/{nodejs/files → java}/.cdsrc.json +0 -0
  286. /package/lib/init/template/tiny-sample/files/nodejs/db/{data-model.cds → schema.cds} +0 -0
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  approuter:
3
3
  image:
4
- repository: <your-container-registry>/{{appName}}-approuter
5
- tag: latest
4
+ repository: {{appName}}-approuter
6
5
  {{#hasMultitenancy}}
7
6
  {{=<% %>=}}
8
7
  env:
@@ -22,11 +21,27 @@ approuter:
22
21
  path: /
23
22
  readiness:
24
23
  path: /
25
- backendDestinations: {}
26
- {{^hasMultitenancy}}
24
+ {{=<% %>=}}
25
+ envFrom:
26
+ - configMapRef:
27
+ name: "{{ .Release.Name }}-approuter-configmap"
28
+ <%={{ }}=%>
29
+ backendDestinations:
30
+ srv-api:
31
+ service: srv
32
+ {{#hasMultitenancy}}
33
+ mtx-api:
34
+ service: {{#isJava}}srv{{/isJava}}{{^isJava}}sidecar{{/isJava}}
35
+ {{/hasMultitenancy}}
27
36
  srv:
28
37
  expose:
29
38
  enabled: false
30
39
  networkSecurity:
31
40
  allowNamespaceInternal: true
41
+ {{#hasMultitenancy}}
42
+ sidecar:
43
+ expose:
44
+ enabled: false
45
+ networkSecurity:
46
+ allowNamespaceInternal: true
32
47
  {{/hasMultitenancy}}
@@ -1,13 +1,22 @@
1
1
  {
2
- "welcomeFile": "app/index.html",
2
+ {{#hasPortal}}
3
+ "welcomeFile": "/cp.portal",
4
+ {{/hasPortal}}
3
5
  "routes": [
4
- {{#hasExtensibility}}
6
+ {{#hasMTXRoute}}
5
7
  {
6
8
  "source": "^/-/cds/.*",
7
9
  "destination": "mtx-api",
8
10
  "authenticationType": "none"
9
11
  },
10
- {{/hasExtensibility}}
12
+ {{/hasMTXRoute}}
13
+ {{#hasMTXRouteJava}}
14
+ {
15
+ "source": "^/mt/.*",
16
+ "destination": "srv-api",
17
+ "authenticationType": "none"
18
+ },
19
+ {{/hasMTXRouteJava}}
11
20
  {
12
21
  "source": "^/app/(.*)$",
13
22
  "target": "$1",
@@ -1,5 +1,5 @@
1
1
  const cds = require('../../../cds')
2
- const { exists, copy } = cds.utils
2
+ const { exists } = cds.utils
3
3
  const { join } = require('path')
4
4
  const { readProject } = require('../../projectReader')
5
5
  const { sort, merge } = require('../../merge')
@@ -8,17 +8,18 @@ const {
8
8
  xsuaa, // BTP Services
9
9
  requiredMtxApi, providedJavaApprouterApi4, providedJavaApprouterApi, // APIs
10
10
  requiredAppApi4, providedAppApi,
11
- approuterExtensibility // xs-app.json config
11
+ approuterMTXRoute,
12
+ approuterMTXRouteJava // xs-app.json config
12
13
  } = require('../../registries/mta')
13
14
 
14
15
  module.exports = class ApprouterTemplate extends require('../../plugin') {
15
16
 
16
- static hasInProduction(env) {
17
- return exists(join(env.folders.app, 'xs-app.json')) || exists(join(env.folders.app, 'router', 'xs-app.json'))
17
+ static help() {
18
+ return 'dynamic routing using @sap/approuter'
18
19
  }
19
20
 
20
- requires() {
21
- return ['xsuaa']
21
+ static hasInProduction(env) {
22
+ return exists(join(env.folders.app, 'xs-app.json')) || exists(join(env.folders.app, 'router', 'xs-app.json'))
22
23
  }
23
24
 
24
25
  async run() {
@@ -31,7 +32,7 @@ module.exports = class ApprouterTemplate extends require('../../plugin') {
31
32
 
32
33
  async combine() {
33
34
  const project = readProject(this.options)
34
- const { isNodejs, isJava, hasExtensibility, hasMultitenancy, hasMta, hasHelm, hasHelmUnifiedRuntime, srvPath, approuterPath } = project
35
+ const { isNodejs, isJava, hasMTXRoute, hasMultitenancy, hasXsuaa, hasMta, hasHelm, hasHelmUnifiedRuntime, hasMTXRouteJava, hasContainerize, srvPath, approuterPath } = project
35
36
 
36
37
  if (hasMta) {
37
38
  const srv = srv4(srvPath)
@@ -41,33 +42,36 @@ module.exports = class ApprouterTemplate extends require('../../plugin') {
41
42
  if (isJava && hasMultitenancy) apis.push(requiredMtxApi)
42
43
  const modules = [srv, approuter]
43
44
  if (hasMultitenancy) modules.push(mtxSidecar)
44
- const additions = [...modules, xsuaa, ...apis]
45
- await merge(__dirname, 'files', 'mta.yaml.hbs').into('mta.yaml', {
46
- with: project,
47
- additions,
48
- relationships: [{
49
- insert: [xsuaa, 'name'],
50
- into: [srv, 'requires', 'name']
51
- }, {
52
- insert: [xsuaa, 'name'],
53
- into: [approuter, 'requires', 'name']
54
- }],
45
+ const additions = [...modules, ...apis]
46
+ if (hasXsuaa) additions.push(xsuaa)
47
+ const relationships = []
48
+ if (hasXsuaa) relationships.push({
49
+ insert: [xsuaa, 'name'],
50
+ into: [srv, 'requires', 'name']
51
+ }, {
52
+ insert: [xsuaa, 'name'],
53
+ into: [approuter, 'requires', 'name']
54
+ })
55
+ await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
56
+ with: project, additions, relationships,
55
57
  })
56
58
  }
57
59
 
58
60
  if (hasHelm || hasHelmUnifiedRuntime) {
59
61
  await merge(__dirname, 'files', 'values.yaml.hbs').into('chart/values.yaml', { with: project })
60
- await merge({ approuter: { envFrom: [{
61
- configMapRef: {
62
- name: "{{ .Release.Name }}-approuter-configmap"
63
- }
64
- }]}}).into('chart/values.yaml', { with: project })
62
+ }
65
63
 
66
- await copy(join(__dirname, 'files/approuter-configmap.yaml')).to('chart', 'templates', 'approuter-configmap.yaml')
64
+ if (hasContainerize) {
65
+ const additions = [{
66
+ in: 'modules',
67
+ where: { name: `${project.appName}-approuter` }
68
+ }]
69
+ await merge(__dirname, '/files/containerize.yaml.hbs').into('containerize.yaml', { with: project, additions })
67
70
  }
68
71
 
69
72
  const xsAppPath = join(approuterPath, 'xs-app.json')
70
- const additions = hasExtensibility ? [{ ...approuterExtensibility, at: 0 }] : []
73
+ const additions = hasMTXRoute ? [{ ...approuterMTXRoute, at: 0 }] : []
74
+ if (hasMTXRouteJava) additions.push({ ...approuterMTXRouteJava, at: 0 })
71
75
  await merge(__dirname, 'files/xs-app.json.hbs').into(xsAppPath, { project, additions })
72
76
  }
73
77
  }
@@ -0,0 +1,14 @@
1
+ ---
2
+ modules:
3
+ - name: {{appName}}-srv
4
+ type: {{language}}
5
+ path: {{& srvPath}}
6
+ requires:
7
+ - name: {{appName}}-attachments
8
+
9
+ resources:
10
+ - name: {{appName}}-attachments
11
+ type: org.cloudfoundry.managed-service
12
+ parameters:
13
+ service: objectstore
14
+ service-plan: standard
@@ -0,0 +1,5 @@
1
+ {
2
+ "dependencies": {
3
+ "@cap-js/attachments": "^1"
4
+ }
5
+ }
@@ -0,0 +1,7 @@
1
+ srv:
2
+ bindings:
3
+ objectstore:
4
+ serviceInstanceName: attachments
5
+ attachments:
6
+ serviceOfferingName: objectstore
7
+ servicePlanName: standard
@@ -0,0 +1,53 @@
1
+ const { readProject } = require('../../projectReader')
2
+ const { merge } = require('../../merge')
3
+ const { srv4, attachments } = require('../../registries/mta')
4
+
5
+ module.exports = class AttachmentsTemplate extends require('../../plugin') {
6
+
7
+ static help() {
8
+ return 'SAP BTP Object Store Service'
9
+ }
10
+
11
+ requires() {
12
+ return ['malware-scanner']
13
+ }
14
+
15
+ static hasInProduction(env) {
16
+ return !!env.requires?.attachments
17
+ }
18
+
19
+ async canRun() {
20
+ const { isJava } = readProject()
21
+ if (isJava) throw `'cds add attachments' is not available for Java yet`
22
+ return true
23
+ }
24
+
25
+ async run() {
26
+ const project = readProject()
27
+ const { isNodejs } = project
28
+ if (isNodejs) {
29
+ await merge(__dirname, 'files/package.json.hbs').into('package.json')
30
+ }
31
+ }
32
+
33
+ async combine() {
34
+ const project = readProject()
35
+ const { hasMta, hasHelm, hasHelmUnifiedRuntime, srvPath } = project
36
+
37
+ if (hasMta) {
38
+ const srv = srv4(srvPath)
39
+ const additions = [srv, attachments]
40
+ const relationships = [{
41
+ insert: [attachments, 'name'],
42
+ into: [srv, 'requires', 'name']
43
+ }]
44
+ await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
45
+ with: project, additions, relationships
46
+ })
47
+ }
48
+
49
+ if (hasHelm || hasHelmUnifiedRuntime) {
50
+ await merge(__dirname, 'files', 'values.yaml').into('chart/values.yaml')
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,14 @@
1
+ ---
2
+ modules:
3
+ - name: {{appName}}-srv
4
+ type: {{language}}
5
+ path: {{& srvPath}}
6
+ requires:
7
+ - name: {{appName}}-auditlog
8
+
9
+ resources:
10
+ - name: {{appName}}-auditlog
11
+ type: org.cloudfoundry.managed-service
12
+ parameters:
13
+ service: auditlog
14
+ service-plan: {{servicePlan}}
@@ -0,0 +1,7 @@
1
+ {
2
+ {{#isNodejs}}
3
+ "dependencies": {
4
+ "@cap-js/audit-logging": ">=0"
5
+ }
6
+ {{/isNodejs}}
7
+ }
@@ -0,0 +1,66 @@
1
+ const { join } = require('path')
2
+ const cds = require('../../../cds')
3
+ const { readProject } = require('../../projectReader')
4
+ const { merge } = require('../../merge')
5
+ const { srv4, auditlog } = require('../../registries/mta')
6
+ const mvn = require('../../mvn')
7
+
8
+ module.exports = class AuditLoggingTemplate extends require('../../plugin') {
9
+
10
+ static help() {
11
+ return 'SAP BTP Audit Logging Service'
12
+ }
13
+
14
+ static hasInProduction(env) {
15
+ return env.requires?.['audit-log']
16
+ }
17
+
18
+ options() {
19
+ return {
20
+ 'plan': {
21
+ type: 'string',
22
+ help: 'Specify the service plan.',
23
+ }
24
+ }
25
+ }
26
+
27
+ async run() {
28
+ const project = readProject()
29
+ const { configFile, isJava } = project
30
+ await merge(join(__dirname, 'files/package.json.hbs')).into(configFile, { with: project })
31
+ if (isJava) await mvn.add('audit_logging')
32
+ }
33
+
34
+ async combine() {
35
+ const project = readProject()
36
+ const { hasMta, hasHelm, hasMultitenancy, srvPath } = project
37
+ const { plan = 'premium' } = cds.cli.options
38
+ project.servicePlan = plan
39
+
40
+ if (hasMultitenancy) {
41
+ await merge(__dirname, 'files/package.sidecar.json').into('mtx/sidecar/package.json')
42
+ }
43
+
44
+ if (hasMta) {
45
+ const srv = srv4(srvPath)
46
+ await merge(join(__dirname, 'files/mta.yaml.hbs')).into('mta.yaml', {
47
+ with: project,
48
+ additions: [srv, auditlog],
49
+ relationships: [{
50
+ insert: [auditlog, 'name'],
51
+ into: [srv, 'requires', 'name']
52
+ }
53
+ ]
54
+ })
55
+ }
56
+ if (hasHelm) {
57
+ await merge({
58
+ srv: { bindings: { auditlog: { serviceInstanceName: 'auditlog' }}},
59
+ auditlog: {
60
+ serviceOfferingName: 'auditlog',
61
+ servicePlanName: plan
62
+ }
63
+ }).into('chart/values.yaml')
64
+ }
65
+ }
66
+ }
@@ -8,6 +8,10 @@ const SERVICES_MANIFEST_FILE = 'services-manifest.yml'
8
8
 
9
9
  module.exports = class CfManifestTemplate extends require('../../plugin') {
10
10
 
11
+ static help() {
12
+ return 'Cloud Foundry deployment using manifest files'
13
+ }
14
+
11
15
  async canRun() {
12
16
  if (cds.cli.options.force) {
13
17
  return true
@@ -8,32 +8,39 @@ const { bold } = require('../../../util/term');
8
8
 
9
9
  const ENTRY_REGEX = /\n{0,2}# cds completion start(.+)# cds completion end/is;
10
10
 
11
+ const SUPPORTED_LINUX_SHELLS = ['bash', 'fish', 'gitbash', 'zsh'];
12
+ const SUPPORTED_WINDOWS_SHELLS = ['ps'];
13
+ const SUPPORTED_SHELLS = [...SUPPORTED_LINUX_SHELLS, ...SUPPORTED_WINDOWS_SHELLS].sort();
14
+
11
15
 
12
16
  module.exports = new class CompletionSetup {
17
+ supportedShells = SUPPORTED_SHELLS
18
+
13
19
  async setup(addEntry, options) {
14
20
  const shell = options.shell
15
- || (process.env.MSYSTEM?.includes('MINGW64') ? 'gitbash' : process.env.SHELL?.match(/(bash|zsh)/)?.[0])
21
+ || (process.env.MSYSTEM?.includes('MINGW64') ? 'gitbash' : process.env.SHELL?.match(/(bash|fish|zsh)/)?.[0])
16
22
  || (process.env.PSModulePath ? 'ps' : null);
17
23
 
18
24
  switch (shell) {
19
25
  case 'bash':
26
+ case 'fish':
20
27
  case 'gitbash':
21
28
  case 'zsh':
22
- return this.setupBashZsh(addEntry, shell);
29
+ return this.setupLinuxLike(addEntry, shell);
23
30
  case 'ps':
24
31
  return this.setupPs(addEntry);
25
32
  case null:
26
33
  try {
27
34
  const shellType = this.determineShellLinux();
28
35
  if (!shellType) {
29
- throw `Unsupported shell.\nSupported shells are: bash, zsh, gitbash, ps.`;
36
+ throw `Unsupported shell.\nSupported shells are: ${SUPPORTED_SHELLS.join(', ')}.`;
30
37
  }
31
- return this.setupBashZsh(addEntry, shellType);
38
+ return this.setupLinuxLike(addEntry, shellType);
32
39
  } catch (err) {
33
40
  throw `Error during completion setup: ${err}`;
34
41
  }
35
42
  default:
36
- throw `Unsupported shell: ${shell}.\nSupported shells are: bash, zsh, gitbash, ps.`;
43
+ throw `Unsupported shell: ${shell}.\nSupported shells are: ${SUPPORTED_SHELLS.join(', ')}.`;
37
44
  }
38
45
  }
39
46
 
@@ -67,23 +74,26 @@ module.exports = new class CompletionSetup {
67
74
  await fsp.copyFile(fileName, fileName + '.cds.bak');
68
75
  }
69
76
 
70
- async setupBashZsh(addEntry, shell) {
71
- const isBash = shell.includes('bash'); // also for gitbash
72
- const isZsh = shell.includes('zsh');
73
- const isGitBash = shell.includes('gitbash');
74
-
75
- if (!isBash && !isZsh) {
76
- throw 'Completion is only supported for bash, zsh or Git Bash shell.';
77
+ async setupLinuxLike(addEntry, shell) {
78
+ let profileFile;
79
+ switch (shell) {
80
+ case 'bash':
81
+ profileFile = os.platform() === 'darwin' ? '.bash_profile' : '.bashrc';
82
+ break;
83
+ case 'gitbash':
84
+ profileFile = '.bash_profile'
85
+ break;
86
+ case 'zsh':
87
+ profileFile = '.zshrc';
88
+ break;
89
+ case 'fish':
90
+ profileFile = '.config/fish/config.fish';
91
+ break;
92
+ default:
93
+ throw `Completion is only supported for ${SUPPORTED_LINUX_SHELLS.join(', ')}.`;
77
94
  }
78
95
 
79
- const profileFile = path.join(
80
- os.homedir(),
81
- isZsh
82
- ? '.zshrc'
83
- : os.platform() === 'darwin' || isGitBash
84
- ? '.bash_profile'
85
- : '.bashrc'
86
- );
96
+ profileFile = path.join(os.homedir(), profileFile);
87
97
 
88
98
  await this.changeProfile(profileFile, shell, addEntry);
89
99
 
@@ -109,15 +119,6 @@ module.exports = new class CompletionSetup {
109
119
 
110
120
  getScript(shell) {
111
121
  switch (shell) {
112
- case 'ps':
113
- return `
114
- try {
115
- $CDS_PROFILE = cds completion --shell ps --profile 2> $null
116
- if (Test-Path -Path "$CDS_PROFILE" -PathType Leaf) {
117
- . $CDS_PROFILE
118
- }
119
- } catch {}
120
- `
121
122
  case 'bash':
122
123
  case 'gitbash':
123
124
  return `
@@ -126,6 +127,25 @@ if [ -r "$CDS_PROFILE" ]; then
126
127
  . "$CDS_PROFILE"
127
128
  fi
128
129
  `
130
+ case 'fish':
131
+ return `
132
+ if type "cds" >/dev/null 2>&1
133
+ set -l CDS_PROFILE (cds completion --shell fish --profile 2> /dev/null)
134
+ if test -e "$CDS_PROFILE"
135
+ source "$CDS_PROFILE"
136
+ end
137
+ end
138
+ `
139
+ case 'ps':
140
+ return `
141
+ try {
142
+ $CDS_PROFILE = cds completion --shell ps --profile 2> $null
143
+ if (Test-Path -Path "$CDS_PROFILE" -PathType Leaf) {
144
+ . "$CDS_PROFILE"
145
+ }
146
+ } catch {}
147
+ `
148
+
129
149
  case 'zsh':
130
150
  return `
131
151
  # compinit can be removed here if loaded elsewhere in the script
@@ -136,7 +156,8 @@ if [ -r "$CDS_PROFILE" ]; then
136
156
  . "$CDS_PROFILE"
137
157
  fi
138
158
  `
139
- default: throw `Unsupported shell: ${shell}`;
159
+ default:
160
+ throw `Unsupported shell: ${shell}`;
140
161
  }
141
162
  }
142
163
 
@@ -171,13 +192,13 @@ ${this.getScript(shell)}
171
192
  const relProfilePath = path.relative(os.homedir(), profileFile);
172
193
  if (profileFileExists) {
173
194
  await this.createBackup(profileFile);
174
- console.log(`Created backup ${bold(`~/${relProfilePath}.cds.bak`)}.`);
195
+ console.log(`Created backup ${bold(`~/${relProfilePath}.cds.bak`)}`);
175
196
  }
176
197
  await fsp.writeFile(profileFile, profile);
177
198
  if (addEntry) {
178
- console.log(`Added entry to ${bold(`~/${relProfilePath}`)}.`);
199
+ console.log(`Added entry to ${bold(`~/${relProfilePath}`)}`);
179
200
  } else {
180
- console.log(`Removed entry from ${bold(`~/${relProfilePath}`)}.`);
201
+ console.log(`Removed entry from ${bold(`~/${relProfilePath}`)}`);
181
202
  }
182
203
  }
183
204
  }
@@ -2,14 +2,20 @@ const cds = require('../../../cds');
2
2
 
3
3
 
4
4
  module.exports = class CompletionTemplate extends require('../../plugin') {
5
+
6
+ static help() {
7
+ return 'shell completion for cds commands'
8
+ }
9
+
5
10
  options() {
11
+ const completionSetup = require('./completionSetup');
6
12
  return {
7
13
  'shell': {
8
14
  type: 'string',
9
15
  short: 's',
10
16
  help: `<optional> Forces completion setup for a given shell and disables auto detection.
11
17
  Usually the shell is determined automatically and this is only for cases where the automatic
12
- detection fails. Valid values: bash, gitbash, zsh, ps`
18
+ detection fails. Valid values: ${completionSetup.supportedShells.join(', ')}.`
13
19
  }
14
20
  }
15
21
  }
@@ -1,12 +1,13 @@
1
- const cds = require('../../../cds')
2
- const { copy } = cds.utils
3
- const { join } = require('path')
4
1
  const { readProject } = require('../../projectReader')
5
2
  const { merge } = require('../../merge')
6
3
  const { srv4, connectivity } = require('../../registries/mta')
7
4
 
8
5
  module.exports = class ConnectivityTemplate extends require('../../plugin') {
9
6
 
7
+ static help() {
8
+ return 'SAP BTP Connectivity Service'
9
+ }
10
+
10
11
  static hasInProduction(env) {
11
12
  return !!env.requires.connectivity
12
13
  }
@@ -39,7 +40,6 @@ module.exports = class ConnectivityTemplate extends require('../../plugin') {
39
40
  where: { name: 'connectivity-secret' }
40
41
  }]
41
42
  })
42
- await copy(join(__dirname, 'files', 'connectivity-proxy-info.yaml')).to('chart', 'templates', 'connectivity-proxy-info.yaml') // REVISIT: Move to build
43
43
  }
44
44
  }
45
45
  }
@@ -0,0 +1,26 @@
1
+ ---
2
+ _schema-version: '1.0'
3
+ repository: <your-container-registry>
4
+ tag: latest
5
+ before-all:
6
+ - npx cds build --production
7
+ {{#isJava}}
8
+ - mvn clean package -DskipTests=true --batch-mode
9
+ {{/isJava}}
10
+ modules:
11
+ - name: {{appName}}-srv
12
+ build-parameters:
13
+ buildpack:
14
+ {{#isNodejs}}
15
+ type: nodejs
16
+ {{/isNodejs}}
17
+ builder: builder-jammy-base
18
+ path: {{#isNodejs}}gen/srv{{/isNodejs}}{{#isJava}}srv/target/{{appName}}-exec.jar{{/isJava}}
19
+ env:
20
+ {{#isNodejs}}
21
+ BP_NODE_RUN_SCRIPTS: ""
22
+ {{/isNodejs}}
23
+ {{#isJava}}
24
+ SPRING_PROFILES_ACTIVE: cloud
25
+ BP_JVM_VERSION: 21
26
+ {{/isJava}}
@@ -0,0 +1,24 @@
1
+ const cds = require('../../../cds')
2
+ const { exists, rimraf } = cds.utils
3
+ const { readProject } = require('../../projectReader');
4
+ const { merge } = require('../../merge')
5
+
6
+ module.exports = class ContainerizeTemplate extends require('../../plugin') {
7
+
8
+ static help() {
9
+ return 'containerization using ctz CLI'
10
+ }
11
+
12
+ static hasInProduction () {
13
+ return exists('containerize.yaml')
14
+ }
15
+
16
+ async run() {
17
+ if (cds.cli.options.force) {
18
+ await rimraf('containerize.yaml')
19
+ }
20
+
21
+ const project = readProject()
22
+ await merge(__dirname, '/files/containerize.yaml.hbs').into('containerize.yaml', { with: project })
23
+ }
24
+ }
@@ -9,6 +9,10 @@ const asCsv = require('./as-csv')
9
9
 
10
10
  module.exports = class DataTemplate extends require('../../plugin') {
11
11
 
12
+ static help() {
13
+ return 'add CSV headers for modeled entities'
14
+ }
15
+
12
16
  options() {
13
17
  return {
14
18
  'filter': {
@@ -6,9 +6,33 @@ modules:
6
6
  requires:
7
7
  - name: {{appName}}-destination
8
8
 
9
+ - name: {{appName}}
10
+ type: approuter.nodejs
11
+ requires:
12
+ - name: {{appName}}-destination
13
+
9
14
  resources:
10
15
  - name: {{appName}}-destination
11
16
  type: org.cloudfoundry.managed-service
12
17
  parameters:
13
18
  service: destination
14
- service-plan: lite
19
+ service-plan: lite{{#hasHtml5Repo}}
20
+ config:
21
+ HTML5Runtime_enabled: true
22
+ init_data:
23
+ instance:
24
+ existing_destinations_policy: update
25
+ destinations:
26
+ - Name: {{appName}}-srv-api
27
+ URL: ~{srv-api/srv-url}
28
+ Authentication: OAuth2UserTokenExchange
29
+ Type: HTTP
30
+ ProxyType: Internet
31
+ HTML5.ForwardAuthToken: true
32
+ HTML5.DynamicDestination: true
33
+ - Authentication: NoAuthentication
34
+ Name: ui5
35
+ ProxyType: Internet
36
+ Type: HTTP
37
+ URL: https://ui5.sap.com
38
+ {{/hasHtml5Repo}}