@sap/cds-dk 10.0.7 → 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 (302) hide show
  1. package/CHANGELOG.md +94 -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/notifications/index.js +2 -2
  117. package/lib/init/template/portal/files/mta.yaml.hbs +4 -0
  118. package/lib/init/template/portal/index.js +13 -8
  119. package/lib/init/template/postgres/index.js +2 -2
  120. package/lib/init/template/redis/index.js +2 -2
  121. package/lib/init/template/sample/files/db/currencies.cds +2 -0
  122. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +1 -1
  123. package/lib/init/template/tiny-sample/files/nodejs/db/data/CatalogService.Books.csv +2 -2
  124. package/lib/init/template/workzone-standard/index.js +5 -5
  125. package/lib/init/template/xsuaa/index.js +20 -2
  126. package/lib/lint/eslintHelp.json +1 -1
  127. package/lib/mtx/auth_manager.js +103 -37
  128. package/lib/mtx/params.js +3 -2
  129. package/lib/mtx/settings_manager.js +45 -28
  130. package/lib/mtx/tenant_action.js +0 -1
  131. package/lib/mtx/util/credentials.js +62 -0
  132. package/node_modules/@sap/cds/CHANGELOG.md +57 -0
  133. package/node_modules/@sap/cds/app/index.js +5 -4
  134. package/node_modules/@sap/cds/eslint.config.mjs +1 -0
  135. package/node_modules/@sap/cds/lib/compile/minify.js +14 -10
  136. package/node_modules/@sap/cds/lib/env/cds-env.js +1 -1
  137. package/node_modules/@sap/cds/lib/env/cds-requires.js +22 -11
  138. package/node_modules/@sap/cds/lib/env/defaults.js +4 -1
  139. package/node_modules/@sap/cds/lib/env/schemas/cds-rc.js +5 -2
  140. package/node_modules/@sap/cds/lib/plugins.js +9 -5
  141. package/node_modules/@sap/cds/lib/req/spawn.js +1 -1
  142. package/node_modules/@sap/cds/lib/srv/srv-dispatch.js +1 -1
  143. package/node_modules/@sap/cds/lib/srv/srv-models.js +1 -1
  144. package/node_modules/@sap/cds/lib/utils/cds-utils.js +2 -1
  145. package/node_modules/@sap/cds/libx/_runtime/common/generic/assert.js +2 -3
  146. package/node_modules/@sap/cds/libx/_runtime/common/generic/auth/restrict.js +8 -1
  147. package/node_modules/@sap/cds/libx/_runtime/common/generic/crud.js +18 -8
  148. package/node_modules/@sap/cds/libx/_runtime/fiori/lean-draft.js +25 -17
  149. package/node_modules/@sap/cds/libx/_runtime/messaging/enterprise-messaging-utils/registerEndpoints.js +9 -3
  150. package/node_modules/@sap/cds/libx/_runtime/remote/Service.js +4 -19
  151. package/node_modules/@sap/cds/libx/_runtime/remote/utils/LruCache.js +42 -0
  152. package/node_modules/@sap/cds/libx/_runtime/remote/utils/client.js +14 -4
  153. package/node_modules/@sap/cds/libx/_runtime/remote/utils/cloudSdkProvider.js +2 -9
  154. package/node_modules/@sap/cds/libx/_runtime/remote/utils/destinationClient.js +150 -0
  155. package/node_modules/@sap/cds/libx/_runtime/remote/utils/error.js +13 -0
  156. package/node_modules/@sap/cds/libx/_runtime/remote/utils/fetchClient.js +26 -18
  157. package/node_modules/@sap/cds/libx/_runtime/remote/utils/query.js +34 -23
  158. package/node_modules/@sap/cds/libx/_runtime/remote/utils/token.js +82 -0
  159. package/node_modules/@sap/cds/libx/_runtime/ucl/Service.js +36 -189
  160. package/node_modules/@sap/cds/libx/common/utils/streaming.js +16 -16
  161. package/node_modules/@sap/cds/libx/http/location.js +3 -3
  162. package/node_modules/@sap/cds/libx/odata/middleware/batch.js +16 -10
  163. package/node_modules/@sap/cds/libx/odata/middleware/metadata.js +9 -6
  164. package/node_modules/@sap/cds/libx/odata/middleware/service-document.js +1 -1
  165. package/node_modules/@sap/cds/libx/odata/parse/afterburner.js +19 -3
  166. package/node_modules/@sap/cds/libx/odata/parse/cqn2odata.js +83 -86
  167. package/node_modules/@sap/cds/libx/queue/SchedulingService.js +17 -2
  168. package/node_modules/@sap/cds/libx/queue/processing.js +1 -3
  169. package/node_modules/@sap/cds/libx/rest/RestAdapter.js +3 -7
  170. package/node_modules/@sap/cds/libx/rest/middleware/delete.js +3 -3
  171. package/node_modules/@sap/cds/libx/rest/middleware/parse.js +13 -8
  172. package/node_modules/@sap/cds/libx/rest/middleware/read.js +3 -3
  173. package/node_modules/@sap/cds/libx/rest/middleware/upsert.js +2 -2
  174. package/node_modules/@sap/cds/package.json +1 -1
  175. package/node_modules/@sap/cds-compiler/CHANGELOG.md +60 -8
  176. package/node_modules/@sap/cds-compiler/bin/cdsc.js +2 -2
  177. package/node_modules/@sap/cds-compiler/doc/IncompatibleChanges_v7.md +46 -19
  178. package/node_modules/@sap/cds-compiler/lib/api/main.js +10 -7
  179. package/node_modules/@sap/cds-compiler/lib/api/options.js +8 -2
  180. package/node_modules/@sap/cds-compiler/lib/base/csnRefs.js +5 -2
  181. package/node_modules/@sap/cds-compiler/lib/base/message-registry.js +4 -0
  182. package/node_modules/@sap/cds-compiler/lib/base/optionProcessor.js +12 -0
  183. package/node_modules/@sap/cds-compiler/lib/checks/enricher.js +1 -0
  184. package/node_modules/@sap/cds-compiler/lib/compiler/assert-consistency.js +8 -7
  185. package/node_modules/@sap/cds-compiler/lib/compiler/checks.js +3 -3
  186. package/node_modules/@sap/cds-compiler/lib/compiler/define.js +301 -75
  187. package/node_modules/@sap/cds-compiler/lib/compiler/dictionaries.js +2 -0
  188. package/node_modules/@sap/cds-compiler/lib/compiler/extend.js +40 -26
  189. package/node_modules/@sap/cds-compiler/lib/compiler/populate.js +45 -60
  190. package/node_modules/@sap/cds-compiler/lib/compiler/propagator.js +16 -7
  191. package/node_modules/@sap/cds-compiler/lib/compiler/resolve.js +41 -15
  192. package/node_modules/@sap/cds-compiler/lib/compiler/shared.js +7 -6
  193. package/node_modules/@sap/cds-compiler/lib/compiler/tweak-assocs.js +62 -50
  194. package/node_modules/@sap/cds-compiler/lib/compiler/utils.js +29 -14
  195. package/node_modules/@sap/cds-compiler/lib/edm/edmAnnoPreprocessor.js +6 -5
  196. package/node_modules/@sap/cds-compiler/lib/gen/CdlGrammar.checksum +1 -1
  197. package/node_modules/@sap/cds-compiler/lib/gen/CdlParser.js +1119 -1109
  198. package/node_modules/@sap/cds-compiler/lib/gen/Dictionary.json +19 -3
  199. package/node_modules/@sap/cds-compiler/lib/json/from-csn.js +10 -16
  200. package/node_modules/@sap/cds-compiler/lib/json/to-csn.js +58 -39
  201. package/node_modules/@sap/cds-compiler/lib/main.d.ts +8 -0
  202. package/node_modules/@sap/cds-compiler/lib/main.js +1 -0
  203. package/node_modules/@sap/cds-compiler/lib/model/csnUtils.js +2 -0
  204. package/node_modules/@sap/cds-compiler/lib/parsers/AstBuildingParser.js +2 -1
  205. package/node_modules/@sap/cds-compiler/lib/parsers/XprTree.js +8 -0
  206. package/node_modules/@sap/cds-compiler/lib/render/toCdl.js +22 -1
  207. package/node_modules/@sap/cds-compiler/lib/render/toSql.js +17 -2
  208. package/node_modules/@sap/cds-compiler/lib/render/utils/common.js +6 -1
  209. package/node_modules/@sap/cds-compiler/lib/render/utils/operators.js +27 -0
  210. package/node_modules/@sap/cds-compiler/lib/render/utils/standardDatabaseFunctions.js +125 -3
  211. package/node_modules/@sap/cds-compiler/lib/tool-lib/revealInternalProperties.js +2 -1
  212. package/node_modules/@sap/cds-compiler/lib/transform/db/applyTransformations.js +3 -0
  213. package/node_modules/@sap/cds-compiler/lib/transform/db/associations.js +8 -2
  214. package/node_modules/@sap/cds-compiler/lib/transform/db/backlinks.js +22 -6
  215. package/node_modules/@sap/cds-compiler/lib/transform/db/constraints.js +62 -1
  216. package/node_modules/@sap/cds-compiler/lib/transform/effective/annotations.js +40 -0
  217. package/node_modules/@sap/cds-compiler/lib/transform/effective/main.js +1 -0
  218. package/node_modules/@sap/cds-compiler/lib/transform/forRelationalDB.js +6 -1
  219. package/node_modules/@sap/cds-compiler/lib/transform/translateAssocsToJoins.js +19 -8
  220. package/node_modules/@sap/cds-compiler/package.json +1 -1
  221. package/node_modules/@sap/cds-mtxs/CHANGELOG.md +15 -0
  222. package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +34 -16
  223. package/node_modules/@sap/cds-mtxs/lib/utils.js +19 -4
  224. package/node_modules/@sap/cds-mtxs/package.json +1 -1
  225. package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +1 -1
  226. package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +22 -13
  227. package/node_modules/@sap/cds-mtxs/srv/model-provider.js +17 -2
  228. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +1 -1
  229. package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +4 -8
  230. package/node_modules/@sap/xsenv/CHANGELOG.md +7 -0
  231. package/node_modules/@sap/xsenv/package.json +10 -7
  232. package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
  233. package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
  234. package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
  235. package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
  236. package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
  237. package/node_modules/hdb/cfg/VERSION +1 -1
  238. package/node_modules/hdb/lib/protocol/ClientInfo.js +16 -3
  239. package/node_modules/hdb/lib/protocol/Connection.js +1 -0
  240. package/node_modules/hdb/package.json +3 -2
  241. package/node_modules/negotiator/lib/accept.js +54 -0
  242. package/node_modules/negotiator/lib/charset.js +10 -34
  243. package/node_modules/negotiator/lib/encoding.js +9 -30
  244. package/node_modules/negotiator/lib/language.js +15 -36
  245. package/node_modules/negotiator/lib/mediaType.js +16 -134
  246. package/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
  247. package/node_modules/negotiator/node_modules/content-type/README.md +71 -0
  248. package/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
  249. package/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
  250. package/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
  251. package/node_modules/negotiator/node_modules/content-type/package.json +52 -0
  252. package/node_modules/negotiator/package.json +16 -10
  253. package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
  254. package/node_modules/qs/CHANGELOG.md +15 -0
  255. package/node_modules/qs/README.md +19 -1
  256. package/node_modules/qs/dist/qs.js +21 -21
  257. package/node_modules/qs/eslint.config.mjs +1 -1
  258. package/node_modules/qs/lib/parse.js +3 -4
  259. package/node_modules/qs/lib/stringify.js +23 -8
  260. package/node_modules/qs/lib/utils.js +10 -3
  261. package/node_modules/qs/package.json +4 -4
  262. package/node_modules/qs/test/parse.js +192 -3
  263. package/node_modules/qs/test/stringify.js +317 -0
  264. package/node_modules/qs/test/utils.js +12 -0
  265. package/node_modules/type-is/node_modules/content-type/README.md +2 -0
  266. package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
  267. package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
  268. package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
  269. package/node_modules/type-is/node_modules/content-type/package.json +1 -1
  270. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  271. package/node_modules/ws/package.json +1 -1
  272. package/package.json +3 -3
  273. package/bin/completion/scripts/cds-bash.sh +0 -20
  274. package/bin/completion/scripts/cds-fish.fish +0 -13
  275. package/bin/completion/scripts/cds-ps.ps1 +0 -19
  276. package/bin/completion/scripts/cds-zsh.sh +0 -13
  277. package/lib/deploy/index.js +0 -25
  278. package/lib/import/asyncapi/importAsyncAPI.js +0 -33
  279. package/lib/import/asyncapi/index.js +0 -18
  280. package/lib/import/asyncapi/parserContext.js +0 -454
  281. package/lib/import/asyncapi/utils.js +0 -49
  282. package/node_modules/@sap/cds/libx/_runtime/ucl/queries.js +0 -61
  283. package/node_modules/negotiator/HISTORY.md +0 -114
  284. /package/{lib → bin}/upgrade/context.js +0 -0
  285. /package/{lib → bin}/upgrade/migrations/cds10/migrations.json +0 -0
  286. /package/{lib → bin}/upgrade/preflight/cds-version.js +0 -0
  287. /package/{lib → bin}/upgrade/preflight/project-type.js +0 -0
  288. /package/{lib → bin}/upgrade/steps/analyze/classification.js +0 -0
  289. /package/{lib → bin}/upgrade/steps/analyze/detector.js +0 -0
  290. /package/{lib → bin}/upgrade/steps/analyze/evaluator.js +0 -0
  291. /package/{lib → bin}/upgrade/steps/analyze/reporter.js +0 -0
  292. /package/{lib → bin}/upgrade/steps/analyze/setup.js +0 -0
  293. /package/{lib → bin}/upgrade/steps/analyze/utils/detection.js +0 -0
  294. /package/{lib → bin}/upgrade/steps/analyze/utils/files.js +0 -0
  295. /package/{lib → bin}/upgrade/steps/analyze/utils/grep.js +0 -0
  296. /package/{lib → bin}/upgrade/steps/analyze/utils/yaml.js +0 -0
  297. /package/{lib → bin}/upgrade/util/workspaces.js +0 -0
  298. /package/{lib → bin}/watch/esm-resolve-registration.js +0 -0
  299. /package/{lib → bin}/watch/livereload-server.js +0 -0
  300. /package/{lib → bin}/watch/node-watch.js +0 -0
  301. /package/{lib → bin}/watch/open.js +0 -0
  302. /package/{lib → bin}/watch/watcher.js +0 -0
@@ -1,7 +1,7 @@
1
1
  # Incompatible Changes in CDS Compiler Version 7
2
2
 
3
3
  This document lists (potentially) incompatible changes
4
- which came with Compiler Version 7.
4
+ which came with Compiler Version 7, including the fixes of Version 7.0.2.
5
5
 
6
6
  <!-- toc: start -->
7
7
 
@@ -17,15 +17,16 @@ which came with Compiler Version 7.
17
17
  1. [name-deprecated-$self](#name-deprecated-self)
18
18
  2. [String representation for expression-like annotation values](#string-representation-for-expression-like-annotation-values)
19
19
  3. [Default for structures](#default-for-structures)
20
- 4. [Default for arrays)](#default-for-arrays-ic-v7-33)
20
+ 4. [Default for arrays](#default-for-arrays)
21
21
  5. [Extend builtin with type properties](#extend-builtin-with-type-properties)
22
- 6. [Key propagation](#key-propagation)
23
- 7. [Annotate with invalid target](#annotate-with-invalid-target)
24
- 8. [Duplicate element via extend with aspect](#duplicate-element-via-extend-with-aspect)
25
- 9. [Extend ... with definitions](#extend--with-definitions)
26
- 10. [Propagate value null](#propagate-value-null)
27
- 11. [Expression as UP TO value](#expression-as-up-to-value)
28
- 12. [Associations defined via backlink associations](#associations-defined-via-backlink-associations)
22
+ 6. [Key propagation in projections](#key-propagation-in-projections)
23
+ 7. [Key propagation for types](#key-propagation-for-types)
24
+ 8. [Annotate with invalid target](#annotate-with-invalid-target)
25
+ 9. [Duplicate element via extend with aspect](#duplicate-element-via-extend-with-aspect)
26
+ 10. [Extend ... with definitions](#extend--with-definitions)
27
+ 11. [Propagate value null](#propagate-value-null)
28
+ 12. [Expression as UP TO value](#expression-as-up-to-value)
29
+ 13. [Associations defined via backlink associations](#associations-defined-via-backlink-associations)
29
30
  6. [Changes in OData/EDM](#changes-in-odataedm)
30
31
  1. [Vocabulary change for Common.SideEffectsType](#vocabulary-change-for-commonsideeffectstype)
31
32
  7. [Changes in to.sql()](#changes-in-tosql)
@@ -53,7 +54,7 @@ Such changes always have a reason, and we don't introduce them "just for the sak
53
54
  | Default for structures | 2 | low |
54
55
  | Default for arrays | 2 | low |
55
56
  | Extend builtin with type properties | 2 | very low |
56
- | Key propagation | 3 | low |
57
+ | Key propagation | 3+4 | medium |
57
58
  | Sec-Annotate with invalid target | 2 | high |
58
59
  | Duplicate elem by extend w/ aspect | 2 | low |
59
60
  | Extend ... with definitions | 4 | zero |
@@ -136,7 +137,7 @@ It was ...
136
137
 
137
138
  The error could be downgraded with
138
139
  ```sh
139
- cdsc b51.<file> --warn syntax-unsupported-masked --deprecated downgradableErrors
140
+ cdsc <file> --warn syntax-unsupported-masked --deprecated downgradableErrors
140
141
  ```
141
142
 
142
143
  In cds-compiler v7:
@@ -195,7 +196,7 @@ entity E {
195
196
  a : Integer;
196
197
  b : Integer;
197
198
  }
198
- entity P as projection on E { a as x, b as y};
199
+ entity P as projection on E { a as x, b as y };
199
200
  ```
200
201
  Resulting CSN:
201
202
  ```jsonc
@@ -334,9 +335,9 @@ the compiler throws configurable errors for these situations.
334
335
  Planned to make non-configurable in v8.
335
336
 
336
337
 
337
- ### Key propagation
338
+ ### Key propagation in projections
338
339
 
339
- Before cds-compiler v7:
340
+ Before cds-compiler v7 or when the v7 option `v6KeyPropagation` is set with truthy value:
340
341
  A view or projection inherits the key of the underlying base entity, if ...
341
342
  * no explicit key is set in the query
342
343
  * all key elements of the primary base entity are selected
@@ -346,25 +347,51 @@ A view or projection inherits the key of the underlying base entity, if ...
346
347
  (key = the entirety of the key elements)
347
348
 
348
349
  Essentially this means: we propagate the key only in situations
349
- where we are (almost) sure that the result is a valid key. "Almost", because
350
+ where we are (almost) sure that the result is a valid key. This was the intention, but
350
351
  a path with a to-many association isn't recognized inside an expression.
351
352
 
352
353
  These rules are unnecessarily complex.
353
354
 
354
- In cds-compiler v7:
355
+ In cds-compiler v7 or when the v6.9 option `v7KeyPropagation` is set with truthy value:
355
356
  Simplify rules: a view or projection inherits the key of the
356
357
  underlying base entity, if ...
357
358
  * no explicit key is set in the query
358
359
  * all key elements of the primary base entity and all key elements of joined
359
360
  entities are selected
360
361
 
361
- Note: second rule is very strict, as oftentimes not all key elements of the target need
362
+ Note: second rule is very strict, as often not all key elements of the target need
362
363
  to be selected because they are tied to a key element of the source via the ON condition.
363
364
  In these situations no key is propagated and we basically have the same situation as before v7.
364
365
 
365
366
  This change means:
366
- we would propagate the key also in many situations where we are not sure the
367
- result is a valid key.
367
+ we would propagate the key also in situations where we are not sure the
368
+ result is a valid key, e.g. with a union query.
369
+
370
+
371
+ ### Key propagation for types
372
+
373
+ An element of an entity can be key with implications for the compiler-calculated foreign keys
374
+ of an association, SQL constraints in the OData protocol, ….
375
+
376
+ Inconsistencies arise when a _sub element_ of an entity is declared to be a key,
377
+ especially if structure flattening comes into play.
378
+ Thus, the compiler issues a warning for `key` on a sub element, and for `key` inside a structured type.
379
+
380
+ Before cds-compiler v7 or when the v7 option `v6KeyPropagation` is set with truthy value:
381
+
382
+ * an element in a structure type doesn't inherit the key of the underlying base element
383
+ if the structure type is a derived type (`type D: T`) or is defined via `projection on`,
384
+ * an element in a structure type _does inherit_ the key of the underlying base element
385
+ if the structure type includes a structure.
386
+
387
+ In cds-compiler v7 or when the v6.9 option `v7KeyPropagation` is set with truthy value:
388
+
389
+ * an element in a structure type _never inherits_ the key of an underlying base element.
390
+
391
+ This way, key sub elements (with their inconsistencies) only arise
392
+ with dubious user-provided element definitions, never for compiler-inferred elements.
393
+
394
+ Users who use a type basically as include should consider using an aspect instead.
368
395
 
369
396
 
370
397
  ### Annotate with invalid target
@@ -522,6 +522,16 @@ function sqlMigration( csn, options, messageFunctions, beforeImage ) {
522
522
  }, {}),
523
523
  };
524
524
 
525
+ // Sort before the loop below sets `@cds.persistence.skip=true`
526
+ // on unchanged artifacts as a `toSqlDdl` suppression hint; `sortViews`
527
+ // does not process non-persisted entities
528
+ const sortOrder = sortViews({ sql: {}, csn: afterImage });
529
+
530
+ const dependentsDict = {};
531
+ sortOrder.forEach(({ name, dependents }) => {
532
+ dependentsDict[name] = dependents;
533
+ });
534
+
525
535
  const markedSkipByUs = {};
526
536
  const cleanup = [];
527
537
  // Delete artifacts that are already present in csn
@@ -548,13 +558,6 @@ function sqlMigration( csn, options, messageFunctions, beforeImage ) {
548
558
  });
549
559
  }
550
560
 
551
- const sortOrder = sortViews({ sql: {}, csn: afterImage });
552
-
553
- const dependentsDict = {};
554
- sortOrder.forEach(({ name, dependents }) => {
555
- dependentsDict[name] = dependents;
556
- });
557
-
558
561
  const stack = Object.keys(drops.creates);
559
562
  while (stack.length > 0) {
560
563
  const name = stack.pop();
@@ -37,12 +37,15 @@ const publicOptionsNewAPI = [
37
37
  'magicVars', // deprecated, not removed in v3 as we have specific error messages for it
38
38
  'variableReplacements',
39
39
  'pre2134ReferentialConstraintNames',
40
+ 'draftAdminDataConstraints',
40
41
  'betterSqliteSessionVariables',
41
42
  'decimal_affinity',
42
43
  'withHanaAssociations',
43
44
  'standardDatabaseFunctions',
44
45
  'booleanEquality',
45
46
  'dollarNowAsTimestamp',
47
+ 'vectorEmbeddingDefaultModel',
48
+ 'vectorEmbeddingHanaDefaultRemoteSource',
46
49
  // ODATA
47
50
  'odataOpenapiHints',
48
51
  'edm4OpenAPI',
@@ -68,6 +71,7 @@ const publicOptionsNewAPI = [
68
71
  // for.effective
69
72
  'resolveSimpleTypes',
70
73
  'resolveProjections',
74
+ 'stringifyAnnoXpr',
71
75
  'remapOdataAnnotations',
72
76
  'keepLocalized',
73
77
  'effectiveServiceName',
@@ -190,6 +194,7 @@ module.exports = {
190
194
  booleanEquality: true,
191
195
  dollarNowAsTimestamp: false,
192
196
  decimal_affinity: 'real',
197
+ draftAdminDataConstraints: false,
193
198
  };
194
199
  const processed = translateOptions(options, defaultOptions, hardOptions, {}, [ 'sql-dialect-and-naming' ], 'to.sql');
195
200
 
@@ -204,6 +209,7 @@ module.exports = {
204
209
  withHanaAssociations: false,
205
210
  booleanEquality: true,
206
211
  dollarNowAsTimestamp: false,
212
+ draftAdminDataConstraints: false,
207
213
  };
208
214
  return translateOptions(options, defaultOptions, hardOptions, { sqlDialect: generateStringValidator([ 'hana' ]) }, undefined, 'to.hdi');
209
215
  },
@@ -241,7 +247,7 @@ module.exports = {
241
247
  effective: (options) => {
242
248
  const hardOptions = { addCdsPersistenceName: false, deriveAnalyticalAnnotations: false };
243
249
  const defaultOptions = {
244
- sqlMapping: 'plain', resolveSimpleTypes: true, resolveProjections: true, remapOdataAnnotations: false, keepLocalized: false,
250
+ sqlMapping: 'plain', resolveSimpleTypes: true, resolveProjections: true, stringifyAnnoXpr: false, remapOdataAnnotations: false, keepLocalized: false,
245
251
  };
246
252
  const processed = translateOptions(options, defaultOptions, hardOptions, null, [ 'sql-dialect-and-naming', 'effectiveServiceName-and-type-resolution' ], 'for.effective');
247
253
 
@@ -251,7 +257,7 @@ module.exports = {
251
257
  const hardOptions = {
252
258
  sqlMapping: 'plain', resolveSimpleTypes: true, resolveProjections: true, keepLocalized: false, addCdsPersistenceName: true,
253
259
  };
254
- const defaultOptions = { remapOdataAnnotations: true, deriveAnalyticalAnnotations: false };
260
+ const defaultOptions = { stringifyAnnoXpr: false, remapOdataAnnotations: true, deriveAnalyticalAnnotations: false };
255
261
  const processed = translateOptions(options, defaultOptions, hardOptions, null, [ 'sql-dialect-and-naming' ], 'for.effective');
256
262
 
257
263
  return Object.assign({}, processed);
@@ -244,6 +244,7 @@ const referenceSemantics = {
244
244
  expand: { lexical: justDollar, dynamic: 'expand' }, // ...using baseEnv
245
245
  inline: { lexical: justDollar, dynamic: 'inline' }, // ...using baseEnv
246
246
  ref_where: { lexical: justDollar, dynamic: 'ref-target' }, // ...using baseEnv
247
+ from_where: { lexical: justDollar, dynamic: 'ref-target' }, // ...using baseEnv
247
248
  on: { lexical: justDollar, dynamic: 'query' }, // assoc defs, redirected to
248
249
  // there are also 'on_join' and 'on_mixin' with default semantics
249
250
  $calc: { lexical: justDollar, dynamic: 'query' }, // calculation for draft
@@ -770,7 +771,9 @@ function csnRefs( csn, universalReady ) {
770
771
  if (head.charAt(0) === '$') {
771
772
  if (head !== '$self' && head !== '$projection')
772
773
  return { scope: '$magic' };
773
- const self = qcache && qcache.$queryNumber > 1 ? qcache._select : main;
774
+ // $self in filter of from -> TODO v8: disallow in core compiler?
775
+ const fcache = (refCtx === 'from_where' && qcache) ? qcache.$next : qcache;
776
+ const self = fcache && fcache.$queryNumber > 1 ? fcache._select : main;
774
777
  return resolvePath( path, self, null, '$self' );
775
778
  }
776
779
  }
@@ -1131,7 +1134,7 @@ function analyseCsnPath( csnPath, csn, resolve ) {
1131
1134
  else if (prop === 'where' && refCtx === 'ref') {
1132
1135
  if (resolve)
1133
1136
  baseEnv = resolve.ref_where( obj, baseRef, baseCtx, main, query, parent, baseEnv );
1134
- refCtx = 'ref_where';
1137
+ refCtx = (baseCtx === 'from') ? 'from_where' : 'ref_where';
1135
1138
  }
1136
1139
  else if (prop === 'expand' || prop === 'inline') {
1137
1140
  if (obj.ref) {
@@ -154,6 +154,7 @@ const centralMessages = {
154
154
 
155
155
  'extend-repeated-intralayer': { severity: 'Warning' },
156
156
  'extend-unrelated-layer': { severity: 'Info' },
157
+ 'ext-unstable-order': { severity: 'Warning' },
157
158
 
158
159
  'ext-duplicate-extend-type': { severity: 'Error' },
159
160
  'ext-duplicate-extend-type-unrelated-layer': { severity: 'Error', configurableFor: true },
@@ -232,6 +233,7 @@ const centralMessages = {
232
233
  'def-missing-virtual': { severity: 'Error', configurableFor: true },
233
234
  'def-expected-structured': { severity: 'Error', configurableFor: true },
234
235
  'def-unsupported-calc-elem': { severity: 'Error', configurableFor: true },
236
+ 'def-unsupported-assoc': { severity: 'Warning' },
235
237
 
236
238
  'def-invalid-key-cardinality': { severity: 'Error' },
237
239
 
@@ -550,6 +552,7 @@ const centralMessageTexts = {
550
552
  'syntax-invalid-anno-struct': {
551
553
  std: 'Objects with properties $(PROP) and $(SIBLINGPROP) are reserved for expressions and can\'t be used as structures',
552
554
  xpr: 'Objects with $(PROP) as only property are reserved for expressions and can\'t be used as structures',
555
+ '...': 'Objects with $(PROP) as only property are reserved for appending arrays and can\'t be used as structures',
553
556
  '#': 'Objects with a property $(PROP) are reserved for enum values and can\'t be used as structures',
554
557
  ref: 'The value of property $(PROP) in structures must be a non-empty string',
555
558
  },
@@ -584,6 +587,7 @@ const centralMessageTexts = {
584
587
  },
585
588
  'syntax-unexpected-sql-clause': {
586
589
  std: 'Unexpected $(KEYWORD) clause for path filter',
590
+ one: '$(CODE) is supported only in standalone queries, not in CDS models',
587
591
  },
588
592
 
589
593
  // Syntax messages, CSN parser - default: Error ------------------------------
@@ -303,6 +303,7 @@ optionProcessor.command('Q, toSql')
303
303
  .option(' --assert-integrity-type <type>', { valid: [ 'RT', 'DB' ], ignoreCase: true })
304
304
  .option(' --constraints-in-create-table')
305
305
  .option(' --pre2134ReferentialConstraintNames')
306
+ .option(' --draft-admin-data-constraints')
306
307
  .option(' --disable-hana-comments')
307
308
  .option(' --generated-by-comment')
308
309
  .option(' --better-sqlite-session-variables <bool>')
@@ -359,6 +360,9 @@ optionProcessor.command('Q, toSql')
359
360
  part of the "CREATE TABLE" statements rather than as separate
360
361
  "ALTER TABLE ADD CONSTRAINT" statements
361
362
  --pre2134ReferentialConstraintNames Do not prefix the constraint identifier with "c__"
363
+ --draft-admin-data-constraints Generate an "ON DELETE CASCADE" referential constraint on the
364
+ DraftAdministrativeData_DraftUUID foreign key of draft shadow
365
+ tables. Independent of assertIntegrity / assertIntegrityType.
362
366
  --disable-hana-comments Disable rendering of doc comments as SAP HANA comments.
363
367
  --generated-by-comment Enable rendering of the initial SQL comment for HDI-based artifacts
364
368
  --better-sqlite-session-variables <bool>
@@ -540,6 +544,7 @@ optionProcessor.command('forEffective')
540
544
  .option('-h, --help')
541
545
  .option('--resolve-simple-types <val>', { valid: [ 'true', 'false' ] } )
542
546
  .option('--resolve-projections <val>', { valid: [ 'true', 'false' ] } )
547
+ .option('--stringify-anno-xpr <val>', { valid: [ 'true', 'false' ] } )
543
548
  .option('--remap-odata-annotations <val>', { valid: [ 'true', 'false' ] } )
544
549
  .option('--keep-localized <val>', { valid: [ 'true', 'false' ] } )
545
550
  .option('--effective-service-name <name>')
@@ -559,6 +564,9 @@ optionProcessor.command('forEffective')
559
564
  --resolve-projections <val> Resolve projections:
560
565
  true: (default) transform projections into ordinary views with SELECT
561
566
  false: leave them as real projections
567
+ --stringify-anno-xpr <val> Stringify annotation expressions:
568
+ true: convert annotation expression nodes to CDL-like strings
569
+ false:(default) keep annotation expressions as structured CSN objects
562
570
  --remap-odata-annotations <val> Remap OData annotations to ABAP annotations:
563
571
  true: remap annotations
564
572
  false:(default) leave them as is
@@ -570,6 +578,7 @@ optionProcessor.command('forEffective')
570
578
 
571
579
  optionProcessor.command('forSeal')
572
580
  .option('-h, --help')
581
+ .option('--stringify-anno-xpr <val>', { valid: [ 'true', 'false' ] } )
573
582
  .option('--remap-odata-annotations <val>', { valid: [ 'true', 'false' ] } )
574
583
  .option('--derive-analytical-annotations <val>', { valid: [ 'true', 'false' ] })
575
584
  .positionalArgument('<files...>')
@@ -580,6 +589,9 @@ optionProcessor.command('forSeal')
580
589
 
581
590
  Options
582
591
  -h, --help Show this help text
592
+ --stringify-anno-xpr <val> Stringify annotation expressions:
593
+ true: convert annotation expression nodes to CDL-like strings
594
+ false:(default) keep annotation expressions as structured CSN objects
583
595
  --remap-odata-annotations <val> Remap OData annotations to ABAP annotations:
584
596
  true: (default) remap annotations
585
597
  false: leave them as is
@@ -34,6 +34,7 @@ function enrichCsn( csn, options ) {
34
34
  target,
35
35
  includes: simpleRef,
36
36
  columns,
37
+ $backlink: () => undefined,
37
38
  '@': annotation,
38
39
  };
39
40
  let cleanupCallbacks = [];
@@ -284,15 +284,15 @@ function assertConsistency( model, stage ) {
284
284
  optional: [
285
285
  'quantifier', 'orderBy', 'limit', 'name', '$parens', 'kind',
286
286
  '_origin', '$contains', // TODO tmp, see TODO in getOriginRaw()
287
- '_parent', '_main', '_leadingQuery', '_effectiveType', '$effectiveSeqNo', // in FROM
287
+ '_parent', '_main', '_effectiveType', '$effectiveSeqNo', // in FROM
288
288
  '$expand', '_$next', // parsing error: tableTerm with UNION on rhs.
289
289
  ],
290
290
  },
291
291
  select: { // sub query
292
292
  requires: [ 'op', 'location', 'from' ],
293
293
  optional: [
294
- 'name', '$parens', 'quantifier', 'mixin', 'excludingDict', 'columns', 'elements', '_deps',
295
- '$calcDepElement',
294
+ 'name', '$parens', 'quantifier', 'one', 'mixin', 'excludingDict', 'columns', 'elements',
295
+ '_deps', '$calcDepElement',
296
296
  'where', 'groupBy', 'having', 'orderBy', '$orderBy', 'limit', '$limit',
297
297
  '_origin', '_block', '$contains',
298
298
  '_projections', '_complexProjections',
@@ -311,7 +311,7 @@ function assertConsistency( model, stage ) {
311
311
  'on', '$parens', 'cardinality',
312
312
  'kind', 'name', '_block', '_parent', '_main', '_user',
313
313
  '$tableAliases', '_combined', '_joinParent', '$joinArgsIndex',
314
- '_leadingQuery', '_$next', '_deps', '$expand',
314
+ '_$next', '_deps', '$expand',
315
315
  ],
316
316
  },
317
317
  ref: {
@@ -453,6 +453,7 @@ function assertConsistency( model, stage ) {
453
453
  optional: [
454
454
  'scope', 'variant', '_artifact', '_originalArtifact',
455
455
  '$inferred', '$parens', 'sort', 'nulls', '$syntax',
456
+ '$extended', '_block', '_outer', // for where/having
456
457
  ],
457
458
  },
458
459
  none: { optional: () => true }, // parse error
@@ -479,6 +480,7 @@ function assertConsistency( model, stage ) {
479
480
  'sort', 'nulls', // if used in GROUP BY
480
481
  // `elements` of type is not put into cast, many will be cds.LargeString
481
482
  ...typeProperties, // for CAST
483
+ '$extended', '_block', '_outer', // for where/having
482
484
  ],
483
485
  },
484
486
  query: { requires: [ 'query', 'location' ], optional: [ 'stored', '$parens' ] },
@@ -570,6 +572,7 @@ function assertConsistency( model, stage ) {
570
572
  virtual: { kind: true, test: locationVal() },
571
573
  key: { kind: true, test: locationVal(), also: [ null, undefined ] },
572
574
  notNull: { kind: true, test: locationVal() },
575
+ one: { kind: true, test: locationVal() },
573
576
  includes: {
574
577
  kind: true,
575
578
  test: isArray(),
@@ -659,19 +662,17 @@ function assertConsistency( model, stage ) {
659
662
  '_effectiveType', '$effectiveSeqNo', '$parens',
660
663
  '_deps', '$calcDepElement', '$expand', '$contains',
661
664
  // query specific
662
- 'where', 'columns', 'mixin', 'quantifier', 'offset',
665
+ 'where', 'columns', 'mixin', 'quantifier', 'one', 'offset',
663
666
  'orderBy', '$orderBy', 'groupBy', 'excludingDict', 'having',
664
667
  '$limit', 'limit', '_status', '_origin',
665
668
  // via casts
666
669
  'enum',
667
670
  ],
668
671
  },
669
- _leadingQuery: { kind: true, test: TODO },
670
672
  $replacement: { kind: true, test: TODO }, // for smart * in queries
671
673
  _origin: { kind: true, test: TODO },
672
674
  _calcOrigin: { kind: true, test: TODO },
673
675
  _columnParent: { kind: [ 'element', undefined ], test: TODO }, // column or * (wildcard)
674
- _from: { kind: true, test: TODO }, // TODO: not necessary anymore ?
675
676
  // array of $tableAlias (or includes) for explicit and implicit redirection:
676
677
  _redirected: { kind: true, test: TODO },
677
678
  // ...array of table aliases for targets from orig to new
@@ -857,9 +857,9 @@ function check( model ) {
857
857
  { '#': 'struct-expr', elemref: xpr } );
858
858
  }
859
859
  else if (xpr._artifact.target !== undefined &&
860
- (!lastStep.where || lastStep.where.args?.length === 0 || isStored)) {
861
- // Allow using an association _with non-empty filter_, but only for on-read
862
- // calculated elements.
860
+ (!lastStep.where || isStored)) {
861
+ // Allow using an association _with a (possibly empty) filter_, but only
862
+ // for on-read calculated elements.
863
863
  // TODO: Also allow bare unmanaged association references and remove beta.
864
864
  const variant = (isStored && lastStep.where && 'assoc-stored') ||
865
865
  (isComposition( model, xpr._artifact ) && 'expr-comp') ||