@sap/cds-dk 10.0.6 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/bin/add.js +7 -23
  3. package/bin/bind.js +10 -0
  4. package/bin/build.js +20 -34
  5. package/bin/cds.js +1 -1
  6. package/bin/compile/index.js +15 -41
  7. package/bin/completion/completionFs.js +11 -8
  8. package/bin/completion/index.js +592 -80
  9. package/bin/completion/scripts/cds.fish +568 -0
  10. package/bin/completion/scripts/cds.ps1 +329 -0
  11. package/bin/completion/scripts/cds.sh +261 -0
  12. package/bin/completion/scripts/cds.zsh +230 -0
  13. package/bin/completion/templates/cds-tmpl.fish +65 -0
  14. package/bin/completion/templates/cds-tmpl.ps1 +208 -0
  15. package/bin/completion/templates/cds-tmpl.sh +93 -0
  16. package/bin/completion/templates/cds-tmpl.zsh +74 -0
  17. package/bin/deploy/index.js +7 -1
  18. package/bin/deploy/options.js +25 -0
  19. package/{lib → bin}/deploy/to-hana/hana.js +8 -8
  20. package/{lib → bin}/deploy/to-hana/hdiDeployUtil.js +1 -1
  21. package/bin/deploy/{to-hana.js → to-hana/index.js} +1 -1
  22. package/{lib → bin}/deploy/to-hana/mtaUtil.js +1 -1
  23. package/bin/deploy/to-sql.js +0 -2
  24. package/bin/export.js +35 -5
  25. package/bin/help/export.md +3 -0
  26. package/bin/help.js +1 -5
  27. package/bin/import.js +6 -0
  28. package/bin/init.js +5 -24
  29. package/bin/inspect.js +6 -0
  30. package/bin/login.js +26 -20
  31. package/bin/pull.js +19 -6
  32. package/bin/push.js +19 -6
  33. package/bin/up.js +14 -11
  34. package/{lib → bin}/upgrade/constants.js +1 -1
  35. package/bin/{upgrade.js → upgrade/index.js} +2 -2
  36. package/{lib → bin}/upgrade/preflight/consistency.js +1 -1
  37. package/{lib → bin}/upgrade/preflight/index.js +1 -1
  38. package/{lib → bin}/upgrade/steps/analyze/index.js +1 -1
  39. package/{lib → bin}/upgrade/steps/install.js +1 -1
  40. package/{lib → bin}/upgrade/steps/openrewrite.js +1 -1
  41. package/{lib → bin}/upgrade/steps/removals.js +1 -1
  42. package/{lib → bin}/upgrade/steps/rewrite.js +1 -1
  43. package/{lib → bin}/upgrade/steps/verify.js +1 -1
  44. package/{lib/upgrade/index.js → bin/upgrade/upgrade.js} +2 -2
  45. package/{lib → bin}/upgrade/util/pom.js +2 -2
  46. package/{lib → bin}/upgrade/util/prompt.js +1 -1
  47. package/bin/util/containerize.js +8 -4
  48. package/bin/version.js +10 -1
  49. package/{lib → bin}/watch/hot-reload.js +1 -1
  50. package/bin/{watch.js → watch/index.js} +17 -9
  51. package/{lib → bin}/watch/livereload-connect.js +1 -1
  52. package/{lib → bin}/watch/vite-watch.js +1 -1
  53. package/{lib → bin}/watch/watched.js +2 -2
  54. package/lib/build/constants.js +1 -1
  55. package/lib/build/plugins/fiori/index.js +31 -2
  56. package/lib/build/plugins/internal.js +4 -2
  57. package/lib/build/plugins/mtx-sidecar/index.js +7 -8
  58. package/lib/build/plugins/nodejs/index.js +64 -7
  59. package/lib/compile/to_asyncapi.js +1 -1
  60. package/lib/env/schema.js +16 -0
  61. package/lib/env/schemas/cds-rc.js +1 -76
  62. package/lib/import/importapi.js +2 -3
  63. package/lib/import/message.js +0 -2
  64. package/lib/init/constants.js +2 -1
  65. package/lib/init/index.js +2 -2
  66. package/lib/init/merge.js +123 -280
  67. package/lib/init/plugin.js +3 -1
  68. package/lib/init/projectReader.js +22 -6
  69. package/lib/init/registries/xs-app.js +3 -5
  70. package/lib/init/template/ai/files/mta.yaml.hbs +1 -1
  71. package/lib/init/template/ai/index.js +14 -2
  72. package/lib/init/template/ams/index.js +2 -2
  73. package/lib/init/template/app-frontend/files/containerize.yaml.hbs +2 -2
  74. package/lib/init/template/app-frontend/index.js +4 -4
  75. package/lib/init/template/application-logging/index.js +2 -2
  76. package/lib/init/template/approuter/files/package.json +1 -1
  77. package/lib/init/template/approuter/index.js +8 -3
  78. package/lib/init/template/attachments/files/package.json.hbs +1 -1
  79. package/lib/init/template/attachments/index.js +2 -2
  80. package/lib/init/template/audit-logging/index.js +2 -2
  81. package/lib/init/template/cloud-logging/files/package.json.hbs +4 -4
  82. package/lib/init/template/cloud-logging/index.js +2 -2
  83. package/lib/init/template/completion/completionSetup.js +36 -39
  84. package/lib/init/template/connectivity/index.js +2 -2
  85. package/lib/init/template/data/as-csv.js +15 -5
  86. package/lib/init/template/data/as-json.js +114 -42
  87. package/lib/init/template/data/index.js +16 -2
  88. package/lib/init/template/destination/index.js +2 -2
  89. package/lib/init/template/dynatrace/files/package.json.hbs +3 -3
  90. package/lib/init/template/dynatrace/index.js +2 -2
  91. package/lib/init/template/enterprise-messaging/index.js +2 -2
  92. package/lib/init/template/enterprise-messaging-shared/index.js +2 -2
  93. package/lib/init/template/extensibility/files/mta.yaml.hbs +11 -0
  94. package/lib/init/template/extensibility/files/xs-security.json.hbs +1 -1
  95. package/lib/init/template/extensibility/index.js +3 -3
  96. package/lib/init/template/github-actions/index.js +2 -2
  97. package/lib/init/template/hana/index.js +3 -2
  98. package/lib/init/template/hana-serverless/files/db/package.json +14 -0
  99. package/lib/init/template/hana-serverless/files/identity.values.yaml.hbs +10 -0
  100. package/lib/init/template/hana-serverless/files/mta.yaml.hbs +64 -0
  101. package/lib/init/template/hana-serverless/files/package.json.hbs +35 -0
  102. package/lib/init/template/hana-serverless/files/src/.hdiconfig +139 -0
  103. package/lib/init/template/hana-serverless/files/undeploy.json +7 -0
  104. package/lib/init/template/hana-serverless/files/values.yaml.hbs +18 -0
  105. package/lib/init/template/hana-serverless/index.js +184 -0
  106. package/lib/init/template/html5-repo/files/containerize.yaml.hbs +2 -2
  107. package/lib/init/template/html5-repo/files/mta.yaml.hbs +5 -0
  108. package/lib/init/template/html5-repo/index.js +18 -14
  109. package/lib/init/template/http/index.js +123 -26
  110. package/lib/init/template/ias/index.js +2 -2
  111. package/lib/init/template/kafka/index.js +2 -2
  112. package/lib/init/template/kyma/index.js +7 -5
  113. package/lib/init/template/malware-scanner/index.js +2 -2
  114. package/lib/init/template/mta/files/mta.yaml.hbs +1 -1
  115. package/lib/init/template/multitenancy/index.js +18 -3
  116. package/lib/init/template/nodejs/index.js +4 -2
  117. package/lib/init/template/notifications/index.js +2 -2
  118. package/lib/init/template/portal/files/mta.yaml.hbs +4 -0
  119. package/lib/init/template/portal/index.js +13 -8
  120. package/lib/init/template/postgres/index.js +2 -2
  121. package/lib/init/template/redis/index.js +2 -2
  122. package/lib/init/template/sample/files/db/currencies.cds +2 -0
  123. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +1 -1
  124. package/lib/init/template/tiny-sample/files/nodejs/db/data/CatalogService.Books.csv +2 -2
  125. package/lib/init/template/workzone-standard/index.js +5 -5
  126. package/lib/init/template/xsuaa/index.js +20 -2
  127. package/lib/lint/eslintHelp.json +1 -1
  128. package/lib/mtx/auth_manager.js +103 -37
  129. package/lib/mtx/params.js +3 -2
  130. package/lib/mtx/settings_manager.js +45 -28
  131. package/lib/mtx/tenant_action.js +0 -1
  132. package/lib/mtx/util/credentials.js +62 -0
  133. package/node_modules/@cap-js/openapi/lib/compile/csdl.js +3 -3
  134. package/node_modules/@cap-js/openapi/lib/compile/csdl2openapi.js +111 -103
  135. package/node_modules/@cap-js/openapi/lib/compile/diagram.js +4 -4
  136. package/node_modules/@cap-js/openapi/lib/compile/types.d.ts +3 -1
  137. package/node_modules/@cap-js/openapi/package.json +3 -3
  138. package/node_modules/@sap/cds/CHANGELOG.md +64 -0
  139. package/node_modules/@sap/cds/app/index.js +5 -4
  140. package/node_modules/@sap/cds/eslint.config.mjs +1 -0
  141. package/node_modules/@sap/cds/lib/compile/for/nodejs.js +1 -0
  142. package/node_modules/@sap/cds/lib/compile/minify.js +14 -10
  143. package/node_modules/@sap/cds/lib/env/cds-env.js +1 -1
  144. package/node_modules/@sap/cds/lib/env/cds-requires.js +22 -11
  145. package/node_modules/@sap/cds/lib/env/defaults.js +4 -1
  146. package/node_modules/@sap/cds/lib/env/schemas/cds-rc.js +5 -2
  147. package/node_modules/@sap/cds/lib/plugins.js +9 -5
  148. package/node_modules/@sap/cds/lib/req/spawn.js +1 -1
  149. package/node_modules/@sap/cds/lib/srv/srv-dispatch.js +1 -1
  150. package/node_modules/@sap/cds/lib/srv/srv-models.js +1 -1
  151. package/node_modules/@sap/cds/lib/utils/cds-utils.js +2 -1
  152. package/node_modules/@sap/cds/libx/_runtime/common/generic/assert.js +2 -3
  153. package/node_modules/@sap/cds/libx/_runtime/common/generic/auth/restrict.js +8 -1
  154. package/node_modules/@sap/cds/libx/_runtime/common/generic/crud.js +18 -8
  155. package/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js +25 -17
  156. package/node_modules/@sap/cds/libx/_runtime/messaging/common-utils/authorizedRequest.js +3 -2
  157. package/node_modules/@sap/cds/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +9 -3
  158. package/node_modules/@sap/cds/libx/_runtime/remote/Service.js +4 -19
  159. package/node_modules/@sap/cds/libx/_runtime/remote/utils/LruCache.js +42 -0
  160. package/node_modules/@sap/cds/libx/_runtime/remote/utils/client.js +14 -4
  161. package/node_modules/@sap/cds/libx/_runtime/remote/utils/cloudSdkProvider.js +2 -9
  162. package/node_modules/@sap/cds/libx/_runtime/remote/utils/destinationClient.js +150 -0
  163. package/node_modules/@sap/cds/libx/_runtime/remote/utils/error.js +13 -0
  164. package/node_modules/@sap/cds/libx/_runtime/remote/utils/fetchClient.js +26 -18
  165. package/node_modules/@sap/cds/libx/_runtime/remote/utils/query.js +34 -23
  166. package/node_modules/@sap/cds/libx/_runtime/remote/utils/token.js +82 -0
  167. package/node_modules/@sap/cds/libx/_runtime/ucl/Service.js +36 -189
  168. package/node_modules/@sap/cds/libx/common/utils/streaming.js +16 -16
  169. package/node_modules/@sap/cds/libx/http/location.js +3 -3
  170. package/node_modules/@sap/cds/libx/odata/middleware/batch.js +16 -10
  171. package/node_modules/@sap/cds/libx/odata/middleware/metadata.js +9 -6
  172. package/node_modules/@sap/cds/libx/odata/middleware/service-document.js +1 -1
  173. package/node_modules/@sap/cds/libx/odata/parse/afterburner.js +19 -3
  174. package/node_modules/@sap/cds/libx/odata/parse/cqn2odata.js +83 -86
  175. package/node_modules/@sap/cds/libx/queue/SchedulingService.js +17 -2
  176. package/node_modules/@sap/cds/libx/queue/processing.js +1 -3
  177. package/node_modules/@sap/cds/libx/rest/RestAdapter.js +3 -7
  178. package/node_modules/@sap/cds/libx/rest/middleware/delete.js +3 -3
  179. package/node_modules/@sap/cds/libx/rest/middleware/parse.js +13 -8
  180. package/node_modules/@sap/cds/libx/rest/middleware/read.js +3 -3
  181. package/node_modules/@sap/cds/libx/rest/middleware/upsert.js +2 -2
  182. package/node_modules/@sap/cds/package.json +1 -1
  183. package/node_modules/@sap/cds-compiler/CHANGELOG.md +60 -8
  184. package/node_modules/@sap/cds-compiler/bin/cdsc.js +2 -2
  185. package/node_modules/@sap/cds-compiler/doc/IncompatibleChanges_v7.md +46 -19
  186. package/node_modules/@sap/cds-compiler/lib/api/main.js +10 -7
  187. package/node_modules/@sap/cds-compiler/lib/api/options.js +8 -2
  188. package/node_modules/@sap/cds-compiler/lib/base/csnRefs.js +5 -2
  189. package/node_modules/@sap/cds-compiler/lib/base/message-registry.js +4 -0
  190. package/node_modules/@sap/cds-compiler/lib/base/optionProcessor.js +12 -0
  191. package/node_modules/@sap/cds-compiler/lib/checks/enricher.js +1 -0
  192. package/node_modules/@sap/cds-compiler/lib/compiler/assert-consistency.js +8 -7
  193. package/node_modules/@sap/cds-compiler/lib/compiler/checks.js +3 -3
  194. package/node_modules/@sap/cds-compiler/lib/compiler/define.js +301 -75
  195. package/node_modules/@sap/cds-compiler/lib/compiler/dictionaries.js +2 -0
  196. package/node_modules/@sap/cds-compiler/lib/compiler/extend.js +40 -26
  197. package/node_modules/@sap/cds-compiler/lib/compiler/populate.js +45 -60
  198. package/node_modules/@sap/cds-compiler/lib/compiler/propagator.js +16 -7
  199. package/node_modules/@sap/cds-compiler/lib/compiler/resolve.js +41 -15
  200. package/node_modules/@sap/cds-compiler/lib/compiler/shared.js +7 -6
  201. package/node_modules/@sap/cds-compiler/lib/compiler/tweak-assocs.js +62 -50
  202. package/node_modules/@sap/cds-compiler/lib/compiler/utils.js +29 -14
  203. package/node_modules/@sap/cds-compiler/lib/edm/edmAnnoPreprocessor.js +6 -5
  204. package/node_modules/@sap/cds-compiler/lib/gen/CdlGrammar.checksum +1 -1
  205. package/node_modules/@sap/cds-compiler/lib/gen/CdlParser.js +1119 -1109
  206. package/node_modules/@sap/cds-compiler/lib/gen/Dictionary.json +19 -3
  207. package/node_modules/@sap/cds-compiler/lib/json/from-csn.js +10 -16
  208. package/node_modules/@sap/cds-compiler/lib/json/to-csn.js +58 -39
  209. package/node_modules/@sap/cds-compiler/lib/main.d.ts +8 -0
  210. package/node_modules/@sap/cds-compiler/lib/main.js +1 -0
  211. package/node_modules/@sap/cds-compiler/lib/model/csnUtils.js +2 -0
  212. package/node_modules/@sap/cds-compiler/lib/parsers/AstBuildingParser.js +2 -1
  213. package/node_modules/@sap/cds-compiler/lib/parsers/XprTree.js +8 -0
  214. package/node_modules/@sap/cds-compiler/lib/render/toCdl.js +22 -1
  215. package/node_modules/@sap/cds-compiler/lib/render/toSql.js +17 -2
  216. package/node_modules/@sap/cds-compiler/lib/render/utils/common.js +6 -1
  217. package/node_modules/@sap/cds-compiler/lib/render/utils/operators.js +27 -0
  218. package/node_modules/@sap/cds-compiler/lib/render/utils/standardDatabaseFunctions.js +125 -3
  219. package/node_modules/@sap/cds-compiler/lib/tool-lib/revealInternalProperties.js +2 -1
  220. package/node_modules/@sap/cds-compiler/lib/transform/db/applyTransformations.js +3 -0
  221. package/node_modules/@sap/cds-compiler/lib/transform/db/associations.js +8 -2
  222. package/node_modules/@sap/cds-compiler/lib/transform/db/backlinks.js +22 -6
  223. package/node_modules/@sap/cds-compiler/lib/transform/db/constraints.js +62 -1
  224. package/node_modules/@sap/cds-compiler/lib/transform/effective/annotations.js +40 -0
  225. package/node_modules/@sap/cds-compiler/lib/transform/effective/main.js +1 -0
  226. package/node_modules/@sap/cds-compiler/lib/transform/forRelationalDB.js +6 -1
  227. package/node_modules/@sap/cds-compiler/lib/transform/translateAssocsToJoins.js +19 -8
  228. package/node_modules/@sap/cds-compiler/package.json +1 -1
  229. package/node_modules/@sap/cds-mtxs/CHANGELOG.md +51 -0
  230. package/node_modules/@sap/cds-mtxs/bin/cds-mtx-migrate.js +32 -48
  231. package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +35 -16
  232. package/node_modules/@sap/cds-mtxs/cds-plugin.js +18 -0
  233. package/node_modules/@sap/cds-mtxs/lib/migration/migration.js +3 -408
  234. package/node_modules/@sap/cds-mtxs/lib/utils.js +19 -4
  235. package/node_modules/@sap/cds-mtxs/package.json +1 -1
  236. package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +6 -7
  237. package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/annotations.js +5 -2
  238. package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/index.js +6 -5
  239. package/node_modules/@sap/cds-mtxs/srv/extensibility-service.cds +0 -11
  240. package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +34 -35
  241. package/node_modules/@sap/cds-mtxs/srv/jobs-service.js +30 -24
  242. package/node_modules/@sap/cds-mtxs/srv/model-provider.js +19 -4
  243. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +6 -3
  244. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/hdi.js +5 -3
  245. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/srv-mgr.js +3 -2
  246. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/tms.js +17 -0
  247. package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +18 -21
  248. package/node_modules/@sap/xsenv/CHANGELOG.md +7 -0
  249. package/node_modules/@sap/xsenv/package.json +10 -7
  250. package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
  251. package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
  252. package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
  253. package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
  254. package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
  255. package/node_modules/hdb/cfg/VERSION +1 -1
  256. package/node_modules/hdb/lib/protocol/ClientInfo.js +16 -3
  257. package/node_modules/hdb/lib/protocol/Connection.js +1 -0
  258. package/node_modules/hdb/package.json +3 -2
  259. package/node_modules/negotiator/lib/accept.js +54 -0
  260. package/node_modules/negotiator/lib/charset.js +10 -34
  261. package/node_modules/negotiator/lib/encoding.js +9 -30
  262. package/node_modules/negotiator/lib/language.js +15 -36
  263. package/node_modules/negotiator/lib/mediaType.js +16 -134
  264. package/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
  265. package/node_modules/negotiator/node_modules/content-type/README.md +71 -0
  266. package/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
  267. package/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
  268. package/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
  269. package/node_modules/negotiator/node_modules/content-type/package.json +52 -0
  270. package/node_modules/negotiator/package.json +16 -10
  271. package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
  272. package/node_modules/qs/CHANGELOG.md +15 -0
  273. package/node_modules/qs/README.md +19 -1
  274. package/node_modules/qs/dist/qs.js +21 -21
  275. package/node_modules/qs/eslint.config.mjs +1 -1
  276. package/node_modules/qs/lib/parse.js +3 -4
  277. package/node_modules/qs/lib/stringify.js +23 -8
  278. package/node_modules/qs/lib/utils.js +10 -3
  279. package/node_modules/qs/package.json +4 -4
  280. package/node_modules/qs/test/parse.js +192 -3
  281. package/node_modules/qs/test/stringify.js +317 -0
  282. package/node_modules/qs/test/utils.js +12 -0
  283. package/node_modules/sax/lib/sax.js +27 -9
  284. package/node_modules/sax/package.json +1 -1
  285. package/node_modules/type-is/node_modules/content-type/README.md +2 -0
  286. package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
  287. package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
  288. package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
  289. package/node_modules/type-is/node_modules/content-type/package.json +1 -1
  290. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  291. package/node_modules/ws/package.json +1 -1
  292. package/package.json +5 -5
  293. package/bin/completion/scripts/cds-bash.sh +0 -20
  294. package/bin/completion/scripts/cds-fish.fish +0 -13
  295. package/bin/completion/scripts/cds-ps.ps1 +0 -19
  296. package/bin/completion/scripts/cds-zsh.sh +0 -13
  297. package/lib/deploy/index.js +0 -25
  298. package/lib/import/asyncapi/importAsyncAPI.js +0 -33
  299. package/lib/import/asyncapi/index.js +0 -18
  300. package/lib/import/asyncapi/parserContext.js +0 -372
  301. package/lib/import/asyncapi/utils.js +0 -49
  302. package/lib/init/template/nodejs/files/.gitignore.hbs +0 -34
  303. package/node_modules/@sap/cds/libx/_runtime/ucl/queries.js +0 -61
  304. package/node_modules/@sap/cds-mtxs/lib/migration/extension-project-builder.js +0 -129
  305. package/node_modules/@sap/cds-mtxs/lib/migration/extension-project.js +0 -89
  306. package/node_modules/@sap/cds-mtxs/lib/migration/mtx-adapter.js +0 -230
  307. package/node_modules/negotiator/HISTORY.md +0 -114
  308. /package/{lib → bin}/upgrade/context.js +0 -0
  309. /package/{lib → bin}/upgrade/migrations/cds10/migrations.json +0 -0
  310. /package/{lib → bin}/upgrade/preflight/cds-version.js +0 -0
  311. /package/{lib → bin}/upgrade/preflight/project-type.js +0 -0
  312. /package/{lib → bin}/upgrade/steps/analyze/classification.js +0 -0
  313. /package/{lib → bin}/upgrade/steps/analyze/detector.js +0 -0
  314. /package/{lib → bin}/upgrade/steps/analyze/evaluator.js +0 -0
  315. /package/{lib → bin}/upgrade/steps/analyze/reporter.js +0 -0
  316. /package/{lib → bin}/upgrade/steps/analyze/setup.js +0 -0
  317. /package/{lib → bin}/upgrade/steps/analyze/utils/detection.js +0 -0
  318. /package/{lib → bin}/upgrade/steps/analyze/utils/files.js +0 -0
  319. /package/{lib → bin}/upgrade/steps/analyze/utils/grep.js +0 -0
  320. /package/{lib → bin}/upgrade/steps/analyze/utils/yaml.js +0 -0
  321. /package/{lib → bin}/upgrade/util/workspaces.js +0 -0
  322. /package/{lib → bin}/watch/esm-resolve-registration.js +0 -0
  323. /package/{lib → bin}/watch/livereload-server.js +0 -0
  324. /package/{lib → bin}/watch/node-watch.js +0 -0
  325. /package/{lib → bin}/watch/open.js +0 -0
  326. /package/{lib → bin}/watch/watcher.js +0 -0
@@ -2,9 +2,32 @@
2
2
  /* eslint-disable no-console */
3
3
 
4
4
  async function run(param, options) {
5
+ const { dry, genTenantList, syncTenantList, cleanup, directory, tag, tagRule } = options
6
+ const skipVerification = options['skip-verification'] || options.skipVerification
7
+
8
+ function _handleError(message) {
9
+ console.log(message)
10
+ process.exit(1)
11
+ }
12
+
13
+ // Check for removed migration options
14
+ const removedOptions = []
15
+ if (cleanup) removedOptions.push('--cleanup')
16
+ if (directory) removedOptions.push('--directory')
17
+ if (tag) removedOptions.push('--tag')
18
+ if (tagRule) removedOptions.push('--tagRule')
19
+ if (skipVerification) removedOptions.push('--skip-verification')
20
+
21
+ if (removedOptions.length) {
22
+ _handleError(`The option(s) ${removedOptions.join(', ')} are no longer supported. The migration from @sap/cds-mtx to @sap/cds-mtxs has been removed.`)
23
+ }
24
+
25
+ if (!genTenantList && !syncTenantList) {
26
+ _handleError(`The migration from @sap/cds-mtx to @sap/cds-mtxs has been removed. Only --init-tenant-list and --sync-tenant-list are still supported.`)
27
+ }
28
+
5
29
  const cds = require('@sap/cds')
6
- const { migrate, cleanupMetatenants, syncTenantList: synchronizeTenantList, _hasMtEnv, getDbId } = require('../lib/migration/migration')
7
- const { dry, cleanup, genTenantList, syncTenantList } = options
30
+ const { syncTenantList: synchronizeTenantList, _hasMtEnv } = require('../lib/migration/migration')
8
31
 
9
32
  async function cds_mtx_migrate(tenants, options) {
10
33
  if (!_hasMtEnv()) _handleError(`cds-mtx-migrate operation can only be run inside a multitenant application environment using @sap/cds-mtxs.`)
@@ -26,35 +49,9 @@ async function run(param, options) {
26
49
  await cds.serve(services)
27
50
  cds.env.requires.multitenancy = cds.env.requires.multitenancy || true // needed for current sidecar config that only enables services
28
51
 
29
- // get and set database id
30
- const deploymentServiceConfig = cds.env.requires['cds.xt.DeploymentService'] || {}
31
- if (!deploymentServiceConfig.hdi?.create?.database_id) {
32
- const foundDbId = await getDbId()
33
- if (foundDbId) {
34
- cds.env.requires['cds.xt.DeploymentService'] = {
35
- ...deploymentServiceConfig,
36
- hdi: { ...deploymentServiceConfig.hdi,
37
- create: {
38
- ...deploymentServiceConfig.hdi?.create,
39
- database_id: foundDbId
40
- }
41
- }
42
- }
43
- }
44
- }
45
-
46
52
  await cds.emit('served')
47
53
 
48
- if (cleanup) {
49
- const deletedTenants = await cleanupMetatenants(tenantList, options)
50
- for (let t of deletedTenants.connectedTenants) await cds.db.disconnect(t)
51
- await cds.db.disconnect()
52
-
53
- deletedTenants.logResult(dry)
54
-
55
- // always fail gracefully
56
- // if (deletedTenants.hasError) process.exit(1)
57
- } else if (genTenantList) {
54
+ if (genTenantList) {
58
55
  const tenantListResult = await synchronizeTenantList(tenantList, options)
59
56
  for (let t of tenantListResult.connectedTenants) await cds.db.disconnect(t)
60
57
  await cds.db.disconnect()
@@ -66,22 +63,9 @@ async function run(param, options) {
66
63
  await cds.db.disconnect()
67
64
 
68
65
  tenantListResult.logResult(dry)
69
- }else {
70
- const migratedTenants = await migrate(tenantList, options)
71
- for (let t of migratedTenants.connectedTenants) await cds.db.disconnect(t)
72
- await cds.db.disconnect()
73
-
74
- migratedTenants.logResult()
75
- // make sure to get result != 0 so that potential followup scripts know of problems
76
- if (migratedTenants.hasError) process.exit(1)
77
66
  }
78
67
  }
79
68
 
80
- function _handleError(message) {
81
- console.log(message)
82
- process.exit(1)
83
- }
84
-
85
69
  function _splitTenants(tenants) {
86
70
  return tenants.split(',')
87
71
  }
@@ -100,16 +84,16 @@ if (require.main === module) {
100
84
  // TODO use command line parser to get arguments
101
85
  // comma separated list of tenants
102
86
  const [, , tenants, ...options] = process.argv
103
- const directory = getParameterValue(options, '-d')
104
- const tag = getParameterValue(options, '--tag')
105
- const tagRule = getParameterValue(options, '--tagRule')
106
87
  const dry = options.includes('--dry')
107
- const cleanup = options.includes('--cleanup')
108
88
  const genTenantList = options.includes('--init-tenant-list')
109
89
  const syncTenantList = options.includes('--sync-tenant-list')
110
90
  const force = options.includes('--force')
91
+ const cleanup = options.includes('--cleanup')
111
92
  const skipVerification = options.includes('--skip-verification')
112
- run(tenants, { directory, dry, force, tag, tagRule, "skip-verification": skipVerification, cleanup, genTenantList, syncTenantList }).catch(console.error)
93
+ const directory = getParameterValue(options, '-d') || getParameterValue(options, '--directory')
94
+ const tag = getParameterValue(options, '--tag')
95
+ const tagRule = getParameterValue(options, '--tagRule')
96
+ run(tenants, { dry, force, genTenantList, syncTenantList, cleanup, directory, tag, tagRule, 'skip-verification': skipVerification }).catch(console.error)
113
97
  } else {
114
- module.exports.run = run
98
+ module.exports.run = run
115
99
  }
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ /* eslint-disable no-console */
2
3
 
3
4
  const cds = require('@sap/cds')
4
5
  const { _import, isfile, local, path } = cds.utils
@@ -9,15 +10,16 @@ const SUPPORTED = ['subscribe', 'unsubscribe', 'upgrade']
9
10
  // This function must only be changed in a backward compatible way. It is used by DwC.
10
11
  async function cds_mtx(cmd, tenant, body) {
11
12
 
12
- let connectedTenants = [tenant]
13
+ const tenants = (Array.isArray(tenant) ? tenant : [tenant]).flatMap(t => t.split(','))
14
+ const one = tenants.length === 1 ? tenants[0] : undefined
15
+
16
+ let connectedTenants = []
13
17
 
14
18
  try {
15
19
  if (!cmd) return _usage()
16
20
  if (!SUPPORTED.includes(cmd)) return _usage(`Unknown command ${cmd}.`)
17
21
  if (!_hasMtEnv()) return _handleError(`cds-mtx ${cmd} operation can only be run inside a multitenant application environment using @sap/cds-mtxs.`)
18
- if (!tenant) return _handleError(`Please provide a tenant: cds-mtx ${cmd} <tenant>`)
19
- if (/.*,.*/.test(tenant)) return _handleError(`List of tenants not supported: ${tenant}`)
20
- // parse body and handle error
22
+ if (!tenants.length) return _handleError(`Please provide a tenant: cds-mtx ${cmd} <tenant>`)
21
23
  let parsedMetadata
22
24
  if (body) {
23
25
  try {
@@ -45,18 +47,27 @@ async function cds_mtx(cmd, tenant, body) {
45
47
  await cds.connect.to('db')
46
48
  }
47
49
 
48
- if (tenant === '*') {
50
+ if (tenants.includes('*')) {
49
51
  if (cmd !== 'upgrade') return _handleError('"*" only supported for upgrade command')
50
- const tenants = await sps.read('tenant')
51
- connectedTenants = tenants.map(t => t.subscribedTenantId)
52
+ if (tenants.length > 1) return _handleError('"*" cannot be combined with other tenants')
53
+ const all = await sps.read('tenant')
54
+ connectedTenants = all.map(t => t.subscribedTenantId)
52
55
  await sps.tx({ user: new cds.User.Privileged() }, async (tx) => {
53
- await tx.upgrade([tenant], parsedMetadata)
56
+ await tx.upgrade(['*'], parsedMetadata)
54
57
  })
55
58
  return
56
- } else if (tenant === 't0') {
59
+ } else if (one === 't0') {
57
60
  return
58
61
  }
59
- await ds[cmd](tenant, parsedMetadata, parsedMetadata)
62
+ connectedTenants = tenants
63
+
64
+ if (cmd === 'upgrade') {
65
+ await sps.tx({ user: new cds.User.Privileged() }, async (tx) => {
66
+ await tx.upgrade(tenants, parsedMetadata)
67
+ })
68
+ } else {
69
+ for (const t of tenants) await ds[cmd](t, parsedMetadata, parsedMetadata)
70
+ }
60
71
  } catch(e) {
61
72
  if (isCli) {
62
73
  console.error(e.message)
@@ -108,27 +119,35 @@ async function _usage(message = '') {
108
119
  USAGE
109
120
 
110
121
  cds-mtx <command> <tenant> [--body <json>]
122
+ cds-mtx <command> <tenant1> [<tenant2> ...] [--body <json>]
123
+ cds-mtx <command> <t1,t2,...> [--body <json>]
111
124
 
112
125
  COMMANDS
113
126
 
114
- subscribe subscribe a tenant
115
- unsubscribe unsubscribe a tenant
116
- upgrade upgrade a tenant
127
+ subscribe subscribe one or more tenants
128
+ unsubscribe unsubscribe one or more tenants
129
+ upgrade upgrade one or more tenants
117
130
 
118
131
  EXAMPLES
119
132
 
120
133
  cds-mtx subscribe t1
134
+ cds-mtx subscribe t1 t2 t3
121
135
  cds-mtx subscribe t1 --body '{ "_": { "hdi": { "create": { "database_id": "<database id>" } } } }'
122
136
  cds-mtx unsubscribe t1
123
137
  cds-mtx upgrade t1
138
+ cds-mtx upgrade t1 t2 t3
139
+ cds-mtx upgrade t1,t2,t3
124
140
  cds-mtx upgrade "*"
125
141
  `
126
142
  )
127
143
  }
128
144
 
129
145
  if (isCli) {
130
- const [, , cmd, tenant, option, json] = process.argv
131
- if (option && option !== '--body') _usage(`Invalid option ${option}`)
132
- ;(async () => await cds_mtx(cmd, tenant, option ? json : undefined))()
146
+ const [, , cmd, ...rest] = process.argv
147
+ const bodyIdx = rest.indexOf('--body')
148
+ const tenants = bodyIdx === -1 ? rest : rest.slice(0, bodyIdx)
149
+ const body = bodyIdx !== -1 ? rest[bodyIdx + 1] : undefined
150
+ if (bodyIdx !== -1 && !body) _usage(`Missing value for --body`)
151
+ ;(async () => await cds_mtx(cmd, tenants, body))()
133
152
  }
134
153
  module.exports = { cds_mtx }
@@ -6,6 +6,9 @@ if (major < 9) throw new Error('@sap/cds-mtxs 3 requires @sap/cds version 9 or h
6
6
  const cdscDefaults = Object.fromEntries(
7
7
  Object.entries(cds.env.defaults?.cdsc || {}).filter(([key]) => !key.startsWith('[') )
8
8
  )
9
+ const sqlDefaults = Object.fromEntries(
10
+ Object.entries(cds.env.defaults?.sql || {}).filter(([key]) => !key.startsWith('[') )
11
+ )
9
12
 
10
13
  require('./srv/extensibility/linter').legacyCheck()
11
14
 
@@ -28,3 +31,18 @@ if (main.env.cdsc && cds.env.requires['cds.xt.ModelProviderService']?._in_sideca
28
31
  } else {
29
32
  cds.env.cdsc = main.env.cdsc
30
33
  }
34
+
35
+ if (cds.env.requires['cds.xt.ModelProviderService']?._in_sidecar === true) {
36
+ if (!(cds.env.requires['cds.xt.ModelProviderService']?.['use-root-sql-config'] === true)) {
37
+ const stringifiedSql = JSON.stringify(cds.env.sql)
38
+
39
+ if (stringifiedSql !== JSON.stringify(main.env.sql) && stringifiedSql !== JSON.stringify(sqlDefaults)) {
40
+ LOG.warn('inconsistent sql configuration: using cds.sql configuration of mtx sidecar')
41
+ }
42
+ // LATER: cds.env.sql = main.env.sql
43
+ } else {
44
+ cds.env.sql = main.env.sql
45
+ }
46
+ } else {
47
+ cds.env.sql = main.env.sql
48
+ }