@sap/cds 6.2.2 → 6.2.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@
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.2.3 - 2022-10-21
8
+
9
+ ### Fixed
10
+
11
+ - New continuation for incoming messages
12
+ - `cds.test` no longer fails if used in ESM modules with `mocha` (`ERR_REQUIRE_ESM` error)
13
+ - Collection-bound actions/functions don't need draft ownership check
14
+
7
15
  ## Version 6.2.2 - 2022-10-13
8
16
 
9
17
  ### Fixed
package/lib/index.js CHANGED
@@ -138,7 +138,8 @@ _global ('parse','CDL','CQL','CXL')
138
138
  // Check Node.js version
139
139
  if (process.env.CDS_STRICT_NODE_VERSION !== 'false') {
140
140
  const v = version => { let vv = version.split('.'); return { version, major: +vv[0], minor: +vv[1] }}
141
- const required = v('14.15'), given = v(process.version.match(/^v(\d+\.\d+)/)[1])
141
+ const required = v(_require('../package.json').engines.node.match(/>=(.*)/)[1])
142
+ const given = v(process.version.match(/^v(\d+\.\d+)/)[1])
142
143
  if (given.major < required.major || given.major === required.major && given.minor < required.minor) process.exit (process.stderr.write (`
143
144
  Node.js v${required.version} or higher is required for @sap/cds.
144
145
  Current v${given.version} does not satisfy this.
@@ -136,7 +136,7 @@ exports.find = function find (base, patterns='*', filter=()=>true) {
136
136
 
137
137
  // internal utility to load a file through ESM or CommonJs. TODO find a better place.
138
138
  exports._import = id => require(id)
139
- if (!global.test && !global.it) {
139
+ if (typeof jest === 'undefined') { // jest's ESM support is experimental: https://jestjs.io/docs/ecmascript-modules
140
140
  const { pathToFileURL } = require('url')
141
141
  exports._import = id => {
142
142
  if (extname(id) === '.ts') return require(id) // ts-node w/ ESM not working (cap/issues#11980)
@@ -160,7 +160,8 @@ const _registerBoundActionHandlers = function (entityName, actions) {
160
160
  action.kind === 'action' &&
161
161
  action.name !== 'draftPrepare' &&
162
162
  action.name !== 'draftEdit' &&
163
- action.name !== 'draftActivate'
163
+ action.name !== 'draftActivate' &&
164
+ !action['@cds.odata.bindingparameter.collection']
164
165
  )
165
166
 
166
167
  for (const action of boundActions) {
@@ -81,11 +81,14 @@ class MessagingService extends OutboxService {
81
81
  const _msg = typeof event === 'object' ? event : { event, data, headers }
82
82
  if (_msg instanceof cds.Event) return super.emit(_msg)
83
83
  if (_msg.inbound && !cds.context) {
84
- cds.context = { tenant: _msg.tenant, user: cds.User.privileged }
85
- if (cds.model) {
86
- const ctx = cds.context
87
- ctx.model = await ExtendedModels.model4(ctx.tenant, ctx.features)
88
- }
84
+ return cds._context.run({ tenant: _msg.tenant, user: cds.User.privileged }, async () => {
85
+ if (cds.model) {
86
+ const ctx = cds.context
87
+ ctx.model = await ExtendedModels.model4(ctx.tenant, ctx.features)
88
+ }
89
+ const msg = new cds.Event(this.message4(_msg))
90
+ return super.emit(msg)
91
+ })
89
92
  }
90
93
  const msg = new cds.Event(this.message4(_msg))
91
94
  return super.emit(msg)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds",
3
- "version": "6.2.2",
3
+ "version": "6.2.3",
4
4
  "description": "SAP Cloud Application Programming Model - CDS for Node.js",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [
@@ -27,7 +27,7 @@
27
27
  "LICENSE"
28
28
  ],
29
29
  "engines": {
30
- "node": ">=14.15.0"
30
+ "node": ">=14.18.0"
31
31
  },
32
32
  "dependencies": {
33
33
  "@sap/cds-compiler": "^3.2.0",