@sap/cds-dk 10.0.7 → 10.1.1

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 (341) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/bin/add.js +7 -23
  3. package/bin/bind.js +14 -0
  4. package/bin/build.js +21 -34
  5. package/bin/cds.js +1 -1
  6. package/bin/compile/index.js +16 -41
  7. package/bin/completion/completionFs.js +11 -8
  8. package/bin/completion/index.js +603 -80
  9. package/bin/completion/scripts/cds.fish +620 -0
  10. package/bin/completion/scripts/cds.ps1 +403 -0
  11. package/bin/completion/scripts/cds.sh +327 -0
  12. package/bin/completion/scripts/cds.zsh +296 -0
  13. package/bin/completion/templates/cds-tmpl.fish +65 -0
  14. package/bin/completion/templates/cds-tmpl.ps1 +217 -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 +11 -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/env.js +4 -1
  25. package/bin/export.js +44 -6
  26. package/bin/help/export.md +3 -0
  27. package/bin/help.js +1 -5
  28. package/bin/import.js +9 -0
  29. package/bin/init.js +6 -24
  30. package/bin/inspect.js +8 -0
  31. package/bin/lint.js +5 -3
  32. package/bin/login.js +26 -20
  33. package/bin/minify.js +6 -1
  34. package/bin/pull.js +19 -6
  35. package/bin/push.js +19 -6
  36. package/bin/repl.js +11 -2
  37. package/bin/run.js +12 -1
  38. package/bin/serve.js +13 -2
  39. package/bin/up.js +17 -11
  40. package/{lib → bin}/upgrade/constants.js +1 -1
  41. package/bin/{upgrade.js → upgrade/index.js} +2 -2
  42. package/{lib → bin}/upgrade/preflight/consistency.js +1 -1
  43. package/{lib → bin}/upgrade/preflight/index.js +1 -1
  44. package/{lib → bin}/upgrade/steps/analyze/index.js +1 -1
  45. package/{lib → bin}/upgrade/steps/install.js +1 -1
  46. package/{lib → bin}/upgrade/steps/openrewrite.js +1 -1
  47. package/{lib → bin}/upgrade/steps/removals.js +1 -1
  48. package/{lib → bin}/upgrade/steps/rewrite.js +1 -1
  49. package/{lib → bin}/upgrade/steps/verify.js +1 -1
  50. package/{lib/upgrade/index.js → bin/upgrade/upgrade.js} +2 -2
  51. package/{lib → bin}/upgrade/util/pom.js +2 -2
  52. package/{lib → bin}/upgrade/util/prompt.js +1 -1
  53. package/bin/util/containerize.js +10 -4
  54. package/bin/version.js +10 -1
  55. package/{lib → bin}/watch/hot-reload.js +1 -1
  56. package/bin/{watch.js → watch/index.js} +24 -9
  57. package/{lib → bin}/watch/livereload-connect.js +1 -1
  58. package/{lib → bin}/watch/vite-watch.js +1 -1
  59. package/{lib → bin}/watch/watched.js +2 -2
  60. package/lib/build/constants.js +1 -1
  61. package/lib/build/plugins/fiori/index.js +31 -2
  62. package/lib/build/plugins/internal.js +4 -2
  63. package/lib/build/plugins/mtx-sidecar/index.js +7 -8
  64. package/lib/build/plugins/nodejs/index.js +64 -7
  65. package/lib/build/util.js +2 -4
  66. package/lib/compile/to_asyncapi.js +1 -1
  67. package/lib/env/schema.js +16 -0
  68. package/lib/env/schemas/cds-rc.js +1 -76
  69. package/lib/import/importapi.js +2 -3
  70. package/lib/import/message.js +0 -2
  71. package/lib/init/constants.js +2 -1
  72. package/lib/init/index.js +2 -2
  73. package/lib/init/merge.js +123 -280
  74. package/lib/init/plugin.js +3 -1
  75. package/lib/init/projectReader.js +22 -6
  76. package/lib/init/registries/xs-app.js +3 -5
  77. package/lib/init/template/ai/files/mta.yaml.hbs +1 -1
  78. package/lib/init/template/ai/index.js +14 -2
  79. package/lib/init/template/ams/index.js +2 -2
  80. package/lib/init/template/app-frontend/files/containerize.yaml.hbs +2 -2
  81. package/lib/init/template/app-frontend/index.js +4 -4
  82. package/lib/init/template/application-logging/index.js +2 -2
  83. package/lib/init/template/approuter/files/package.json +1 -1
  84. package/lib/init/template/approuter/index.js +8 -3
  85. package/lib/init/template/attachments/files/package.json.hbs +1 -1
  86. package/lib/init/template/attachments/index.js +2 -2
  87. package/lib/init/template/audit-logging/index.js +2 -2
  88. package/lib/init/template/cloud-logging/files/package.json.hbs +4 -4
  89. package/lib/init/template/cloud-logging/index.js +2 -2
  90. package/lib/init/template/completion/completionSetup.js +36 -39
  91. package/lib/init/template/connectivity/index.js +2 -2
  92. package/lib/init/template/data/as-csv.js +15 -5
  93. package/lib/init/template/data/as-json.js +117 -42
  94. package/lib/init/template/data/index.js +16 -2
  95. package/lib/init/template/destination/index.js +2 -2
  96. package/lib/init/template/dynatrace/files/package.json.hbs +3 -3
  97. package/lib/init/template/dynatrace/index.js +2 -2
  98. package/lib/init/template/enterprise-messaging/index.js +2 -2
  99. package/lib/init/template/enterprise-messaging-shared/index.js +2 -2
  100. package/lib/init/template/extensibility/files/mta.yaml.hbs +11 -0
  101. package/lib/init/template/extensibility/files/xs-security.json.hbs +1 -1
  102. package/lib/init/template/extensibility/index.js +3 -3
  103. package/lib/init/template/github-actions/index.js +2 -2
  104. package/lib/init/template/hana/index.js +3 -2
  105. package/lib/init/template/hana-serverless/files/db/package.json +14 -0
  106. package/lib/init/template/hana-serverless/files/identity.values.yaml.hbs +10 -0
  107. package/lib/init/template/hana-serverless/files/mta.yaml.hbs +64 -0
  108. package/lib/init/template/hana-serverless/files/package.json.hbs +35 -0
  109. package/lib/init/template/hana-serverless/files/src/.hdiconfig +139 -0
  110. package/lib/init/template/hana-serverless/files/undeploy.json +7 -0
  111. package/lib/init/template/hana-serverless/files/values.yaml.hbs +18 -0
  112. package/lib/init/template/hana-serverless/index.js +184 -0
  113. package/lib/init/template/html5-repo/files/containerize.yaml.hbs +2 -2
  114. package/lib/init/template/html5-repo/files/mta.yaml.hbs +5 -0
  115. package/lib/init/template/html5-repo/index.js +18 -14
  116. package/lib/init/template/http/index.js +123 -26
  117. package/lib/init/template/ias/index.js +2 -2
  118. package/lib/init/template/kafka/index.js +2 -2
  119. package/lib/init/template/kyma/index.js +7 -5
  120. package/lib/init/template/malware-scanner/index.js +2 -2
  121. package/lib/init/template/mta/files/mta.yaml.hbs +1 -1
  122. package/lib/init/template/multitenancy/index.js +18 -3
  123. package/lib/init/template/notifications/index.js +2 -2
  124. package/lib/init/template/portal/files/mta.yaml.hbs +4 -0
  125. package/lib/init/template/portal/index.js +13 -8
  126. package/lib/init/template/postgres/index.js +2 -2
  127. package/lib/init/template/redis/index.js +2 -2
  128. package/lib/init/template/sample/files/db/currencies.cds +2 -0
  129. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +1 -1
  130. package/lib/init/template/tiny-sample/files/nodejs/db/data/CatalogService.Books.csv +2 -2
  131. package/lib/init/template/workzone-standard/index.js +5 -5
  132. package/lib/init/template/xsuaa/index.js +20 -2
  133. package/lib/lint/eslintHelp.json +1 -1
  134. package/lib/mtx/auth_manager.js +103 -37
  135. package/lib/mtx/params.js +3 -2
  136. package/lib/mtx/settings_manager.js +45 -28
  137. package/lib/mtx/tenant_action.js +0 -1
  138. package/lib/mtx/util/credentials.js +62 -0
  139. package/node_modules/@cap-js/db-service/CHANGELOG.md +17 -0
  140. package/node_modules/@cap-js/db-service/lib/common/generic-pool.js +4 -7
  141. package/node_modules/@cap-js/db-service/lib/cqn2pql.js +1 -1
  142. package/node_modules/@cap-js/db-service/lib/cqn2sql.js +15 -11
  143. package/node_modules/@cap-js/db-service/lib/cqn4sql.js +119 -19
  144. package/node_modules/@cap-js/db-service/lib/infer/index.js +27 -16
  145. package/node_modules/@cap-js/db-service/lib/recursion-guard.js +40 -0
  146. package/node_modules/@cap-js/db-service/lib/search.js +1 -1
  147. package/node_modules/@cap-js/db-service/package.json +1 -1
  148. package/node_modules/@cap-js/sqlite/CHANGELOG.md +19 -0
  149. package/node_modules/@cap-js/sqlite/lib/SQLiteService.js +110 -14
  150. package/node_modules/@cap-js/sqlite/package.json +3 -3
  151. package/node_modules/@sap/cds/CHANGELOG.md +57 -0
  152. package/node_modules/@sap/cds/app/index.js +5 -4
  153. package/node_modules/@sap/cds/eslint.config.mjs +1 -0
  154. package/node_modules/@sap/cds/lib/compile/minify.js +14 -10
  155. package/node_modules/@sap/cds/lib/env/cds-env.js +1 -1
  156. package/node_modules/@sap/cds/lib/env/cds-requires.js +22 -11
  157. package/node_modules/@sap/cds/lib/env/defaults.js +4 -1
  158. package/node_modules/@sap/cds/lib/env/schemas/cds-rc.js +5 -2
  159. package/node_modules/@sap/cds/lib/plugins.js +9 -5
  160. package/node_modules/@sap/cds/lib/req/spawn.js +1 -1
  161. package/node_modules/@sap/cds/lib/srv/srv-dispatch.js +1 -1
  162. package/node_modules/@sap/cds/lib/srv/srv-models.js +1 -1
  163. package/node_modules/@sap/cds/lib/utils/cds-utils.js +2 -1
  164. package/node_modules/@sap/cds/libx/_runtime/common/generic/assert.js +2 -3
  165. package/node_modules/@sap/cds/libx/_runtime/common/generic/auth/restrict.js +8 -1
  166. package/node_modules/@sap/cds/libx/_runtime/common/generic/crud.js +18 -8
  167. package/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js +25 -17
  168. package/node_modules/@sap/cds/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +9 -3
  169. package/node_modules/@sap/cds/libx/_runtime/remote/Service.js +4 -19
  170. package/node_modules/@sap/cds/libx/_runtime/remote/utils/LruCache.js +42 -0
  171. package/node_modules/@sap/cds/libx/_runtime/remote/utils/client.js +14 -4
  172. package/node_modules/@sap/cds/libx/_runtime/remote/utils/cloudSdkProvider.js +2 -9
  173. package/node_modules/@sap/cds/libx/_runtime/remote/utils/destinationClient.js +150 -0
  174. package/node_modules/@sap/cds/libx/_runtime/remote/utils/error.js +13 -0
  175. package/node_modules/@sap/cds/libx/_runtime/remote/utils/fetchClient.js +26 -18
  176. package/node_modules/@sap/cds/libx/_runtime/remote/utils/query.js +34 -23
  177. package/node_modules/@sap/cds/libx/_runtime/remote/utils/token.js +82 -0
  178. package/node_modules/@sap/cds/libx/_runtime/ucl/Service.js +36 -189
  179. package/node_modules/@sap/cds/libx/common/utils/streaming.js +16 -16
  180. package/node_modules/@sap/cds/libx/http/location.js +3 -3
  181. package/node_modules/@sap/cds/libx/odata/middleware/batch.js +16 -10
  182. package/node_modules/@sap/cds/libx/odata/middleware/metadata.js +9 -6
  183. package/node_modules/@sap/cds/libx/odata/middleware/service-document.js +1 -1
  184. package/node_modules/@sap/cds/libx/odata/parse/afterburner.js +19 -3
  185. package/node_modules/@sap/cds/libx/odata/parse/cqn2odata.js +83 -86
  186. package/node_modules/@sap/cds/libx/queue/SchedulingService.js +17 -2
  187. package/node_modules/@sap/cds/libx/queue/processing.js +1 -3
  188. package/node_modules/@sap/cds/libx/rest/RestAdapter.js +3 -7
  189. package/node_modules/@sap/cds/libx/rest/middleware/delete.js +3 -3
  190. package/node_modules/@sap/cds/libx/rest/middleware/parse.js +13 -8
  191. package/node_modules/@sap/cds/libx/rest/middleware/read.js +3 -3
  192. package/node_modules/@sap/cds/libx/rest/middleware/upsert.js +2 -2
  193. package/node_modules/@sap/cds/package.json +1 -1
  194. package/node_modules/@sap/cds-compiler/CHANGELOG.md +75 -8
  195. package/node_modules/@sap/cds-compiler/bin/cdsc.js +2 -2
  196. package/node_modules/@sap/cds-compiler/doc/IncompatibleChanges_v7.md +46 -19
  197. package/node_modules/@sap/cds-compiler/lib/api/main.js +10 -7
  198. package/node_modules/@sap/cds-compiler/lib/api/options.js +8 -2
  199. package/node_modules/@sap/cds-compiler/lib/base/csnRefs.js +5 -2
  200. package/node_modules/@sap/cds-compiler/lib/base/message-registry.js +4 -0
  201. package/node_modules/@sap/cds-compiler/lib/base/optionProcessor.js +12 -0
  202. package/node_modules/@sap/cds-compiler/lib/checks/enricher.js +1 -0
  203. package/node_modules/@sap/cds-compiler/lib/compiler/assert-consistency.js +8 -7
  204. package/node_modules/@sap/cds-compiler/lib/compiler/checks.js +3 -3
  205. package/node_modules/@sap/cds-compiler/lib/compiler/define.js +301 -75
  206. package/node_modules/@sap/cds-compiler/lib/compiler/dictionaries.js +2 -0
  207. package/node_modules/@sap/cds-compiler/lib/compiler/extend.js +40 -26
  208. package/node_modules/@sap/cds-compiler/lib/compiler/populate.js +45 -60
  209. package/node_modules/@sap/cds-compiler/lib/compiler/propagator.js +16 -7
  210. package/node_modules/@sap/cds-compiler/lib/compiler/resolve.js +48 -18
  211. package/node_modules/@sap/cds-compiler/lib/compiler/shared.js +7 -6
  212. package/node_modules/@sap/cds-compiler/lib/compiler/tweak-assocs.js +62 -50
  213. package/node_modules/@sap/cds-compiler/lib/compiler/utils.js +29 -14
  214. package/node_modules/@sap/cds-compiler/lib/edm/edmAnnoPreprocessor.js +6 -5
  215. package/node_modules/@sap/cds-compiler/lib/gen/CdlGrammar.checksum +1 -1
  216. package/node_modules/@sap/cds-compiler/lib/gen/CdlParser.js +1119 -1109
  217. package/node_modules/@sap/cds-compiler/lib/gen/Dictionary.json +19 -3
  218. package/node_modules/@sap/cds-compiler/lib/json/from-csn.js +10 -16
  219. package/node_modules/@sap/cds-compiler/lib/json/to-csn.js +58 -39
  220. package/node_modules/@sap/cds-compiler/lib/main.d.ts +8 -0
  221. package/node_modules/@sap/cds-compiler/lib/main.js +1 -0
  222. package/node_modules/@sap/cds-compiler/lib/model/csnUtils.js +4 -0
  223. package/node_modules/@sap/cds-compiler/lib/parsers/AstBuildingParser.js +2 -1
  224. package/node_modules/@sap/cds-compiler/lib/parsers/XprTree.js +8 -0
  225. package/node_modules/@sap/cds-compiler/lib/render/toCdl.js +22 -1
  226. package/node_modules/@sap/cds-compiler/lib/render/toSql.js +17 -2
  227. package/node_modules/@sap/cds-compiler/lib/render/utils/common.js +6 -1
  228. package/node_modules/@sap/cds-compiler/lib/render/utils/operators.js +27 -0
  229. package/node_modules/@sap/cds-compiler/lib/render/utils/standardDatabaseFunctions.js +125 -3
  230. package/node_modules/@sap/cds-compiler/lib/tool-lib/revealInternalProperties.js +2 -1
  231. package/node_modules/@sap/cds-compiler/lib/transform/db/applyTransformations.js +15 -0
  232. package/node_modules/@sap/cds-compiler/lib/transform/db/associations.js +10 -2
  233. package/node_modules/@sap/cds-compiler/lib/transform/db/backlinks.js +22 -6
  234. package/node_modules/@sap/cds-compiler/lib/transform/db/constraints.js +62 -1
  235. package/node_modules/@sap/cds-compiler/lib/transform/db/flattening.js +4 -3
  236. package/node_modules/@sap/cds-compiler/lib/transform/effective/annotations.js +40 -0
  237. package/node_modules/@sap/cds-compiler/lib/transform/effective/flattening.js +17 -1
  238. package/node_modules/@sap/cds-compiler/lib/transform/effective/main.js +20 -0
  239. package/node_modules/@sap/cds-compiler/lib/transform/fioriTreeViews.js +12 -1
  240. package/node_modules/@sap/cds-compiler/lib/transform/forRelationalDB.js +7 -2
  241. package/node_modules/@sap/cds-compiler/lib/transform/odata/adaptAnnotationRefs.js +11 -5
  242. package/node_modules/@sap/cds-compiler/lib/transform/translateAssocsToJoins.js +48 -10
  243. package/node_modules/@sap/cds-compiler/package.json +1 -1
  244. package/node_modules/@sap/cds-mtxs/CHANGELOG.md +49 -0
  245. package/node_modules/@sap/cds-mtxs/bin/cds-mtx-migrate.js +26 -5
  246. package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +37 -16
  247. package/node_modules/@sap/cds-mtxs/lib/utils.js +23 -7
  248. package/node_modules/@sap/cds-mtxs/package.json +1 -1
  249. package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +63 -8
  250. package/node_modules/@sap/cds-mtxs/srv/cf/saas-provisioning-service.js +1 -1
  251. package/node_modules/@sap/cds-mtxs/srv/cf/sms-provisioning-service.js +23 -3
  252. package/node_modules/@sap/cds-mtxs/srv/extensibility/compat/update.js +15 -0
  253. package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/annotations.js +2 -2
  254. package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/config.js +2 -0
  255. package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/index.js +2 -0
  256. package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/protected-namespace.js +45 -0
  257. package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +30 -16
  258. package/node_modules/@sap/cds-mtxs/srv/jobs-service.js +49 -10
  259. package/node_modules/@sap/cds-mtxs/srv/model-provider.js +28 -4
  260. package/node_modules/@sap/cds-mtxs/srv/plugins/common.js +19 -12
  261. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +1 -1
  262. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/hdi-ctnr-mgr.js +6 -3
  263. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/serverless.js +271 -0
  264. package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +7 -10
  265. package/node_modules/@sap/cds-mtxs/srv/worker/job-worker-pool.js +212 -0
  266. package/node_modules/@sap/cds-mtxs/srv/worker/job-worker.js +61 -0
  267. package/node_modules/@sap/xsenv/CHANGELOG.md +7 -0
  268. package/node_modules/@sap/xsenv/package.json +10 -7
  269. package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
  270. package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
  271. package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
  272. package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
  273. package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
  274. package/node_modules/hdb/cfg/VERSION +1 -1
  275. package/node_modules/hdb/lib/protocol/ClientInfo.js +16 -3
  276. package/node_modules/hdb/lib/protocol/Connection.js +1 -0
  277. package/node_modules/hdb/package.json +3 -2
  278. package/node_modules/negotiator/lib/accept.js +54 -0
  279. package/node_modules/negotiator/lib/charset.js +10 -34
  280. package/node_modules/negotiator/lib/encoding.js +9 -30
  281. package/node_modules/negotiator/lib/language.js +15 -36
  282. package/node_modules/negotiator/lib/mediaType.js +16 -134
  283. package/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
  284. package/node_modules/negotiator/node_modules/content-type/README.md +71 -0
  285. package/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
  286. package/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
  287. package/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
  288. package/node_modules/negotiator/node_modules/content-type/package.json +52 -0
  289. package/node_modules/negotiator/package.json +16 -10
  290. package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
  291. package/node_modules/qs/CHANGELOG.md +15 -0
  292. package/node_modules/qs/README.md +19 -1
  293. package/node_modules/qs/dist/qs.js +21 -21
  294. package/node_modules/qs/eslint.config.mjs +1 -1
  295. package/node_modules/qs/lib/parse.js +3 -4
  296. package/node_modules/qs/lib/stringify.js +23 -8
  297. package/node_modules/qs/lib/utils.js +10 -3
  298. package/node_modules/qs/package.json +4 -4
  299. package/node_modules/qs/test/parse.js +192 -3
  300. package/node_modules/qs/test/stringify.js +317 -0
  301. package/node_modules/qs/test/utils.js +12 -0
  302. package/node_modules/type-is/node_modules/content-type/README.md +2 -0
  303. package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
  304. package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
  305. package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
  306. package/node_modules/type-is/node_modules/content-type/package.json +1 -1
  307. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  308. package/node_modules/ws/package.json +1 -1
  309. package/package.json +2 -2
  310. package/bin/completion/scripts/cds-bash.sh +0 -20
  311. package/bin/completion/scripts/cds-fish.fish +0 -13
  312. package/bin/completion/scripts/cds-ps.ps1 +0 -19
  313. package/bin/completion/scripts/cds-zsh.sh +0 -13
  314. package/lib/deploy/index.js +0 -25
  315. package/lib/import/asyncapi/importAsyncAPI.js +0 -33
  316. package/lib/import/asyncapi/index.js +0 -18
  317. package/lib/import/asyncapi/parserContext.js +0 -454
  318. package/lib/import/asyncapi/utils.js +0 -49
  319. package/node_modules/@sap/cds/libx/_runtime/ucl/queries.js +0 -61
  320. package/node_modules/negotiator/HISTORY.md +0 -114
  321. /package/{lib → bin}/upgrade/context.js +0 -0
  322. /package/{lib → bin}/upgrade/migrations/cds10/migrations.json +0 -0
  323. /package/{lib → bin}/upgrade/preflight/cds-version.js +0 -0
  324. /package/{lib → bin}/upgrade/preflight/project-type.js +0 -0
  325. /package/{lib → bin}/upgrade/steps/analyze/classification.js +0 -0
  326. /package/{lib → bin}/upgrade/steps/analyze/detector.js +0 -0
  327. /package/{lib → bin}/upgrade/steps/analyze/evaluator.js +0 -0
  328. /package/{lib → bin}/upgrade/steps/analyze/reporter.js +0 -0
  329. /package/{lib → bin}/upgrade/steps/analyze/setup.js +0 -0
  330. /package/{lib → bin}/upgrade/steps/analyze/utils/detection.js +0 -0
  331. /package/{lib → bin}/upgrade/steps/analyze/utils/files.js +0 -0
  332. /package/{lib → bin}/upgrade/steps/analyze/utils/grep.js +0 -0
  333. /package/{lib → bin}/upgrade/steps/analyze/utils/yaml.js +0 -0
  334. /package/{lib → bin}/upgrade/util/workspaces.js +0 -0
  335. /package/{lib → bin}/watch/esm-resolve-registration.js +0 -0
  336. /package/{lib → bin}/watch/livereload-server.js +0 -0
  337. /package/{lib → bin}/watch/node-watch.js +0 -0
  338. /package/{lib → bin}/watch/open.js +0 -0
  339. /package/{lib → bin}/watch/watcher.js +0 -0
  340. /package/node_modules/@sap/cds-mtxs/srv/worker/{pool.js → model-worker-pool.js} +0 -0
  341. /package/node_modules/@sap/cds-mtxs/srv/worker/{load.js → model-worker.js} +0 -0
@@ -0,0 +1,93 @@
1
+ #!/bin/bash
2
+ # This file was generated from bin/completion/templates/cds-tmpl.sh by
3
+ # 'cds completion --generate' and is written to bin/completion/scripts/cds.sh.
4
+ #
5
+ # Do not edit directly — modify the template and regenerate.
6
+ #
7
+ # Completion strategy (fastest-first):
8
+ # 1. Shortcuts — single-character aliases resolved before any other logic.
9
+ # 2. Top-level — all known subcommands when no subcommand has been typed yet.
10
+ # 3. Flags — matched when the current token starts with '-'.
11
+ # 3.5. Option values — static values for known flags (e.g. --to sqlite).
12
+ # 3.6. Comma values — comma-separable list (e.g. cds add ai,hana).
13
+ # 4. File positionals — files/dirs for subcommands that take a path argument.
14
+ # 4.6. String positionals — fixed word list (e.g. cds help <tab>).
15
+ # 5. Dynamic fallback — calls 'cds completion' for anything not covered above.
16
+ #
17
+ # compopt -o nospace suppresses the trailing space bash normally appends after a
18
+ # completion, which is required for path completions (so the user can keep typing
19
+ # a subdirectory) and for flag names (so '=' can follow immediately).
20
+ CDS_COMMAND="cds"
21
+
22
+ _completeCds()
23
+ {
24
+ local current previous cmd
25
+ COMPREPLY=()
26
+ current="${COMP_WORDS[COMP_CWORD]}"
27
+ previous="${COMP_WORDS[COMP_CWORD - 1]}"
28
+ # The subcommand is always the second token (index 1).
29
+ cmd="${COMP_WORDS[1]}"
30
+ # Step 1: resolve single-character shortcuts to their canonical command name
31
+ # so that subsequent case statements only need to handle canonical names.
32
+ {{SHORTCUT_CASE}}
33
+ # Step 2: top-level — offer all known subcommands when no subcommand has been
34
+ # typed yet (COMP_WORDS includes the command itself, so ≤ 2 means "cds <cursor>").
35
+ if [[ "${#COMP_WORDS[@]}" -le 2 ]]; then
36
+ COMPREPLY=( $(compgen -W "{{COMMANDS}}" -- "$current") )
37
+ compopt -o nospace
38
+ return 0
39
+ fi
40
+
41
+ # Step 3: flag/option completion — only triggered when the token starts with '-'.
42
+ if [[ "$current" == -* ]]; then
43
+ case "$cmd" in
44
+ {{FLAG_CASES}}
45
+ esac
46
+ if [[ "${#COMPREPLY[@]}" -gt 0 ]]; then
47
+ compopt -o nospace
48
+ return 0
49
+ fi
50
+ fi
51
+
52
+ # Step 3.5: option-value completion — triggered when the previous word is a known option.
53
+ case "$cmd" in
54
+ {{OPTION_VALUE_CASES}}
55
+ esac
56
+
57
+ # Step 3.6: comma-separated option-value completion.
58
+ # Splits $current on commas, filters out already-used values, prepends the prefix.
59
+ case "$cmd" in
60
+ {{COMMA_CASES}}
61
+ esac
62
+
63
+ # Step 4: file-sentinel positionals — fill COMPREPLY with files and return.
64
+ case "$cmd" in
65
+ {{FILE_CASES}}
66
+ esac
67
+ if [[ "${#COMPREPLY[@]}" -gt 0 ]]; then
68
+ compopt -o nospace
69
+ return 0
70
+ fi
71
+
72
+ # Step 4.6: string positionals (e.g. cds help <tab>).
73
+ case "$cmd" in
74
+ {{STRING_POSITIONAL_CASES}}
75
+ esac
76
+ if [[ "${#COMPREPLY[@]}" -gt 0 ]]; then
77
+ compopt -o nospace
78
+ return 0
79
+ fi
80
+
81
+ # Step 5: dynamic fallback — calls 'cds completion' for subcommands whose arguments
82
+ # cannot be determined statically (e.g. service names, model names, unknown flags).
83
+ # Single-quoting $previous/$current prevents bare word 'h' from being interpreted
84
+ # as the 'help' shortcut by the completion handler before it is processed.
85
+ local options
86
+ options=$($CDS_COMMAND completion --shell bash --prev "'$previous'" --curr "'$current'" --line "'${COMP_WORDS[*]}'")
87
+ COMPREPLY=( $(compgen -W "${options}" -- "${current}") )
88
+ compopt -o nospace
89
+ return 0
90
+ }
91
+
92
+ # Register the completion function for the 'cds' command.
93
+ complete -F _completeCds "$CDS_COMMAND"
@@ -0,0 +1,74 @@
1
+ #!/bin/zsh
2
+ # This file was generated from bin/completion/templates/cds-tmpl.zsh by
3
+ # 'cds completion --generate' and is written to bin/completion/scripts/cds.zsh.
4
+ #
5
+ # Do not edit directly — modify the template and regenerate.
6
+ #
7
+ # Completion strategy (fastest-first):
8
+ # 1. Shortcuts — single-character aliases resolved before any other logic.
9
+ # 2. Top-level — all known subcommands when no subcommand has been typed yet.
10
+ # 3. Flags — matched when the current token starts with '-'.
11
+ # 3.5. Option values — static values for known flags (e.g. --to sqlite).
12
+ # 3.6. Comma values — comma-separable list (e.g. cds add ai,hana).
13
+ # 4. File positionals — files/dirs for subcommands that take a path argument.
14
+ # 4.6. String positionals — fixed word list (e.g. cds help <tab>).
15
+ # 5. Dynamic fallback — calls 'cds completion' for anything not covered above.
16
+ #
17
+ # Zsh uses $words (1-based token array) and $CURRENT (index of cursor token).
18
+ # Completions are added with compadd instead of bash's COMPREPLY.
19
+ # 'case ... esac && return' exits the function when a case arm matched.
20
+
21
+ CDS_COMMAND="cds"
22
+
23
+ _completeCds() {
24
+ local current="${words[CURRENT]}"
25
+ local previous="${words[CURRENT-1]}"
26
+ # The subcommand is always the second token (index 2 in 1-based zsh arrays).
27
+ local cmd="${words[2]}"
28
+ # Step 1: resolve single-character shortcuts to their canonical command name.
29
+ {{SHORTCUT_CASE}}
30
+ # Step 2: top-level — offer all known subcommands when no subcommand has been
31
+ # typed yet ($words is 1-based; ≤ 2 means "cds <cursor>").
32
+ if [[ "${#words[@]}" -le 2 ]]; then
33
+ compadd -S '' -- {{COMMANDS}}
34
+ return
35
+ fi
36
+
37
+ # Step 3: flag/option completion — only triggered when the token starts with '-'.
38
+ # 'case ... esac && return' exits the function when a case arm matched.
39
+ if [[ "$current" == -* ]]; then
40
+ case "$cmd" in
41
+ {{FLAG_CASES}}
42
+ esac && return
43
+ fi
44
+
45
+ # Step 3.5: option-value completion — triggered when the previous word is a known option.
46
+ case "$cmd" in
47
+ {{OPTION_VALUE_CASES}}
48
+ esac
49
+
50
+ # Step 3.6: comma-separated option-value completion.
51
+ case "$cmd" in
52
+ {{COMMA_CASES}}
53
+ esac
54
+
55
+ # Step 4: file-sentinel positionals — emit files and return.
56
+ case "$cmd" in
57
+ {{FILE_CASES}}
58
+ esac
59
+
60
+ # Step 4.6: string positionals (e.g. cds help <tab>) — return after matching.
61
+ case "$cmd" in
62
+ {{STRING_POSITIONAL_CASES}}
63
+ esac && return
64
+
65
+ # Step 5: dynamic fallback — calls 'cds completion' for subcommands whose arguments
66
+ # cannot be determined statically (e.g. service names, model names, unknown flags).
67
+ # Single-quoting $prev/$curr prevents bare word 'h' from being interpreted
68
+ # as the 'help' shortcut by the completion handler before it is processed.
69
+ # compadd -S '' suppresses the trailing space zsh normally appends after a completion.
70
+ compadd -S '' -- $(${CDS_COMMAND} completion --shell zsh --prev "'${words[CURRENT-1]}'" --curr "'${words[CURRENT]}'" --line "'${words[*]}'")
71
+ }
72
+
73
+ # Register the completion function for the 'cds' command.
74
+ compdef _completeCds ${CDS_COMMAND}
@@ -1,6 +1,16 @@
1
- const { options, flags, shortcuts } = require('../../lib/deploy/index.js');
1
+ const { FILE } = require('../completion');
2
+ const { options, flags, shortcuts } = require('./options');
2
3
 
3
4
  module.exports = Object.assign(deploy, {
5
+ staticCompletions: () => ({
6
+ '--to': ['sqlite', 'hana'],
7
+ '--on': ['cf', 'k8s'],
8
+ '--for': ['development', 'production', 'hybrid'],
9
+ '-4': ['development', 'production', 'hybrid'],
10
+ '--vcap-file': FILE('json'),
11
+ '--delta-from': FILE('json'),
12
+ '_': FILE('cds,json', { dirs: true }),
13
+ }),
4
14
  options,
5
15
  flags,
6
16
  shortcuts,
@@ -0,0 +1,25 @@
1
+ module.exports = {
2
+ options: /** @type{const} */([
3
+ '--to',
4
+ '--for',
5
+ '--out',
6
+ '--on',
7
+ '--tunnel-address',
8
+ '--vcap-file',
9
+ '--delta-from'
10
+ ]),
11
+ flags: /** @type{const} */([
12
+ '--resolve-bindings',
13
+ '--no-save',
14
+ '--auto-undeploy',
15
+ '--dry',
16
+ '--xdry',
17
+ '--with-mocks',
18
+ '--store-credentials',
19
+ '--no-build',
20
+ '--model-only',
21
+ '--script',
22
+ '--with-auto-schema-evolution'
23
+ ]),
24
+ shortcuts: ['-2', '-4', '-o', '-n', '', '', '', '-b']
25
+ }
@@ -3,18 +3,18 @@ const path = require('path');
3
3
  const cds = require('../../../lib/cds');
4
4
  const { exists, read, write, mkdirp } = cds.utils;
5
5
 
6
- const { build } = require('../../build');
6
+ const { build } = require('../../../lib/build');
7
7
 
8
8
  const hdi = require('./hdiDeployUtil');
9
- const cfUtil = require('../../util/cf');
9
+ const cfUtil = require('../../../lib/util/cf');
10
10
  const mtaUtil = require('./mtaUtil');
11
11
 
12
- const { bold, info, warn } = require('../../util/term');
12
+ const { bold, info, warn } = require('../../../lib/util/term');
13
13
 
14
- const { bind, storeBindings, env: bindingEnv } = require('../../bind/shared');
15
- const { BUILD_TASK_HANA } = require('../../build/constants');
14
+ const { bind, storeBindings, env: bindingEnv } = require('../../../lib/bind/shared');
15
+ const { BUILD_TASK_HANA } = require('../../../lib/build/constants');
16
16
 
17
- const { options, flags } = require('../index');
17
+ const { options, flags } = require('../options');
18
18
  const allOptions = [...options, ...flags];
19
19
 
20
20
  const DEBUG = cds.debug('cli');
@@ -147,7 +147,7 @@ Therefore, specifying the CDS model is not required when calling 'cds deploy'.`;
147
147
  let bindOptions
148
148
  let usesExistingK8sBinding = false
149
149
 
150
- const { readProject } = require('../../init/projectReader')
150
+ const { readProject } = require('../../../lib/init/projectReader')
151
151
  const { hasKyma, hasMta } = readProject()
152
152
  const onKyma = cds.cli.options.on === 'k8s' || (hasKyma && !hasMta && cds.cli.options.on !== 'cf')
153
153
  if (onKyma) {
@@ -260,7 +260,7 @@ spec:
260
260
  await storeBindings(services, bindOptions)
261
261
  }
262
262
 
263
- const { env4 } = require('../../init/projectReader')
263
+ const { env4 } = require('../../../lib/init/projectReader')
264
264
  if (env4('production').requires?.db?.kind !== 'hana') {
265
265
  console.log(`use ${info('cds add hana')} to configure the project for SAP HANA.\n`);
266
266
  }
@@ -1,5 +1,5 @@
1
1
  const path = require('path');
2
- const { bold } = require('../../util/term');
2
+ const { bold } = require('../../../lib/util/term');
3
3
 
4
4
  const HDI_DEPLOY_LIB = '@sap/hdi-deploy';
5
5
 
@@ -1,5 +1,5 @@
1
1
  exports.deploy = (model, serviceName, options) => {
2
- const hanaDeployer = require('../../lib/deploy/to-hana/hana');
2
+ const hanaDeployer = require('./hana');
3
3
 
4
4
  return hanaDeployer.deploy({
5
5
  ...options,
@@ -1,4 +1,4 @@
1
- const cds = require('../../cds')
1
+ const cds = require('../../../lib/cds')
2
2
 
3
3
  const fs = require('fs').promises
4
4
  const {existsSync} = require('fs')
@@ -1,5 +1,3 @@
1
1
  exports.deploy = function deploy_to_sql (...args) {
2
- // TODO check env.requires.db ...
3
2
  return require('./to-sqlite') .deploy (...args)
4
3
  }
5
- /* eslint no-console: off */
package/bin/env.js CHANGED
@@ -1,4 +1,8 @@
1
1
  module.exports = Object.assign (env, {
2
+ staticCompletions: () => ({
3
+ '--for': ['development', 'production', 'hybrid'],
4
+ '-4': ['development', 'production', 'hybrid'],
5
+ }),
2
6
  options: ['--for', '--mocked'],
3
7
  flags: ['--keys', '--properties', '--list', '--json', '--raw', '--process-env', '--resolve-bindings', '--sources'],
4
8
  shortcuts: ['-4', 0, '-k', '-p', '-l', '-j', '-r', '-P', '-b'],
@@ -63,7 +67,6 @@ async function env ([cmd, key, value], options={}) {
63
67
  )
64
68
 
65
69
  let env = cds.env
66
- // REVISIT: Currently only read in env.test.js
67
70
  env['_home_cds-dk'] = path.resolve(__dirname, '..') // to help tools find the DK
68
71
 
69
72
  if (!options.for && options.mocked || options["resolve-bindings"])
package/bin/export.js CHANGED
@@ -3,7 +3,9 @@ const cds = require ('../lib/cds.js')
3
3
  const { regex4 } = require ('./util/cli.js')
4
4
  const { Minify } = require ('./minify.js')
5
5
  const mvn = require('../lib/init/mvn')
6
+ const term = require('../lib/util/term')
6
7
  const { read, write: cdswrite, exists, mkdirp, local, path, fs } = cds.utils
8
+ const DEBUG = cds.debug('export')
7
9
 
8
10
  class Export extends Minify {
9
11
 
@@ -30,7 +32,8 @@ class Export extends Minify {
30
32
  data: false,
31
33
  as: 'csn',
32
34
  for: 'npm',
33
- force: false,
35
+ artifact: '',
36
+ mvn: '',
34
37
  }
35
38
  static shortcuts = { ...super.shortcuts,
36
39
  to:'2',
@@ -42,6 +45,22 @@ class Export extends Minify {
42
45
  parseArgs (conf) {
43
46
  if (!process.stdout.isTTY) this.options.to = '-'
44
47
  let [sources,o] = super.parseArgs (conf)
48
+ if (o.mvn) {
49
+ o.for = 'mvn'
50
+ o.artifact = o.mvn
51
+ }
52
+ if (o.for === 'mvn') {
53
+ if (!o.mvn)
54
+ console.warn(term.warn(`\n Option --for mvn is deprecated. Use --mvn ${o.artifact || 'groupId:artifactId'} instead.\n`))
55
+ const raw = o.artifact
56
+ if (!raw || !raw.includes(':'))
57
+ throw `\n Maven export requires a --mvn "groupId:artifactId" option.\n`
58
+ const parts = raw.split(':')
59
+ if (parts.length !== 2 || !parts[0] || !parts[1])
60
+ throw `\n Invalid Maven artifact "${raw}". Expected format: "groupId:artifactId".\n`
61
+ const [groupId, artifactId] = parts
62
+ o.artifact = { groupId, artifactId }
63
+ }
45
64
  if (o.from && o.from != '*') { // variant: cds-export <services> --from <models>
46
65
  if (o.services == '/all/') o.services = regex4 (sources)
47
66
  sources = o.from
@@ -108,18 +127,29 @@ class Export extends Minify {
108
127
  }
109
128
 
110
129
  async output (minified,o) {
130
+ const isMvnExport = o.for == 'mvn'
111
131
  if (this.options.to === '-') return super.output (minified)
112
132
  if (this.options.to.endsWith('/*')) this.options.to = this.export_to()
133
+ const rawModuleName = this.options.to
134
+ if (isMvnExport) {
135
+ const { groupId, artifactId } = o.artifact
136
+ this.options.to = path.join(this.options.to, 'src', 'main', 'resources', 'cds', groupId, artifactId)
137
+ }
113
138
  console.log(`\n${this.name}ing APIs to`, cds.utils.local(this.options.to), '...\n')
114
139
  const exports = []; exports.push(...this.export_models (minified))
115
140
  if (o.texts) exports.push (...this.export_texts (minified))
116
141
  if (o.data) exports.push (this.export_data (minified))
117
142
  if (o.for === 'npm') exports.push (this.export_package_json())
118
143
  await Promise.all (exports)
119
- if (o.for === 'mvn') {
120
- // Maven task moves files from the default behaviour to Maven specific locations,
121
- // so we need to await this separately
122
- await mvn.add('cds_export', { 'module-name': o.to })
144
+ if (isMvnExport) {
145
+ const pomPath = path.join(rawModuleName, 'pom.xml')
146
+ if (exists(pomPath)) {
147
+ DEBUG?.(`Skipping mvn.add: pom.xml already exists at ${local(pomPath)}`)
148
+ } else {
149
+ // Maven task modifies pom.xml and sets up the module — await separately
150
+ const { groupId, artifactId } = o.artifact
151
+ await mvn.add('cds_export', { 'to': rawModuleName, 'group-id': groupId, 'artifact-id': artifactId })
152
+ }
123
153
  }
124
154
  console.log()
125
155
  }
@@ -248,4 +278,12 @@ class Export extends Minify {
248
278
 
249
279
  const { DIMMED, RESET } = cds.utils.colors
250
280
 
251
- module.exports = Object.assign (Export._for_cds_dk(), { Export })
281
+ const { FILE, DIR } = require('./completion')
282
+ module.exports = Object.assign (Export._for_cds_dk(), { Export,
283
+ staticCompletions: () => ({
284
+ '_': FILE('cds,json', { dirs: true }),
285
+ '--to': DIR(),
286
+ '--as': ['csn', 'cdl'],
287
+ '--for': ['npm', 'mvn'],
288
+ })
289
+ })
@@ -12,6 +12,8 @@
12
12
  *-a | --as* <csn|cdl>
13
13
  *-4 | --for* <npm|mvn>
14
14
 
15
+ *--mvn* <groupId:artifactId> Export for Maven (implies --for mvn)
16
+
15
17
  *-c | --cleanse* <properties>
16
18
  *-k | --keep* <kinds>
17
19
  *-x | --skip* <kinds>
@@ -36,3 +38,4 @@
36
38
  *cds export* -s cat*s --inspect=2
37
39
  *cds export* -s cat*s --as cdl
38
40
  *cds export* -s cat*s
41
+ *cds export* --mvn com.example:my-service --to java-module
package/bin/help.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const cds = require('../lib/cds')
2
2
 
3
3
 
4
- module.exports = exports = Object.assign (help, {formatHelp, handleCompletion, help:`
4
+ module.exports = exports = Object.assign (help, {formatHelp, staticCompletions: () => Object.values(require('./cds').cmds ?? {}), help:`
5
5
  # USAGE
6
6
 
7
7
  *cds* <command> [<args>]
@@ -42,10 +42,6 @@ module.exports = exports = Object.assign (help, {formatHelp, handleCompletion, h
42
42
 
43
43
  `});
44
44
 
45
- async function handleCompletion() {
46
- const cds = require('./cds');
47
- return Object.values(cds.cmds);
48
- }
49
45
 
50
46
  async function help (topic) {
51
47
  await cds.plugins
package/bin/import.js CHANGED
@@ -1,5 +1,13 @@
1
+ const { FILE, DIR } = require('./completion')
1
2
  module.exports = Object.assign(_import, {
2
3
  _name: 'import',
4
+ staticCompletions: () => ({
5
+ '--from': ['asyncapi', 'edmx', 'openapi'],
6
+ '--as': ['cds', 'csn', 'json'],
7
+ '--out': DIR(),
8
+ '-o': DIR(),
9
+ '_': FILE('json,xml,edmx'),
10
+ }),
3
11
  options: [ '--services', '--for', '--out', '--as', '--name', '--include-namespaces', '--dependencies', '--from', '--config', '--destination', '--group', '--into-namespace' ],
4
12
  shortcuts: [ '-s', '-4', '-o', '-as', '-n', '-ns', '-d',undefined, '-c', undefined, undefined, '-2', '-', '-f', '-b'],
5
13
  flags: [ '--dry', '--force', '--resolve-bindings', '--no-copy', '--no-save', '--keep-namespace', '--data-product', '--edmx', '--rfc', '--odata', '--openapi', '--asyncapi', '--odata-v2-annotations' ],
@@ -26,6 +34,7 @@ module.exports = Object.assign(_import, {
26
34
  *--asyncapi*
27
35
  *--rfc*
28
36
  Imports the model from the one of the API formats OData EDMX, OpenAPI, AsyncAPI or RFC.
37
+ AsyncAPI requires @cap-js/asyncapi as a project dependency (currently bundled as a fallback)
29
38
 
30
39
  *--data-product*
31
40
  Tells cds import to import a data product. The source must be a valid
package/bin/init.js CHANGED
@@ -1,12 +1,17 @@
1
1
  const { join } = require('path')
2
2
  const { URLS } = require('../lib/init/constants')
3
+ const { DIR, COMMA } = require('../bin/completion')
3
4
 
4
5
  // REVISIT: necessary because module is loaded too early -> shouldn't be necessary
5
6
  const cds = require('../lib/cds')
6
7
  cds.root = join(process.cwd(), process.argv[3]?.startsWith('--') ? '.' : process.argv[3] ?? '')
7
8
 
8
9
  module.exports = Object.assign(init, {
9
- handleCompletion,
10
+ staticCompletions: () => ({
11
+ '--add': COMMA(require('../bin/completion/completionFs').readTemplates([])),
12
+ '--java:package': DIR(),
13
+ '--base': DIR(),
14
+ }),
10
15
  options: ['--add', '--java:mvn', '--java:package', '--lint:custom', '--lint:custom:example', '--no-db', '--base'],
11
16
  shortcuts: ['-a'],
12
17
  flags: ['--nodejs', '--java', '--force', '--verbose'],
@@ -60,29 +65,6 @@ ${require('../lib/init').help()}
60
65
 
61
66
  `})
62
67
 
63
- async function handleCompletion(currentWord, previousWord, argv, util) {
64
- const allOptionsFlags = [
65
- ...init.options ?? [],
66
- ...init.flags ?? []
67
- ].filter(e => !argv.includes(e));
68
-
69
- if (currentWord?.startsWith('-')) {
70
- return allOptionsFlags;
71
- }
72
-
73
- if (previousWord === '--java:package') {
74
- const excludes = ['_merging'];
75
- return (await util.completionFs.readdir(currentWord, { files: false }))
76
- .filter(e => !excludes.includes(e));
77
- }
78
-
79
- const templates = await util.completionFs.readTemplates(argv);
80
- if (previousWord === '--add' || argv.includes('--add') && previousWord.endsWith(',')) {
81
- return templates;
82
- }
83
-
84
- return allOptionsFlags;
85
- }
86
68
 
87
69
  async function init(args) {
88
70
  console.log()
package/bin/inspect.js CHANGED
@@ -4,7 +4,15 @@ cds inspect model.Req
4
4
  cds inspect model.Requisition --ids
5
5
  */
6
6
 
7
+ const { FILE } = require('./completion');
8
+
7
9
  module.exports = Object.assign (inspect, {
10
+ staticCompletions: () => ({
11
+ '--kind': ['entity', 'aspect', 'type', 'service'],
12
+ '--list': ['names', 'elements', 'keys', 'associations', 'compositions', 'ids', 'sources', 'all'],
13
+ '-l': ['names', 'elements', 'keys', 'associations', 'compositions', 'ids', 'sources', 'all'],
14
+ '_': FILE('cds,json', { dirs: true }),
15
+ }),
8
16
  options: [ '--stats', '--list', '--kind' ],
9
17
  shortcuts: [ '-s', '-l', '-k' ],
10
18
  help: `
package/bin/lint.js CHANGED
@@ -1,13 +1,15 @@
1
+ const { FILE } = require('./completion')
1
2
  const Linter = require('../lib/lint/Linter');
2
3
  const linter = new Linter();
3
4
 
4
- // cds cli exec expects an executable object with various additional properties.
5
- // As most of the linting functionality is bound to a class instance, we need to wrap the instance
6
- // to not lose the this-context and attach the additional properties to the function.
7
5
  const lint = (...args) => linter.lint(...args)
8
6
  const additionalProperties = Object.entries(linter.init())
9
7
  .map(([key, value]) => [key, { value }])
10
8
 
11
9
  Object.defineProperties(lint, Object.fromEntries(additionalProperties))
12
10
 
11
+ lint.staticCompletions = () => ({
12
+ '_': FILE('js,ts,cds', { dirs: true }),
13
+ })
14
+
13
15
  module.exports = lint
package/bin/login.js CHANGED
@@ -85,30 +85,36 @@ module.exports = Object.assign(login, {
85
85
  Note: Productive secrets should not be specified on a command line,
86
86
  since this might expose them to unauthorized users on the same machine!
87
87
 
88
- *-c* | *--client* <clientid>[:<clientsecret>]
88
+ *-c* | *--client* [<clientid>[:<clientsecret>]]
89
89
 
90
90
  Client Credentials (Client ID and optionally Client Secret) for
91
- authentication. If omitted, Client Secret will be queried interactively.
92
-
91
+ authentication. Client Credentials may instead be provided via the
92
+ CDS_LOGIN_CLIENT_ID and CDS_LOGIN_CLIENT_SECRET environment variables,
93
+ which is recommended for CI so that secrets do not appear on the
94
+ command line. Inline values take precedence over the environment. If
95
+ the Client Secret is given neither inline nor via the environment, it is
96
+ queried interactively.
97
+
93
98
  Obtain the Client Credentials from the UAA binding of MTXS.
94
-
99
+
95
100
  Client Credentials will not be saved, only the resulting token.
96
101
 
97
102
  Note: Productive secrets should not be specified on a command line,
98
103
  since this might expose them to unauthorized users on the same machine!
99
104
 
100
- *-m* | *--mtls* <clientid>[:<key>]
105
+ *-m* | *--mtls* [<clientid>]
106
+
107
+ Client-certificate (mTLS) authentication. The Client ID may be given
108
+ inline or via the CDS_LOGIN_CLIENT_ID environment variable. The client
109
+ certificate and its private key are read from the CDS_LOGIN_CLIENT_CERT
110
+ and CDS_LOGIN_CLIENT_KEY environment variables (PEM), which is
111
+ recommended for CI so that key material does not appear on the command
112
+ line. The token is then obtained directly from the authorization
113
+ server over mTLS.
101
114
 
102
- Client Credentials (Client ID and optionally Client-Certificate Private
103
- Key in Base64 encoding) for authentication. If omitted, Private Key will
104
- be queried interactively (avoid newline characters when pasting it).
105
-
106
115
  Obtain the Client Credentials from the UAA binding of MTXS.
107
-
108
- Client Credentials will not be saved, only the resulting token.
109
-
110
- Note: Productive secrets should not be specified on a command line,
111
- since this might expose them to unauthorized users on the same machine!
116
+
117
+ Only the resulting token will be saved.
112
118
 
113
119
  *--save-refresh-token*
114
120
 
@@ -152,14 +158,14 @@ module.exports = Object.assign(login, {
152
158
  async function login ([url], options = {}) {
153
159
  const [username, password] = options.user?.split(':') ?? [];
154
160
  delete options.user;
155
- if (options.client) {
156
- const [clientid, clientsecret] = options.client.split(':');
161
+ if (options.mtls) {
162
+ const { clientid, certificate, key } = require('../lib/mtx/util/credentials').clientCertificate(options.mtls);
163
+ delete options.mtls;
164
+ Object.assign(options, { clientid, certificate, key });
165
+ } else if (options.client) {
166
+ const { clientid, clientsecret } = require('../lib/mtx/util/credentials').clientCredentials(options.client);
157
167
  delete options.client;
158
168
  Object.assign(options, { clientid, clientsecret });
159
- } else if (options.mtls) {
160
- const [clientid, key = 'ask'] = options.mtls.split(':');
161
- delete options.mtls;
162
- Object.assign(options, { clientid, key });
163
169
  }
164
170
  Object.assign(options, {
165
171
  url,
package/bin/minify.js CHANGED
@@ -119,4 +119,9 @@ class Dryifier extends Minifier {
119
119
  }
120
120
  }
121
121
 
122
- module.exports = Object.assign (Minify._for_cds_dk(), { Minify })
122
+ const { FILE } = require('./completion')
123
+ module.exports = Object.assign (Minify._for_cds_dk(), { Minify,
124
+ staticCompletions: () => ({
125
+ '_': FILE('cds,json', { dirs: true }),
126
+ })
127
+ })