@sap/cds 5.9.7 → 6.0.2

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 +267 -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 +90 -53
  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 +19 -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 +9 -10
  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 +56 -21
  37. package/bin/utils/log.js +13 -30
  38. package/bin/version.js +5 -4
  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 +11 -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 +23 -20
  86. package/lib/serve/index.js +51 -54
  87. package/lib/utils/axios.js +8 -12
  88. package/lib/utils/index.js +3 -3
  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 +128 -42
  106. package/libx/_runtime/cds-services/adapter/odata-v4/OData.js +6 -3
  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 +10 -45
  109. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/create.js +5 -9
  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 +1 -1
  114. package/libx/_runtime/cds-services/adapter/odata-v4/handlers/update.js +15 -21
  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 +100 -91
  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 +77 -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 +15 -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 +6 -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 +3 -7
  232. package/libx/_runtime/fiori/generic/index.js +31 -0
  233. package/libx/_runtime/fiori/generic/new.js +2 -4
  234. package/libx/_runtime/fiori/generic/patch.js +4 -8
  235. package/libx/_runtime/fiori/generic/prepare.js +2 -4
  236. package/libx/_runtime/fiori/generic/read.js +137 -162
  237. package/libx/_runtime/fiori/generic/readOverDraft.js +10 -4
  238. package/libx/_runtime/fiori/utils/handler.js +10 -5
  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 +11 -2
  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 +2 -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 +84 -46
  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 +261 -157
  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,249 @@
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.2 - 2022-07-06
8
+
9
+ ### Fixed
10
+
11
+ - Jest tests do not fail any longer because of logs during app shutdown
12
+ - `cds build` now uses correct `mtx/sidecar` context. This avoids redundant `cds-mtxs` npm dependency for Java projects.
13
+
14
+ ## Version 6.0.1 - 2022-07-05
15
+
16
+ ### Added
17
+ - Config option `cds.env.server.port` allows to configure the port to use (in addition to `process.env.PORT` and CLI option `--port`)
18
+
19
+ ### Fixed
20
+
21
+ - Removed debug log about shutdown from `cds serve`
22
+ - Hiding timeout error in production mode
23
+
24
+ ### Changed
25
+
26
+ - Plugins cannot be loaded as ES modules, but need to remain CommonJS modules
27
+
28
+ ## Version 6.0.0 - 2022-06-30
29
+
30
+ ### Added
31
+
32
+ - Listeners for `commit` events on the request object are now awaited
33
+ - Experimental support for ECMAScript modules (ESM): You can now write your custom code, i.e.,
34
+ service implementations, `server.js`, `db/init.js` using ES6 `import` statements.
35
+ **Note though** that this is _experimental_ for now. Known limitation: _jest_ doesn't
36
+ support dynamic imports, which are required for that.
37
+
38
+ - Improved `cds.error` to allow these using variants:
39
+ ```js
40
+ cds.error `Message with formatted: ${{foo:'bar'}}`
41
+ cds.error ({ message, code, ... })
42
+ cds.error (message, { code, ... })
43
+ let e = new cds.error(...) //> will not throw
44
+ ```
45
+ > Calling `cds.error()` with `new` returns the newly created Error,
46
+ > while calling it without `new` it throws immediately. The latter is
47
+ > useful for usages like that:
48
+
49
+ - Improved `req.error` to always turn each recorded error in to an instance of `Error` with own stack trace.
50
+ Multiple errors are finally thrown as an array of these errors with `.message = 'MULTIPLE_ERRORS'`
51
+ and `.details = this` (the latter is for compatibility to former releases).
52
+
53
+ - Public API for `cds.User.roles`: For example, this allows to construct new instances of `cds.User` like so:
54
+ ```js
55
+ let user = new cds.User ({ id:'me', roles:['admin'] })
56
+ user.is('admin') //> true
57
+ ```
58
+
59
+ - Public API for `cds.context.tx`: This provides access to the current global root `tx`, if any.
60
+ (This replaces the former undocumented `req._tx`)
61
+
62
+ - Public API `cds.User.anonymous` and `cds.User.privileged` which are sealed instances you can use directly
63
+ instead of always passing `new cds.UserPrivileged`.
64
+
65
+ - Public API `cds.context.http` to reliably access inbound http `req` and `res` objects.
66
+
67
+ - Persistent outbox now contains last error and timestamp of last attempt
68
+ - Enable PUT requests for UPDATE queries with CQN for remote services
69
+ - Support for new major version 2 of SAP Cloud SDK
70
+ - Support for the `@assert.target` annotation for managed-to-one associations
71
+ - Support for `FOR SHARE LOCK` on SAP HANA to acquire shared locks on the queried records so that the locked records
72
+ stay intact until the transaction is committed or rolled back.
73
+ - Consistent error information for remote batch requests
74
+ - `cds.env` now supports expanding scalar `cds.requires` entries from `cds.requires.kinds`as follows:
75
+ ```jsonc
76
+ { "cds": {
77
+ "requires": {
78
+ "mtx-sidecar": true,
79
+ "db": "sql",
80
+ "kinds": {
81
+ "sql": {/* detailed config for sql */},
82
+ "mtx-sidecar": {/* detailed config */},
83
+ }
84
+ }
85
+ }}
86
+ ```
87
+ - Support for mTLS in `enterprise-messaging-shared` and `message-queuing`
88
+ - Allow empty publish and subscribe prefixes for SAP Event Mesh when using the format `cloudevents`
89
+ - Custom type `sap.common.Locale` in common.cds
90
+ - Ordering by aggregated value for draft-enabled active entity
91
+ - `cds build` support for model provider service-based resource deployment.
92
+ - Remote service:
93
+ - Conversion of OData V2 (`"kind": "odata-v2"`) function and action results to OData V4 format
94
+ - Conversion of binary data in CQN queries to `base64url` in URL and payload
95
+ - Key predicate is omitted for single-key entities in resulting URL (e.g. `GET /Foo(1)` instead of `GET /Foo(ID=1)`)
96
+ - Support of views with parameters
97
+ - Add `@odata.mediaContentType` if selecting stream property
98
+ - Kubernetes service bindings: Support for servicebinding.io and SAP BTP Service Operator based bindings
99
+ - `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`.
100
+ - `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`.
101
+ - Beta OData URL to CQN parser (`cds.env.features.odata_new_parser = true`):
102
+ - `@odata.context` is derived without using okra, not yet supported:
103
+ - `$expand=*` query option
104
+ - Support for actions and functions
105
+ - Further `$apply` transformations supported
106
+ - (nested) `concat` transformations
107
+ - `orderBy` transformation
108
+ - `top` & `skip` transformation
109
+ - `identity` transformation
110
+ - Log `BEGIN`/`COMMIT`/`ROLLBACK` commands when using SAP HANA as the underlying database
111
+ - Binary data in payload is validated to be RFC-4648 and OData ABNF conformed
112
+ - Support multiple media (streaming) properties in one entity
113
+ - Support for annotation `@protocol:'none'` to mark services as internal
114
+ - New build task aliases `java` and `nodejs` deprecating `java-cf`and `node-cf`, which are still supported for compatibility reasons.
115
+ - New shutdown event sent by `cds serve` (beta)
116
+ - $filter in $expand for remote services
117
+ - Mapping of aliases in $expand for remote services
118
+
119
+
120
+ ### Changed
121
+
122
+ - `@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.
123
+ - SAP Cloud SDK is now only an optional dependency and must be installed manually
124
+ - 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.
125
+ - Improved `cds.tx(tx=>{ ... })`: The new `tx` will be set as `cds.context.tx` for the function body's continuation,
126
+ so all nested service or database operations will be executed within this transaction automatically.
127
+ - Node.js 14.15 is now the minimum required Node.js version. Version 12 is no longer supported.
128
+ - Node.js 14.15 is now enforced on loading of `@sap/cds`, for example, on server startup.
129
+ - Improve error messages in messaging management
130
+ - `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:
131
+ ```js
132
+ let sql = cds.requires.sql //> is undefined now
133
+ let sql = cds.requires.kinds.sql //> use this instead
134
+ ```
135
+ Alternatively you can add this to your cds config:
136
+ ```json
137
+ { "cds": { "requires": { "sql": true } }}
138
+ ```
139
+ - Details of errors from remote services are now in property `reason` (before it was `innererror`)
140
+ - `innererror` is not removed from OData error response
141
+ - The `file` option of file-based messaging is now on top level (before it was in `credentials`)
142
+ - Optimized Search: `cds.env.features.optimized_search=true` is now the default behavior.
143
+ - `cds build` no longer generates CF manifest files for Nodejs and HANA db deployer modules.
144
+ - `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.
145
+ - Remote services: Batched `GET` requests will not fetch CSRF tokens
146
+ - CQN now uses `xpr` correctly instead of brackets in `where`
147
+ - `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.
148
+ - `cds build` no longer filters `./` file dependencies from package.json in the build output.
149
+ - 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.
150
+ - `cds build` no longer copies the `node_modules` folder into the deployment folder (usually `gen/db/**` and `gen/srv/**`).
151
+ - Set default tenant to `undefined` in single-tenant mode
152
+ - Handle foreign keys of to-one associations which should be set to `null` on db layer
153
+ - `cds build` uses the native `fs` functions instead of `fs-extra`.
154
+ - `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.
155
+ - `cds deploy` reads Cloud Foundry file `config.json` to get org and space information.
156
+ - New REST adapter replaced old (limited) implementation
157
+ - Default behaviour for runtime integrity checks. From now on no integrity checks will be done by default.
158
+ 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.
159
+ - `cds build` no longer copies `.env` or `default-env.json` files into the deployment folder.
160
+ - 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:
161
+ + 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.
162
+ + 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.
163
+ + 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.
164
+ + Modification logs are now followed by corresponding access logs.
165
+ + More details can be found in cds v6.0.0 release notes.
166
+ - Message for PreconditionFailedError is now configurable in messages.properties
167
+ - Remove circular references in Kibana logging
168
+ - 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.
169
+ 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.
170
+
171
+ ### Fixed
172
+
173
+ - Improved shutdown for AMQP connections and file listeners
174
+ - Using `CQL` with a tagged template string `SELECT from Foo { null as boo }` throwed an exception.
175
+ - In case of `MULTIPLE_ERRORS` throw an `Error` instead of an object
176
+ - `cds build` ensures correct precedence of feature annotations. Fixes `Duplicate assignment` compilation errors.
177
+ - Compatibility with former support to find service `@impl: 'relative/to/cdw'`.
178
+ - Views on views with parameters where erroneously inherited params through `cds.linked()`.
179
+ - Authentication: Return HTTP `404 Not Found` rather than `204 No Content` status code for invalid requests.
180
+ For example, given the following request `/ReqAdmin(1)/toIntermediate/toa` and assuming that the `toIntermediate` instance does not exist,
181
+ the runtime returned an HTTP `204 No Content` success status response code indicating that the request has succeeded.
182
+ In such scenarios, now the HTTP `404 Not Found` status code is returned rather than `204 No Content`.
183
+ - 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.
184
+ - Errors constructed and thrown by `req.reject()` now have a stack starting at the code calling `req.reject()`.
185
+ - Auth annotations `@restrict` and `@requires` with empty array do not allow access anymore
186
+ - Delete on restricted singleton caused request to fail
187
+ - Add workaround of typescript not complete literal unions, specially when union strings.
188
+ - Accidental handling of non-proxy entities as they would have been proxies (`cds.env.odata.proxies`) in expands
189
+ - Boolean keys are properly parsed into JS boolean values
190
+ - 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`)
191
+ - All entities in `@sap/cds/common` have now proper CDS doc comments
192
+ - `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.
193
+ - Pass options from `cds.parse.expr` to `cdsc.parse.expr`.
194
+ - 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.
195
+ - Correct URL generation for `Integer64` and `Decimal` for remote services
196
+ - Operation parameters from structured type and annotated with @open are not filtered from the input query
197
+ - 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`.
198
+ - Optimized Search: Exception when searching on views using built-in SQL SAP HANA functions
199
+ - In some cases, custom error handlers were not called for rest
200
+ - `cds build` adds newline at EOF for `hdbmigrationtable` files
201
+ - Static values in on condition were ignored when inserting on navigation
202
+ - Removed entity key validation by POST request in rest
203
+ - `$count=false` returned count
204
+ - `odata_new_parser`: `format=json` allowed as query parameter, other formats not supported and returning 501, trailing `?` allowed e.g. `/Employees?`
205
+ - `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')`
206
+ - `odata_new_parser`: Behavior of piped transformations while using `topcount` or `bottomcount` is now correct
207
+ - Better error message for missing `exists` predicate in `@restrict.where`
208
+ - Reading raw Binary data provided as a `base64` (standard or url-safe) string by means of a `$value` query option
209
+ - Selecting a navigation with `$select` ended up in database error
210
+ - `cds.compile` no longer fails for cds sources that contain the `file:` pattern
211
+ - $select=IsActiveEntity did not work on draft enabled entity, when requesting active data via navigation
212
+ - not equal operator `<>` treated the same way as `!=`
213
+ - `cds.localize` now respects custom i18n file names (which is not recommended though)
214
+ - `cds version` now handles array-valued entries for `folders.db`and `folders.srv` gracefully when looking for MTX sidecar
215
+ - OData access of entities named `get` and `set`
216
+ - missing brackets for OR condition in `.where()` when requesting by navigation
217
+ - `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 "."
218
+ - `cds build <dir>` is now correctly executed if called by npm script or mta build.
219
+ - `cds deploy` now shows a better error message on INSERT errors (on SQLite).
220
+
221
+ ### Removed
222
+
223
+ - Deprecated option to send synchronous requests via `srv.emit()` -> use `srv.send()` for that
224
+ - Deprecated feature flag `cds.env.features.implicit_sorting`
225
+ - Deprecated feature flag `cds.env.features.update_managed_properties`
226
+ - Deprecated feature flag `cds.env.features.resolve_views`
227
+ - Deprecated feature flag `cds.env.features.spaced_columns`
228
+ - Deprecated feature flag `cds.env.features.throw_diff_error`
229
+ - Deprecated feature flag `cds.env.features.delay_assert_deep_assoc`
230
+ - Deprecated feature flag `cds.env.features.auto_fetch_expand_keys`
231
+ - Deprecation warning for query parameters `sap-valid-from` and `sap-valid-to`
232
+ - Built-in graphql support &rarr; moved to new `@sap/cds-graphql`
233
+ - Deprecated feature flag `cds.env.features.extract_vals`
234
+ - Support for CQN `where in` syntax `{ val: [1, 2, 3] }` without `list`. Use `{ list: [{ val: 1 }, { val: 2 }, { val: 3 }] }` instead.
235
+ - Support for selects in restrict entries, e.g. `where : 'exists (select 1 from MyTable where a = b)'` is not allowed anymore
236
+ - Input validation for deep `INSERT`/`UPDATE` for associations in the service layer
237
+ - Support for `@odata.contained` annotation. Use Compositions instead.
238
+ - Support for `@odata.on.insert/update` annotation. Use `cds.on.insert/update` instead.
239
+ - Support for expressions in references, for example: `ref: ['foo as bar']`).
240
+ - Generic support of `$expand` and `$select` OData query options for custom actions and functions
241
+
242
+ ## Version 5.9.8 - 2022-06-24
243
+
244
+ ### Fixed
245
+
246
+ - Application model is now again properly updated after extension activation
247
+ - Avoid crashes during `cds version` when `folders.db` or `folders.srv` are array-valued instead of strings
248
+ - `cds build` correctly validates MTX extension allow lists and doesn't log false positive warning messages
249
+
7
250
  ## Version 5.9.7 - 2022-06-13
8
251
 
9
252
  ### Fixed
@@ -63,11 +306,10 @@
63
306
 
64
307
  - 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.
65
308
  - 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.
66
- - 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()`.
309
+ - 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()`.
67
310
  - Invalid batch requests were further processed after error response was already sent to client, leading to an InternalServerError
68
311
  - Full support of `SELECT` queries with operator expressions (`xpr`)
69
312
 
70
-
71
313
  ## Version 5.9.2 - 2022-04-07
72
314
 
73
315
  ### Fixed
@@ -86,11 +328,11 @@
86
328
 
87
329
  - Function arguments might be escaped too often
88
330
  - URL encoding for remote services for CQN queries
89
- - `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.
331
+ - `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.
90
332
  - Endless loop in localization handling
91
333
  - Ensure service impl while extending entity from the service
92
334
  - Post-processing of custom draft queries
93
- - No minifying of CSN artifacts for Java build
335
+ - `cds build` no longer omits unused CDS type definitions, leading to Java compiler errors
94
336
 
95
337
  ## Version 5.9.0 - 2022-03-25
96
338
 
@@ -108,13 +350,14 @@
108
350
  + `[{ grant: '...', to: ['...'], where: '...' }, ...]`: applicable restrictions with grant normalized to strings
109
351
  + That is, `grant: ['CREATE', 'UPDATE']` in model becomes `[{ grant: 'CREATE' }, { grant: 'UPDATE' }]`
110
352
  + Promise resolving to any of the above (needed for CAS override)
111
- - Internal model provider service can be used for obtaining dynamic csn including features and key user extensions
353
+ - Internal model provider service can be used for obtaining dynamic csn, including features and key user extensions
112
354
  - Support insert of SQL snippets for HANA migration tables using @sql.append and @sql.prepend annotations.
113
355
  - Support for the `@odata.draft.enclosed` annotation on associations targeted via navigation — previously only supported for `$expand`
114
356
  - Pseudo role `internal-user` for technical user tokens acquired from own XSUAA instance
115
357
  - Include globally-installed cds-dk version in output of `cds version`.
116
358
  - Include version of cds-mtx in output of `cds version`, if available.
117
359
  - Feature toggle support in `cds build` for cloud deployments. Create language bundles and parsed CSN for all features.
360
+ - Support for `@Aggregation.default` in new OData parser (`cds.env.features.odata_new_parser = true`)
118
361
 
119
362
  ### Changed
120
363
 
@@ -147,7 +390,7 @@
147
390
  - '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.
148
391
  - Don't throw error in GraphQL adapter if update mutation filter does not match any entries (to be consistent with delete mutations)
149
392
  - Remote call of unbound action/function returns octet-stream instead of string by default
150
- - Default pool's behaviour has been changed from `FIFO` (queue) to `LIFO` (stack). Can be changed in pool configuration.
393
+ - Default pool's behavior has been changed from `FIFO` (queue) to `LIFO` (stack). Can be changed in pool configuration.
151
394
  - `cds run/serve` now gracefully shuts down the HTTP server before exiting. Custom handlers for signals like `SIGTERM` or `SIGINT` can now be processed.
152
395
  - `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.
153
396
 
@@ -182,7 +425,8 @@
182
425
  - `cds.compile` correctly supports reserved namespaces like `cds.foundation`.
183
426
  - `cds.compile.to.serviceinfo` now uses the correct configuration for the base URL paths for Java services
184
427
  - `cds deploy --to sqlite` correctly localizes texts in deployed views. Before not all localized texts have been correctly resolved.
185
- - `cds deploy --to hana` reports missing org or space info with better message.
428
+ - `cds deploy --to hana` reports missing org or space info with a better message.
429
+ - Using combinations of `.` and `_` in CSN definition names
186
430
 
187
431
  ### Removed
188
432
 
@@ -199,17 +443,18 @@
199
443
 
200
444
  ### Fixed
201
445
 
202
- - `queries` property for application defined destinations of remote services
446
+ - `queries` property for application-defined destinations of remote services
203
447
  - `cds serve --watch` no longer fails if `@sap/cds-dk` is installed only globally
204
448
  - `cds serve` during development longer redirects URLs with similar path segments from different services, like `/service/one` and `/service`
205
449
  - `cds deploy --to sqlite` now ignores a `_texts.csv` file again if there is a language-specific file like `_texts_en.csv` present
206
450
  - Using logical blocks (surrounded with `(` and `)`) in ON-conditions of unmanaged associations and compositions
207
- - 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
451
+ - 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
208
452
  - Limited support for binary data in OData
209
- + Using of `base64` string values in `WHERE IN` on hana
210
- + `base64url` values in `@odata.context` annotation
453
+ - Using of `base64` encoded string values in `WHERE IN` on SAP HANA
454
+ - `base64url` values in `@odata.context` annotation
211
455
  - `cds.context` is set in GraphQL adapter
212
- - Using payloads with `@odata.type` annotating primitive properties no longer crashes the application. `#` in type value may be ommitted. Example:
456
+ - Using payloads with `@odata.type` annotating primitive properties no longer crashes the application. `#` in type value may be omitted. Example:
457
+
213
458
  ```json
214
459
  {
215
460
  "ID": 201,
@@ -219,13 +464,14 @@
219
464
  "stock": 12
220
465
  }
221
466
  ```
467
+
222
468
  - Unicode support for i18n bundles
223
469
 
224
470
  ## Version 5.8.2 - 2022-02-22
225
471
 
226
472
  ### Fixed
227
473
 
228
- - Crash if error does not have a stack in kibana logging
474
+ - Crash if error does not have a stack in Kibana logging
229
475
  - Allow short names for bound operations in odata-server
230
476
  - Performance issue during deep operations
231
477
  - Resolving views with parameters
@@ -265,17 +511,18 @@
265
511
  - Draft (Access control for bound actions): Only the user that is the owner of the draft can execute its bound actions.
266
512
  - Check that all keys are provided in REST adapter
267
513
  - Restrict access to all services via `cds.env.requires.auth.restrict_all_services = true`
268
- + That is, all unrestricted services (i.e., w/o own `@requires`) are treated as having `@requires: 'authenticated-user'`
514
+ - That is, all unrestricted services (i.e., w/o own `@requires`) are treated as having `@requires: 'authenticated-user'`
269
515
  - 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)
270
516
  - Limited support for binary data in OData
271
- + In payloads, the binary data must be a base64 encoded string
272
- + In URLs, the binary data must have the following format: `binary'<url-safe base64 encoded>'`, e.g., `$filter=ID eq binary'Q0FQIE5vZGUuanM='`
273
- + The use of binary data in some advanced constructs like `$apply` and `/any()` may be limited
274
- + On SQLite, the base64 encoded string is stored in the database
275
- + It’s strongly discouraged to use binary data as keys. See "Primary Keys — Best Practices" in the documentation.
517
+ - In payloads, the binary data must be a base64 encoded string
518
+ - In URLs, the binary data must have the following format: `binary'<url-safe base64 encoded>'`, e.g., `$filter=ID eq binary'Q0FQIE5vZGUuanM='`
519
+ - The use of binary data in some advanced constructs like `$apply` and `/any()` may be limited
520
+ - On SQLite, the base64 encoded string is stored in the database
521
+ - It’s strongly discouraged to use binary data as keys. See "Primary Keys — Best Practices" in the documentation.
276
522
  - Support for OData annotation `@Core.ContentDisposition.Type` with `attachment` as the default value
277
523
  - Support for returning custom stream objects in custom handlers (beta):
278
- + Example:
524
+ - Example:
525
+
279
526
  ```js
280
527
  return {
281
528
  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
  }