@sap/cds 5.9.8 → 6.0.3

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 (381) hide show
  1. package/CHANGELOG.md +277 -20
  2. package/apis/services.d.ts +1 -1
  3. package/app/fiori/preview.js +2 -6
  4. package/app/index.js +3 -3
  5. package/bin/build/buildTaskEngine.js +17 -15
  6. package/bin/build/buildTaskFactory.js +29 -19
  7. package/bin/build/buildTaskHandler.js +27 -11
  8. package/bin/build/buildTaskProvider.js +2 -4
  9. package/bin/build/buildTaskProviderFactory.js +11 -16
  10. package/bin/build/constants.js +14 -6
  11. package/bin/build/csv-reader.js +2 -1
  12. package/bin/build/index.js +12 -18
  13. package/bin/build/provider/buildTaskHandlerEdmx.js +3 -39
  14. package/bin/build/provider/buildTaskHandlerFeatureToggles.js +149 -0
  15. package/bin/build/provider/buildTaskHandlerInternal.js +2 -3
  16. package/bin/build/provider/buildTaskProviderInternal.js +108 -239
  17. package/bin/build/provider/fiori/index.js +2 -2
  18. package/bin/build/provider/hana/2migration.js +11 -11
  19. package/bin/build/provider/hana/2tabledata.js +3 -3
  20. package/bin/build/provider/hana/index.js +89 -99
  21. package/bin/build/provider/hana/migrationtable.js +4 -3
  22. package/bin/build/provider/java/index.js +101 -0
  23. package/bin/build/provider/java-cf/index.js +1 -101
  24. package/bin/build/provider/mtx/index.js +83 -41
  25. package/bin/build/provider/mtx/resourcesTarBuilder.js +68 -0
  26. package/bin/build/provider/mtx-sidecar/index.js +110 -0
  27. package/bin/build/provider/node-cf/index.js +1 -308
  28. package/bin/build/provider/nodejs/index.js +189 -0
  29. package/bin/build/util.js +21 -31
  30. package/bin/cds.js +5 -3
  31. package/bin/deploy/to-hana/cfUtil.js +31 -6
  32. package/bin/deploy/to-hana/gitUtil.js +5 -3
  33. package/bin/deploy/to-hana/hana.js +15 -13
  34. package/bin/{build → deploy/to-hana}/mtaUtil.js +10 -9
  35. package/bin/mtx/in-cds.js +19 -7
  36. package/bin/serve.js +49 -22
  37. package/bin/utils/log.js +13 -30
  38. package/bin/version.js +4 -3
  39. package/common.cds +61 -16
  40. package/lib/compile/cdsc.js +3 -2
  41. package/lib/compile/etc/_localized.js +15 -14
  42. package/lib/compile/for/drafts.js +3 -4
  43. package/lib/compile/for/java.js +13 -10
  44. package/lib/compile/for/nodejs.js +8 -8
  45. package/lib/compile/for/odata.js +7 -12
  46. package/lib/compile/for/sql.js +5 -6
  47. package/lib/compile/index.js +5 -4
  48. package/lib/compile/load.js +9 -11
  49. package/lib/compile/minify.js +8 -5
  50. package/lib/compile/parse.js +4 -2
  51. package/lib/compile/resolve.js +18 -15
  52. package/lib/compile/to/edm.js +0 -1
  53. package/lib/compile/to/gql.js +3 -2
  54. package/lib/compile/to/json.js +24 -17
  55. package/lib/connect/bindings.js +3 -2
  56. package/lib/connect/index.js +5 -5
  57. package/lib/core/classes.js +74 -2
  58. package/lib/core/entities.js +52 -3
  59. package/lib/core/reflect.js +2 -1
  60. package/lib/deploy.js +10 -8
  61. package/lib/env/defaults.js +4 -3
  62. package/lib/env/index.js +71 -31
  63. package/lib/env/presets.js +1 -14
  64. package/lib/env/requires.js +71 -20
  65. package/lib/env/serviceBindings.js +147 -0
  66. package/lib/i18n/localize.js +22 -23
  67. package/lib/index.js +148 -144
  68. package/lib/log/errors.js +55 -12
  69. package/lib/log/format/kibana.js +1 -1
  70. package/lib/log/index.js +4 -0
  71. package/lib/ql/SELECT.js +7 -2
  72. package/lib/ql/Whereable.js +8 -2
  73. package/lib/ql/index.js +2 -2
  74. package/lib/req/assert.js +71 -0
  75. package/lib/req/cds-context.js +38 -70
  76. package/lib/req/context.js +34 -21
  77. package/lib/req/request.js +12 -18
  78. package/lib/req/response.js +6 -2
  79. package/lib/req/user.js +30 -22
  80. package/lib/serve/Service-api.js +17 -12
  81. package/lib/serve/Service-dispatch.js +5 -9
  82. package/lib/serve/Service-methods.js +4 -3
  83. package/lib/serve/Transaction.js +24 -21
  84. package/lib/serve/adapters.js +15 -5
  85. package/lib/serve/factory.js +22 -20
  86. package/lib/serve/index.js +51 -54
  87. package/lib/utils/axios.js +8 -12
  88. package/lib/utils/index.js +13 -4
  89. package/lib/utils/resources/index.js +1 -44
  90. package/lib/utils/resources/tar.js +2 -1
  91. package/lib/utils/tests.js +13 -15
  92. package/libx/_runtime/.eslintrc +1 -1
  93. package/libx/_runtime/audit/Service.js +6 -4
  94. package/libx/_runtime/audit/generic/personal/access.js +19 -43
  95. package/libx/_runtime/audit/generic/personal/index.js +40 -34
  96. package/libx/_runtime/audit/generic/personal/modification.js +11 -9
  97. package/libx/_runtime/audit/generic/personal/utils.js +13 -6
  98. package/libx/_runtime/audit/utils/v2.js +6 -3
  99. package/libx/_runtime/auth/index.js +71 -66
  100. package/libx/_runtime/auth/strategies/JWT.js +3 -2
  101. package/libx/_runtime/auth/strategies/mock.js +54 -53
  102. package/libx/_runtime/auth/strategies/xssecUtils.js +3 -4
  103. package/libx/_runtime/auth/strategies/xsuaa.js +3 -2
  104. package/libx/_runtime/auth/utils.js +2 -15
  105. package/libx/_runtime/cds-services/adapter/odata-v4/Dispatcher.js +127 -41
  106. package/libx/_runtime/cds-services/adapter/odata-v4/OData.js +9 -5
  107. package/libx/_runtime/cds-services/adapter/odata-v4/ODataRequest.js +93 -73
  108. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/action.js +25 -45
  109. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/create.js +10 -14
  110. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/error.js +9 -5
  111. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/metadata.js +4 -2
  112. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/read.js +60 -53
  113. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/request.js +2 -2
  114. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/update.js +21 -26
  115. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/ExpressionToCQN.js +8 -15
  116. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/expandToCQN.js +29 -41
  117. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/index.js +1 -4
  118. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/readToCQN.js +13 -13
  119. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/selectToCQN.js +0 -7
  120. package/libx/_runtime/cds-services/adapter/odata-v4/odata-to-cqn/utils.js +24 -1
  121. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/edm/EdmEntityContainer.js +1 -1
  122. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/uri/UriHelper.js +4 -3
  123. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/utils/PrimitiveValueDecoder.js +4 -5
  124. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/utils/ValueConverter.js +4 -3
  125. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-commons/validator/ValueValidator.js +5 -3
  126. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/core/ResponseHeaderSetter.js +2 -0
  127. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/DebugSerializingCommand.js +1 -1
  128. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/PresetResponseHeadersCommand.js +1 -1
  129. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/SerializingCommand.js +1 -1
  130. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/invocation/SetResponseHeadersCommand.js +1 -1
  131. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ContextURLFactory.js +3 -2
  132. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/ErrorJsonSerializer.js +3 -1
  133. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/SerializerFactory.js +1 -0
  134. package/libx/_runtime/cds-services/adapter/odata-v4/okra/odata-server/serializer/TrustedResourceJsonSerializer.js +3 -3
  135. package/libx/_runtime/cds-services/adapter/odata-v4/utils/data.js +36 -25
  136. package/libx/_runtime/cds-services/adapter/odata-v4/utils/handlerUtils.js +97 -92
  137. package/libx/_runtime/cds-services/adapter/odata-v4/utils/metaInfo.js +382 -0
  138. package/libx/_runtime/cds-services/adapter/odata-v4/utils/oDataConfiguration.js +1 -4
  139. package/libx/_runtime/cds-services/adapter/odata-v4/utils/omitValues.js +5 -6
  140. package/libx/_runtime/cds-services/adapter/odata-v4/utils/readAfterWrite.js +82 -21
  141. package/libx/_runtime/cds-services/adapter/odata-v4/utils/request.js +3 -11
  142. package/libx/_runtime/cds-services/adapter/odata-v4/utils/result.js +91 -69
  143. package/libx/_runtime/cds-services/adapter/odata-v4/utils/stream.js +27 -6
  144. package/libx/_runtime/cds-services/adapter/rest/utils/validation-checks.js +7 -17
  145. package/libx/_runtime/cds-services/services/Service.js +17 -76
  146. package/libx/_runtime/cds-services/services/utils/columns.js +6 -4
  147. package/libx/_runtime/cds-services/services/utils/compareJson.js +1 -53
  148. package/libx/_runtime/cds-services/services/utils/differ.js +15 -19
  149. package/libx/_runtime/cds-services/util/assert.js +107 -34
  150. package/libx/_runtime/cds.js +1 -31
  151. package/libx/_runtime/common/aspects/Association.js +40 -54
  152. package/libx/_runtime/common/aspects/any.js +61 -6
  153. package/libx/_runtime/common/aspects/entity.js +19 -79
  154. package/libx/_runtime/common/composition/data.js +2 -2
  155. package/libx/_runtime/common/composition/delete.js +8 -7
  156. package/libx/_runtime/common/composition/tree.js +10 -10
  157. package/libx/_runtime/common/composition/update.js +3 -2
  158. package/libx/_runtime/common/constants/events.js +13 -0
  159. package/libx/_runtime/common/error/entry.js +9 -3
  160. package/libx/_runtime/common/error/frontend.js +13 -19
  161. package/libx/_runtime/common/error/index.js +8 -3
  162. package/libx/_runtime/common/generic/auth/capabilities.js +2 -1
  163. package/libx/_runtime/common/generic/auth/constants.js +1 -4
  164. package/libx/_runtime/common/generic/auth/requires.js +1 -1
  165. package/libx/_runtime/common/generic/auth/restrict.js +12 -28
  166. package/libx/_runtime/common/generic/auth/restrictions.js +12 -4
  167. package/libx/_runtime/common/generic/auth/utils.js +2 -1
  168. package/libx/_runtime/common/generic/crud.js +9 -60
  169. package/libx/_runtime/common/generic/etag.js +41 -7
  170. package/libx/_runtime/common/generic/input.js +128 -66
  171. package/libx/_runtime/common/generic/paging.js +9 -3
  172. package/libx/_runtime/common/generic/put.js +2 -2
  173. package/libx/_runtime/common/generic/sorting.js +7 -3
  174. package/libx/_runtime/common/generic/temporal.js +0 -5
  175. package/libx/_runtime/common/i18n/messages.properties +2 -1
  176. package/libx/_runtime/common/utils/binary.js +69 -0
  177. package/libx/_runtime/common/utils/cqn.js +39 -14
  178. package/libx/_runtime/common/utils/cqn2cqn4sql.js +93 -59
  179. package/libx/_runtime/common/utils/csn.js +87 -85
  180. package/libx/_runtime/common/utils/dollar.js +8 -7
  181. package/libx/_runtime/common/utils/draft.js +1 -1
  182. package/libx/_runtime/common/utils/foreignKeyPropagations.js +23 -7
  183. package/libx/_runtime/common/utils/generateOnCond.js +2 -1
  184. package/libx/_runtime/common/utils/keys.js +30 -13
  185. package/libx/_runtime/common/utils/postProcessing.js +6 -1
  186. package/libx/_runtime/common/utils/quotingStyles.js +0 -23
  187. package/libx/_runtime/common/utils/resolveStructured.js +23 -26
  188. package/libx/_runtime/common/utils/resolveView.js +4 -1
  189. package/libx/_runtime/common/utils/rewriteAsterisks.js +3 -0
  190. package/libx/_runtime/common/utils/search2cqn4sql.js +4 -13
  191. package/libx/_runtime/common/utils/searchToLike.js +9 -13
  192. package/libx/_runtime/common/utils/streamProp.js +35 -0
  193. package/libx/_runtime/common/utils/structured.js +12 -18
  194. package/libx/_runtime/common/utils/template.js +3 -5
  195. package/libx/_runtime/common/utils/templateProcessor.js +22 -14
  196. package/libx/_runtime/common/utils/unionCqnTemplate.js +4 -14
  197. package/libx/_runtime/db/Service.js +2 -1
  198. package/libx/_runtime/db/expand/expand-v2.js +2 -2
  199. package/libx/_runtime/db/expand/expandCQNToJoin.js +7 -6
  200. package/libx/_runtime/db/generic/input.js +14 -17
  201. package/libx/_runtime/db/generic/integrity.js +1 -2
  202. package/libx/_runtime/db/generic/update.js +14 -1
  203. package/libx/_runtime/db/query/read.js +0 -1
  204. package/libx/_runtime/db/query/update.js +1 -1
  205. package/libx/_runtime/db/sql-builder/BaseBuilder.js +1 -1
  206. package/libx/_runtime/db/sql-builder/ExpressionBuilder.js +5 -31
  207. package/libx/_runtime/db/sql-builder/InsertBuilder.js +1 -1
  208. package/libx/_runtime/db/sql-builder/ReferenceBuilder.js +0 -9
  209. package/libx/_runtime/db/sql-builder/SelectBuilder.js +11 -10
  210. package/libx/_runtime/db/sql-builder/UpdateBuilder.js +2 -2
  211. package/libx/_runtime/db/sql-builder/annotations.js +1 -2
  212. package/libx/_runtime/db/utils/coloredTxCommands.js +5 -0
  213. package/libx/_runtime/db/utils/columns.js +1 -1
  214. package/libx/_runtime/db/utils/propagateForeignKeys.js +10 -2
  215. package/libx/_runtime/extensibility/activate.js +69 -0
  216. package/libx/_runtime/extensibility/add.js +41 -0
  217. package/libx/_runtime/extensibility/addExtension.js +68 -0
  218. package/libx/_runtime/extensibility/defaults.js +39 -0
  219. package/libx/_runtime/extensibility/{uiflex/handler → handler}/transformREAD.js +0 -0
  220. package/libx/_runtime/extensibility/{uiflex/handler → handler}/transformRESULT.js +2 -2
  221. package/libx/_runtime/extensibility/{uiflex/handler → handler}/transformWRITE.js +2 -2
  222. package/libx/_runtime/extensibility/push.js +61 -0
  223. package/libx/_runtime/extensibility/service.js +21 -0
  224. package/libx/_runtime/extensibility/{uiflex/utils.js → utils.js} +39 -3
  225. package/libx/_runtime/extensibility/validation.js +53 -0
  226. package/libx/_runtime/extensibility/views.js +12 -0
  227. package/libx/_runtime/fiori/generic/activate.js +2 -4
  228. package/libx/_runtime/fiori/generic/before.js +17 -29
  229. package/libx/_runtime/fiori/generic/cancel.js +2 -4
  230. package/libx/_runtime/fiori/generic/delete.js +2 -4
  231. package/libx/_runtime/fiori/generic/edit.js +4 -16
  232. package/libx/_runtime/fiori/generic/index.js +31 -0
  233. package/libx/_runtime/fiori/generic/new.js +5 -21
  234. package/libx/_runtime/fiori/generic/patch.js +10 -15
  235. package/libx/_runtime/fiori/generic/prepare.js +13 -22
  236. package/libx/_runtime/fiori/generic/read.js +148 -163
  237. package/libx/_runtime/fiori/generic/readOverDraft.js +10 -4
  238. package/libx/_runtime/fiori/utils/handler.js +10 -22
  239. package/libx/_runtime/fiori/utils/where.js +1 -4
  240. package/libx/_runtime/hana/Service.js +14 -7
  241. package/libx/_runtime/hana/customBuilder/CustomSelectBuilder.js +1 -1
  242. package/libx/_runtime/hana/dynatrace.js +2 -2
  243. package/libx/_runtime/hana/localized.js +7 -6
  244. package/libx/_runtime/hana/pool.js +9 -6
  245. package/libx/_runtime/hana/search.js +2 -3
  246. package/libx/_runtime/hana/{searchToContains.js → search2Contains.js} +5 -2
  247. package/libx/_runtime/hana/search2cqn4sql.js +20 -17
  248. package/libx/_runtime/index.js +2 -6
  249. package/libx/_runtime/messaging/AMQPWebhookMessaging.js +30 -22
  250. package/libx/_runtime/messaging/common-utils/AMQPClient.js +4 -3
  251. package/libx/_runtime/messaging/common-utils/appId.js +9 -0
  252. package/libx/_runtime/messaging/common-utils/authorizedRequest.js +2 -18
  253. package/libx/_runtime/messaging/common-utils/connections.js +1 -1
  254. package/libx/_runtime/messaging/enterprise-messaging-shared.js +2 -2
  255. package/libx/_runtime/messaging/enterprise-messaging-utils/EMManagement.js +305 -231
  256. package/libx/_runtime/messaging/enterprise-messaging-utils/cloudEvents.js +2 -2
  257. package/libx/_runtime/messaging/enterprise-messaging-utils/options-management.js +15 -8
  258. package/libx/_runtime/messaging/enterprise-messaging-utils/options-messaging.js +57 -14
  259. package/libx/_runtime/messaging/enterprise-messaging.js +14 -19
  260. package/libx/_runtime/messaging/file-based.js +3 -1
  261. package/libx/_runtime/messaging/http-utils/token.js +18 -6
  262. package/libx/_runtime/messaging/message-queuing-utils/options-management.js +22 -12
  263. package/libx/_runtime/messaging/message-queuing-utils/options-messaging.js +27 -14
  264. package/libx/_runtime/messaging/message-queuing.js +138 -85
  265. package/libx/_runtime/messaging/outbox/utils.js +13 -7
  266. package/libx/_runtime/messaging/redis-messaging.js +0 -1
  267. package/libx/_runtime/messaging/service.js +4 -1
  268. package/libx/_runtime/remote/Service.js +24 -18
  269. package/libx/_runtime/remote/utils/client.js +90 -48
  270. package/libx/_runtime/remote/utils/data.js +23 -6
  271. package/libx/_runtime/sqlite/Service.js +14 -13
  272. package/libx/_runtime/sqlite/convertAssocToOneManaged.js +2 -0
  273. package/libx/_runtime/sqlite/customBuilder/CustomSelectBuilder.js +1 -0
  274. package/libx/_runtime/sqlite/execute.js +3 -9
  275. package/libx/_runtime/types/api.js +23 -11
  276. package/libx/common/utils/ucsn.js +15 -9
  277. package/libx/odata/afterburner.js +109 -29
  278. package/libx/odata/cqn2odata.js +48 -9
  279. package/libx/odata/grammar.pegjs +263 -156
  280. package/libx/odata/index.js +21 -9
  281. package/libx/odata/parseToCqn.js +8 -5
  282. package/libx/odata/parser.js +1 -1
  283. package/libx/odata/utils.js +13 -3
  284. package/libx/rest/RestAdapter.js +173 -113
  285. package/libx/rest/RestRequest.js +3 -2
  286. package/libx/rest/middleware/create.js +8 -6
  287. package/libx/rest/middleware/delete.js +6 -13
  288. package/libx/rest/middleware/error.js +1 -1
  289. package/libx/rest/middleware/input.js +6 -6
  290. package/libx/rest/middleware/operation.js +8 -3
  291. package/libx/rest/middleware/parse.js +3 -3
  292. package/libx/rest/middleware/payload.js +12 -0
  293. package/libx/rest/middleware/read.js +12 -2
  294. package/libx/rest/middleware/update.js +3 -3
  295. package/package.json +4 -6
  296. package/server.js +3 -44
  297. package/srv/extensibility-service.cds +56 -0
  298. package/srv/extensibility-service.js +1 -0
  299. package/srv/extensions.cds +8 -0
  300. package/srv/model-provider.cds +59 -0
  301. package/srv/model-provider.js +163 -0
  302. package/srv/mtx.cds +2 -0
  303. package/srv/mtx.js +22 -0
  304. package/srv/outbox.cds +2 -0
  305. package/tasks/enterprise-messaging-deploy.js +19 -12
  306. package/lib/serve/Service-compat.js +0 -36
  307. package/libx/_runtime/audit/generic/personal/constants.js +0 -4
  308. package/libx/_runtime/auth/strategies/dwc.js +0 -45
  309. package/libx/_runtime/cds-services/adapter/odata-v4/utils/dispatcherUtils.js +0 -56
  310. package/libx/_runtime/cds-services/adapter/rest/Rest.js +0 -183
  311. package/libx/_runtime/cds-services/adapter/rest/RestRequest.js +0 -67
  312. package/libx/_runtime/cds-services/adapter/rest/handlers/create.js +0 -82
  313. package/libx/_runtime/cds-services/adapter/rest/handlers/delete.js +0 -39
  314. package/libx/_runtime/cds-services/adapter/rest/handlers/operation.js +0 -63
  315. package/libx/_runtime/cds-services/adapter/rest/handlers/read.js +0 -52
  316. package/libx/_runtime/cds-services/adapter/rest/handlers/update.js +0 -81
  317. package/libx/_runtime/cds-services/adapter/rest/rest-to-cqn/index.js +0 -56
  318. package/libx/_runtime/cds-services/adapter/rest/rest-to-cqn/utils.js +0 -33
  319. package/libx/_runtime/cds-services/adapter/rest/to.js +0 -8
  320. package/libx/_runtime/cds-services/adapter/rest/utils/binary.js +0 -50
  321. package/libx/_runtime/cds-services/adapter/rest/utils/data.js +0 -117
  322. package/libx/_runtime/cds-services/adapter/rest/utils/header-checks.js +0 -14
  323. package/libx/_runtime/cds-services/adapter/rest/utils/key-value-utils.js +0 -30
  324. package/libx/_runtime/cds-services/adapter/rest/utils/parse-url.js +0 -250
  325. package/libx/_runtime/cds-services/adapter/rest/utils/result.js +0 -26
  326. package/libx/_runtime/cds-services/services/utils/handlerUtils.js +0 -200
  327. package/libx/_runtime/common/aspects/utils.js +0 -152
  328. package/libx/_runtime/common/toggles/handler.js +0 -21
  329. package/libx/_runtime/common/utils/extensibilityUtils.js +0 -18
  330. package/libx/_runtime/extensibility/mps/index.js +0 -5
  331. package/libx/_runtime/extensibility/mps/service.js +0 -111
  332. package/libx/_runtime/extensibility/mps/tar.js +0 -42
  333. package/libx/_runtime/extensibility/mps/utils.js +0 -11
  334. package/libx/_runtime/extensibility/uiflex/index.js +0 -54
  335. package/libx/_runtime/extensibility/uiflex/service.js +0 -276
  336. package/libx/_runtime/messaging/common-utils/naming-conventions.js +0 -20
  337. package/libx/_runtime/remote/utils/client-types.d.ts +0 -7
  338. package/libx/gql/GraphQLAdapter.js +0 -33
  339. package/libx/gql/constants/adapter.js +0 -69
  340. package/libx/gql/constants/cds.js +0 -18
  341. package/libx/gql/constants/graphql.js +0 -33
  342. package/libx/gql/readme.md +0 -1
  343. package/libx/gql/resolvers/crud/create.js +0 -20
  344. package/libx/gql/resolvers/crud/delete.js +0 -29
  345. package/libx/gql/resolvers/crud/index.js +0 -6
  346. package/libx/gql/resolvers/crud/read.js +0 -30
  347. package/libx/gql/resolvers/crud/update.js +0 -42
  348. package/libx/gql/resolvers/crud/utils/index.js +0 -36
  349. package/libx/gql/resolvers/field.js +0 -5
  350. package/libx/gql/resolvers/index.js +0 -7
  351. package/libx/gql/resolvers/mutation.js +0 -23
  352. package/libx/gql/resolvers/parse/ast/enrich.js +0 -52
  353. package/libx/gql/resolvers/parse/ast/fragment.js +0 -11
  354. package/libx/gql/resolvers/parse/ast/fromObject.js +0 -39
  355. package/libx/gql/resolvers/parse/ast/index.js +0 -3
  356. package/libx/gql/resolvers/parse/ast/meta.js +0 -4
  357. package/libx/gql/resolvers/parse/ast/variable.js +0 -7
  358. package/libx/gql/resolvers/parse/ast2cqn/columns.js +0 -44
  359. package/libx/gql/resolvers/parse/ast2cqn/entries.js +0 -31
  360. package/libx/gql/resolvers/parse/ast2cqn/index.js +0 -8
  361. package/libx/gql/resolvers/parse/ast2cqn/limit.js +0 -6
  362. package/libx/gql/resolvers/parse/ast2cqn/orderBy.js +0 -24
  363. package/libx/gql/resolvers/parse/ast2cqn/utils/index.js +0 -3
  364. package/libx/gql/resolvers/parse/ast2cqn/where.js +0 -70
  365. package/libx/gql/resolvers/parse/utils/index.js +0 -8
  366. package/libx/gql/resolvers/query.js +0 -13
  367. package/libx/gql/resolvers/root.js +0 -34
  368. package/libx/gql/schema/generate.js +0 -18
  369. package/libx/gql/schema/index.js +0 -5
  370. package/libx/gql/schema/mutation.js +0 -76
  371. package/libx/gql/schema/query.js +0 -108
  372. package/libx/gql/schema/typeDefMap.js +0 -45
  373. package/libx/gql/schema/utils/index.js +0 -54
  374. package/libx/gql/utils/index.js +0 -12
  375. package/libx/rest/middleware/auth.js +0 -20
  376. package/libx/rest/middleware/content.js +0 -19
  377. package/srv/flex.cds +0 -21
  378. package/srv/flex.js +0 -1
  379. package/srv/mps.cds +0 -23
  380. package/srv/mps.js +0 -1
  381. package/srv/outbox.js +0 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,259 @@
4
4
  - The format is based on [Keep a Changelog](http://keepachangelog.com/).
5
5
  - This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## Version 6.0.3 - 2022-07-14
8
+
9
+ ### Changed
10
+
11
+ - On Business Application Studio, `@sap/cds` now rejects starting on Node 12, as it does locally. This avoids cryptic follow-up errors.
12
+
13
+ ### Fixed
14
+
15
+ - Generic handlers for draft-related operations will trigger a READ event afterwards
16
+ - `file-based-messaging` only watches the file when at least one handler is registered
17
+ - `--vap-file` parameter of `cds deploy` is available again
18
+ - `cds build` no longer throws an error if `@sap/cds-mtx` library (classic MTX) isn't installed locally.
19
+ - `cds.spawn` no longer tries to reuse a transaction
20
+ - Custom query parameter caused bad request on certain characters in rest adapter
21
+ - `cds-ts` no longer fails with an `ERR_UNKNOWN_FILE_EXTENSION` error
22
+ - Timeouts when sending string payloads to remote services
23
+ - `cds.context.http` for `$batch` using atomicity groups
24
+
25
+ ## Version 6.0.2 - 2022-07-06
26
+
27
+ ### Fixed
28
+
29
+ - Jest tests do not fail any longer because of logs during app shutdown
30
+ - `cds build` now uses correct `mtx/sidecar` context. This avoids redundant `cds-mtxs` npm dependency for Java projects.
31
+
32
+ ## Version 6.0.1 - 2022-07-05
33
+
34
+ ### Added
35
+ - Config option `cds.env.server.port` allows to configure the port to use (in addition to `process.env.PORT` and CLI option `--port`)
36
+
37
+ ### Fixed
38
+
39
+ - Removed debug log about shutdown from `cds serve`
40
+ - Hiding timeout error in production mode
41
+
42
+ ### Changed
43
+
44
+ - Plugins cannot be loaded as ES modules, but need to remain CommonJS modules
45
+
46
+ ## Version 6.0.0 - 2022-06-30
47
+
48
+ ### Added
49
+
50
+ - Listeners for `commit` events on the request object are now awaited
51
+ - Experimental support for ECMAScript modules (ESM): You can now write your custom code, i.e.,
52
+ service implementations, `server.js`, `db/init.js` using ES6 `import` statements.
53
+ **Note though** that this is _experimental_ for now. Known limitation: _jest_ doesn't
54
+ support dynamic imports, which are required for that.
55
+
56
+ - Improved `cds.error` to allow these using variants:
57
+ ```js
58
+ cds.error `Message with formatted: ${{foo:'bar'}}`
59
+ cds.error ({ message, code, ... })
60
+ cds.error (message, { code, ... })
61
+ let e = new cds.error(...) //> will not throw
62
+ ```
63
+ > Calling `cds.error()` with `new` returns the newly created Error,
64
+ > while calling it without `new` it throws immediately. The latter is
65
+ > useful for usages like that:
66
+
67
+ - Improved `req.error` to always turn each recorded error in to an instance of `Error` with own stack trace.
68
+ Multiple errors are finally thrown as an array of these errors with `.message = 'MULTIPLE_ERRORS'`
69
+ and `.details = this` (the latter is for compatibility to former releases).
70
+
71
+ - Public API for `cds.User.roles`: For example, this allows to construct new instances of `cds.User` like so:
72
+ ```js
73
+ let user = new cds.User ({ id:'me', roles:['admin'] })
74
+ user.is('admin') //> true
75
+ ```
76
+
77
+ - Public API for `cds.context.tx`: This provides access to the current global root `tx`, if any.
78
+ (This replaces the former undocumented `req._tx`)
79
+
80
+ - Public API `cds.User.anonymous` and `cds.User.privileged` which are sealed instances you can use directly
81
+ instead of always passing `new cds.UserPrivileged`.
82
+
83
+ - Public API `cds.context.http` to reliably access inbound http `req` and `res` objects.
84
+
85
+ - Persistent outbox now contains last error and timestamp of last attempt
86
+ - Enable PUT requests for UPDATE queries with CQN for remote services
87
+ - Support for new major version 2 of SAP Cloud SDK
88
+ - Support for the `@assert.target` annotation for managed-to-one associations
89
+ - Support for `FOR SHARE LOCK` on SAP HANA to acquire shared locks on the queried records so that the locked records
90
+ stay intact until the transaction is committed or rolled back.
91
+ - Consistent error information for remote batch requests
92
+ - `cds.env` now supports expanding scalar `cds.requires` entries from `cds.requires.kinds`as follows:
93
+ ```jsonc
94
+ { "cds": {
95
+ "requires": {
96
+ "mtx-sidecar": true,
97
+ "db": "sql",
98
+ "kinds": {
99
+ "sql": {/* detailed config for sql */},
100
+ "mtx-sidecar": {/* detailed config */},
101
+ }
102
+ }
103
+ }}
104
+ ```
105
+ - Support for mTLS in `enterprise-messaging-shared` and `message-queuing`
106
+ - Allow empty publish and subscribe prefixes for SAP Event Mesh when using the format `cloudevents`
107
+ - Custom type `sap.common.Locale` in common.cds
108
+ - Ordering by aggregated value for draft-enabled active entity
109
+ - `cds build` support for model provider service-based resource deployment.
110
+ - Remote service:
111
+ - Conversion of OData V2 (`"kind": "odata-v2"`) function and action results to OData V4 format
112
+ - Conversion of binary data in CQN queries to `base64url` in URL and payload
113
+ - Key predicate is omitted for single-key entities in resulting URL (e.g. `GET /Foo(1)` instead of `GET /Foo(ID=1)`)
114
+ - Support of views with parameters
115
+ - Add `@odata.mediaContentType` if selecting stream property
116
+ - Kubernetes service bindings: Support for servicebinding.io and SAP BTP Service Operator based bindings
117
+ - `cds build` copies an existing `.npmrc` file located in the root or srv folder of your project into the deployment folder (usually `gen/srv`). This allows for dedicated npm configuration in cloud environments. Can be switched off by cds build option `contentNpmrc`.
118
+ - `cds build` copies an existing `.cdsrc.json` file located in the root or srv folder of your project into the deployment folder (usually `gen/srv`). The effective CDS configuration is created from the `.cdsrc.json` and CDS configuration defined in the `package.json` file. Can be switched off by cds build option `contentCdsrcJson`.
119
+ - Beta OData URL to CQN parser (`cds.env.features.odata_new_parser = true`):
120
+ - `@odata.context` is derived without using okra, not yet supported:
121
+ - `$expand=*` query option
122
+ - Support for actions and functions
123
+ - Further `$apply` transformations supported
124
+ - (nested) `concat` transformations
125
+ - `orderBy` transformation
126
+ - `top` & `skip` transformation
127
+ - `identity` transformation
128
+ - Log `BEGIN`/`COMMIT`/`ROLLBACK` commands when using SAP HANA as the underlying database
129
+ - Binary data in payload is validated to be RFC-4648 and OData ABNF conformed
130
+ - Support multiple media (streaming) properties in one entity
131
+ - Support for annotation `@protocol:'none'` to mark services as internal
132
+ - New build task aliases `java` and `nodejs` deprecating `java-cf`and `node-cf`, which are still supported for compatibility reasons.
133
+ - New shutdown event sent by `cds serve` (beta)
134
+ - $filter in $expand for remote services
135
+ - Mapping of aliases in $expand for remote services
136
+
137
+
138
+ ### Changed
139
+
140
+ - `@sap/cds` can now be loaded from different install locations like any other module, i.e. `@require('@sap/cds')` will no longer return the same singleton instance.
141
+ - SAP Cloud SDK is now only an optional dependency and must be installed manually
142
+ - Improved `cds.context` implementation to use `AsyncLocalStorage` instead of plain `async_hooks` (-> [see Node.js docs](https://nodejs.org/api/async_context.html)); APIs stay the same.
143
+ - Improved `cds.tx(tx=>{ ... })`: The new `tx` will be set as `cds.context.tx` for the function body's continuation,
144
+ so all nested service or database operations will be executed within this transaction automatically.
145
+ - Node.js 14.15 is now the minimum required Node.js version. Version 12 is no longer supported.
146
+ - Node.js 14.15 is now enforced on loading of `@sap/cds`, for example, on server startup.
147
+ - Improve error messages in messaging management
148
+ - `cds.env.requires` formerly inherited from `cds.env.requires.kinds`. This is not the case anymore; hence things like this worked before but don't anymore:
149
+ ```js
150
+ let sql = cds.requires.sql //> is undefined now
151
+ let sql = cds.requires.kinds.sql //> use this instead
152
+ ```
153
+ Alternatively you can add this to your cds config:
154
+ ```json
155
+ { "cds": { "requires": { "sql": true } }}
156
+ ```
157
+ - Details of errors from remote services are now in property `reason` (before it was `innererror`)
158
+ - `innererror` is not removed from OData error response
159
+ - The `file` option of file-based messaging is now on top level (before it was in `credentials`)
160
+ - Optimized Search: `cds.env.features.optimized_search=true` is now the default behavior.
161
+ - `cds build` no longer generates CF manifest files for Nodejs and HANA db deployer modules.
162
+ - `cds build` no longer supports WebIDE Fullstack compatibility mode. Consequently HANA artifacts and service EDMX files for Fiori modules might no longer be correctly generated.
163
+ - Remote services: Batched `GET` requests will not fetch CSRF tokens
164
+ - CQN now uses `xpr` correctly instead of brackets in `where`
165
+ - `process.exit` is called again by `cds run/serve` and `watch`, to gain a reliable `exit` event for cleanup tasks. Before, this would be spoiled by apps that do not shut down the event loop properly.
166
+ - `cds build` no longer filters `./` file dependencies from package.json in the build output.
167
+ - Fiori preview no longer supports URL pattern with `service` and `entity` query parameters, e.g. `$fiori-preview?service=...&entity=...`. These URLs were created back in `@sap/cds` 3.x.
168
+ - `cds build` no longer copies the `node_modules` folder into the deployment folder (usually `gen/db/**` and `gen/srv/**`).
169
+ - Set default tenant to `undefined` in single-tenant mode
170
+ - Handle foreign keys of to-one associations which should be set to `null` on db layer
171
+ - `cds build` uses the native `fs` functions instead of `fs-extra`.
172
+ - `cds build` supports initial data in CSV files that are located in any 'csv' or 'data' subfolder of some CDS model file. This also implies CSV files stored in reuse modules. Now, this behaviour is consistent with SQLite deployment. If the location of some CSV file has changed, a deployment error might be returned. In that case previously deployed `hdbtabledata` files have to be undeployed.
173
+ - `cds deploy` reads Cloud Foundry file `config.json` to get org and space information.
174
+ - New REST adapter replaced old (limited) implementation
175
+ - Default behaviour for runtime integrity checks. From now on no integrity checks will be done by default.
176
+ Note that this is a breaking change for appliations that rely on automatic integrity checks by runtime. We recommend to use `cds.env.features.assert_integrity`: `db` to switch on database integrity constraints. The value `app` can be used as fallback to previous behaviour.
177
+ - `cds build` no longer copies `.env` or `default-env.json` files into the deployment folder.
178
+ - OData `POST`, `PATCH` and `PUT` requests as well as draft-related `draftEdit` and `draftActivate` actions are now followed by an additional `READ` request to the application service. Consequently affected functionality:
179
+ + It is now sufficient to have a custom `READ` handler in order to adjust the response (e.g. to handle virtual properties) of the modification request.
180
+ + A user is now required to be authorized to read updated data e.g. a user having a role restricted with "INSERT-only" annotation pattern will get empty results in response to `POST` request.
181
+ + For compatibility reasons, `req._` of the modification request is uplinked to `req._` of the follow-up `READ` request so that one still can access original `req._.req/res` request objects of the modification request within the corresponding `READ` handlers.
182
+ + Modification logs are now followed by corresponding access logs.
183
+ + More details can be found in cds v6.0.0 release notes.
184
+ - Message for PreconditionFailedError is now configurable in messages.properties
185
+ - Remove circular references in Kibana logging
186
+ - Error sanitization in production is skipped for custom errors with HTTP code `5xx`. From now on, it's possible for an app developer to return any error message to the client.
187
+ Note that this is a breaking change for appliations that rely on error sanitization for custom errors in production. The behaviour of errors thrown by CAP framework is unchanged.
188
+
189
+ ### Fixed
190
+
191
+ - Improved shutdown for AMQP connections and file listeners
192
+ - Using `CQL` with a tagged template string `SELECT from Foo { null as boo }` throwed an exception.
193
+ - In case of `MULTIPLE_ERRORS` throw an `Error` instead of an object
194
+ - `cds build` ensures correct precedence of feature annotations. Fixes `Duplicate assignment` compilation errors.
195
+ - Compatibility with former support to find service `@impl: 'relative/to/cdw'`.
196
+ - Views on views with parameters where erroneously inherited params through `cds.linked()`.
197
+ - Authentication: Return HTTP `404 Not Found` rather than `204 No Content` status code for invalid requests.
198
+ For example, given the following request `/ReqAdmin(1)/toIntermediate/toa` and assuming that the `toIntermediate` instance does not exist,
199
+ the runtime returned an HTTP `204 No Content` success status response code indicating that the request has succeeded.
200
+ In such scenarios, now the HTTP `404 Not Found` status code is returned rather than `204 No Content`.
201
+ - Errors from HTTP requests sent via `cds.test.axios` now are the original Axios errors, i.e. including properties like `request` and `response`, with stack traces from caller.
202
+ - Errors constructed and thrown by `req.reject()` now have a stack starting at the code calling `req.reject()`.
203
+ - Auth annotations `@restrict` and `@requires` with empty array do not allow access anymore
204
+ - Delete on restricted singleton caused request to fail
205
+ - Add workaround of typescript not complete literal unions, specially when union strings.
206
+ - Accidental handling of non-proxy entities as they would have been proxies (`cds.env.odata.proxies`) in expands
207
+ - Boolean keys are properly parsed into JS boolean values
208
+ - Navigation path segments with aliased keys in structured mode (OData flavors `w4` and `x4`) when using beta OData URL to CQN parser (`cds.env.features.odata_new_parser`)
209
+ - All entities in `@sap/cds/common` have now proper CDS doc comments
210
+ - `cds build` uses `package.json` and `package-lock.json` files located in `srv` folder for deployment if existing. Before, `package.json` and `package-lock.json` files of the project root folder have always been taken.
211
+ - Pass options from `cds.parse.expr` to `cdsc.parse.expr`.
212
+ - Avoid error that is caused e.g. in a streaming scenario when there is an issue while processing the stream. Trying to change/send the response object could cause a crash because the response was sent already.
213
+ - Correct URL generation for `Integer64` and `Decimal` for remote services
214
+ - Operation parameters from structured type and annotated with @open are not filtered from the input query
215
+ - Services are secured by default in production. Can be disabled via feature flag `cds.env.auth.restrict_all_services: false` or by using `mocked-auth`.
216
+ - Optimized Search: Exception when searching on views using built-in SQL SAP HANA functions
217
+ - In some cases, custom error handlers were not called for rest
218
+ - `cds build` adds newline at EOF for `hdbmigrationtable` files
219
+ - Static values in on condition were ignored when inserting on navigation
220
+ - Removed entity key validation by POST request in rest
221
+ - `$count=false` returned count
222
+ - `odata_new_parser`: `format=json` allowed as query parameter, other formats not supported and returning 501, trailing `?` allowed e.g. `/Employees?`
223
+ - `odata_new_parser`: Piped use of same transformations is now supported, like `/Students?$apply=filter(BIRTHYEAR ge 2000)/groupby((UNIVERSITY),aggregate(SUBJECT with countdistinct as distinctSubjects))/filter(UNIVERSITY eq 'Hamburg')`
224
+ - `odata_new_parser`: Behavior of piped transformations while using `topcount` or `bottomcount` is now correct
225
+ - Better error message for missing `exists` predicate in `@restrict.where`
226
+ - Reading raw Binary data provided as a `base64` (standard or url-safe) string by means of a `$value` query option
227
+ - Selecting a navigation with `$select` ended up in database error
228
+ - `cds.compile` no longer fails for cds sources that contain the `file:` pattern
229
+ - $select=IsActiveEntity did not work on draft enabled entity, when requesting active data via navigation
230
+ - not equal operator `<>` treated the same way as `!=`
231
+ - `cds.localize` now respects custom i18n file names (which is not recommended though)
232
+ - `cds version` now handles array-valued entries for `folders.db`and `folders.srv` gracefully when looking for MTX sidecar
233
+ - OData access of entities named `get` and `set`
234
+ - missing brackets for OR condition in `.where()` when requesting by navigation
235
+ - `cds build` now correctly supports nodejs apps that do not have a service module defined. In these cases the build task's _src_ folder has to be configured as "."
236
+ - `cds build <dir>` is now correctly executed if called by npm script or mta build.
237
+ - `cds deploy` now shows a better error message on INSERT errors (on SQLite).
238
+
239
+ ### Removed
240
+
241
+ - Deprecated option to send synchronous requests via `srv.emit()` -> use `srv.send()` for that
242
+ - Deprecated feature flag `cds.env.features.implicit_sorting`
243
+ - Deprecated feature flag `cds.env.features.update_managed_properties`
244
+ - Deprecated feature flag `cds.env.features.resolve_views`
245
+ - Deprecated feature flag `cds.env.features.spaced_columns`
246
+ - Deprecated feature flag `cds.env.features.throw_diff_error`
247
+ - Deprecated feature flag `cds.env.features.delay_assert_deep_assoc`
248
+ - Deprecated feature flag `cds.env.features.auto_fetch_expand_keys`
249
+ - Deprecation warning for query parameters `sap-valid-from` and `sap-valid-to`
250
+ - Built-in graphql support &rarr; moved to new `@sap/cds-graphql`
251
+ - Deprecated feature flag `cds.env.features.extract_vals`
252
+ - Support for CQN `where in` syntax `{ val: [1, 2, 3] }` without `list`. Use `{ list: [{ val: 1 }, { val: 2 }, { val: 3 }] }` instead.
253
+ - Support for selects in restrict entries, e.g. `where : 'exists (select 1 from MyTable where a = b)'` is not allowed anymore
254
+ - Input validation for deep `INSERT`/`UPDATE` for associations in the service layer
255
+ - Support for `@odata.contained` annotation. Use Compositions instead.
256
+ - Support for `@odata.on.insert/update` annotation. Use `cds.on.insert/update` instead.
257
+ - Support for expressions in references, for example: `ref: ['foo as bar']`).
258
+ - Generic support of `$expand` and `$select` OData query options for custom actions and functions
259
+
7
260
  ## Version 5.9.8 - 2022-06-24
8
261
 
9
262
  ### Fixed
@@ -71,11 +324,10 @@
71
324
 
72
325
  - Since 5.8.2 `req.target` for requests like `srv.put('/MyService.entity')` is defined, but `req.query` undefined (before `req.target` was also undefined). This was leading to accessing undefined, which has been fixed.
73
326
  - Custom actions with names conflicting with methods from service base classes, e.g. `run()`, could lead to hard-to-detect errors. This is now detected and avoided with a warning.
74
- - Typed methods for custom actions were erroneously applied to `cds.db` service, which led to server crashes, e.g. when the action was named `deploy()`.
327
+ - Typed methods for custom actions were erroneously applied to `cds.db` service, which led to server crashes, for example, when the action was named `deploy()`.
75
328
  - Invalid batch requests were further processed after error response was already sent to client, leading to an InternalServerError
76
329
  - Full support of `SELECT` queries with operator expressions (`xpr`)
77
330
 
78
-
79
331
  ## Version 5.9.2 - 2022-04-07
80
332
 
81
333
  ### Fixed
@@ -94,11 +346,11 @@
94
346
 
95
347
  - Function arguments might be escaped too often
96
348
  - URL encoding for remote services for CQN queries
97
- - `cds serve` during development again redirects URLs with for UI apps in a folder with the same name as a service, so `/foo/webapp` would redirect to `/foo`. This got broken in 5.8.3.
349
+ - `cds serve` during development again redirects URLs for UI apps in a folder with the same name as a service, so `/foo/webapp` would redirect to `/foo` again. This got broken in 5.8.3.
98
350
  - Endless loop in localization handling
99
351
  - Ensure service impl while extending entity from the service
100
352
  - Post-processing of custom draft queries
101
- - No minifying of CSN artifacts for Java build
353
+ - `cds build` no longer omits unused CDS type definitions, leading to Java compiler errors
102
354
 
103
355
  ## Version 5.9.0 - 2022-03-25
104
356
 
@@ -116,13 +368,14 @@
116
368
  + `[{ grant: '...', to: ['...'], where: '...' }, ...]`: applicable restrictions with grant normalized to strings
117
369
  + That is, `grant: ['CREATE', 'UPDATE']` in model becomes `[{ grant: 'CREATE' }, { grant: 'UPDATE' }]`
118
370
  + Promise resolving to any of the above (needed for CAS override)
119
- - Internal model provider service can be used for obtaining dynamic csn including features and key user extensions
371
+ - Internal model provider service can be used for obtaining dynamic csn, including features and key user extensions
120
372
  - Support insert of SQL snippets for HANA migration tables using @sql.append and @sql.prepend annotations.
121
373
  - Support for the `@odata.draft.enclosed` annotation on associations targeted via navigation — previously only supported for `$expand`
122
374
  - Pseudo role `internal-user` for technical user tokens acquired from own XSUAA instance
123
375
  - Include globally-installed cds-dk version in output of `cds version`.
124
376
  - Include version of cds-mtx in output of `cds version`, if available.
125
377
  - Feature toggle support in `cds build` for cloud deployments. Create language bundles and parsed CSN for all features.
378
+ - Support for `@Aggregation.default` in new OData parser (`cds.env.features.odata_new_parser = true`)
126
379
 
127
380
  ### Changed
128
381
 
@@ -155,7 +408,7 @@
155
408
  - 'Preview' links in generic index.html page no longer get the word _preview_ appended automatically, allowing for more flexible naming. Link providers should make sure to add the _preview_ word if necessary.
156
409
  - Don't throw error in GraphQL adapter if update mutation filter does not match any entries (to be consistent with delete mutations)
157
410
  - Remote call of unbound action/function returns octet-stream instead of string by default
158
- - Default pool's behaviour has been changed from `FIFO` (queue) to `LIFO` (stack). Can be changed in pool configuration.
411
+ - Default pool's behavior has been changed from `FIFO` (queue) to `LIFO` (stack). Can be changed in pool configuration.
159
412
  - `cds run/serve` now gracefully shuts down the HTTP server before exiting. Custom handlers for signals like `SIGTERM` or `SIGINT` can now be processed.
160
413
  - `cds build` no longer creates `COMMENT` statements for HANA if doc comments are present in CDS models. The statements caused superfluous table migrations during HANA deployments.
161
414
 
@@ -190,7 +443,8 @@
190
443
  - `cds.compile` correctly supports reserved namespaces like `cds.foundation`.
191
444
  - `cds.compile.to.serviceinfo` now uses the correct configuration for the base URL paths for Java services
192
445
  - `cds deploy --to sqlite` correctly localizes texts in deployed views. Before not all localized texts have been correctly resolved.
193
- - `cds deploy --to hana` reports missing org or space info with better message.
446
+ - `cds deploy --to hana` reports missing org or space info with a better message.
447
+ - Using combinations of `.` and `_` in CSN definition names
194
448
 
195
449
  ### Removed
196
450
 
@@ -207,17 +461,18 @@
207
461
 
208
462
  ### Fixed
209
463
 
210
- - `queries` property for application defined destinations of remote services
464
+ - `queries` property for application-defined destinations of remote services
211
465
  - `cds serve --watch` no longer fails if `@sap/cds-dk` is installed only globally
212
466
  - `cds serve` during development longer redirects URLs with similar path segments from different services, like `/service/one` and `/service`
213
467
  - `cds deploy --to sqlite` now ignores a `_texts.csv` file again if there is a language-specific file like `_texts_en.csv` present
214
468
  - Using logical blocks (surrounded with `(` and `)`) in ON-conditions of unmanaged associations and compositions
215
- - Skip "with parameters" clause if no order by clause or all columns in the order by clause are not strings when using parametrized views on hana
469
+ - Skip "with parameters" clause if no order by clause or all columns in the order by clause are not strings when using parametrized views on SAP HANA
216
470
  - Limited support for binary data in OData
217
- + Using of `base64` string values in `WHERE IN` on hana
218
- + `base64url` values in `@odata.context` annotation
471
+ - Using of `base64` encoded string values in `WHERE IN` on SAP HANA
472
+ - `base64url` values in `@odata.context` annotation
219
473
  - `cds.context` is set in GraphQL adapter
220
- - Using payloads with `@odata.type` annotating primitive properties no longer crashes the application. `#` in type value may be ommitted. Example:
474
+ - Using payloads with `@odata.type` annotating primitive properties no longer crashes the application. `#` in type value may be omitted. Example:
475
+
221
476
  ```json
222
477
  {
223
478
  "ID": 201,
@@ -227,13 +482,14 @@
227
482
  "stock": 12
228
483
  }
229
484
  ```
485
+
230
486
  - Unicode support for i18n bundles
231
487
 
232
488
  ## Version 5.8.2 - 2022-02-22
233
489
 
234
490
  ### Fixed
235
491
 
236
- - Crash if error does not have a stack in kibana logging
492
+ - Crash if error does not have a stack in Kibana logging
237
493
  - Allow short names for bound operations in odata-server
238
494
  - Performance issue during deep operations
239
495
  - Resolving views with parameters
@@ -273,17 +529,18 @@
273
529
  - Draft (Access control for bound actions): Only the user that is the owner of the draft can execute its bound actions.
274
530
  - Check that all keys are provided in REST adapter
275
531
  - Restrict access to all services via `cds.env.requires.auth.restrict_all_services = true`
276
- + That is, all unrestricted services (i.e., w/o own `@requires`) are treated as having `@requires: 'authenticated-user'`
532
+ - That is, all unrestricted services (i.e., w/o own `@requires`) are treated as having `@requires: 'authenticated-user'`
277
533
  - Threshold for automatically sending GET requests as `$batch` (beta, cf. @sap/cds@5.6.0) can be configured per remote service via `cds.env.requires.<srv>.max_get_url_length` (if not configured on service, the global config applies)
278
534
  - Limited support for binary data in OData
279
- + In payloads, the binary data must be a base64 encoded string
280
- + In URLs, the binary data must have the following format: `binary'<url-safe base64 encoded>'`, e.g., `$filter=ID eq binary'Q0FQIE5vZGUuanM='`
281
- + The use of binary data in some advanced constructs like `$apply` and `/any()` may be limited
282
- + On SQLite, the base64 encoded string is stored in the database
283
- + It’s strongly discouraged to use binary data as keys. See "Primary Keys — Best Practices" in the documentation.
535
+ - In payloads, the binary data must be a base64 encoded string
536
+ - In URLs, the binary data must have the following format: `binary'<url-safe base64 encoded>'`, e.g., `$filter=ID eq binary'Q0FQIE5vZGUuanM='`
537
+ - The use of binary data in some advanced constructs like `$apply` and `/any()` may be limited
538
+ - On SQLite, the base64 encoded string is stored in the database
539
+ - It’s strongly discouraged to use binary data as keys. See "Primary Keys — Best Practices" in the documentation.
284
540
  - Support for OData annotation `@Core.ContentDisposition.Type` with `attachment` as the default value
285
541
  - Support for returning custom stream objects in custom handlers (beta):
286
- + Example:
542
+ - Example:
543
+
287
544
  ```js
288
545
  return {
289
546
  value: instanceof Readable || null,
@@ -317,7 +317,7 @@ interface EventContext {
317
317
  }
318
318
 
319
319
  type Events = Event | Event[]
320
- type Event = ( CRUD | TX | HTTP | DRAFT ) | CustomOp
320
+ type Event = ( CRUD | TX | HTTP | DRAFT ) | (CustomOp & {})
321
321
  type CRUD = 'CREATE' | 'READ' | 'UPDATE' | 'DELETE'
322
322
  type DRAFT = 'NEW' | 'EDIT' | 'PATCH' | 'SAVE'
323
323
  type HTTP = 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE'
@@ -233,7 +233,7 @@ cds.on('served', ()=>{
233
233
 
234
234
  // fetch and instrument all OData providers
235
235
  const any = providers.filter (srv =>
236
- srv._adapters [Object.keys(srv._adapters) .find (a => a.startsWith ('odata'))]
236
+ srv._adapters && srv._adapters [Object.keys(srv._adapters) .find (a => a.startsWith ('odata'))]
237
237
  )
238
238
  .map(srv => {
239
239
  // called from ../index.js to provide the data for the HTML link
@@ -251,11 +251,7 @@ cds.on('served', ()=>{
251
251
  router.get ('/:service/:entity/app/Component.js', ({ params }, resp) => resp.send(_componentJs(params.service, params.entity)))
252
252
  // html
253
253
  router.get ('/:service/:entity', ({ params }, resp) => resp.send(_html(params.service, params.entity)))
254
- // legacy URL pattern from cds 3.x
255
- router.get ('/', ({ query }, resp, next) => {
256
- if (query.service && query.entity) resp.redirect (308, _appURL(query.service, query.entity))
257
- else next()
258
- })
254
+
259
255
  app.use(mountPoint.replace('$','\\$'), router)
260
256
  }
261
257
 
package/app/index.js CHANGED
@@ -3,7 +3,7 @@ const { find, path, fs } = cds.utils
3
3
 
4
4
  module.exports = { get html(){
5
5
 
6
- const odata = srv => Object.keys(srv._adapters).find (a => a.startsWith ('odata'))
6
+ const odata = srv => srv._adapters && Object.keys(srv._adapters).find (a => a.startsWith ('odata'))
7
7
  const metadata = srv => odata(srv) ? ` / <a href="${srv.path}/$metadata">$metadata</a>` : ``
8
8
 
9
9
  let html = fs.readFileSync(path.join(__dirname,'index.html'),'utf-8')
@@ -14,7 +14,7 @@ module.exports = { get html(){
14
14
  html => `\n<li><a href="${html}">/${html.replace(/^[/]/,'')}</a></li>`
15
15
  ).join('\n') || '— none —'
16
16
  )
17
- .replace ('{{services}}', cds.service.providers.map (srv => `
17
+ .replace ('{{services}}', cds.service.providers.map (srv => srv._is_dark ? '' : `
18
18
  <h3>
19
19
  <a href="${srv.path}">${srv.path}</a>${metadata(srv)} ${_moreLinks(srv)}
20
20
  </h3>
@@ -73,7 +73,7 @@ function _moreLinks (srv, entity) {
73
73
  }
74
74
 
75
75
  function _project(){
76
- const cwd = global.cds.root
76
+ const cwd = cds.root
77
77
  try {
78
78
  const pj = require(cwd+'/package.json')
79
79
  return `${pj.name} ${pj.version}`
@@ -1,9 +1,9 @@
1
- const { fs } = require('@sap/cds-foss')
1
+ const fs = require('fs')
2
2
  const path = require('path')
3
3
  const _cds = require('./cds'), { log } = _cds.exec
4
4
  const BuildTaskProviderFactory = require('./buildTaskProviderFactory')
5
5
  const { sortMessagesSeverityAware, deduplicateMessages, CompilationError } = require('@sap/cds-compiler')
6
- const { allSettled, relativePaths, BuildError, BuildMessage } = require('./util')
6
+ const { relativePaths, BuildError, BuildMessage } = require('./util')
7
7
  const { OUTPUT_MODE_DEFAULT, SEVERITIES, LOG_LEVELS, LOG_MODULE_NAMES } = require('./constants')
8
8
  const BuildTaskHandlerInternal = require('./provider/buildTaskHandlerInternal')
9
9
 
@@ -43,7 +43,7 @@ class BuildTaskEngine {
43
43
  }
44
44
 
45
45
  this.logger.log(`building project [${buildOptions.root}], clean [${clean}]`)
46
- this.logger.log(`cds [${_cds.version}], compiler [${require('@sap/cds-compiler/package.json').version}], home [${_cds.home}]\n`)
46
+ this.logger.log(`cds [${_cds.version}], compiler [${_cds.compiler.version()}], home [${_cds.home}]\n`)
47
47
 
48
48
  if (!buildOptions.target) {
49
49
  buildOptions.target = path.resolve(buildOptions.root, this.env.build.target)
@@ -108,7 +108,7 @@ class BuildTaskEngine {
108
108
 
109
109
  /**
110
110
  * @deprecated
111
- * @param {*} handlerGroup
111
+ * @param {*} handlerGroup
112
112
  */
113
113
  async _doPrepare(handlerGroup, buildOptions) {
114
114
  for (let handler of handlerGroup) {
@@ -128,10 +128,10 @@ class BuildTaskEngine {
128
128
  // clean entire build staging folder once
129
129
  if (buildOptions.target !== buildOptions.root) {
130
130
  this.logger._debug && this.logger.debug(`cleaning staging folder ${buildOptions.target}`)
131
- await fs.remove(buildOptions.target)
131
+ await fs.promises.rm(buildOptions.target, {force: true, recursive: true})
132
132
  }
133
133
 
134
- const results = await allSettled(handlers.map((handler) => {
134
+ const results = await Promise.allSettled(handlers.map((handler) => {
135
135
  this.logger._debug && this.logger.debug(`cleaning, handler [${handler.constructor.name}], src [${relativePaths(buildOptions.root, handler.task.src)}]`)
136
136
  return handler.clean()
137
137
  }))
@@ -169,7 +169,7 @@ class BuildTaskEngine {
169
169
  async _executePipeline(buildOptions, pipeline) {
170
170
  let allResults = []
171
171
  for (const group of pipeline) {
172
- const results = await allSettled(group.map((handler) => {
172
+ const results = await Promise.allSettled(group.map((handler) => {
173
173
  this.logger._debug && this.logger.debug(`building, handler [${handler.constructor.name}], src [${relativePaths(buildOptions.root, handler.task.src)}]`)
174
174
  return handler.build()
175
175
  .then(handlerResult => {
@@ -188,10 +188,10 @@ class BuildTaskEngine {
188
188
  _resolveHandlerResponse(results, buildOptions, handlerMessages = []) {
189
189
  const errors = []
190
190
  const resolvedResults = results.reduce((acc, r) => {
191
- if (r.state === 'fulfilled') {
191
+ if (r.status === 'fulfilled') {
192
192
  acc.push(r.value)
193
193
  }
194
- if (r.state === 'rejected' && r.reason) {
194
+ if (r.status === 'rejected' && r.reason) {
195
195
  errors.push(r.reason)
196
196
  }
197
197
  return acc
@@ -262,12 +262,13 @@ class BuildTaskEngine {
262
262
  const outputFile = this.env.build.outputfile || process.env.GENERATION_LOG
263
263
  if (outputFile) {
264
264
  this.logger.log(`writing generation log to [${outputFile}]\n`)
265
- await fs.outputFile(outputFile, files.join('\n'))
266
- .catch((error) => {
267
- this.logger.error(`failed to write generation log`)
268
- this.logger.error(error.stack || error)
269
- return Promise.resolve()
270
- })
265
+ await fs.promises.mkdir(path.dirname(outputFile), {recursive: true}).then(() =>
266
+ fs.promises.writeFile(outputFile, files.join('\n'))
267
+ ).catch((error) => {
268
+ this.logger.error(`failed to write generation log`)
269
+ this.logger.error(error.stack || error)
270
+ return Promise.resolve()
271
+ })
271
272
  }
272
273
  }
273
274
  }
@@ -287,6 +288,7 @@ class BuildTaskEngine {
287
288
  log: this.logger.log,
288
289
  "log-level": this._getLogLevel(buildOptions) // ensures that for tests the correct cds.env is used
289
290
  }
291
+ deduplicateMessages(messages)
290
292
  log(messages, options)
291
293
  }
292
294
  }