@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
package/bin/pull.js CHANGED
@@ -1,7 +1,7 @@
1
1
  module.exports = Object.assign(pull, {
2
- options: ['--subdomain', '--passcode', '--user', '--client', '--from'],
2
+ options: ['--subdomain', '--passcode', '--user', '--client', '--mtls', '--from'],
3
3
  flags: [],
4
- shortcuts: ['-s', '-p', '-u', '-c'],
4
+ shortcuts: ['-s', '-p', '-u', '-c', '-m'],
5
5
  help: `
6
6
  # SYNOPSIS
7
7
 
@@ -42,9 +42,17 @@ module.exports = Object.assign(pull, {
42
42
  Username and optionally password for authentication with Basic Auth in
43
43
  test scenarios.
44
44
 
45
- *-c* | *--client* <clientid>[:<clientsecret>]
45
+ *-c* | *--client* [<clientid>[:<clientsecret>]]
46
46
 
47
- Client ID and optionally Client Secret for authentication.
47
+ Client ID and optionally Client Secret for authentication. May also be
48
+ provided via the CDS_LOGIN_CLIENT_ID and CDS_LOGIN_CLIENT_SECRET
49
+ environment variables. See *cds login* for details.
50
+
51
+ *-m* | *--mtls* [<clientid>]
52
+
53
+ Client-certificate (mTLS) authentication. Client ID inline or via
54
+ CDS_LOGIN_CLIENT_ID; certificate and key via CDS_LOGIN_CLIENT_CERT and
55
+ CDS_LOGIN_CLIENT_KEY. See *cds login* for details.
48
56
 
49
57
  # SEE ALSO
50
58
 
@@ -61,8 +69,11 @@ module.exports = Object.assign(pull, {
61
69
  async function pull([url], options = {}) {
62
70
  const [username, password] = options.user?.split(':') ?? [];
63
71
  delete options.user;
64
- const [clientid, clientsecret] = options.client?.split(':') ?? [];
72
+ const { clientid, clientsecret, certificate, key } = options.mtls
73
+ ? require('../lib/mtx/util/credentials').clientCertificate(options.mtls)
74
+ : require('../lib/mtx/util/credentials').clientCredentials(options.client);
65
75
  delete options.client;
76
+ delete options.mtls;
66
77
  if (options.from) url = options.from;
67
78
  delete options.from;
68
79
 
@@ -72,6 +83,8 @@ async function pull([url], options = {}) {
72
83
  username,
73
84
  password,
74
85
  clientid,
75
- clientsecret
86
+ clientsecret,
87
+ certificate,
88
+ key
76
89
  });
77
90
  }
package/bin/push.js CHANGED
@@ -1,7 +1,7 @@
1
1
  module.exports = Object.assign(push, {
2
- options: ['--subdomain', '--passcode', '--user', '--client', '--to', '--async', '--sync'],
2
+ options: ['--subdomain', '--passcode', '--user', '--client', '--mtls', '--to', '--async', '--sync'],
3
3
  flags: [],
4
- shortcuts: ['-s', '-p', '-u', '-c', '-2'],
4
+ shortcuts: ['-s', '-p', '-u', '-c', '-m', '-2'],
5
5
  help: `
6
6
  # SYNOPSIS
7
7
 
@@ -44,9 +44,17 @@ module.exports = Object.assign(push, {
44
44
  Username and optionally password for authentication with Basic Auth in
45
45
  test scenarios.
46
46
 
47
- *-c* | *--client* <clientid>[:<clientsecret>]
47
+ *-c* | *--client* [<clientid>[:<clientsecret>]]
48
48
 
49
- Client ID and optionally Client Secret for authentication.
49
+ Client ID and optionally Client Secret for authentication. May also be
50
+ provided via the CDS_LOGIN_CLIENT_ID and CDS_LOGIN_CLIENT_SECRET
51
+ environment variables. See *cds login* for details.
52
+
53
+ *-m* | *--mtls* [<clientid>]
54
+
55
+ Client-certificate (mTLS) authentication. Client ID inline or via
56
+ CDS_LOGIN_CLIENT_ID; certificate and key via CDS_LOGIN_CLIENT_CERT and
57
+ CDS_LOGIN_CLIENT_KEY. See *cds login* for details.
50
58
 
51
59
  *--async*
52
60
 
@@ -71,15 +79,20 @@ async function push([extArchive], options = {}) {
71
79
 
72
80
  const [username, password] = options.user?.split(':') ?? [];
73
81
  delete options.user;
74
- const [clientid, clientsecret] = options.client?.split(':') ?? [];
82
+ const { clientid, clientsecret, certificate, key } = options.mtls
83
+ ? require('../lib/mtx/util/credentials').clientCertificate(options.mtls)
84
+ : require('../lib/mtx/util/credentials').clientCredentials(options.client);
75
85
  delete options.client;
86
+ delete options.mtls;
76
87
 
77
88
  const args = [{
78
89
  ...options,
79
90
  username,
80
91
  password,
81
92
  clientid,
82
- clientsecret
93
+ clientsecret,
94
+ certificate,
95
+ key
83
96
  }];
84
97
  if (extArchive) {
85
98
  args.push({ extArchive });
package/bin/repl.js CHANGED
@@ -1,6 +1,15 @@
1
+ const { DIR } = require('./completion');
1
2
  module.exports = Object.assign (repl, {
2
- options: [ '--run', '--use', '--ql' ],
3
- shortcuts: [ '-r', '-u' ],
3
+ options: [ '--run', '--use' ],
4
+ flags: [ '--ql' ],
5
+ shortcuts: ['-r', '-u'],
6
+ staticCompletions: () => ({
7
+ '_': DIR(),
8
+ '--run': DIR(),
9
+ '-r': DIR(),
10
+ '--use': ['xl', 'ql', 'entities', 'services'],
11
+ '-u': ['xl', 'ql', 'entities', 'services'],
12
+ }),
4
13
  help: `
5
14
  # SYNOPSIS
6
15
 
package/bin/run.js CHANGED
@@ -1,6 +1,17 @@
1
+ const { DIR } = require('./completion');
1
2
  const serve = require ('./serve')
2
3
  module.exports = Object.assign (
3
- cds_run, serve, {help: `
4
+ cds_run, serve, {
5
+ staticCompletions: () => ({
6
+ '_': DIR(),
7
+ '--from': DIR(),
8
+ '-f': DIR(),
9
+ '--with': DIR(),
10
+ '-w': DIR(),
11
+ '--to': ['odata', 'fiori', 'rest'],
12
+ '-2': ['odata', 'fiori', 'rest'],
13
+ }),
14
+ help: `
4
15
  # SYNOPSIS
5
16
 
6
17
  *cds run* [<project>] [<options>]
package/bin/serve.js CHANGED
@@ -1,6 +1,17 @@
1
1
  // allows executing `cds serve` even when `cds` executable is removed from `@sap/cds`
2
-
3
- module.exports = require(_local('@sap/cds/bin/serve'))
2
+ const { DIR } = require('./completion');
3
+ const serve = require(_local('@sap/cds/bin/serve'))
4
+ module.exports = Object.assign(serve, {
5
+ staticCompletions: () => ({
6
+ '_': DIR(),
7
+ '--from': DIR(),
8
+ '-f': DIR(),
9
+ '--with': DIR(),
10
+ '-w': DIR(),
11
+ '--to': ['odata', 'fiori', 'rest'],
12
+ '-2': ['odata', 'fiori', 'rest'],
13
+ }),
14
+ })
4
15
 
5
16
  function _local (id) {
6
17
  return require.resolve (id, { paths: [ process.cwd(), __dirname ] })
package/bin/up.js CHANGED
@@ -1,4 +1,10 @@
1
+ const { FILE } = require('./completion');
2
+
1
3
  module.exports = Object.assign(up, {
4
+ staticCompletions: () => ({
5
+ '--to': ['cf', 'k8s'],
6
+ '--overlay': FILE('mtaext')
7
+ }),
2
8
  options: ['--to', '--namespace', '--overlay'],
3
9
  shortcuts: ['-2', '-n'],
4
10
  flags: [],
@@ -117,7 +123,7 @@ const _mtaextForOverlay = overlay => {
117
123
 
118
124
  async function up() {
119
125
  const project = readProject()
120
- const { apps, appName, hasApprouter, hasXsuaa, isMonorepoMicroservice, hasKyma, hasMta, k8s } = project
126
+ const { approuterPath, html5DeployerPath, apps, appName, hasApprouter, hasXsuaa, isMonorepoMicroservice, hasKyma, hasMta, k8s } = project
121
127
  const toKyma = cds.cli.options.to === 'k8s' || hasKyma && !hasMta, toCf = !toKyma
122
128
 
123
129
  if (cds.cli.options.overlay && toKyma) {
@@ -175,10 +181,10 @@ async function up() {
175
181
  if (!exists('chart') || !exists('containerize.yaml')) run('cds add kyma')
176
182
 
177
183
  if (project.hasHtml5Repo) {
178
- const html5DeployerPath = join(cds.root, cds.env.folders.app, 'html5-deployer', 'resources')
184
+ const html5DeployerResources = join(cds.root, html5DeployerPath, 'resources')
179
185
 
180
186
  if (apps.length > 0) {
181
- await mkdirp(html5DeployerPath)
187
+ await mkdirp(html5DeployerResources)
182
188
  }
183
189
 
184
190
  for (const { app, archiveName } of apps) {
@@ -199,7 +205,7 @@ async function up() {
199
205
  if (needsBuild || process.env.SKIP_CHECK == 'true') {
200
206
  DEBUG?.(dim(`build required for '${app}' – checksums`, { old: storedChecksum, new: currentChecksum }))
201
207
  run(`npm run build --prefix ${appPath}`)
202
- await copy(zipPath).to(html5DeployerPath, `${app}.zip`)
208
+ await copy(zipPath).to(html5DeployerResources, `${app}.zip`)
203
209
  writeStoredChecksum(app, currentChecksum)
204
210
  } else {
205
211
  console.log(info(`Skipping build for UI5 app '${app}' - no changes detected (checksum: ${currentChecksum.substring(0, 8)}...)`))
@@ -209,11 +215,11 @@ async function up() {
209
215
  }
210
216
 
211
217
  if (project.hasAppFrontend) {
212
- const html5DeployerPath = join(cds.root, cds.env.folders.app, 'html5-deployer', 'resources')
218
+ const html5DeployerResources = join(cds.root, html5DeployerPath, 'resources')
213
219
  let isRootApp = true;
214
220
 
215
221
  if (apps.length > 0) {
216
- await mkdirp(html5DeployerPath)
222
+ await mkdirp(html5DeployerResources)
217
223
  }
218
224
 
219
225
  for (const { app } of apps) {
@@ -235,13 +241,13 @@ async function up() {
235
241
  if (needsBuild || process.env.SKIP_CHECK == 'true') {
236
242
  DEBUG?.(dim(`build required for '${app}' – checksums`, { old: storedChecksum, new: currentChecksum }))
237
243
  run(`npm run build --prefix ${appPath}`)
238
- await copy(zipPath).to(html5DeployerPath, `${app}.zip`)
244
+ await copy(zipPath).to(html5DeployerResources, `${app}.zip`)
239
245
  writeStoredChecksum(app, currentChecksum)
240
246
  } else {
241
247
  console.log(info(`Skipping build for React app '${app}' - no changes detected (checksum: ${currentChecksum.substring(0, 8)}...)`))
242
248
  }
243
249
  }
244
-
250
+
245
251
  // for single UI app where Vite app is directly added into app/
246
252
  const appPath = path.join(cds.root, cds.env.folders.app)
247
253
  const rootPkgJson = exists(path.join(appPath, 'package.json'))
@@ -251,7 +257,7 @@ async function up() {
251
257
  const rootZipPath = path.join(appPath, `dist/${appName}.zip`)
252
258
  if(isRootApp) {
253
259
  run(`npm run build --prefix ${appPath}`)
254
- await copy(rootZipPath).to(html5DeployerPath, `${appName}.zip`)
260
+ await copy(rootZipPath).to(html5DeployerResources, `${appName}.zip`)
255
261
  }
256
262
  }
257
263
  }
@@ -332,10 +338,10 @@ async function up() {
332
338
  if (m.path === 'gen/srv') {
333
339
  helmArgs.push(`--set srv.annotations.deployment.deployment-checksum=${m.checksum}`)
334
340
  }
335
- if (m.path === 'app/router') {
341
+ if (m.path === approuterPath) {
336
342
  helmArgs.push(`--set approuter.annotations.deployment.deployment-checksum=${m.checksum}`)
337
343
  }
338
- if (m.path === 'app/html5-deployer') {
344
+ if (m.path === html5DeployerPath) {
339
345
  helmArgs.push(`--set html5-apps-deployer.annotations.job.job-checksum=${m.checksum}`)
340
346
  }
341
347
  if (m.path === 'gen/db') {
@@ -3,7 +3,7 @@
3
3
  const UPGRADE_DIR = '.cds-upgrade'
4
4
  const REPORT_FILE = 'report.md'
5
5
  const FINDINGS_FILE = 'report.yaml'
6
- const JAVA_LATEST = require('../init/constants').MAVEN_ARCHETYPE_VERSION
6
+ const JAVA_LATEST = require('../../lib/init/constants').MAVEN_ARCHETYPE_VERSION
7
7
 
8
8
  // CDS dependencies to rewrite (Node.js)
9
9
  const CDS_DEPS = ['@sap/cds', '@sap/cds-dk']
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  // Thin redirect wrapper for smart routing
4
- const upgradeTenant = require('./upgrade-tenant')
4
+ const upgradeTenant = require('../upgrade-tenant')
5
5
 
6
6
  module.exports = Object.assign(upgrade, {
7
7
  _name: 'upgrade',
@@ -75,6 +75,6 @@ async function upgrade(args, options = {}) {
75
75
  return upgradeTenant(args, options)
76
76
  }
77
77
 
78
- const versionUpgrade = require('../lib/upgrade')
78
+ const versionUpgrade = require('./upgrade')
79
79
  return versionUpgrade(options)
80
80
  }
@@ -47,7 +47,7 @@ function collectJava(ctx, cds) {
47
47
  }
48
48
 
49
49
  function printListing(occurrences) {
50
- const { bold, error } = require('../../util/term');
50
+ const { bold, error } = require('../../../lib/util/term');
51
51
  console.log(error('✗ Inconsistent cds versions detected'));
52
52
  console.log();
53
53
  const byFile = new Map();
@@ -15,7 +15,7 @@ function deriveTarget() {
15
15
  }
16
16
 
17
17
  async function runPreflight(ctx, cds) {
18
- const { info, error, bold } = require('../../util/term');
18
+ const { info, error, bold } = require('../../../lib/util/term');
19
19
 
20
20
  ctx.target = deriveTarget();
21
21
  console.log(`${bold(`Upgrading project to cds ${ctx.target}`)}`);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const { info, warn, bold, dim, error } = require('../../../util/term');
3
+ const { info, warn, bold, dim, error } = require('../../../../lib/util/term');
4
4
  const { UPGRADE_DIR, REPORT_FILE } = require('../../constants');
5
5
 
6
6
  const { setup } = require('./setup');
@@ -62,7 +62,7 @@ async function runNpmInstalls(ctx, cds) {
62
62
 
63
63
  async function runInstall(ctx, cds) {
64
64
  const { askYesNo, NonTTYError } = require('../util/prompt');
65
- const { error } = require('../../util/term');
65
+ const { error } = require('../../../lib/util/term');
66
66
  let nodeRan = false, javaRan = false, aborted = false;
67
67
 
68
68
  const mismatches = ctx.verifyMismatches || [];
@@ -7,7 +7,7 @@ const { execFile, execSync } = require('child_process');
7
7
  const { promisify } = require('util');
8
8
  const cds = require('@sap/cds');
9
9
 
10
- const { info, warn, dim } = require('../../util/term');
10
+ const { info, warn, dim } = require('../../../lib/util/term');
11
11
 
12
12
  const execFileAsync = promisify(execFile);
13
13
  const TIMEOUT_MS = 120_000;
@@ -18,7 +18,7 @@ const REMOVAL_COPY = {
18
18
 
19
19
  async function runRemovals(ctx, cds) {
20
20
  const { askYesNo, NonTTYError } = require('../util/prompt');
21
- const { info, bold, dim } = require('../../util/term');
21
+ const { info, bold, dim } = require('../../../lib/util/term');
22
22
 
23
23
  const removals = ctx.proposal?.removals || [];
24
24
  if (removals.length === 0) return;
@@ -81,7 +81,7 @@ function buildProposal(ctx, cds) {
81
81
  async function runRewrite(ctx, cds) {
82
82
  const { askYesNo, NonTTYError } = require('../util/prompt');
83
83
  const path = require('node:path');
84
- const { info, bold, dim } = require('../../util/term');
84
+ const { info, bold, dim } = require('../../../lib/util/term');
85
85
 
86
86
  const { updates, removals } = buildProposal(ctx, cds);
87
87
  ctx.proposal = { updates, removals };
@@ -76,7 +76,7 @@ function verifyJava(ctx, cds) {
76
76
  }
77
77
 
78
78
  async function runVerify(ctx, cds) {
79
- const { error, bold, dim } = require('../../util/term');
79
+ const { error, bold, dim } = require('../../../lib/util/term');
80
80
  const mismatches = [
81
81
  ...(ctx.project.isNode ? await verifyNode(ctx, cds) : []),
82
82
  ...(ctx.project.isJava ? verifyJava(ctx, cds) : []),
@@ -13,8 +13,8 @@ const { runOpenRewrite } = require('./steps/openrewrite');
13
13
  const { generate } = require('./steps/analyze/reporter');
14
14
 
15
15
  async function upgrade(options = {}) {
16
- const cds = require('../cds');
17
- const { error } = require('../util/term');
16
+ const cds = require('../../lib/cds');
17
+ const { error } = require('../../lib/util/term');
18
18
 
19
19
  console.log();
20
20
  try {
@@ -1,13 +1,13 @@
1
1
  'use strict'
2
2
 
3
- const { parseXml } = require('../../init/xml')
3
+ const { parseXml } = require('../../../lib/init/xml')
4
4
 
5
5
  function parsePomXml(filePath) {
6
6
  return parseXml(filePath)
7
7
  }
8
8
 
9
9
  function updatePomPropertyInFile(filePath, propertyName, newValue) {
10
- const cds = require('../../cds')
10
+ const cds = require('../../../lib/cds')
11
11
  const { fs } = cds.utils
12
12
 
13
13
  const content = fs.readFileSync(filePath, 'utf8')
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const { ask4 } = require('../../util/question');
3
+ const { ask4 } = require('../../../lib/util/question');
4
4
 
5
5
  class NonTTYError extends Error {
6
6
  constructor(message = 'non-interactive stdin') {
@@ -57,17 +57,21 @@ function processDockerfile(bp, name, tag) {
57
57
  function processCommands(bp) {
58
58
  return bp.commands ? bp.commands.map(c => c.trim().split(' ')) : []
59
59
  }
60
- function processBuildpack(bp, name, tag, clearCache = false) {
60
+ function processBuildpack(bp, name, tag, clearCache = false, image, publish = false) {
61
61
  let { type, path, env, builder } = bp.buildpack
62
+ const dependencyMirrors = Object.keys(process.env).filter(key => key.startsWith('BP_DEPENDENCY_MIRROR_') && process.env[key])
62
63
  type = type ? type.split(',').map(t => buildpacks.has(t.trim()) ? `paketo-buildpacks/${t.trim()}` : t.trim()) : []
63
64
  if (builders.has(builder)) builder = `paketobuildpacks/${builder}`
64
65
  const cacheArgs = clearCache ? ['--clear-cache'] : []
66
+ const target = publish ? image : `${name}:${tag}`
65
67
  return [['pack',
66
- ...appendSubcommand(`${name}:${tag}`, 'build'),
68
+ ...appendSubcommand(target, 'build'),
67
69
  ...appendSubcommand(path, '--path'),
68
70
  ...type.flatMap(t => appendSubcommand(t, '--buildpack')),
69
71
  ...appendSubcommand(builder, '--builder'),
70
72
  ...appendSubcommand(env, '--env'),
73
+ ...dependencyMirrors.flatMap(key => ['--env', key]),
74
+ ...(publish ? ['--publish'] : []),
71
75
  ...cacheArgs
72
76
  ]]
73
77
  }
@@ -107,14 +111,16 @@ async function parseYAML(filename, repoOpt = '', options) {
107
111
  const buildType = keyProcessorMap[key]
108
112
 
109
113
  if (!buildType) throw `'build-parameters' ${Object.keys(bp)} in ${filename} is invalid`
114
+ const publish = key === 'buildpack' && options.push
110
115
  return {
111
116
  name,
112
117
  tag,
113
- buildCmd: buildType(bp, name, tag, key === 'buildpack' && options.clearCache),
118
+ buildCmd: buildType(bp, name, tag, key === 'buildpack' && options.clearCache, repoImg, publish),
114
119
  pushCmd: ['docker', 'push', repoImg],
115
120
  tagCmd: [['docker', 'tag', source, repoImg]],
116
121
  image: rawImg,
117
122
  source,
123
+ publish,
118
124
  path: bp.buildpack?.path
119
125
  }
120
126
  }))
@@ -137,7 +143,7 @@ async function executeModules(modules, options) {
137
143
  }
138
144
 
139
145
  for (const cmd of m.buildCmd) run(cmd)
140
- if (options.push) {
146
+ if (options.push && !m.publish) {
141
147
  for (const cmd of m.tagCmd) run(cmd)
142
148
  run(m.pushCmd)
143
149
  }
package/bin/version.js CHANGED
@@ -20,6 +20,9 @@ module.exports = exports = async function cds_version (pattern, options) {
20
20
  console.log()
21
21
  }
22
22
 
23
+ exports.staticCompletions = () => ({
24
+ '--omit': ['dev', 'optional', 'peer'],
25
+ })
23
26
  exports.options = [ '--depth', '--omit' ]
24
27
  exports.flags = [ '--info', '--markdown', '--abs', '--all', '--json' ]
25
28
  exports.shortcuts = [ '-d', '-o', '-i', '-m', '-a' ]
@@ -79,7 +82,9 @@ function canonic_options4 ([pattern], options) {
79
82
  async function node_versions(o) {
80
83
 
81
84
  // Call npm root and npm ls in parallel...
82
- const [ [npm_root_g],[npm_root_l], lines ] = await Promise.all ([
85
+ const [ [npm_version], [npm_exec], [npm_root_g],[npm_root_l], lines ] = await Promise.all ([
86
+ $`npm --version`,
87
+ process.platform === 'win32' ? $`where npm.cmd` : $`which npm`,
83
88
  $`npm root --global`,
84
89
  $`npm root --local`,
85
90
  $`npm ls -lp ${
@@ -118,6 +123,9 @@ async function node_versions(o) {
118
123
  if (name.match(_pkg)) return [ name, version, location ]
119
124
  }) .filter (x => x)
120
125
 
126
+ // windows adds \r at the end of line
127
+ const _npm_exec = npm_exec.trim()
128
+
121
129
  // Sort SAP packages and CAP packages on top
122
130
  const entries = deps.sort (function sap_then_cap_on_top ([a],[b]) {
123
131
  let a_is_cdk = a === '@sap/cds-dk'
@@ -151,6 +159,7 @@ async function node_versions(o) {
151
159
  [ 'npm root -l', null, npm_root_l ],
152
160
  [ 'npm root -g', null, npm_root_g ],
153
161
  [ 'Node.js', process.version.slice(1), process.execPath ],
162
+ [ 'npm', npm_version, _npm_exec ]
154
163
  )
155
164
 
156
165
  return entries
@@ -1,6 +1,6 @@
1
1
  const crypto = require('crypto')
2
2
  const stream = require('stream/promises')
3
- const cds = require('../cds');
3
+ const cds = require('../../lib/cds');
4
4
  const log = cds.log('cds');
5
5
 
6
6
  module.exports = async function hotReloading() {
@@ -1,6 +1,20 @@
1
1
  const watchOnlyOptions = ['--ext', '--livereload', '--experimental-hot-reload', '--open', '--debug', '--inspect', '--inspect-brk', '--include', '--exclude']
2
+ const { DIR } = require('../completion')
2
3
 
3
4
  module.exports = Object.assign ( watch, {
5
+ staticCompletions: () => ({
6
+ '_': DIR(),
7
+ '--from': DIR(),
8
+ '-f': DIR(),
9
+ '--with': DIR(),
10
+ '-w': DIR(),
11
+ '--to': ['odata', 'fiori', 'rest'],
12
+ '-2': ['odata', 'fiori', 'rest'],
13
+ '--experimental-hot-reload': ['true', 'false'],
14
+ '--livereload': ['false'],
15
+ '--include': DIR(),
16
+ '--exclude': DIR()
17
+ }),
4
18
  flags: [ '--in-memory', '--in-memory?', '--with-mocks', '--with-mtx' ],
5
19
  options: [ '--port', ...watchOnlyOptions ],
6
20
  help: `
@@ -78,14 +92,15 @@ module.exports = Object.assign ( watch, {
78
92
  `})
79
93
 
80
94
  const fs = require ('node:fs')
81
- const cds = require('../lib/cds')
95
+ const cds = require('../../lib/cds')
82
96
  const DEBUG = /\b(y|all|cli|watch)\b/.test (process.env.DEBUG) ? ((..._) => console.debug ('[cli] -', ..._)) : undefined
83
97
  const {delimiter,relative,resolve,sep} = require ('path')
84
- const {codes} = require('../lib/util/term'), t = codes
98
+ const {codes} = require('../../lib/util/term'), t = codes
85
99
 
86
100
  const escapedSep = sep === '\\' ? '\\\\' : sep // escape backslash for windows
87
101
  const ignoreDefaults = [
88
102
  /\.git/,
103
+ new RegExp(`${escapedSep}\\.cds(${escapedSep}|$)`), // .cds folder — but not .cds model files or .cdsrc.json
89
104
  /node_modules/,
90
105
  /_out/,
91
106
  /@types/,
@@ -148,7 +163,7 @@ async function watch ([cwd], {
148
163
  // if sap/cds is not installed locally, run with cds-dk's deps. (sap/cds, sqlite etc)
149
164
  if (!installed('@sap/cds', cwd)) {
150
165
  env.NODE_PATH = [...paths(cwd), ...paths(__dirname)].join(delimiter)
151
- env.NODE_OPTIONS = [env.NODE_OPTIONS, `--import ${require.resolve('../lib/watch/esm-resolve-registration.js')}`].filter(Boolean).join(' ')
166
+ env.NODE_OPTIONS = [env.NODE_OPTIONS, `--import ${require.resolve('./esm-resolve-registration.js')}`].filter(Boolean).join(' ')
152
167
  }
153
168
 
154
169
  const delay = parseInt(process.env.CDS_WATCH_DELAY) || 200
@@ -163,8 +178,8 @@ async function watch ([cwd], {
163
178
  let liveReload //= ...
164
179
  if (!/false|no/.test(options.livereload)) {
165
180
  log ('( live reload enabled for browsers )')
166
- liveReload = new (require ('../lib/watch/livereload-server'))
167
- env.CDS_LIVERELOAD_PATH = require.resolve ('../lib/watch/livereload-connect')
181
+ liveReload = new (require ('./livereload-server'))
182
+ env.CDS_LIVERELOAD_PATH = require.resolve ('./livereload-connect')
168
183
  env.CDS_LIVERELOAD_URL = await liveReload.start (options['livereload'], cwd, delay)
169
184
  .catch(err => { console.log(`Error starting live reload: ${err.message}`); liveReload = null })
170
185
  }
@@ -177,7 +192,7 @@ async function watch ([cwd], {
177
192
  })
178
193
 
179
194
  if (process.argv.includes('--profile') || process.env.CDS_ENV) {
180
- const bind = require('../lib/bind/shared')
195
+ const bind = require('../../lib/bind/shared')
181
196
  Object.assign(env, await bind.env({cwd}))
182
197
  }
183
198
 
@@ -192,9 +207,9 @@ async function watch ([cwd], {
192
207
  // return
193
208
  // }
194
209
 
195
- const nodemon = require('../lib/watch/node-watch')
210
+ const nodemon = require('./node-watch')
196
211
  const watcher = nodemon ({
197
- script: resolve(__dirname,'../lib/watch/watched'), cwd, env, ext, ignore, watched,
212
+ script: resolve(__dirname,'./watched'), cwd, env, ext, ignore, watched,
198
213
  delay,
199
214
  options
200
215
  }).on('restart', (files)=>{
@@ -203,7 +218,7 @@ async function watch ([cwd], {
203
218
  }).on('message', async (msg) => { switch (msg.code) { // messages from child process
204
219
  case 'listening':
205
220
  env.PORT = msg.address?.port || msg.port
206
- if (options.open) require('../lib/watch/open').openURL (options.open, env.PORT)
221
+ if (options.open) require('./open').openURL (options.open, env.PORT)
207
222
  else liveReload?.reload()
208
223
  delete options.open
209
224
  break
@@ -1,4 +1,4 @@
1
- const cds = require('../cds');
1
+ const cds = require('../../lib/cds');
2
2
  const DEBUG = cds.debug('cli|watch|livereload');
3
3
 
4
4
  module.exports = function livereload(opt) {
@@ -1,4 +1,4 @@
1
- const cds = require('../cds')
1
+ const cds = require('../../lib/cds')
2
2
  const { pathToFileURL } = require('node:url')
3
3
  const { path, stat, readdir, isdir, colors: { BOLD, RESET } } = cds.utils
4
4
 
@@ -1,13 +1,13 @@
1
1
  //
2
2
  // Child process impl launched by cds watch
3
- // Extracted from watch.js to avoid cds.env loaded too eagerly
3
+ // Extracted from watch/index.js to avoid cds.env loaded too eagerly
4
4
  //
5
5
 
6
6
  (async () => {
7
7
 
8
8
  // run through cli in order to use its error handling
9
9
  const args = JSON.parse(process.env._args)
10
- const cds = require('../cds'); cds.watched = true
10
+ const cds = require('../../lib/cds'); cds.watched = true
11
11
  require('./vite-watch')
12
12
  const bootstrap = require('../../bin/cds')(...args)
13
13
 
@@ -21,7 +21,7 @@ exports.CONTENT_PACKAGE_JSON = "contentPackageJson" // create packag
21
21
  exports.CONTENT_PACKAGELOCK_JSON = "contentPackageLockJson" // copy package-lock.json file into deployment folder - ENABLED by default
22
22
  exports.CONTENT_HDBTABLEDATA = "contentHdbtabledata" // create .hdbtabledata files for .csv files if not already existing - ENABLED by default
23
23
  exports.CONTENT_NPMRC = "contentNpmrc" // copy .npmrc file into deployment folder - ENABLED by default
24
- exports.CONTENT_CDSRC_JSON = "contentCdsrcJson" // copy .cdsrc.json file into deployment folder - ENABLED by default
24
+ exports.CONTENT_CDSRC = "contentCdsrc" // copy .cdsrc.* config files into deployment folder - ENABLED by default
25
25
  exports.CONTENT_NODE_MODULES = "contentNodeModules" // copy node_modules folder into deployment folder - DISABLED by default
26
26
  exports.CONTENT_ENV = "contentEnv" // copy .env file into deployment folder - DISABLED by default
27
27
  exports.CONTENT_DEFAULT_ENV_JSON = "contentDefaultEnvJson" // copy default-env.json file into deployment folder - DISABLED by default