@sap/cds-dk 8.9.0 → 8.9.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
@@ -7,6 +7,27 @@ This project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  The format is based on [Keep a Changelog](https://keepachangelog.com/).
9
9
 
10
+ ## Version 8.9.2 - 2025-04-16
11
+
12
+ ### Fixed
13
+
14
+ - `cds bind` gives better error messages if the Cloud Foundry org or space are not found.
15
+ - `cds add html5-repo` works in combination with multitenancy when no app router or Work Zone is set up.
16
+
17
+ ### Changed
18
+
19
+ - The Node version in `gen/db/package.json` file generated by `cds build` is now `>=18`, matching to what `@sap/hdi-deploy` specifies.
20
+ - `cds` commands now fail if used in combination with the upcoming `@sap/cds` version 9.
21
+
22
+ ## Version 8.9.1 - 2025-04-04
23
+
24
+ ### Fixed
25
+
26
+ - `cds build` restores compatibility with `@sap/cds` 7, no more crashing there with `TypeError: Cannot read properties of undefined (reading 'enabled')`.
27
+ - `cds add containerize` works if run before `cds add helm`.
28
+ - `cds add http` no longer writes headers starting with a placeholder (IntelliJ compatibility)
29
+ - `cds init --force` overwrites existing files.
30
+
10
31
  ## Version 8.9.0 - 2025-03-31
11
32
 
12
33
  ### Added
package/lib/bind/cf.js CHANGED
@@ -41,7 +41,9 @@ module.exports = new class CFBind extends require('./plugin') {
41
41
  if (org && space) {
42
42
  // org and space can be overwritten by currently logged in org and space
43
43
  const orgObj = await cf.org(org);
44
+ if (!orgObj) throw `org ${bold(org)} not found when resolving service instance ${bold(instance)} in ${bold(this.target.apiEndpoint)}`;
44
45
  const spaceObj = await cf.space(orgObj.guid, space);
46
+ if (!spaceObj) throw `space ${bold(space)} not found in org ${bold(org)} when resolving service instance ${bold(instance)} in ${bold(this.target.apiEndpoint)}`;
45
47
  spaceGuid = spaceObj.guid;
46
48
  orgGuid = orgObj.guid;
47
49
  } else {
@@ -11,6 +11,8 @@ const COMPILATION_ERROR = 'CompilationError'
11
11
  const COMPILE_MESSAGE = 'CompileMessage'
12
12
  const DEBUG = cds.debug('cli|build')
13
13
  const LOG_LIMIT = 30
14
+ // TODO replace with cds.utils.clors.colors.enabled in cds-dk 9
15
+ const colors = process.stdout.isTTY && !process.env.NO_COLOR || process.env.FORCE_COLOR
14
16
 
15
17
  class BuildTaskEngine {
16
18
  constructor(options) {
@@ -32,7 +34,7 @@ class BuildTaskEngine {
32
34
  target: cds.env.build.target,
33
35
  tasks: tasks.map(({ _uses, ...task }) => task),
34
36
  ...(!this.options.clean && { clean: this.options.clean }),
35
- }, { depth: 11, colors: cds.utils.colors.enabled, compact: 3, breakLength: 250 }))
37
+ }, { depth: 11, colors, compact: 3, breakLength: 250 }))
36
38
 
37
39
  DEBUG?.("cds configuration settings:")
38
40
  DEBUG?.(redactCredentials(cds.env))
@@ -5,7 +5,7 @@
5
5
  "@sap/hdi-deploy": "^5"
6
6
  },
7
7
  "engines": {
8
- "node": "^18 || ^20"
8
+ "node": ">=18"
9
9
  },
10
10
  "scripts": {
11
11
  "start": "node node_modules/@sap/hdi-deploy/deploy.js --use-hdb"
package/lib/index.js CHANGED
@@ -39,7 +39,6 @@ const REQUIRED_CDS_MAJOR = 7, REQUIRED_CDS_MINOR = 2
39
39
  const [major, minor] = cds.version.split('.').map(Number)
40
40
  if (major < REQUIRED_CDS_MAJOR || major === REQUIRED_CDS_MAJOR && minor < REQUIRED_CDS_MINOR) {
41
41
  const [dkVersion] = require('../package.json').version.split('.')
42
-
43
42
  console.error(`
44
43
  This application uses '@sap/cds' version ${major}.${minor}, which is not compatible with the installed '@sap/cds-dk' version ${dkVersion}.
45
44
  You can either:
@@ -49,6 +48,16 @@ if (major < REQUIRED_CDS_MAJOR || major === REQUIRED_CDS_MAJOR && minor < REQUIR
49
48
  process.exit(1)
50
49
  }
51
50
 
51
+ const EXCLUDED_CDS_MAJOR = 9
52
+ if (major >= EXCLUDED_CDS_MAJOR) {
53
+ const [dkVersion] = require('../package.json').version.split('.')
54
+ console.error(`
55
+ This application uses '@sap/cds' version ${major}, which is not compatible with the installed '@sap/cds-dk' version ${dkVersion}.
56
+ Update '@sap/cds-dk' to the latest version.
57
+ `)
58
+ process.exit(1)
59
+ }
60
+
52
61
  cds.extend (cds.constructor) .with (CdsDk)
53
62
 
54
63
  class CdsDkAdd {
@@ -5,7 +5,7 @@ module.exports = {
5
5
  COMMAND_ADD: 'add',
6
6
 
7
7
  JAVA_LTS_VERSIONS: [17, 21],
8
- MAVEN_ARCHETYPE_VERSION: '3.8.1',
8
+ MAVEN_ARCHETYPE_VERSION: '3.9.0',
9
9
 
10
10
  OPTIONS: Object.freeze({
11
11
  COMPLETION: 'completion',
@@ -194,7 +194,7 @@ module.exports = new class ProjectReader {
194
194
  hasUI5: _ui5,
195
195
  hasMTXRoute: () => _inProd('extensibility') || (_inProd('multitenancy') && !_isJava()),
196
196
  hasMTXRouteJava: () => (_inProd('helm-unified-runtime') || _inProd('helm')) && _isJava() && _inProd('multitenancy'),
197
- imageRegistry: () => exists('chart/values.yaml') ? cds.load.yaml('chart/values.yaml').global?.image?.registry ?? '<your-container-registry>' : '<your-container-registry>',
197
+ imageRegistry: () => exists('chart/values.yaml') ? cds.load.yaml(join(cds.root, 'chart/values.yaml')).global?.image?.registry ?? '<your-container-registry>' : '<your-container-registry>',
198
198
  extendsApp: _extends,
199
199
  }
200
200
 
@@ -76,7 +76,7 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
76
76
  insert: [html5RepoHost, 'name'],
77
77
  into: [appDeployer, 'requires', 'name'],
78
78
  }]
79
- if (hasApprouter || hasWorkzoneStandard) {
79
+ if (hasApprouter || hasWorkzoneStandard || hasMultitenancy) {
80
80
  additions.push(html5Runtime)
81
81
  }
82
82
  if (hasApprouter) {
@@ -133,14 +133,15 @@ module.exports = class HttpTemplate extends require('../../plugin') {
133
133
  async #generateRequests(services, payload, csn) {
134
134
  let varsDefined = false // when writing requests for multiple services to stdout, define vars only once
135
135
  for (const [serviceName, service] of services) {
136
- let [hostname, auth] = await this.#getHostnameAndAuth(service, csn)
136
+ let [hostname, username, password] = await this.#getHostnameAndAuth(service, csn)
137
137
  let requests = []
138
138
  if (!cds.cli.options.dry || !varsDefined) {
139
- requests.push(auth ? `@server = ${hostname}\n@auth = ${auth}\n` : `@server = ${hostname}\n`)
139
+ const auth = username ? `@username=${username}\n@password=${password}\n` : ''
140
+ requests.push(`@server=${hostname}\n${auth}`)
140
141
  }
141
142
  varsDefined = true
142
- const headers = auth ? `Content-Type: application/json\n{{auth}}` : `Content-Type: application/json`
143
- const headerAuth = auth ? '{{auth}}' : ''
143
+ const headerAuth = username ? `Authorization: Basic {{username}}:{{password}}` : ''
144
+ const headers = headerAuth ? `Content-Type: application/json\n${headerAuth}` : `Content-Type: application/json`
144
145
 
145
146
  service.urlPaths.forEach((urlPath) => {
146
147
  if (service.urlPaths.length > 1) {
@@ -201,7 +202,7 @@ module.exports = class HttpTemplate extends require('../../plugin') {
201
202
  const nameDraftsCreate = slug(title+'_Draft_POST')
202
203
  requests.push(`${title} Drafts GET\n# @name ${slug(title+'_Drafts_GET')}\nGET ${url}?$filter=(IsActiveEntity eq false)\n${headerAuth}\n`) // unencoded URL for better readability (client can handle this)
203
204
  requests.push(`${title} Draft POST\n# @name ${nameDraftsCreate}\nPOST ${url}\n${headers}\n\n${postBody}\n`)
204
- requests.push(`\n### Result from POST request above\n@draftID = {{${nameDraftsCreate}.response.body.$.${key}}}\n`)
205
+ requests.push(`\n### Result from POST request above\n@draftID={{${nameDraftsCreate}.response.body.$.${key}}}\n`)
205
206
  requests.push(`${title} Draft PATCH\n# @name ${slug(title+'_Draft_Patch')}\nPATCH ${url}(${key}={{draftID}},IsActiveEntity=false)\n${headers}\n\n${postBody}\n`)
206
207
  requests.push(`${title} Draft Prepare\n# @name ${slug(title+'_Draft_Prepare')}\nPOST ${url}(${key}={{draftID}},IsActiveEntity=false)/AdminService.draftPrepare\n${headers}\n\n{}\n`)
207
208
  requests.push(`${title} Draft Activate\n# @name ${slug(title+'_Draft_Activate')}\nPOST ${url}(${key}={{draftID}},IsActiveEntity=false)/AdminService.draftActivate\n${headers}\n\n{}\n`)
@@ -216,8 +217,10 @@ module.exports = class HttpTemplate extends require('../../plugin') {
216
217
  if (!cds.cli.options['for-app']) {
217
218
  const host = service.isJava ? this.#javaHost : this.#nodeHost
218
219
  const users = Object.values(await this.#mockUsersForService(service, csn))
219
- const authStr = users.length ? `Authorization: Basic ${users[0].name}:${users[0].password||''}` : null
220
- return [host, authStr]
220
+ if (users.length) {
221
+ return [host, users[0].name, users[0].password || '']
222
+ }
223
+ return [host]
221
224
  }
222
225
 
223
226
  if (!this.approuterAuth) {
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "devDependencies": {
13
13
  "@cap-js/sqlite": "^1",
14
- "@cap-js/cds-types": "^0.9.0"
14
+ "@cap-js/cds-types": "^0.10.0"
15
15
  },
16
16
  "scripts": {
17
17
  "start": "cds-serve"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "devDependencies": {
3
- "@cap-js/cds-types": "^0.9.0",
3
+ "@cap-js/cds-types": "^0.10.0",
4
4
  "@types/node": "^22.0.0",
5
5
  "typescript": "^5"
6
6
  },
@@ -14,6 +14,7 @@ Specify a different project name by replacing characters with '_' or '-', for ex
14
14
  }
15
15
 
16
16
  module.exports.projectFolder = cwd => {
17
+ if (cds.cli.options.force) return
17
18
  const existingProjectFile = PROJECT_FILES.find(exists)
18
19
  if (existingProjectFile) {
19
20
  if (cwd === cds.root) {
@@ -9,6 +9,7 @@ const { exit } = require("process");
9
9
  const LOG = cds.debug("lint");
10
10
  const LOG_CONFIG = cds.debug("lint:config");
11
11
  const GENERAL_ERROR = 1;
12
+ const FATAL_ERROR = 2;
12
13
 
13
14
  /**
14
15
  * Safely require a module, return empty object if module not found
@@ -325,6 +326,12 @@ class Linter {
325
326
 
326
327
  if (results?.length > 0) {
327
328
  console.log(formatter.format(results));
329
+ const { errorCount, fatalErrorCount } = this.#countErrors(results);
330
+ if (fatalErrorCount > 0) {
331
+ exit(FATAL_ERROR);
332
+ } else if (errorCount > 0) {
333
+ exit(GENERAL_ERROR);
334
+ }
328
335
  }
329
336
  }
330
337
  } catch (err) {
@@ -343,6 +350,18 @@ class Linter {
343
350
  }
344
351
  }
345
352
 
353
+ #countErrors(results) {
354
+ let errorCount = 0;
355
+ let fatalErrorCount = 0;
356
+
357
+ for (const result of results) {
358
+ errorCount += result.errorCount;
359
+ fatalErrorCount += result.fatalErrorCount;
360
+ }
361
+
362
+ return { errorCount, fatalErrorCount };
363
+ }
364
+
346
365
  async #getConfigFileAndSetProjectPath(args) {
347
366
  // Get config path
348
367
  if (args.length > 0) {
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@sap/cds-dk",
3
- "version": "8.9.0",
3
+ "version": "8.9.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@sap/cds-dk",
9
- "version": "8.9.0",
9
+ "version": "8.9.2",
10
10
  "license": "SEE LICENSE IN LICENSE",
11
11
  "dependencies": {
12
12
  "@cap-js/asyncapi": "^1.0.0",
13
13
  "@cap-js/openapi": "^1.0.0",
14
- "@sap/cds": ">=7",
14
+ "@sap/cds": "^7 || ^8",
15
15
  "@sap/cds-foss": "^5.0.0",
16
- "@sap/cds-mtxs": ">=1.9.0",
17
- "@sap/eslint-plugin-cds": ">=3.0.1",
16
+ "@sap/cds-mtxs": "^1.9.0 || ^2",
17
+ "@sap/eslint-plugin-cds": "^3.0.1",
18
18
  "@sap/hdi-deploy": "^5",
19
19
  "axios": "^1",
20
20
  "eslint": "^9",
@@ -43,7 +43,7 @@
43
43
  }
44
44
  },
45
45
  "node_modules/@cap-js/db-service": {
46
- "version": "1.18.0",
46
+ "version": "1.19.1",
47
47
  "license": "SEE LICENSE",
48
48
  "optional": true,
49
49
  "dependencies": {
@@ -64,11 +64,11 @@
64
64
  }
65
65
  },
66
66
  "node_modules/@cap-js/sqlite": {
67
- "version": "1.9.0",
67
+ "version": "1.10.0",
68
68
  "license": "SEE LICENSE",
69
69
  "optional": true,
70
70
  "dependencies": {
71
- "@cap-js/db-service": "^1.18.0",
71
+ "@cap-js/db-service": "^1.19.0",
72
72
  "better-sqlite3": "^11.0.0"
73
73
  },
74
74
  "peerDependencies": {
@@ -76,7 +76,7 @@
76
76
  }
77
77
  },
78
78
  "node_modules/@eslint-community/eslint-utils": {
79
- "version": "4.5.1",
79
+ "version": "4.6.0",
80
80
  "license": "MIT",
81
81
  "dependencies": {
82
82
  "eslint-visitor-keys": "^3.4.3"
@@ -109,7 +109,7 @@
109
109
  }
110
110
  },
111
111
  "node_modules/@eslint/config-array": {
112
- "version": "0.19.2",
112
+ "version": "0.20.0",
113
113
  "license": "Apache-2.0",
114
114
  "dependencies": {
115
115
  "@eslint/object-schema": "^2.1.6",
@@ -121,7 +121,7 @@
121
121
  }
122
122
  },
123
123
  "node_modules/@eslint/config-helpers": {
124
- "version": "0.2.0",
124
+ "version": "0.2.1",
125
125
  "license": "Apache-2.0",
126
126
  "engines": {
127
127
  "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -159,7 +159,7 @@
159
159
  }
160
160
  },
161
161
  "node_modules/@eslint/js": {
162
- "version": "9.23.0",
162
+ "version": "9.24.0",
163
163
  "license": "MIT",
164
164
  "engines": {
165
165
  "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -173,16 +173,26 @@
173
173
  }
174
174
  },
175
175
  "node_modules/@eslint/plugin-kit": {
176
- "version": "0.2.7",
176
+ "version": "0.2.8",
177
177
  "license": "Apache-2.0",
178
178
  "dependencies": {
179
- "@eslint/core": "^0.12.0",
179
+ "@eslint/core": "^0.13.0",
180
180
  "levn": "^0.4.1"
181
181
  },
182
182
  "engines": {
183
183
  "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
184
184
  }
185
185
  },
186
+ "node_modules/@eslint/plugin-kit/node_modules/@eslint/core": {
187
+ "version": "0.13.0",
188
+ "license": "Apache-2.0",
189
+ "dependencies": {
190
+ "@types/json-schema": "^7.0.15"
191
+ },
192
+ "engines": {
193
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
194
+ }
195
+ },
186
196
  "node_modules/@humanfs/core": {
187
197
  "version": "0.19.1",
188
198
  "license": "Apache-2.0",
@@ -235,7 +245,7 @@
235
245
  }
236
246
  },
237
247
  "node_modules/@sap/cds": {
238
- "version": "8.9.0",
248
+ "version": "8.9.2",
239
249
  "license": "SEE LICENSE IN LICENSE",
240
250
  "dependencies": {
241
251
  "@sap/cds-compiler": ">=5.1",
@@ -265,7 +275,7 @@
265
275
  }
266
276
  },
267
277
  "node_modules/@sap/cds-compiler": {
268
- "version": "5.9.0",
278
+ "version": "5.9.2",
269
279
  "license": "SEE LICENSE IN LICENSE",
270
280
  "dependencies": {
271
281
  "antlr4": "4.9.3"
@@ -280,7 +290,7 @@
280
290
  }
281
291
  },
282
292
  "node_modules/@sap/cds-fiori": {
283
- "version": "1.4.0",
293
+ "version": "1.4.1",
284
294
  "license": "SEE LICENSE IN LICENSE",
285
295
  "peerDependencies": {
286
296
  "@sap/cds": ">=7.6",
@@ -301,7 +311,7 @@
301
311
  }
302
312
  },
303
313
  "node_modules/@sap/cds-mtxs": {
304
- "version": "2.7.0",
314
+ "version": "2.7.1",
305
315
  "license": "SEE LICENSE IN LICENSE",
306
316
  "dependencies": {
307
317
  "@sap/hdi-deploy": ">=4",
@@ -834,7 +844,7 @@
834
844
  }
835
845
  },
836
846
  "node_modules/dotenv": {
837
- "version": "16.4.7",
847
+ "version": "16.5.0",
838
848
  "license": "BSD-2-Clause",
839
849
  "engines": {
840
850
  "node": ">=12"
@@ -926,16 +936,16 @@
926
936
  }
927
937
  },
928
938
  "node_modules/eslint": {
929
- "version": "9.23.0",
939
+ "version": "9.24.0",
930
940
  "license": "MIT",
931
941
  "dependencies": {
932
942
  "@eslint-community/eslint-utils": "^4.2.0",
933
943
  "@eslint-community/regexpp": "^4.12.1",
934
- "@eslint/config-array": "^0.19.2",
944
+ "@eslint/config-array": "^0.20.0",
935
945
  "@eslint/config-helpers": "^0.2.0",
936
946
  "@eslint/core": "^0.12.0",
937
947
  "@eslint/eslintrc": "^3.3.1",
938
- "@eslint/js": "9.23.0",
948
+ "@eslint/js": "9.24.0",
939
949
  "@eslint/plugin-kit": "^0.2.7",
940
950
  "@humanfs/node": "^0.16.6",
941
951
  "@humanwhocodes/module-importer": "^1.0.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds-dk",
3
- "version": "8.9.0",
3
+ "version": "8.9.2",
4
4
  "description": "Command line client and development toolkit for the SAP Cloud Application Programming Model",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [
@@ -19,10 +19,10 @@
19
19
  "dependencies": {
20
20
  "@cap-js/asyncapi": "^1.0.0",
21
21
  "@cap-js/openapi": "^1.0.0",
22
- "@sap/cds": ">=7",
22
+ "@sap/cds": "^7 || ^8",
23
23
  "@sap/cds-foss": "^5.0.0",
24
- "@sap/cds-mtxs": ">=1.9.0",
25
- "@sap/eslint-plugin-cds": ">=3.0.1",
24
+ "@sap/cds-mtxs": "^1.9.0 || ^2",
25
+ "@sap/eslint-plugin-cds": "^3.0.1",
26
26
  "@sap/hdi-deploy": "^5",
27
27
  "axios": "^1",
28
28
  "eslint": "^9",