@sap/cds-dk 10.0.6 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/bin/add.js +7 -23
  3. package/bin/bind.js +10 -0
  4. package/bin/build.js +20 -34
  5. package/bin/cds.js +1 -1
  6. package/bin/compile/index.js +15 -41
  7. package/bin/completion/completionFs.js +11 -8
  8. package/bin/completion/index.js +592 -80
  9. package/bin/completion/scripts/cds.fish +568 -0
  10. package/bin/completion/scripts/cds.ps1 +329 -0
  11. package/bin/completion/scripts/cds.sh +261 -0
  12. package/bin/completion/scripts/cds.zsh +230 -0
  13. package/bin/completion/templates/cds-tmpl.fish +65 -0
  14. package/bin/completion/templates/cds-tmpl.ps1 +208 -0
  15. package/bin/completion/templates/cds-tmpl.sh +93 -0
  16. package/bin/completion/templates/cds-tmpl.zsh +74 -0
  17. package/bin/deploy/index.js +7 -1
  18. package/bin/deploy/options.js +25 -0
  19. package/{lib → bin}/deploy/to-hana/hana.js +8 -8
  20. package/{lib → bin}/deploy/to-hana/hdiDeployUtil.js +1 -1
  21. package/bin/deploy/{to-hana.js → to-hana/index.js} +1 -1
  22. package/{lib → bin}/deploy/to-hana/mtaUtil.js +1 -1
  23. package/bin/deploy/to-sql.js +0 -2
  24. package/bin/export.js +35 -5
  25. package/bin/help/export.md +3 -0
  26. package/bin/help.js +1 -5
  27. package/bin/import.js +6 -0
  28. package/bin/init.js +5 -24
  29. package/bin/inspect.js +6 -0
  30. package/bin/login.js +26 -20
  31. package/bin/pull.js +19 -6
  32. package/bin/push.js +19 -6
  33. package/bin/up.js +14 -11
  34. package/{lib → bin}/upgrade/constants.js +1 -1
  35. package/bin/{upgrade.js → upgrade/index.js} +2 -2
  36. package/{lib → bin}/upgrade/preflight/consistency.js +1 -1
  37. package/{lib → bin}/upgrade/preflight/index.js +1 -1
  38. package/{lib → bin}/upgrade/steps/analyze/index.js +1 -1
  39. package/{lib → bin}/upgrade/steps/install.js +1 -1
  40. package/{lib → bin}/upgrade/steps/openrewrite.js +1 -1
  41. package/{lib → bin}/upgrade/steps/removals.js +1 -1
  42. package/{lib → bin}/upgrade/steps/rewrite.js +1 -1
  43. package/{lib → bin}/upgrade/steps/verify.js +1 -1
  44. package/{lib/upgrade/index.js → bin/upgrade/upgrade.js} +2 -2
  45. package/{lib → bin}/upgrade/util/pom.js +2 -2
  46. package/{lib → bin}/upgrade/util/prompt.js +1 -1
  47. package/bin/util/containerize.js +8 -4
  48. package/bin/version.js +10 -1
  49. package/{lib → bin}/watch/hot-reload.js +1 -1
  50. package/bin/{watch.js → watch/index.js} +17 -9
  51. package/{lib → bin}/watch/livereload-connect.js +1 -1
  52. package/{lib → bin}/watch/vite-watch.js +1 -1
  53. package/{lib → bin}/watch/watched.js +2 -2
  54. package/lib/build/constants.js +1 -1
  55. package/lib/build/plugins/fiori/index.js +31 -2
  56. package/lib/build/plugins/internal.js +4 -2
  57. package/lib/build/plugins/mtx-sidecar/index.js +7 -8
  58. package/lib/build/plugins/nodejs/index.js +64 -7
  59. package/lib/compile/to_asyncapi.js +1 -1
  60. package/lib/env/schema.js +16 -0
  61. package/lib/env/schemas/cds-rc.js +1 -76
  62. package/lib/import/importapi.js +2 -3
  63. package/lib/import/message.js +0 -2
  64. package/lib/init/constants.js +2 -1
  65. package/lib/init/index.js +2 -2
  66. package/lib/init/merge.js +123 -280
  67. package/lib/init/plugin.js +3 -1
  68. package/lib/init/projectReader.js +22 -6
  69. package/lib/init/registries/xs-app.js +3 -5
  70. package/lib/init/template/ai/files/mta.yaml.hbs +1 -1
  71. package/lib/init/template/ai/index.js +14 -2
  72. package/lib/init/template/ams/index.js +2 -2
  73. package/lib/init/template/app-frontend/files/containerize.yaml.hbs +2 -2
  74. package/lib/init/template/app-frontend/index.js +4 -4
  75. package/lib/init/template/application-logging/index.js +2 -2
  76. package/lib/init/template/approuter/files/package.json +1 -1
  77. package/lib/init/template/approuter/index.js +8 -3
  78. package/lib/init/template/attachments/files/package.json.hbs +1 -1
  79. package/lib/init/template/attachments/index.js +2 -2
  80. package/lib/init/template/audit-logging/index.js +2 -2
  81. package/lib/init/template/cloud-logging/files/package.json.hbs +4 -4
  82. package/lib/init/template/cloud-logging/index.js +2 -2
  83. package/lib/init/template/completion/completionSetup.js +36 -39
  84. package/lib/init/template/connectivity/index.js +2 -2
  85. package/lib/init/template/data/as-csv.js +15 -5
  86. package/lib/init/template/data/as-json.js +114 -42
  87. package/lib/init/template/data/index.js +16 -2
  88. package/lib/init/template/destination/index.js +2 -2
  89. package/lib/init/template/dynatrace/files/package.json.hbs +3 -3
  90. package/lib/init/template/dynatrace/index.js +2 -2
  91. package/lib/init/template/enterprise-messaging/index.js +2 -2
  92. package/lib/init/template/enterprise-messaging-shared/index.js +2 -2
  93. package/lib/init/template/extensibility/files/mta.yaml.hbs +11 -0
  94. package/lib/init/template/extensibility/files/xs-security.json.hbs +1 -1
  95. package/lib/init/template/extensibility/index.js +3 -3
  96. package/lib/init/template/github-actions/index.js +2 -2
  97. package/lib/init/template/hana/index.js +3 -2
  98. package/lib/init/template/hana-serverless/files/db/package.json +14 -0
  99. package/lib/init/template/hana-serverless/files/identity.values.yaml.hbs +10 -0
  100. package/lib/init/template/hana-serverless/files/mta.yaml.hbs +64 -0
  101. package/lib/init/template/hana-serverless/files/package.json.hbs +35 -0
  102. package/lib/init/template/hana-serverless/files/src/.hdiconfig +139 -0
  103. package/lib/init/template/hana-serverless/files/undeploy.json +7 -0
  104. package/lib/init/template/hana-serverless/files/values.yaml.hbs +18 -0
  105. package/lib/init/template/hana-serverless/index.js +184 -0
  106. package/lib/init/template/html5-repo/files/containerize.yaml.hbs +2 -2
  107. package/lib/init/template/html5-repo/files/mta.yaml.hbs +5 -0
  108. package/lib/init/template/html5-repo/index.js +18 -14
  109. package/lib/init/template/http/index.js +123 -26
  110. package/lib/init/template/ias/index.js +2 -2
  111. package/lib/init/template/kafka/index.js +2 -2
  112. package/lib/init/template/kyma/index.js +7 -5
  113. package/lib/init/template/malware-scanner/index.js +2 -2
  114. package/lib/init/template/mta/files/mta.yaml.hbs +1 -1
  115. package/lib/init/template/multitenancy/index.js +18 -3
  116. package/lib/init/template/nodejs/index.js +4 -2
  117. package/lib/init/template/notifications/index.js +2 -2
  118. package/lib/init/template/portal/files/mta.yaml.hbs +4 -0
  119. package/lib/init/template/portal/index.js +13 -8
  120. package/lib/init/template/postgres/index.js +2 -2
  121. package/lib/init/template/redis/index.js +2 -2
  122. package/lib/init/template/sample/files/db/currencies.cds +2 -0
  123. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +1 -1
  124. package/lib/init/template/tiny-sample/files/nodejs/db/data/CatalogService.Books.csv +2 -2
  125. package/lib/init/template/workzone-standard/index.js +5 -5
  126. package/lib/init/template/xsuaa/index.js +20 -2
  127. package/lib/lint/eslintHelp.json +1 -1
  128. package/lib/mtx/auth_manager.js +103 -37
  129. package/lib/mtx/params.js +3 -2
  130. package/lib/mtx/settings_manager.js +45 -28
  131. package/lib/mtx/tenant_action.js +0 -1
  132. package/lib/mtx/util/credentials.js +62 -0
  133. package/node_modules/@cap-js/openapi/lib/compile/csdl.js +3 -3
  134. package/node_modules/@cap-js/openapi/lib/compile/csdl2openapi.js +111 -103
  135. package/node_modules/@cap-js/openapi/lib/compile/diagram.js +4 -4
  136. package/node_modules/@cap-js/openapi/lib/compile/types.d.ts +3 -1
  137. package/node_modules/@cap-js/openapi/package.json +3 -3
  138. package/node_modules/@sap/cds/CHANGELOG.md +64 -0
  139. package/node_modules/@sap/cds/app/index.js +5 -4
  140. package/node_modules/@sap/cds/eslint.config.mjs +1 -0
  141. package/node_modules/@sap/cds/lib/compile/for/nodejs.js +1 -0
  142. package/node_modules/@sap/cds/lib/compile/minify.js +14 -10
  143. package/node_modules/@sap/cds/lib/env/cds-env.js +1 -1
  144. package/node_modules/@sap/cds/lib/env/cds-requires.js +22 -11
  145. package/node_modules/@sap/cds/lib/env/defaults.js +4 -1
  146. package/node_modules/@sap/cds/lib/env/schemas/cds-rc.js +5 -2
  147. package/node_modules/@sap/cds/lib/plugins.js +9 -5
  148. package/node_modules/@sap/cds/lib/req/spawn.js +1 -1
  149. package/node_modules/@sap/cds/lib/srv/srv-dispatch.js +1 -1
  150. package/node_modules/@sap/cds/lib/srv/srv-models.js +1 -1
  151. package/node_modules/@sap/cds/lib/utils/cds-utils.js +2 -1
  152. package/node_modules/@sap/cds/libx/_runtime/common/generic/assert.js +2 -3
  153. package/node_modules/@sap/cds/libx/_runtime/common/generic/auth/restrict.js +8 -1
  154. package/node_modules/@sap/cds/libx/_runtime/common/generic/crud.js +18 -8
  155. package/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js +25 -17
  156. package/node_modules/@sap/cds/libx/_runtime/messaging/common-utils/authorizedRequest.js +3 -2
  157. package/node_modules/@sap/cds/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +9 -3
  158. package/node_modules/@sap/cds/libx/_runtime/remote/Service.js +4 -19
  159. package/node_modules/@sap/cds/libx/_runtime/remote/utils/LruCache.js +42 -0
  160. package/node_modules/@sap/cds/libx/_runtime/remote/utils/client.js +14 -4
  161. package/node_modules/@sap/cds/libx/_runtime/remote/utils/cloudSdkProvider.js +2 -9
  162. package/node_modules/@sap/cds/libx/_runtime/remote/utils/destinationClient.js +150 -0
  163. package/node_modules/@sap/cds/libx/_runtime/remote/utils/error.js +13 -0
  164. package/node_modules/@sap/cds/libx/_runtime/remote/utils/fetchClient.js +26 -18
  165. package/node_modules/@sap/cds/libx/_runtime/remote/utils/query.js +34 -23
  166. package/node_modules/@sap/cds/libx/_runtime/remote/utils/token.js +82 -0
  167. package/node_modules/@sap/cds/libx/_runtime/ucl/Service.js +36 -189
  168. package/node_modules/@sap/cds/libx/common/utils/streaming.js +16 -16
  169. package/node_modules/@sap/cds/libx/http/location.js +3 -3
  170. package/node_modules/@sap/cds/libx/odata/middleware/batch.js +16 -10
  171. package/node_modules/@sap/cds/libx/odata/middleware/metadata.js +9 -6
  172. package/node_modules/@sap/cds/libx/odata/middleware/service-document.js +1 -1
  173. package/node_modules/@sap/cds/libx/odata/parse/afterburner.js +19 -3
  174. package/node_modules/@sap/cds/libx/odata/parse/cqn2odata.js +83 -86
  175. package/node_modules/@sap/cds/libx/queue/SchedulingService.js +17 -2
  176. package/node_modules/@sap/cds/libx/queue/processing.js +1 -3
  177. package/node_modules/@sap/cds/libx/rest/RestAdapter.js +3 -7
  178. package/node_modules/@sap/cds/libx/rest/middleware/delete.js +3 -3
  179. package/node_modules/@sap/cds/libx/rest/middleware/parse.js +13 -8
  180. package/node_modules/@sap/cds/libx/rest/middleware/read.js +3 -3
  181. package/node_modules/@sap/cds/libx/rest/middleware/upsert.js +2 -2
  182. package/node_modules/@sap/cds/package.json +1 -1
  183. package/node_modules/@sap/cds-compiler/CHANGELOG.md +60 -8
  184. package/node_modules/@sap/cds-compiler/bin/cdsc.js +2 -2
  185. package/node_modules/@sap/cds-compiler/doc/IncompatibleChanges_v7.md +46 -19
  186. package/node_modules/@sap/cds-compiler/lib/api/main.js +10 -7
  187. package/node_modules/@sap/cds-compiler/lib/api/options.js +8 -2
  188. package/node_modules/@sap/cds-compiler/lib/base/csnRefs.js +5 -2
  189. package/node_modules/@sap/cds-compiler/lib/base/message-registry.js +4 -0
  190. package/node_modules/@sap/cds-compiler/lib/base/optionProcessor.js +12 -0
  191. package/node_modules/@sap/cds-compiler/lib/checks/enricher.js +1 -0
  192. package/node_modules/@sap/cds-compiler/lib/compiler/assert-consistency.js +8 -7
  193. package/node_modules/@sap/cds-compiler/lib/compiler/checks.js +3 -3
  194. package/node_modules/@sap/cds-compiler/lib/compiler/define.js +301 -75
  195. package/node_modules/@sap/cds-compiler/lib/compiler/dictionaries.js +2 -0
  196. package/node_modules/@sap/cds-compiler/lib/compiler/extend.js +40 -26
  197. package/node_modules/@sap/cds-compiler/lib/compiler/populate.js +45 -60
  198. package/node_modules/@sap/cds-compiler/lib/compiler/propagator.js +16 -7
  199. package/node_modules/@sap/cds-compiler/lib/compiler/resolve.js +41 -15
  200. package/node_modules/@sap/cds-compiler/lib/compiler/shared.js +7 -6
  201. package/node_modules/@sap/cds-compiler/lib/compiler/tweak-assocs.js +62 -50
  202. package/node_modules/@sap/cds-compiler/lib/compiler/utils.js +29 -14
  203. package/node_modules/@sap/cds-compiler/lib/edm/edmAnnoPreprocessor.js +6 -5
  204. package/node_modules/@sap/cds-compiler/lib/gen/CdlGrammar.checksum +1 -1
  205. package/node_modules/@sap/cds-compiler/lib/gen/CdlParser.js +1119 -1109
  206. package/node_modules/@sap/cds-compiler/lib/gen/Dictionary.json +19 -3
  207. package/node_modules/@sap/cds-compiler/lib/json/from-csn.js +10 -16
  208. package/node_modules/@sap/cds-compiler/lib/json/to-csn.js +58 -39
  209. package/node_modules/@sap/cds-compiler/lib/main.d.ts +8 -0
  210. package/node_modules/@sap/cds-compiler/lib/main.js +1 -0
  211. package/node_modules/@sap/cds-compiler/lib/model/csnUtils.js +2 -0
  212. package/node_modules/@sap/cds-compiler/lib/parsers/AstBuildingParser.js +2 -1
  213. package/node_modules/@sap/cds-compiler/lib/parsers/XprTree.js +8 -0
  214. package/node_modules/@sap/cds-compiler/lib/render/toCdl.js +22 -1
  215. package/node_modules/@sap/cds-compiler/lib/render/toSql.js +17 -2
  216. package/node_modules/@sap/cds-compiler/lib/render/utils/common.js +6 -1
  217. package/node_modules/@sap/cds-compiler/lib/render/utils/operators.js +27 -0
  218. package/node_modules/@sap/cds-compiler/lib/render/utils/standardDatabaseFunctions.js +125 -3
  219. package/node_modules/@sap/cds-compiler/lib/tool-lib/revealInternalProperties.js +2 -1
  220. package/node_modules/@sap/cds-compiler/lib/transform/db/applyTransformations.js +3 -0
  221. package/node_modules/@sap/cds-compiler/lib/transform/db/associations.js +8 -2
  222. package/node_modules/@sap/cds-compiler/lib/transform/db/backlinks.js +22 -6
  223. package/node_modules/@sap/cds-compiler/lib/transform/db/constraints.js +62 -1
  224. package/node_modules/@sap/cds-compiler/lib/transform/effective/annotations.js +40 -0
  225. package/node_modules/@sap/cds-compiler/lib/transform/effective/main.js +1 -0
  226. package/node_modules/@sap/cds-compiler/lib/transform/forRelationalDB.js +6 -1
  227. package/node_modules/@sap/cds-compiler/lib/transform/translateAssocsToJoins.js +19 -8
  228. package/node_modules/@sap/cds-compiler/package.json +1 -1
  229. package/node_modules/@sap/cds-mtxs/CHANGELOG.md +51 -0
  230. package/node_modules/@sap/cds-mtxs/bin/cds-mtx-migrate.js +32 -48
  231. package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +35 -16
  232. package/node_modules/@sap/cds-mtxs/cds-plugin.js +18 -0
  233. package/node_modules/@sap/cds-mtxs/lib/migration/migration.js +3 -408
  234. package/node_modules/@sap/cds-mtxs/lib/utils.js +19 -4
  235. package/node_modules/@sap/cds-mtxs/package.json +1 -1
  236. package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +6 -7
  237. package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/annotations.js +5 -2
  238. package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/index.js +6 -5
  239. package/node_modules/@sap/cds-mtxs/srv/extensibility-service.cds +0 -11
  240. package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +34 -35
  241. package/node_modules/@sap/cds-mtxs/srv/jobs-service.js +30 -24
  242. package/node_modules/@sap/cds-mtxs/srv/model-provider.js +19 -4
  243. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +6 -3
  244. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/hdi.js +5 -3
  245. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/srv-mgr.js +3 -2
  246. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/tms.js +17 -0
  247. package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +18 -21
  248. package/node_modules/@sap/xsenv/CHANGELOG.md +7 -0
  249. package/node_modules/@sap/xsenv/package.json +10 -7
  250. package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
  251. package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
  252. package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
  253. package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
  254. package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
  255. package/node_modules/hdb/cfg/VERSION +1 -1
  256. package/node_modules/hdb/lib/protocol/ClientInfo.js +16 -3
  257. package/node_modules/hdb/lib/protocol/Connection.js +1 -0
  258. package/node_modules/hdb/package.json +3 -2
  259. package/node_modules/negotiator/lib/accept.js +54 -0
  260. package/node_modules/negotiator/lib/charset.js +10 -34
  261. package/node_modules/negotiator/lib/encoding.js +9 -30
  262. package/node_modules/negotiator/lib/language.js +15 -36
  263. package/node_modules/negotiator/lib/mediaType.js +16 -134
  264. package/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
  265. package/node_modules/negotiator/node_modules/content-type/README.md +71 -0
  266. package/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
  267. package/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
  268. package/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
  269. package/node_modules/negotiator/node_modules/content-type/package.json +52 -0
  270. package/node_modules/negotiator/package.json +16 -10
  271. package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
  272. package/node_modules/qs/CHANGELOG.md +15 -0
  273. package/node_modules/qs/README.md +19 -1
  274. package/node_modules/qs/dist/qs.js +21 -21
  275. package/node_modules/qs/eslint.config.mjs +1 -1
  276. package/node_modules/qs/lib/parse.js +3 -4
  277. package/node_modules/qs/lib/stringify.js +23 -8
  278. package/node_modules/qs/lib/utils.js +10 -3
  279. package/node_modules/qs/package.json +4 -4
  280. package/node_modules/qs/test/parse.js +192 -3
  281. package/node_modules/qs/test/stringify.js +317 -0
  282. package/node_modules/qs/test/utils.js +12 -0
  283. package/node_modules/sax/lib/sax.js +27 -9
  284. package/node_modules/sax/package.json +1 -1
  285. package/node_modules/type-is/node_modules/content-type/README.md +2 -0
  286. package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
  287. package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
  288. package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
  289. package/node_modules/type-is/node_modules/content-type/package.json +1 -1
  290. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  291. package/node_modules/ws/package.json +1 -1
  292. package/package.json +5 -5
  293. package/bin/completion/scripts/cds-bash.sh +0 -20
  294. package/bin/completion/scripts/cds-fish.fish +0 -13
  295. package/bin/completion/scripts/cds-ps.ps1 +0 -19
  296. package/bin/completion/scripts/cds-zsh.sh +0 -13
  297. package/lib/deploy/index.js +0 -25
  298. package/lib/import/asyncapi/importAsyncAPI.js +0 -33
  299. package/lib/import/asyncapi/index.js +0 -18
  300. package/lib/import/asyncapi/parserContext.js +0 -372
  301. package/lib/import/asyncapi/utils.js +0 -49
  302. package/lib/init/template/nodejs/files/.gitignore.hbs +0 -34
  303. package/node_modules/@sap/cds/libx/_runtime/ucl/queries.js +0 -61
  304. package/node_modules/@sap/cds-mtxs/lib/migration/extension-project-builder.js +0 -129
  305. package/node_modules/@sap/cds-mtxs/lib/migration/extension-project.js +0 -89
  306. package/node_modules/@sap/cds-mtxs/lib/migration/mtx-adapter.js +0 -230
  307. package/node_modules/negotiator/HISTORY.md +0 -114
  308. /package/{lib → bin}/upgrade/context.js +0 -0
  309. /package/{lib → bin}/upgrade/migrations/cds10/migrations.json +0 -0
  310. /package/{lib → bin}/upgrade/preflight/cds-version.js +0 -0
  311. /package/{lib → bin}/upgrade/preflight/project-type.js +0 -0
  312. /package/{lib → bin}/upgrade/steps/analyze/classification.js +0 -0
  313. /package/{lib → bin}/upgrade/steps/analyze/detector.js +0 -0
  314. /package/{lib → bin}/upgrade/steps/analyze/evaluator.js +0 -0
  315. /package/{lib → bin}/upgrade/steps/analyze/reporter.js +0 -0
  316. /package/{lib → bin}/upgrade/steps/analyze/setup.js +0 -0
  317. /package/{lib → bin}/upgrade/steps/analyze/utils/detection.js +0 -0
  318. /package/{lib → bin}/upgrade/steps/analyze/utils/files.js +0 -0
  319. /package/{lib → bin}/upgrade/steps/analyze/utils/grep.js +0 -0
  320. /package/{lib → bin}/upgrade/steps/analyze/utils/yaml.js +0 -0
  321. /package/{lib → bin}/upgrade/util/workspaces.js +0 -0
  322. /package/{lib → bin}/watch/esm-resolve-registration.js +0 -0
  323. /package/{lib → bin}/watch/livereload-server.js +0 -0
  324. /package/{lib → bin}/watch/node-watch.js +0 -0
  325. /package/{lib → bin}/watch/open.js +0 -0
  326. /package/{lib → bin}/watch/watcher.js +0 -0
package/CHANGELOG.md CHANGED
@@ -6,17 +6,110 @@ This project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  The format is based on [Keep a Changelog](https://keepachangelog.com/).
8
8
 
9
+ ## Version 10.1.0 - 2026-09-03
10
+
11
+ ### Added
12
+
13
+ - `cds add hana-serverless` sets up SAP HANA Cloud serverless as the database, provisioning one HDI container per tenant through the serverless Tenant API.
14
+ - `cds add ai` now supports a `--plan` option to set the AI Core service plan in `mta.yaml` (default: `standard`).
15
+ - `cds add data` now supports a `--keys-only` option that, together with `--records`, fills only key columns in the generated CSV files and leaves all other columns empty.
16
+ - `cds add data` now generates values for `Binary`/`LargeBinary` (base64) and `Vector` (JSON array) elements instead of leaving them empty.
17
+ - `cds add data` now supports a `--composition-records` option to control how many records are generated per to-many composition (default 2).
18
+ - `cds add` now accepts space-separated features in addition to comma-separated, e.g. `cds add xsuaa hana nodejs`.
19
+ - `cds add extensibility` now adds an `ExtensionDeveloper` role collection to `mta.yaml` (suffixed `${org}-${space}`) and `chart/values.yaml` (suffixed with the Kyma namespace), so it can be assigned immediately after deployment.
20
+ - `cds version` now also shows the npm version and executable path.
21
+
22
+ ### Fixed
23
+
24
+ - `cds add data` now generates values across the full `@assert.range` when the range lies outside the default `[0,100]`, instead of emitting the lower bound for every record (integers) or exceeding the upper bound (decimals).
25
+ - `cds add data` now generates varying `Time` values instead of the same fixed `22:59:53` for every record.
26
+ - `cds add data` now honors `@assert.range` on `Double` elements instead of generating values across the default `[0,100]` regardless of the annotation.
27
+ - `cds add data` now generates whole numbers for `Integer` elements whose `@assert.range` uses fractional bounds, instead of emitting fractional values.
28
+ - `cds add data` now generates varied values for `Decimal` elements whose scale equals their precision (such as `Decimal(2,2)`), instead of emitting `0` for every record.
29
+ - `cds add data` now honors `@assert.range` on `Timestamp` elements instead of always generating dates in the default `2000-2024` window.
30
+ - `cds add data` no longer crashes with `Invalid time value` when a `Date` element has a single-day `@assert.range`.
31
+ - `cds add data` now generates varied dates within `@assert.range` bounds on `Date`, `DateTime` and `Timestamp` elements when the range lies entirely outside the default `2000-2024` window, instead of emitting the same out-of-range value for every record.
32
+ - `cds add data` now honors open-interval and infinity `@assert.range` bounds (such as `[(0),_]` or `[(5),(10)]`) on numeric and date elements, instead of ignoring them and generating values across the default range.
33
+ - `cds add data` now generates the exact day for `Date` elements regardless of the local timezone, instead of occasionally emitting the day before the intended date.
34
+ - `cds add data` now generates multiple distinct rows for link entities whose key consists of two or more associations, instead of collapsing them to a single row.
35
+ - `cds add data` now writes the foreign-key column for to-one compositions into the parent CSV, instead of leaving the parent unlinked to its generated child.
36
+ - `cds add data` now honors an `@assert.range` on an `array of` scalar element, so the generated array elements stay within the annotated bounds.
37
+ - `cds add data` now generates the requested number of distinct rows for a standalone link entity whose key associations point to entities created on demand, instead of collapsing them to a single row.
38
+ - `cds add data` now pairs two distinct target rows in a self-referential link entity (two key associations to the same entity), instead of pointing both foreign keys at the same row.
39
+ - `cds build --ws-pack` now also packs the workspace root package into a module's `gen/srv` when the module depends on it via a `file:` spec, so monorepos whose root package is itself a dependency no longer need to pack it by hand.
40
+ - `cds bind --to-app-services` no longer classifies a machine-to-machine `identity` binding that consumes another service (carrying `consumed-services`) as the application's user authentication, so it no longer overwrites the real `xsuaa` auth binding.
41
+ - `cds build` now copies the workspace root `package-lock.json` into a module's `gen/srv` when the module has none, so npm workspaces monorepo deployments get frozen dependencies instead of freshly resolved ranges.
42
+ - `cds build` now copies `.cdsrc.yaml` into the deployment output folder alongside `.cdsrc.json`, so YAML-based CDS configuration works correctly when deployed to Cloud Foundry.
43
+ - `cds import --from asyncapi` now correctly imports types referenced via `$ref` in AsyncAPI schemas, including `allOf` composition, and no longer loses types from earlier events when a service has multiple events.
44
+ - `cds build` now correctly resolves `manifest.json` for UI5 CLI v5 component projects, which use a `src/` folder instead of `webapp/`.
45
+ - `cds build --for fiori` now honors custom `resources.configuration.paths` mappings in `ui5.yaml` when locating a UI module's `manifest.json`.
46
+ - `cds add html5-repo`, `cds add workzone`, and `cds add portal` no longer emit an HTML5 application content deployer module into `mta.yaml` when the project has no UI apps, avoiding the `could not find the ".../gen/app" path` build failure.
47
+ - `cds up` now pushes buildpack images directly to the registry via `pack build --publish`, avoiding the `manifest invalid` error on containerd-backed Docker daemons.
48
+ - `cds add app-front` avoids duplicates for `srv-api` in `xs-app.json` if entries pre-exist.
49
+ - `cds add ias` (and `cds add ams`) with an approuter no longer leaves a stray `properties.name: srv-api` on the approuter's `srv-api` destination in `mta.yaml`, which uses certificate-based forwarding instead.
50
+ - `cds add sample` fixes cds files such that `const { Books } = cds.entities` works, i.e. the default namespace is set.
51
+
52
+ ### Changed
53
+
54
+ - `cds watch` now ignores the `.cds` folder by default, alongside the existing defaults like `node_modules` and `gen`. `.cds` model files and `.cdsrc.json` are unaffected.
55
+ - `cds compile -2 asyncapi` and `cds import --asyncapi` are now provided by `@cap-js/asyncapi` as a CDS plugin. The plugin is currently still bundled with `@sap/cds-dk`. Add it explicitly to your `devDependencies` as it will be removed in a future version.
56
+ - `cds build` now packages npm workspace dependencies as tarballs by default, use `--no-ws-pack` to disable.
57
+ - `cds completion` now comes with pre-calculated shell scripts for faster tab-completion. Also, it no longer disturbs shell completion in VS Code debug terminals.
58
+ - `cds add approuter` now uses `@sap/approuter@^23.0.0` instead of `@sap/approuter@^22.0.0`.
59
+
60
+ ## Version 10.0.9 - tbd
61
+
62
+ ### Fixed
63
+
64
+ - `cds login`, `cds pull`, and `cds push` again support non-interactive machine login with `--client` and `--mtls`, now performed directly against the authorization server. See `cds login --help` for the credentials and environment variables.
65
+
66
+ ## Version 10.0.8 - 2026-08-24
67
+
68
+ ### Changed
69
+
70
+ - `cds login` now uses the renamed login endpoints `/-/cds/login/grant` and `/-/cds/login/grant-metadata` with a legacy fallback, and updates saved legacy token URLs.
71
+
72
+ ## Version 10.0.7 - 2026-08-07
73
+
74
+ ### Fixed
75
+
76
+ - Bundle `@sap/cds-mtxs` 4 again, instead of 3.
77
+ - `cds import --from asyncapi` now correctly imports types referenced via `$ref` in AsyncAPI schemas, including `allOf` composition, and no longer loses types from earlier events when a service has multiple events.
78
+ - `cds add html5-repo`, `cds add workzone`, and `cds add portal` no longer emit an HTML5 application content deployer module into `mta.yaml` when the project has no UI apps, avoiding the `could not find the ".../gen/app" path` build failure.
79
+ - `cds init --nodejs` creates the ESLint and VS Code config files again
80
+
81
+ ### Changed
82
+
83
+ - `cds init --nodejs` creates a cleaned-up .gitignore file
84
+
9
85
  ## Version 10.0.6 - 2026-07-24
10
86
 
11
87
  ### Added
12
88
 
13
89
  - `cds add xsuaa` now generates namespace-suffixed XSUAA `role-collections` for Kyma.
14
90
 
91
+ ### Changed
92
+
93
+ - `cds init` and `cds add` now detect app folders by the UI framework in their `package.json` (`@ui5/cli`, `react`, `vue`, `svelte`, `@angular/core`, `vite`) or a `webapp/manifest.json`, instead of matching against well-known folder names.
94
+ - `cds add approuter` now generates the approuter into `.deploy/app-router` by default instead of `app/router`, still respecting an existing `app/router` folder.
95
+ - `cds add html5-repo`, `cds add app-frontend`, and `cds add portal` now place the HTML5 application content deployer in `.deploy/html5-deployer` by default instead of `app/html5-deployer`, still respecting an existing `app/html5-deployer` folder.
96
+
15
97
  ### Fixed
16
98
 
99
+ - `cds add http` now respects capability restrictions, emitting only supported requests for `@Capabilities.*Restrictions: false`, `@odata.singleton`, and `@insertonly` entities.
100
+ - `cds add http` now generates requests for bound actions and functions on an instance, including draft-enabled entities (e.g. `POST .../E(ID=…,IsActiveEntity=true)/S.approve`), and `GET` requests for OData functions.
101
+ - `cds add http` now omits readonly, computed and managed fields (`@readonly`, `@Core.Computed`, `@cds.on.insert`/`@cds.on.update`) from `POST`/`PATCH` bodies, since clients cannot set them.
102
+ - `cds add http` now slugs `# @name` handles and suffixes collisions, so delimited names (`![a.b]`) and entities that slug alike (`A.sub` vs. `Asub`) yield valid, unique handles.
103
+ - `cds add http` now flattens nested composition entity-set names to underscores in URLs (e.g. `E_addr` instead of the unroutable `E.addr`).
104
+ - `cds add http` now includes all keys in composite-key draft requests instead of only the first, and single-quotes single string keys (e.g. `Books/'abc'`), matching composite string keys.
105
+ - `cds add http` now addresses parameterized entities as `Entity(p=…)/Set`, omitting the invalid `POST`/`PATCH`/`DELETE` requests it previously generated for them.
106
+ - `cds add http` no longer emits `PATCH`/`DELETE` requests with `undefined` or `[object Object]` in the URL for keys without a sample value, structured keys, or entities without a scalar key.
107
+ - `cds add http` no longer produces a double slash in request URLs for a service mounted at the root path (`@path: '/'`).
108
+ - `cds add http` and `cds add data` no longer crash with `Cannot convert undefined or null to object` for a keyless entity whose composition's `on` condition references `$self`.
17
109
  - `cds add http` no longer throws `MULTIPLE_DOCS` when `application.yaml` uses `---` separators (Spring Boot multi-profile format).
18
110
  - `cds export --data` now reads seed data via in-memory SQLite instead of the configured db driver, so it no longer fails in projects with `requires.db: hana` (e.g. CAP Java).
19
111
  - `cds init --java --add mta` now writes `path: srv` for the Java `srv` module in `mta.yaml` instead of `gen/srv`, so `mbt build` no longer fails with `the "gen/srv" path of the "<app>-srv" module does not exist`.
112
+ - `cds build --for nodejs --production` now also bundles _messages.properties_ files from plugins found via neighborhood resolution. `cds build --for java` retains the previous behaviour and does not use neighborhood resolution for plugin message files.
20
113
  - `cds version` no longer reports dependency problems if no dependencies are installed at all. It prints an info message instead.
21
114
  - `cds add test` creates tests that are green by default. Sample data is provided as commented code.
22
115
 
@@ -84,6 +177,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
84
177
  - `cds add ias` does not use the `HTML5.` prefix for HTML5 repo settings.
85
178
  - `cds add node` now adds a devDependency to `@cap-js/sqlite@^3`
86
179
  - `cds upgrade` now produces concise CLI output (count + title per rule) and a structured report with capire-aligned sections.
180
+ - The preferred way of calling `cds export` for Maven is now `cds export --mvn groupId:artifactId`. When using the old `cds export -4 mvn` syntax, groupId and artifactId must be passed via the `--artifact` parameter instead.
87
181
 
88
182
  ### Fixed
89
183
 
@@ -137,6 +231,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
137
231
  - `cds migrate` is removed as `@sap/cds-mtx` to `@sap/cds-mtxs` migration is now effectively complete.
138
232
  - `cds login`, `cds logout`, `cds pull`, `cds push`: the project-folder argument and the `--directory` (`-d`) option are removed; run these commands from the project directory instead.
139
233
 
234
+ ## Version 9.9.5 - 2026-08-24
235
+
236
+ ### Changed
237
+
238
+ - `cds login` now uses the renamed login endpoints `/-/cds/login/grant` and `/-/cds/login/grant-metadata` with a legacy fallback, and updates saved legacy token URLs.
239
+
240
+ ## Version 9.9.4 - 2026-07-31
241
+
242
+ ### Changed
243
+
244
+ - `cds init` uses Maven Java archetype version 4.9.1 for creating Java projects.
245
+ - Other dependency updates
246
+
140
247
  ## Version 9.9.3 - 2026-06-29
141
248
 
142
249
  ### Fixed
package/bin/add.js CHANGED
@@ -5,7 +5,7 @@ const { join } = require('path')
5
5
  const fromDk = fs.readdirSync(join(__dirname, '../lib/init/template'))
6
6
  const fromPlugins = require('../lib/init/add').registered
7
7
  const conf = {}
8
- for (const plugin of [...fromDk, ...Object.keys(Object.fromEntries(fromPlugins))]) {
8
+ for (const plugin of [...fromDk, ...fromPlugins.keys()]) {
9
9
  const Plugin = fromPlugins.get(plugin) ?? require(join(__dirname, '../lib/init/template', plugin))
10
10
  for (const [key, { type, help, short }] of Object.entries(new Plugin().options())) {
11
11
  conf[plugin] ??= { options: [], flags: [], help: [] }
@@ -22,15 +22,17 @@ const shortcuts = ['-4', '-p', ...Object.values(conf).flatMap(p => p.options).so
22
22
  const flags = ['--force', ...Object.values(conf).flatMap(p => p.flags).map(o => o.key)]
23
23
  DEBUG?.('cli config ', { options, shortcuts, flags })
24
24
 
25
+ const { COMMA } = require('./completion')
26
+
25
27
  module.exports = Object.assign(add, {
26
- handleCompletion,
28
+ staticCompletions: () => ({ '_': COMMA(require('./completion/completionFs').readTemplates([])) }),
27
29
  options,
28
30
  shortcuts,
29
31
  flags,
30
32
  help: `
31
33
  # SYNOPSIS
32
34
 
33
- *cds add* <feature | comma-separated list of features>
35
+ *cds add* <feature> [<feature> ...]
34
36
 
35
37
  Add one or more features to an existing project - grow as you go.
36
38
 
@@ -66,6 +68,7 @@ ${Object.entries(conf).flatMap(([pluginName, { options, flags }]) => {
66
68
  # EXAMPLES
67
69
 
68
70
  *cds add* sample
71
+ *cds add* multitenancy hana xsuaa
69
72
  *cds add* multitenancy,hana,xsuaa
70
73
  *cds add* data --filter my.namespace.MyEntity
71
74
  *cds add* mta
@@ -77,29 +80,10 @@ ${Object.entries(conf).flatMap(([pluginName, { options, flags }]) => {
77
80
 
78
81
  # SUMMARY
79
82
 
80
- *cds add* <feature | comma-separated list of features>
83
+ *cds add* <feature> [<feature> ...]
81
84
 
82
85
  `});
83
86
 
84
- async function handleCompletion(currentWord, previousWord, argv, util) {
85
- const allOptionsFlags = [
86
- ...options ?? [],
87
- ...flags ?? []
88
- ].filter(e => !argv.includes(e));
89
-
90
- if (currentWord?.startsWith('-')) {
91
- return allOptionsFlags;
92
- }
93
-
94
- if (!currentWord && options?.includes(previousWord)) {
95
- return [];
96
- }
97
-
98
- const entries = await util.completionFs.readTemplates(argv);
99
- entries.push(...allOptionsFlags);
100
-
101
- return entries;
102
- }
103
87
 
104
88
  async function add(args) {
105
89
  const cds = require('../lib/cds')
package/bin/bind.js CHANGED
@@ -1,6 +1,12 @@
1
1
  const term = require('../lib/util/term')
2
+ const { FILE } = require('./completion')
2
3
 
3
4
  module.exports = Object.assign(cds_bind, {
5
+ staticCompletions: () => ({
6
+ '--on': ['cf', 'k8s'],
7
+ '--out': FILE(),
8
+ '--output-file': FILE(),
9
+ }),
4
10
  options: ['--to', '--for', '--on', '--kind', '--out', '--to-app-services', '--credentials', '--output-file'],
5
11
  flags: ['--exec', '--no-create-service-key'],
6
12
  shortcuts: ['-2', '-4', '-n', '-k', '-o', '-a', '-c'],
@@ -165,6 +171,10 @@ async function cds_bind(args, options) {
165
171
 
166
172
  services.forEach(service => {
167
173
  const type = service.label || service.type;
174
+ if (type === 'identity' && Array.isArray(service.credentials?.['consumed-services']) && service.credentials['consumed-services'].length > 0) {
175
+ console.log(`skipping ${term.bold(service.name)}: identity binding consuming another service, not the application's user authentication`)
176
+ return
177
+ }
168
178
  const requiredServiceEntry = Object.entries(cds.env.requires).find(([, requiredService]) => requiredService.kind === type && requiredService?.vcap?.name === service.name)
169
179
  if (requiredServiceEntry) {
170
180
  resolvedServices.push({ options: { ...options, ...{ to: service.name, serviceArg: requiredServiceEntry[0] } } })
package/bin/build.js CHANGED
@@ -1,8 +1,15 @@
1
+ const { DIR } = require('./completion');
2
+
1
3
  module.exports = Object.assign(build, {
2
- handleCompletion,
4
+ staticCompletions: () => ({
5
+ '--for': ['hana', 'helm', 'java', 'mtx', 'mtx-extension', 'mtx-sidecar', 'nodejs'],
6
+ '--log-level':['debug', 'info', 'warn', 'error'],
7
+ '--dest': DIR(),
8
+ '--src': DIR(),
9
+ }),
3
10
  options: ['--project', '--src', '--dest', '--for', '--opts', '--log-level', '--options-model'],
4
11
  shortcuts: ['-in', '-s', '-o', '-4'],
5
- flags: ['--no-clean', '--ws', '--ws-pack'],
12
+ flags: ['--no-clean', '--ws', '--ws-pack', '--no-ws-pack'],
6
13
  help: `
7
14
  # SYNOPSIS
8
15
 
@@ -70,7 +77,7 @@ module.exports = Object.assign(build, {
70
77
 
71
78
  Skips cleaning the output folder before running the build.
72
79
 
73
- *--ws-pack* (beta)
80
+ *--ws-pack* (default)
74
81
 
75
82
  Enable tarball based packaging of npm workspace dependencies - typically defined for
76
83
  Node.js mono or multi-repo setups.
@@ -79,6 +86,10 @@ module.exports = Object.assign(build, {
79
86
  will be adapted to point to the correct tarball file URL.
80
87
  Contents is packaged based on the rules of the 'npm pack' command.
81
88
 
89
+ *--no-ws-pack*
90
+
91
+ Disable tarball based packaging of npm workspace dependencies.
92
+
82
93
  *--ws* (beta)
83
94
 
84
95
  NPM workspaces are typically used in mono or multi-repo setups whereas each workspace
@@ -101,36 +112,6 @@ module.exports = Object.assign(build, {
101
112
  *cds* build --for java --dest ../srv/target --opts model=[db/model,srv,schema]
102
113
  `})
103
114
 
104
- async function handleCompletion(currentWord, previousWord, argv, util) {
105
- const allOptionsFlags = [
106
- ...build.options ?? [],
107
- ...build.flags ?? []
108
- ].filter(e => !argv.includes(e));
109
-
110
- if (currentWord?.startsWith('-')) {
111
- return allOptionsFlags;
112
- }
113
-
114
- switch (previousWord) {
115
- case '--log-level':
116
- return ['debug', 'info', 'warn', 'error'];
117
- case '-4':
118
- case '--for':
119
- return ['hana', 'java', 'mtx', 'mtx-extension', 'mtx-sidecar', 'nodejs'];
120
- case '--dest':
121
- case '-o':
122
- case '-s':
123
- case '--src': {
124
- return util.completionFs.readdir(currentWord, { files: false });
125
- }
126
- }
127
-
128
- if (!currentWord && build.options?.includes(previousWord)) {
129
- return [];
130
- }
131
-
132
- return allOptionsFlags;
133
- }
134
115
 
135
116
  async function build([project], options = {}) {
136
117
  const path = require('path')
@@ -160,6 +141,12 @@ async function build([project], options = {}) {
160
141
  }
161
142
  delete options["no-clean"]
162
143
  }
144
+ if (options["no-ws-pack"] === "true" || options["no-ws-pack"] === true) {
145
+ options["ws-pack"] = false
146
+ delete options["no-ws-pack"]
147
+ } else if (typeof options["ws-pack"] === 'undefined') {
148
+ options["ws-pack"] = true
149
+ }
163
150
  // convert opts string to task options object
164
151
  if (options.opts) {
165
152
  options.taskOptions = scanTaskOptionParams(options.opts)
@@ -198,4 +185,3 @@ function scanTaskOptionParams(optsParams) {
198
185
  }
199
186
  return taskOptions
200
187
  }
201
-
package/bin/cds.js CHANGED
@@ -229,7 +229,7 @@ function _dieForUnknownCommand(cmd) {
229
229
  }
230
230
 
231
231
  function getCommands() {
232
- const excludeList = new Set(['cds.js', 'cds-ts.js', 'fix-redirects.js']);
232
+ const excludeList = new Set(['cds.js', 'cds-ts.js', 'cds-tsx.js', 'fix-redirects.js']);
233
233
 
234
234
  const files = fs.readdirSync(__dirname, { withFileTypes: true, encoding: 'utf8' })
235
235
  const result = new Set()
@@ -1,6 +1,19 @@
1
+ const { FILE, DIR } = require('../completion');
1
2
 
2
3
  module.exports = Object.assign ( compile, {
3
- handleCompletion,
4
+ staticCompletions: () => ({
5
+ '--to': ['json', 'yml', 'edm', 'edmx', 'edmx-v2', 'edmx-v4', 'sql', 'hdbtable', 'hana', 'cdl', 'xsuaa', 'openapi', 'asyncapi'],
6
+ '--for': ['odata', 'sql'],
7
+ '--dialect': ['sqlite', 'h2', 'postgres', 'hana'],
8
+ '--sql-dialect': ['sqlite', 'h2', 'postgres', 'hana'],
9
+ '--log-level': ['debug', 'info', 'warn', 'error'],
10
+ '--odata-version':['4.0', '4.01'],
11
+ '--flavor': ['sources', 'files', 'parsed', 'xtended', 'inferred'],
12
+ '--service': ['all'],
13
+ '--lang': ['all'],
14
+ '--dest': DIR(),
15
+ '_': FILE('cds,json'),
16
+ }),
4
17
  options: [
5
18
  '--from',
6
19
  '--service',
@@ -77,7 +90,7 @@ module.exports = Object.assign ( compile, {
77
90
  - cdl
78
91
  - xsuaa
79
92
  - openapi
80
- - asyncapi
93
+ - asyncapi (requires @cap-js/asyncapi as a project dependency, currently bundled as a fallback)
81
94
 
82
95
  *-4* | *--for* <target>
83
96
 
@@ -188,45 +201,6 @@ module.exports = Object.assign ( compile, {
188
201
 
189
202
  const path = require('path')
190
203
 
191
- async function handleCompletion(currentWord, previousWord, argv, util) {
192
- const allOptionsFlags = [
193
- ...compile.options ?? [],
194
- ...compile.flags ?? []
195
- ].filter(e => !argv.includes(e))
196
-
197
- if (currentWord?.startsWith('-')) { return allOptionsFlags }
198
-
199
- switch (previousWord) {
200
- case '-2':
201
- case '--to':
202
- return ['json', 'yml', 'edm', 'edmx', 'edmx-v2', 'edmx-v4', 'sql', 'hdbtable', 'hana', 'cdl', 'xsuaa', 'openapi', 'asyncapi'];
203
- case '-4':
204
- case '--for':
205
- return ['odata', 'sql'];
206
- case '--dialect':
207
- return ['sqlite', 'h2', 'postgres', 'hana'];
208
- case '--log-level':
209
- return ['debug', 'info', 'warn', 'error'];
210
- case '--odata-version':
211
- return ['4.0', '4.01'];
212
- case '-f':
213
- case '--flavor':
214
- return ['sources', 'files', 'parsed', 'xtended', 'inferred'];
215
- case '-s':
216
- case '--service':
217
- case '-l':
218
- case '--lang':
219
- return ['all'];
220
- case '-o':
221
- case '--dest':
222
- return util.completionFs.readdir(currentWord, { files: false })
223
- default:
224
- }
225
-
226
- if (!currentWord && compile.options?.includes(previousWord)) { return [] }
227
-
228
- return util.completionFs.readdir(currentWord, { fileRegex: /\.(cds|json)/ })
229
- }
230
204
 
231
205
  async function compile_all (root='.') {
232
206
 
@@ -1,4 +1,6 @@
1
1
  module.exports = new class CompletionFS {
2
+ // Returns a list of file/folder names under currentFolder that match the given options.
3
+ // currentFolder may be a partial path typed by the user (e.g. 'src/', 'lib/u').
2
4
  async readdir(currentFolder, options) {
3
5
  options = {
4
6
  files: true,
@@ -10,6 +12,8 @@ module.exports = new class CompletionFS {
10
12
  const fsp = require('node:fs/promises');
11
13
  const path = require('node:path');
12
14
 
15
+ // Detect the path separator from the typed prefix so completions use the same style.
16
+ // Group 1 captures '\' (Windows), group 0 captures '/' (Unix); default to '/'.
13
17
  const match = /\/|(\\)[^\s]/.exec(currentFolder);
14
18
  const separationChar = match?.[1] || match?.[0] || '/';
15
19
  let folder = currentFolder || process.cwd();
@@ -18,9 +22,11 @@ module.exports = new class CompletionFS {
18
22
  try {
19
23
  entries = await fsp.readdir(folder, { withFileTypes: true });
20
24
  } catch {
25
+ // currentFolder was a partial filename (not a directory) — list its parent instead.
21
26
  folder = path.dirname(folder);
22
27
  entries = await fsp.readdir(folder, { withFileTypes: true });
23
28
  }
29
+ // When listing the cwd, use relative names (e.g. 'src/') rather than absolute paths.
24
30
  const isCwd = folder === '.' || folder === process.cwd();
25
31
 
26
32
  entries = entries
@@ -28,15 +34,10 @@ module.exports = new class CompletionFS {
28
34
  options.folders && e.isDirectory() && e.name.match(options.folderRegex)
29
35
  || options.files && e.isFile() && e.name.match(options.fileRegex))
30
36
  .map(e => {
31
- let result = isCwd
32
- ? path.relative(folder, e.name)
37
+ const name = isCwd
38
+ ? e.name
33
39
  : (folder + separationChar + e.name).replace(/\\{2,}/g, '\\').replace(/\/{2,}/g, '/');
34
-
35
- if (e.isDirectory()) {
36
- result += separationChar;
37
- }
38
-
39
- return result;
40
+ return e.isDirectory() ? name + separationChar : name;
40
41
  });
41
42
 
42
43
  if (entries.length === 0) {
@@ -45,6 +46,8 @@ module.exports = new class CompletionFS {
45
46
  return entries;
46
47
  }
47
48
 
49
+ // Returns the names of available project template directories (used by `cds init --add`).
50
+ // argv: template names to exclude in addition to the built-in 'nodejs' and 'java' ones.
48
51
  async readTemplates(argv) {
49
52
  const fsp = require('node:fs/promises');
50
53
  const path = require('node:path');