@sap/cds 8.5.0 → 8.5.1

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,13 @@
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 8.5.1 - 2024-12-06
8
+
9
+ ### Fixed
10
+
11
+ - `cds deploy --dry --model-only` no longer tries to load a SQLite database
12
+ - Requests with HTTP methods other than `POST` to the `/$batch` endpoint are now rejected when using the new OData adapter
13
+
7
14
  ## Version 8.5.0 - 2024-11-25
8
15
 
9
16
  ### Added
@@ -37,7 +37,7 @@ const deploy = module.exports = function cds_deploy (model, options, csvs) {
37
37
  const _run = fn => o.dry ? fn(db) : db.run(fn)
38
38
  await _run (async tx => {
39
39
  let any = await deploy.schema (tx, model, o)
40
- if (any || csvs) await deploy.data (tx, model, o, csvs, file => LOG?.(GREY, ' > init from', local(file), RESET))
40
+ if ((any || csvs) && !o.dry) await deploy.data (tx, model, o, csvs, file => LOG?.(GREY, ' > init from', local(file), RESET))
41
41
  })
42
42
  LOG?.('/> successfully deployed to', descr, '\n')
43
43
  } catch (e) {
@@ -96,7 +96,8 @@ class ODataAdapter extends HttpAdapter {
96
96
  return jsonBodyParser(req, res, next)
97
97
  })
98
98
  // batch
99
- .post('/\\$batch', require('./middleware/batch')(this))
99
+ // .all is used deliberately instead of .use so that the matched path is not stripped from req properties
100
+ .all('/\\$batch', require('./middleware/batch')(this))
100
101
  // handle
101
102
  // REVISIT: with old adapter, we return 405 for HEAD requests -> check OData spec
102
103
  .head('*', (_, res) => res.sendStatus(405))
@@ -561,6 +561,10 @@ module.exports = adapter => {
561
561
  })
562
562
 
563
563
  return function odata_batch(req, res, next) {
564
+ if (req.method !== 'POST') {
565
+ throw cds.error(`Method ${req.method} is not allowed for calls to $batch endpoint`, { code: 405 })
566
+ }
567
+
564
568
  if (req.headers['content-type'].includes('application/json')) {
565
569
  return _processBatch(service, router, req, res, next)
566
570
  }
@@ -19,7 +19,7 @@ function _getDefinition(definition, name, namespace) {
19
19
 
20
20
  function _resolveAliasesInRef(ref, target) {
21
21
  if (ref.length === 1) {
22
- if (target.keys[ref[0]]) return ref
22
+ if (target.keys?.[ref[0]]) return ref
23
23
 
24
24
  // resolve multi-part refs for innermost ref in url
25
25
  if (target._flattenedKeys === undefined) {
@@ -312,6 +312,7 @@ const handleSapMessages = (cdsReq, req, res) => {
312
312
  }
313
313
 
314
314
  const isStream = query => {
315
+ if (!query) return
315
316
  const { _propertyAccess, target } = query
316
317
  if (!_propertyAccess) return
317
318
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds",
3
- "version": "8.5.0",
3
+ "version": "8.5.1",
4
4
  "description": "SAP Cloud Application Programming Model - CDS for Node.js",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [