@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds-dk",
3
- "version": "7.9.5",
3
+ "version": "8.0.2",
4
4
  "description": "Command line client and development toolkit for the SAP Cloud Application Programming Model",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [
@@ -16,29 +16,34 @@
16
16
  },
17
17
  "main": "lib/index.js",
18
18
  "dependencies": {
19
- "@sap/cds": "^7",
19
+ "@cap-js/asyncapi": "^1.0.0",
20
+ "@cap-js/openapi": "^1.0.0",
21
+ "@sap/cds": ">=7",
20
22
  "@sap/cds-foss": "^5.0.0",
21
- "@sap/cds-mtxs": "^1.9.0",
23
+ "@sap/cds-mtxs": ">=1.9.0",
22
24
  "@sap/eslint-plugin-cds": "^3.0.1",
23
- "@sap/hdi-deploy": "^4.8.0",
25
+ "@sap/hdi-deploy": "^5",
24
26
  "axios": "^1",
25
- "eslint": "^8",
27
+ "eslint": "^9",
26
28
  "express": "^4.17.3",
29
+ "hdb": "^0",
27
30
  "livereload-js": "^4.0.1",
28
31
  "mustache": "^4.0.1",
29
32
  "node-watch": ">=0.7",
30
- "pluralize": "^8.0.0",
31
33
  "ws": "^8.4.2",
32
34
  "xml-js": "^1.6.11"
33
35
  },
34
36
  "optionalDependencies": {
35
- "sqlite3": "^5.0.4"
37
+ "@cap-js/sqlite": "^1"
36
38
  },
37
39
  "files": [
38
40
  "bin/",
39
41
  "lib/",
42
+ "CHANGELOG.md",
43
+ "LICENSE",
40
44
  "npm-shrinkwrap.json",
41
- "LICENSE"
45
+ "package.json",
46
+ "readme.md"
42
47
  ],
43
48
  "_hasShrinkwrap": true
44
49
  }
package/bin/activate.js DELETED
@@ -1,77 +0,0 @@
1
- module.exports = Object.assign(activate, {
2
- options: ['--subdomain', '--passcode', '--username', '--clientid', '--to', '--sync'],
3
- flags: ['--undeploy', '--wsdl'],
4
- shortcuts: ['-s', '-p', '-u', '-c', '-2'],
5
- help: `
6
- # SYNOPSIS
7
-
8
- *cds activate* [ <extension-project-directory> ]
9
-
10
- **Deprecated - for use with previous MTX Services (@sap/cds-mtx).**
11
-
12
- Activate an extension project.
13
- By default, the current working directory is used as project directory.
14
-
15
- To facilitate running this multiple times against the same app, refer to the
16
- *cds login* command.
17
-
18
-
19
- # OPTIONS
20
-
21
- *--to* <url>
22
-
23
- Specify the URL of the extensible SaaS app. By default, it's determined
24
- from project settings.
25
-
26
- *-s* | *--subdomain* <tenant-subdomain>
27
-
28
- Specify your tenant's subdomain. By default, it's determined from
29
- project settings.
30
-
31
- *-p* | *--passcode* <passcode>
32
-
33
- Tenant-specific passcode for authentication.
34
- Also see cds login --help or https://cap.cloud.sap/docs/guides/extensibility/#save-an-authentication-token-for-a-simplified-workflow
35
-
36
- *-u* | *--username* <name>
37
-
38
- Deprecated. Use the passcode parameter.
39
-
40
- *-c* | *--clientid* <clientid>
41
-
42
- Client ID for authentication. This will override the default Client ID
43
- from environment.
44
-
45
- *--undeploy*
46
-
47
- Undeploy a previously deployed extension, e.g. to remove a renamed or
48
- otherwise obsolete extension.
49
-
50
- *--sync*
51
-
52
- Use the synchronous server API to upload extensions.
53
-
54
- # SEE ALSO
55
-
56
- *cds push* to push an extension to a SaaS app based on current MTX Services
57
- (@sap/cds-mtxs).
58
-
59
- https://cap.cloud.sap/docs/guides/multitenancy/mtxs for information on
60
- @sap/cds-mtxs.
61
-
62
- `})
63
-
64
-
65
- async function activate ([projectFolder], options = {}) {
66
- const injection = {
67
- cds: require('../lib/cds')
68
- }
69
-
70
- Object.assign(options, { projectFolder })
71
-
72
- await require('../lib/mtx/activate').run(injection, options);
73
- }
74
-
75
-
76
-
77
- /* eslint no-console: off */
@@ -1,22 +0,0 @@
1
- const { getEventName } = require('./utils');
2
-
3
- function getChannel(eventName) {
4
- return {
5
- subscribe: {
6
- message: {
7
- $ref: "#/components/messages/" + eventName
8
- }
9
- }
10
- }
11
- }
12
-
13
- module.exports = function getChannels(definitions, events) {
14
- let channels = {};
15
-
16
- events.forEach(event => {
17
- let eventName = getEventName(event, definitions[event]);
18
- channels[eventName] = getChannel(eventName);
19
- });
20
-
21
- return channels;
22
- }
@@ -1,89 +0,0 @@
1
- /**
2
- * Get a map of message traits.
3
- */
4
- module.exports = function getMessageTraits() {
5
-
6
- return {
7
- "CloudEventsContext.v1": {
8
- "headers": {
9
- "type": "object",
10
- "properties": {
11
- "id": {
12
- "description": "Identifies the event.",
13
- "type": "string",
14
- "examples": [
15
- "6925d08e-bc19-4ad7-902e-bd29721cc69b"
16
- ]
17
- },
18
- "specversion": {
19
- "description": "The version of the CloudEvents specification which the event uses.",
20
- "type": "string",
21
- "const": "1.0"
22
- },
23
- "source": {
24
- "description": "Identifies the instance the event originated in.",
25
- "type": "string",
26
- "format": "uri-reference",
27
- "examples": [
28
- "/default/sap.s4.beh/ER9CLNT001",
29
- "/eu/sap.billing.sb/91dec60d-9757-4e2c-b9e5-21da10016fe9"
30
- ]
31
- },
32
- "type": {
33
- "description": "Describes the type of the event related to the source the event originated in.",
34
- "type": "string",
35
- "examples": [
36
- "sap.dsc.FreightOrder.Arrived.v1",
37
- "sap.billing.sb.Subscription.Canceled.v1"
38
- ]
39
- },
40
- "subject": {
41
- "description": "Describes the subject of the event in the context of the source the event originated in (e.g., the id of the business object the event is about).",
42
- "type": "string",
43
- "examples": [
44
- "ce307052-75a0-4a8f-a961-ebf21669bb80",
45
- "urn:epc:tag:sgtin-96:1.7332402.026591.1234567890"
46
- ]
47
- },
48
- "datacontenttype": {
49
- "description": "Content type of the event data.",
50
- "type": "string",
51
- "const": "application/json"
52
- },
53
- "dataschema": {
54
- "description": "Identifies the schema that the event data adheres to.",
55
- "type": "string",
56
- "format": "uri",
57
- "examples": [
58
- "http://example.com/event/sap.billing.sb.Subscription.Canceled/v1.2.0"
59
- ]
60
- },
61
- "time": {
62
- "description": "Timestamp of when the occurrence happened.",
63
- "format": "date-time",
64
- "type": "string",
65
- "examples": [
66
- "2018-04-05T17:31:00Z"
67
- ]
68
- }
69
- },
70
- "required": [
71
- "id",
72
- "source",
73
- "specversion",
74
- "type"
75
- ],
76
- "patternProperties": {
77
- "^xsap[a-z0-9]+$": {
78
- "description": "Application defined custom extension context attributes.",
79
- "type": [
80
- "boolean",
81
- "integer",
82
- "string"
83
- ]
84
- }
85
- }
86
- }
87
- }
88
- };
89
- }
@@ -1,173 +0,0 @@
1
- const { getEventName } = require('../../utils');
2
-
3
- const annotationMapping = {
4
- 'EventSpecVersion': 'x-sap-event-spec-version',
5
- 'EventSource': 'x-sap-event-source',
6
- 'EventSourceParams': 'x-sap-event-source-parameters',
7
- 'EventCharacteristics': 'x-sap-event-characteristics',
8
- 'EventStateInfo': 'x-sap-stateInfo',
9
- 'EventSchemaVersion': 'x-sap-event-version'
10
- };
11
-
12
- /**
13
- * Get header properties from definition.
14
- */
15
- function getHeaderProperties(name) {
16
- return { type: { const: name } };
17
- }
18
-
19
- function nestedAnnotation(resObj, asyncapiProperty, keys, value) {
20
- if (resObj[asyncapiProperty] === undefined) {
21
- resObj[asyncapiProperty] = {};
22
- }
23
-
24
- let node = resObj[asyncapiProperty];
25
-
26
- // traverse the annotation property and define the objects if they're not defined
27
- for (let nestedIndex = 1; nestedIndex < keys.length - 1; nestedIndex++) {
28
- const nestedElement = keys[nestedIndex];
29
- if (node[nestedElement] === undefined) {
30
- node[nestedElement] = {};
31
- }
32
- node = node[nestedElement];
33
- }
34
-
35
- // set value annotation property
36
- node[keys[keys.length - 1]] = value;
37
- }
38
-
39
- function readAnnotations(definition, presets) {
40
- let resObj = {};
41
-
42
- for (const [key, value] of Object.entries(definition)) {
43
- if (key.startsWith('@AsyncAPI') && !key.startsWith('@AsyncAPI.Extensions')) {
44
- // get annotation value after @AsyncAPI
45
- const annotationProperties = key.split('@AsyncAPI.')[1];
46
- const keys = annotationProperties.split('.');
47
-
48
- // convert annotation property (ex: EventSource) to asyncapi property (ex: x-sap-event-source)
49
- // if annotation property isn't present in map then ignore the property
50
- if (annotationMapping[keys[0]] === undefined) continue;
51
-
52
- const asyncapiProperty = annotationMapping[keys[0]];
53
-
54
- // if there's no nesting then just set the value
55
- if (keys.length === 1) {
56
- resObj[asyncapiProperty] = value;
57
- } else {
58
- nestedAnnotation(resObj, asyncapiProperty, keys, value)
59
- }
60
- }
61
-
62
- else if (key.startsWith('@AsyncAPI.Extensions')) {
63
- const annotationProperties = key.split('@AsyncAPI.Extensions.')[1];
64
- const keys = annotationProperties.split('.');
65
- keys[0] = "x-" + keys[0];
66
-
67
- if (keys.length === 1) {
68
- // if the key is already present, that means, Annotations have already been considered
69
- if (resObj[keys[0]]) continue;
70
- // else we populate
71
- resObj[keys[0]] = value;
72
- } else {
73
- nestedAnnotation(resObj, keys[0], keys, value);
74
- }
75
- }
76
- }
77
-
78
- for (const [key, value] of Object.entries(presets)) {
79
- if (resObj[key] === undefined) {
80
- resObj[key] = value;
81
- }
82
- }
83
-
84
- addDefaults(resObj);
85
- return resObj;
86
- }
87
-
88
- function addDefaults(obj) {
89
- const defaults = {
90
- 'x-sap-event-source': '/{region}/{applicationNamespace}/{instanceId}',
91
- 'x-sap-event-source-parameters': {
92
- "region": {
93
- "description": "The regional context of the application.",
94
- "schema": {
95
- "type": "string"
96
- }
97
- },
98
- "applicationNamespace": {
99
- "description": "The registered namespace of the application.",
100
- "schema": {
101
- "type": "string"
102
- }
103
- },
104
- "instanceId": {
105
- "description": "The instance id (tenant, installation, ...) of the application.",
106
- "schema": {
107
- "type": "string"
108
- }
109
- }
110
- }
111
- }
112
-
113
- for (const [key, value] of Object.entries(defaults)) {
114
- if (!obj[key]) {
115
- obj[key] = value;
116
- }
117
- }
118
- }
119
-
120
- /**
121
- * Get message for the event definition.
122
- */
123
- function eventToMessage(definition, name, presets) {
124
- let obj = readAnnotations(definition, presets);
125
-
126
- let messageObj = {
127
- name,
128
- headers: {
129
- type: 'object',
130
- properties: getHeaderProperties(name)
131
- },
132
- payload: {
133
- $ref: `#/components/schemas/${name}`
134
- },
135
- traits: [
136
- {
137
- $ref: '#/components/messageTraits/CloudEventsContext.v1'
138
- }
139
- ]
140
- }
141
-
142
- const message = { ...obj, ...messageObj};
143
-
144
- return message;
145
- }
146
-
147
- /**
148
- * Event definitions of one CSN to messages.
149
- */
150
- function entriesToMessages(definitions, events, presets) {
151
- const messages = {};
152
-
153
- events.forEach(event => {
154
- let name = getEventName(event, definitions[event]);
155
- messages[name] = eventToMessage(definitions[event], name, presets);
156
- });
157
-
158
- return messages;
159
- }
160
-
161
- /**
162
- * Combining the definition objects from CSN into one schema
163
- */
164
- function definitionsToMessages(definitions, events, presets) {
165
- const messages = {};
166
- Object.assign(messages, entriesToMessages(definitions, events, presets));
167
- return messages;
168
- }
169
-
170
- module.exports = {
171
- definitionsToMessages,
172
- nestedAnnotation
173
- }
@@ -1,33 +0,0 @@
1
-
2
- const odmAnnotationsMapping = Object.freeze({
3
- '@ODM.entityName': 'x-sap-odm-entity-name',
4
- '@ODM.oid': 'x-sap-odm-oid'
5
- });
6
-
7
- function addOdmExtensions(definition, object) {
8
- for (const [annotation, asyncApiExtension] of Object.entries(odmAnnotationsMapping)) {
9
- if (definition[annotation]) {
10
- object[asyncApiExtension] = definition[annotation];
11
- }
12
- }
13
- }
14
-
15
- module.exports = function addAnnotations(definition, object) {
16
- if (typeof (definition['@title']) === 'string') {
17
- object.title = definition['@title'];
18
- }
19
-
20
- if (typeof (definition['@description']) === 'string') {
21
- object.description = definition['@description'];
22
- } else if (typeof definition.doc === 'string') {
23
- object.description = definition.doc.replace(/\n/g, ' ');
24
- }
25
-
26
- if (definition['@ODM.root']) {
27
- object['x-sap-root-entity'] = definition['@ODM.root']
28
- }
29
-
30
- addOdmExtensions(definition, object);
31
-
32
- return object;
33
- }
@@ -1,8 +0,0 @@
1
- const { getBaseTypeStructure } = require('./utils');
2
-
3
- module.exports = function getArrayOfType(type) {
4
- const array = getBaseTypeStructure('array');
5
- array.items = type;
6
-
7
- return array;
8
- }
@@ -1,14 +0,0 @@
1
- function cacheAndReturn(schemaCache, type, schema) {
2
- schemaCache[type] = schema;
3
-
4
- return schema;
5
- }
6
-
7
- function getCache(schemaCache, type) {
8
- return schemaCache[type];
9
- }
10
-
11
- module.exports = {
12
- cacheAndReturn,
13
- getCache
14
- }
@@ -1,187 +0,0 @@
1
- const { addEnum } = require('./enum');
2
- const schemaUtils = require('./utils');
3
- const { cacheAndReturn, getCache } = require('./cache');
4
- const { getOwnValue } = require('../../utils');
5
- const { toLocalizedArray } = require('./localized');
6
- const addAnnotations = require('./annotations');
7
- const primitiveElementToSchema = require('./primitiveElement');
8
- const getArrayOfType= require('./array');
9
- const { followRefRecursive } = require('./ref');
10
-
11
- function definitionToSchema(eventDefinition, definitions, schemaCache) {
12
- const definition = definitions[eventDefinition];
13
-
14
- if (schemaUtils.isStructured(definition)) {
15
- return addAnnotations(definition, elementsToSchema(schemaCache, definitions, definition));
16
- }
17
-
18
- return addAnnotations(definition, elementToSchema(schemaCache, definitions, definition));
19
- }
20
-
21
- function elementsToSchema(schemaCache, definitions, entry, nullable) {
22
- if (!schemaUtils.isStructured(entry)) {
23
- return elementToSchema(schemaCache, definitions, entry, nullable);
24
- }
25
-
26
- const required = [];
27
- const object = schemaUtils.getBaseTypeStructure("object");
28
- for (const [name, element] of Object.entries(entry.elements)) {
29
- if (getOwnValue(element, "key")
30
- || getOwnValue(element, "@mandatory")
31
- || (getOwnValue(element, "@Common.FieldControl") && getOwnValue(element["@Common.FieldControl"], "#") === 'Mandatory')
32
- ) {
33
- required.push(name);
34
- }
35
-
36
- if (!schemaUtils.elementIsRelevant(name, element)) {
37
- continue;
38
- }
39
-
40
- if (!object.properties) {
41
- object.properties = {};
42
- }
43
-
44
- object.properties[name] = addAnnotations(element, elementToSchema(schemaCache, definitions, element));
45
- }
46
-
47
- if (required.length) {
48
- object.required = required;
49
- }
50
-
51
- return object;
52
- }
53
-
54
- function elementToSchema(schemaCache, definitions, entry) {
55
- /*
56
- * Process reuse types as first step.
57
- * A structured type will be preprocessed and 'elements' will exists as inherited prototype.
58
- * If type is processed first, the reuse will be cached.
59
- * If the inherited elements would be processed instead, each reuse would process them again.
60
- */
61
- if (typeof entry.type === "string" && definitions[entry.type]) {
62
- // has been processed before
63
- if (schemaCache[entry.type]) {
64
- return getCache(schemaCache, entry.type);
65
- }
66
-
67
- return cacheAndReturn(schemaCache, entry.type,
68
- elementToSchema(schemaCache, definitions, definitions[entry.type])
69
- );
70
- }
71
-
72
- // Process anonymous attribute object structures like "deep: {deeper: {attr: String;};};"
73
- if (schemaUtils.isStructured(entry)) {
74
- return elementsToSchema(schemaCache, definitions, entry);
75
- }
76
-
77
- // Arrayed primitives and structured objects without keyed property
78
- if (schemaUtils.isManyEntry(entry)) {
79
- return manyToSchema(schemaCache, definitions, entry);
80
- }
81
-
82
- // Definition > element references
83
- if (schemaUtils.isRefEntry(entry)) {
84
- return refToSchema(schemaCache, definitions, entry);
85
- }
86
-
87
- // Associations to (root) entities and code lists
88
- if (schemaUtils.isAssociation(entry)) {
89
- return associationToSchema(schemaCache, definitions, entry);
90
- }
91
-
92
- // Compositions of aspect or entity
93
- if (schemaUtils.isComposition(entry)) {
94
- return compositionToSchema(schemaCache, definitions, entry);
95
- }
96
-
97
- //A localized element is a primitive at CSN and an array of objects at JSON schema (all translations)
98
- if (entry.localized === true) {
99
- return toLocalizedArray(entry);
100
- }
101
-
102
- const schema = addAnnotations(entry, primitiveElementToSchema(entry));
103
-
104
- if (schemaUtils.isDefault(entry)) {
105
- schemaUtils.addDefaultValue(entry, schema);
106
- }
107
-
108
- if (schemaUtils.isEnum(entry)) {
109
- addEnum(entry, schema);
110
- }
111
-
112
- return schema;
113
- }
114
-
115
- function associationToSchema(schemaCache, definitions, entry) {
116
- let associationTargetDefinition = JSON.parse(JSON.stringify(definitions[entry.target]));
117
- Object.keys(associationTargetDefinition.elements).forEach(element => {
118
- if (associationTargetDefinition.elements[element].key === undefined) {
119
- delete associationTargetDefinition.elements[element];
120
- }
121
- });
122
-
123
- if (schemaUtils.isToManyAssociation(entry)) {
124
- return getArrayOfType(elementsToSchema(schemaCache, definitions, associationTargetDefinition));
125
- } else {
126
- return elementsToSchema(schemaCache, definitions, associationTargetDefinition);
127
- }
128
- }
129
-
130
- function manyToSchema(schemaCache, definitions, entry) {
131
- return getArrayOfType(
132
- schemaUtils.isStructured(entry.items)
133
- ? elementsToSchema(schemaCache, definitions, entry.items)
134
- : elementToSchema(schemaCache, definitions,
135
- // if entry.items.type can be found at definitions, it is a reuse type
136
- definitions[entry.items.type] ? definitions[entry.items.type] : (entry.items)
137
- )
138
- );
139
- }
140
-
141
- function compositionToSchema(schemaCache, definitions, entry) {
142
- if (schemaUtils.isStructured(entry.targetAspect)) {
143
- const objectType = elementsToSchema(schemaCache, definitions, entry.targetAspect);
144
- return schemaUtils.isToMany(entry) ? getArrayOfType(objectType) : objectType;
145
- }
146
- // Composition of aspects might have a target towards a generated entity
147
- const target = entry.targetAspect || entry.target;
148
- // An aspect is a reuse element, which might be used at more than one place with different cardinality
149
- const cacheKey = `${target}${schemaUtils.isToMany(entry) ? 'Many' : 'One'}`;
150
-
151
- /*
152
- * Check if the target entity has been processed as association target before.
153
- */
154
- if (schemaCache[cacheKey]) {
155
- return getCache(schemaCache, cacheKey);
156
- }
157
-
158
- let objectType;
159
- if (schemaUtils.isStructured(definitions[target])) {
160
- objectType = elementsToSchema(schemaCache, definitions, definitions[target]);
161
- } else {
162
- objectType = elementToSchema(schemaCache, definitions, target);
163
- }
164
-
165
- return cacheAndReturn(schemaCache, cacheKey,
166
- schemaUtils.isToMany(entry) ? getArrayOfType(objectType) : objectType
167
- );
168
- }
169
-
170
- function refToSchema(schemaCache, definitions, entry) {
171
- const refKey = entry.type.ref.join('.');
172
-
173
- if (schemaCache[refKey]) {
174
- return getCache(schemaCache, refKey);
175
- }
176
-
177
- return cacheAndReturn(
178
- schemaCache,
179
- refKey,
180
- elementToSchema(schemaCache, definitions, followRefRecursive(definitions, entry.type))
181
- );
182
- }
183
-
184
- module.exports = {
185
- definitionToSchema,
186
- elementToSchema
187
- }
@@ -1,16 +0,0 @@
1
- const schemaUtils = require('./utils');
2
-
3
- function addEnum(entry, schema) {
4
- if (entry.kind === 'type') {
5
- // eslint-disable-next-line no-unused-vars
6
- schema.enum = Object.entries(entry.enum).map(([key, value]) => {
7
- return (schemaUtils.isVal(entry) ? entry.val : key)
8
- });
9
- } else {
10
- schema.enum = Object.keys(entry.enum);
11
- }
12
- }
13
-
14
- module.exports = {
15
- addEnum
16
- }
@@ -1,10 +0,0 @@
1
- const Examples = {
2
- UUID_EXAMPLE: 'e78f1eb8-ada8-49b0-8c8f-a5d316e82952',
3
- PARTIAL_TIME_EXAMPLE:'20:54:21',
4
- DATE_EXAMPLE: '2017-02-14',
5
- DATE_TIME_EXAMPLE: '2017-02-14T20:54:21+00:00',
6
- INT_64_EXAMPLE: '3155378975999999999',
7
- DECIMAL_EXAMPLE: '3.141592653589793238462643383279',
8
- }
9
-
10
- module.exports = Examples