@sap/cds 8.9.2 → 8.9.4

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,25 @@
4
4
  - The format is based on [Keep a Changelog](https://keepachangelog.com/).
5
5
  - This project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## Version 8.9.4 - 2025-05-16
8
+
9
+ ### Fixed
10
+
11
+ - No longer require `@sap/cds-compiler` versions 6.x as these are not supported with CAP Java 3.
12
+ - Regression in view resolving with mixins
13
+ - View resolving for external service entities aborted too early
14
+ - `cds.Map` validation in action/function parameters
15
+
16
+ ## Version 8.9.3 - 2025-05-06
17
+
18
+ ### Fixed
19
+
20
+ - OData: `$value` access of primitive properties returned by custom handler
21
+ - UCL: Add missing declaration of variable `$input` in mutation for creating an application template
22
+ - Purge of `servers` from `.cds-services.json` file
23
+ - Loading of relative service implementations in plugins
24
+ - `cds.compile.to.edmx` in case the model was manipulated in a plugin
25
+
7
26
  ## Version 8.9.2 - 2025-04-14
8
27
 
9
28
  ### Fixed
@@ -71,7 +71,7 @@ function _4odata (csn,o) {
71
71
  }
72
72
 
73
73
  // o.service is specified now
74
- return cds.compile.for.odata(csn,o)
74
+ return cds.env.features.compile_to_edmx_compat ? cds.compile.for.odata(csn,o) : csn //> leave that to cdsc: cds.compile.for.odata(csn,o)
75
75
  }
76
76
 
77
77
 
@@ -147,6 +147,7 @@ class type extends any { is(kind) { return kind === 'type' || super.is(kind) }
147
147
  }
148
148
 
149
149
  class Map extends struct {
150
+ get '@open' () { return this.set('@open', true) }
150
151
  get elements() { return this.set('elements', new LinkedDefinitions) }
151
152
  }
152
153
 
@@ -47,6 +47,7 @@ class LinkedCSN {
47
47
  if (p.actions && !d.actions) _set (d,'actions',undefined) //> don't propagate .actions
48
48
  if (p.params && !d.params) _set (d,'params',undefined) //> don't propagate .params
49
49
  if (d.elements?.localized) _set (d,'texts', defs[d.elements.localized.target])
50
+ if (!Object.hasOwn(d,'_service')) _set (d,'_service',undefined) //> don't propagate ._service
50
51
  } else if (d.kind === 'element') {
51
52
  if (p.key && !d.key) _set (d,'key',undefined) //> don't propagate .key
52
53
  }
package/lib/ql/resolve.js CHANGED
@@ -8,6 +8,7 @@ const _isPersistenceTable = target =>
8
8
  // REVISIT revert after cds-dbs pr
9
9
  // REVISIT: Remove once we get rid of old db
10
10
  const _abortDB = resolve.abortDB = target => !!(_isPersistenceTable(target)|| !target.query?._target)
11
+ // _service seems to be inherited in projections, so do not consider prototype chain
11
12
  const _defaultAbort = tx => e => e._service?.name === tx.definition?.name
12
13
 
13
14
  function resolve(query, tx, abortCondition) {
@@ -99,11 +99,12 @@ class Bindings {
99
99
  }
100
100
 
101
101
  purge() {
102
- if (this.done) return; else this.done = true
102
+ if (this.done) return;
103
103
  this.load (fs.readFileSync)
104
104
  LOG.debug ('purging bindings from:', registry)
105
105
  this.cleanup()
106
106
  this.store (fs.writeFileSync)
107
+ this.done = true
107
108
  }
108
109
 
109
110
  /**
@@ -113,7 +114,7 @@ class Bindings {
113
114
  const { servers, provides } = this, { pid } = process
114
115
  for (let [key,srv] of Object.entries (provides))
115
116
  if (srv.server === pid || url && srv.credentials?.url?.startsWith(url)) delete provides [key]
116
- delete servers [pid]
117
+ delete servers [pid.toString()]
117
118
  return this
118
119
  }
119
120
  }
@@ -23,9 +23,9 @@ function ServiceFactory (name, model, options) {
23
23
  return _use (impl[name] || impl.default || _kind())
24
24
  case 'string':
25
25
  if (impl.startsWith('@sap/cds/')) impl = cds.home + impl.slice(8) //> for local tests in @sap/cds dev
26
- if (impl.startsWith('./')) impl = path.resolve (cds.root, _source4(def) || '.', '..', impl.slice(2))
27
- try { var resolved = require.resolve(impl, {paths:[ cds.root, cds.home ]}) } catch {
28
- try { resolved = require.resolve(path.join(cds.root, impl)) } catch (e) { // compatibility
26
+ if (impl.startsWith('./')) impl = path.join (_source4(def) || 'x', '.'+impl)
27
+ try { var resolved = require.resolve (path.join (cds.root, impl)) } catch (e) { // fetch local paths
28
+ try { resolved = require.resolve (impl, {paths:[ cds.root, cds.home ]}) } catch { // fetch in node_modules
29
29
  throw cds.error(`Failed loading service implementation from ` + impl, { cause: e })
30
30
  }
31
31
  }
@@ -51,7 +51,7 @@ const _sibling = d => {
51
51
  for (let subdir of ['/', '/lib/', '/handlers/']) {
52
52
  for (let ext of exts) try {
53
53
  const impl = dir + subdir + name + ext
54
- return isfile(impl) || require.resolve (impl)
54
+ return isfile(impl) || require.resolve (impl, {paths:[ cds.root, cds.home ]})
55
55
  } catch(e) {
56
56
  if (e.code !== 'MODULE_NOT_FOUND') throw e
57
57
  }
@@ -32,7 +32,7 @@ const _inverseTransition = transition => {
32
32
  const ref0 = value.ref[0]
33
33
  if (value.ref.length > 1) {
34
34
  // ignore flattened columns like author.name
35
- if (transition.target.elements[ref0].isAssociation) continue
35
+ if (transition.target.elements[ref0]?.isAssociation) continue
36
36
 
37
37
  const nested = inverseTransition.mapping.get(ref0) || {}
38
38
  if (!nested.transition) nested.transition = { mapping: new Map() }
@@ -155,7 +155,7 @@ const READ_QUERY = `
155
155
  }`
156
156
 
157
157
  const CREATE_MUTATION = `
158
- mutation {
158
+ mutation ($input: ApplicationTemplateInput!) {
159
159
  result: createApplicationTemplate (
160
160
  in: $input
161
161
  ) {
@@ -246,7 +246,7 @@ module.exports = adapter => {
246
246
 
247
247
  // 204
248
248
  if (result == null && query.SELECT.one) return res.sendStatus(204)
249
- if (_propertyAccess && result[_propertyAccess] === null) return res.sendStatus(204)
249
+ if (_propertyAccess && result[_propertyAccess] == null) return res.sendStatus(204)
250
250
 
251
251
  // 304
252
252
  if (validateIfNoneMatch(cdsReq.target, req.headers?.['if-none-match'], result)) return res.sendStatus(304)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds",
3
- "version": "8.9.2",
3
+ "version": "8.9.4",
4
4
  "description": "SAP Cloud Application Programming Model - CDS for Node.js",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [
@@ -33,7 +33,7 @@
33
33
  "node": ">=18"
34
34
  },
35
35
  "dependencies": {
36
- "@sap/cds-compiler": ">=5.1",
36
+ "@sap/cds-compiler": "^5",
37
37
  "@sap/cds-fiori": "^1",
38
38
  "@sap/cds-foss": "^5.0.0"
39
39
  },