@sap/cds 7.8.0 → 7.8.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@
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 7.8.2 - 2024-04-22
8
+
9
+ ### Fixed
10
+
11
+ - `.find` and `.filter` in `linked.entities()` now returns values instead of names
12
+ - `cds.app.serve.from(pkg,folder)` did not consider `pkg` for serving static resources
13
+
14
+ ## Version 7.8.1 - 2024-04-11
15
+
16
+ ### Fixed
17
+
18
+ - In some cases, `<entity>.drafts` erroneously pointed to a CSN entity stub.
19
+ - Feature vectors including falsy values like `{ ft1: true, ft2: true, ft3: false }`
20
+
7
21
  ## Version 7.8.0 - 2024-03-25
8
22
 
9
23
  ### Added
@@ -166,10 +166,10 @@ class event extends aspect {}
166
166
  class LinkedDefinitions {
167
167
  *[Symbol.iterator](){ for (let e in this) yield this[e] }
168
168
  forEach(f){ let i=0; for (let k in this) f(this[k],i++,this) }
169
- filter(f){ let i=0, r=[]; for (let k in this) f(this[k],i++,this) && r.push(k); return r }
169
+ filter(f){ let i=0, r=[]; for (let k in this) f(this[k],i++,this) && r.push(this[k]); return r }
170
170
  map(f){ let i=0, r=[]; for (let k in this) r.push(f(this[k],i++,this)); return r }
171
171
  some(f){ for (let k in this) if (f(this[k])) return true }
172
- find(f){ for (let k in this) if (f(this[k])) return k }
172
+ find(f){ for (let k in this) if (f(this[k])) return this[k] }
173
173
  }
174
174
 
175
175
 
@@ -23,6 +23,7 @@ class entity extends struct {
23
23
  }
24
24
 
25
25
  get drafts() {
26
+ if (cds.env.fiori.lean_draft) return null
26
27
  // Remove this getter when old draft is removed
27
28
  return this.own('_drafts') || this.set('_drafts', this.elements?.HasDraftEntity && {
28
29
  name: this.name + '_drafts', keys: this.keys,
@@ -192,7 +192,7 @@ class Features {
192
192
  if (x == null) return
193
193
  if (x === '*') return this.all
194
194
  if (Array.isArray(x)) ; //> go on below
195
- else if (typeof x === 'object') x = Object.keys(x)
195
+ else if (typeof x === 'object') x = Object.keys(x).filter(k => x[k])
196
196
  else if (typeof x === 'string') x = x.split(',')
197
197
  if (x.length) return Object.assign (new this, x.reduce((o,f)=>{o[f]=true;return o},{}))
198
198
  }
@@ -57,6 +57,7 @@ function _process(obj, def, errs, opts) {
57
57
 
58
58
  for (let [k, v] of Object.entries(obj)) {
59
59
  let ele = def.elements?.[k] || def.params?.[k] || def.items
60
+ if (typeof ele !== 'object') ele = undefined //> ignore non-object elements, e.g., functions of prototypes
60
61
 
61
62
  /*
62
63
  * TODO: should we support this? with or without transformation?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds",
3
- "version": "7.8.0",
3
+ "version": "7.8.2",
4
4
  "description": "SAP Cloud Application Programming Model - CDS for Node.js",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [
package/server.js CHANGED
@@ -89,7 +89,7 @@ const defaults = {
89
89
  * @example app.serve('/bookshop').from('@capire/bookshop','app/vue')
90
90
  */
91
91
  express.application.serve = function (endpoint) { return { from: (pkg,folder) => {
92
- folder = !folder ? pkg : cds.utils.path.resolve (require.resolve(pkg+'/package.json',{paths:[cds.root]}),'..',folder)
92
+ folder = !folder ? pkg : cds.utils.path.resolve (require.resolve(pkg+'/package.json',{paths:[cds.root]}),'../'+folder)
93
93
  this.use (endpoint, express.static(folder))
94
94
  if (!endpoint.endsWith('/webapp')) (this._app_links ??= []) .push (endpoint)
95
95
  }}}