@sap/cds-dk 6.4.0 → 6.4.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
@@ -7,12 +7,19 @@ This project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
8
  The format is based on [Keep a Changelog](http://keepachangelog.com/).
9
9
 
10
+ ## Version 6.4.1 - 2022-01-17
11
+
12
+ ### Fixed
13
+
14
+ - `cds deploy -2 sqlite` now preserves the `schema_evolution` setting in the `package.json`.
15
+ - `cds import` bug fix for OData V4 import crash.
16
+
10
17
  ## Version 6.4.0 - 2022-12-15
11
18
 
12
19
  ### Added
13
20
 
14
21
  - `cds add helm` now supports approuter.
15
- - `cds subscribe --local` starts @sap/cds-mtxs locally instead of contacting a running instance via URL.
22
+ - `cds subscribe --local` starts `@sap/cds-mtxs` locally instead of contacting a running instance via URL.
16
23
  - `cds unsubscribe` removes the subscription of a tenant from a SaaS app.
17
24
 
18
25
  ### Changed
@@ -112,10 +112,12 @@ async function update_package_json (kind, model, database) {
112
112
  const { readFile, writeFile } = fs.promises
113
113
  const package_json = path.resolve ('package.json'), exists = isfile (package_json)
114
114
  const conf = exists ? JSON.parse (await readFile (package_json)) : {}
115
- const requires = ['cds','requires'] .reduce ((p,n)=>p[n] || (p[n]={}), conf)
115
+ const requires = conf.cds?.requires
116
+ const { schema_evolution } = requires?.db ?? {}
116
117
  requires.db = cds.env.requires.db = { kind, model }
117
118
  if (database) requires.db.credentials = { database }
118
119
  else if (kind === 'sqlite') requires.db.credentials = { database:'db.sqlite' }
120
+ if (schema_evolution) requires.db.schema_evolution = schema_evolution
119
121
  await writeFile (package_json, JSON.stringify(conf,null,' '))
120
122
  console.log (`/> ${ exists ? 'updated' : 'created' } ./package.json`)
121
123
  }
@@ -112,7 +112,12 @@ function _isValidJSON(jsonObj, parserContext) {
112
112
  function _hasEntityContainer(jsonObj, parserContext) {
113
113
  let jsonObjEntityContainer = jsonObj.$EntityContainer;
114
114
  try {
115
- if (jsonObjEntityContainer) [parserContext.namespace, parserContext.jsonEntityContainerName] = jsonObjEntityContainer.split('.');
115
+ if (jsonObjEntityContainer) {
116
+ // scenario: Schema Namespace="A.B.C.D" & jsonObjEntityContainer is "A.B.C.D.EntityContainerName"
117
+ let lastIndex = jsonObjEntityContainer.lastIndexOf('.');
118
+ parserContext.namespace = jsonObjEntityContainer.substring(0, lastIndex);
119
+ parserContext.jsonEntityContainerName = jsonObjEntityContainer.substring(lastIndex + 1);
120
+ }
116
121
  if (jsonObj[parserContext.namespace][parserContext.jsonEntityContainerName] &&
117
122
  jsonObj[parserContext.namespace][parserContext.jsonEntityContainerName] instanceof Object
118
123
  ) {