@sap/cds-dk 8.9.0 → 8.9.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 +9 -0
- package/lib/build/buildTaskEngine.js +3 -1
- package/lib/init/constants.js +1 -1
- package/lib/init/projectReader.js +1 -1
- package/lib/init/template/http/index.js +10 -7
- package/lib/init/template/nodejs/files/package.json.hbs +1 -1
- package/lib/init/template/typescript/files/package.json +1 -1
- package/lib/init/validate.js +1 -0
- package/lib/lint/Linter.js +19 -0
- package/npm-shrinkwrap.json +20 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ 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.1 - 2025-04-04
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- `cds build` restores compatibility with `@sap/cds` 7, no more crashing there with `TypeError: Cannot read properties of undefined (reading 'enabled')`.
|
|
15
|
+
- `cds add containerize` works if run before `cds add helm`.
|
|
16
|
+
- `cds add http` no longer writes headers starting with a placeholder (IntelliJ compatibility)
|
|
17
|
+
- `cds init --force` overwrites existing files.
|
|
18
|
+
|
|
10
19
|
## Version 8.9.0 - 2025-03-31
|
|
11
20
|
|
|
12
21
|
### Added
|
|
@@ -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
|
|
37
|
+
}, { depth: 11, colors, compact: 3, breakLength: 250 }))
|
|
36
38
|
|
|
37
39
|
DEBUG?.("cds configuration settings:")
|
|
38
40
|
DEBUG?.(redactCredentials(cds.env))
|
package/lib/init/constants.js
CHANGED
|
@@ -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
|
|
|
@@ -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,
|
|
136
|
+
let [hostname, username, password] = await this.#getHostnameAndAuth(service, csn)
|
|
137
137
|
let requests = []
|
|
138
138
|
if (!cds.cli.options.dry || !varsDefined) {
|
|
139
|
-
|
|
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
|
|
143
|
-
const
|
|
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
|
|
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
|
-
|
|
220
|
-
|
|
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) {
|
package/lib/init/validate.js
CHANGED
|
@@ -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) {
|
package/lib/lint/Linter.js
CHANGED
|
@@ -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) {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap/cds-dk",
|
|
3
|
-
"version": "8.9.
|
|
3
|
+
"version": "8.9.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@sap/cds-dk",
|
|
9
|
-
"version": "8.9.
|
|
9
|
+
"version": "8.9.1",
|
|
10
10
|
"license": "SEE LICENSE IN LICENSE",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@cap-js/asyncapi": "^1.0.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"node_modules/@cap-js/db-service": {
|
|
46
|
-
"version": "1.
|
|
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.
|
|
67
|
+
"version": "1.10.0",
|
|
68
68
|
"license": "SEE LICENSE",
|
|
69
69
|
"optional": true,
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@cap-js/db-service": "^1.
|
|
71
|
+
"@cap-js/db-service": "^1.19.0",
|
|
72
72
|
"better-sqlite3": "^11.0.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"node_modules/@eslint/config-helpers": {
|
|
124
|
-
"version": "0.2.
|
|
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"
|
|
@@ -173,16 +173,26 @@
|
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
175
|
"node_modules/@eslint/plugin-kit": {
|
|
176
|
-
"version": "0.2.
|
|
176
|
+
"version": "0.2.8",
|
|
177
177
|
"license": "Apache-2.0",
|
|
178
178
|
"dependencies": {
|
|
179
|
-
"@eslint/core": "^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.
|
|
248
|
+
"version": "8.9.1",
|
|
239
249
|
"license": "SEE LICENSE IN LICENSE",
|
|
240
250
|
"dependencies": {
|
|
241
251
|
"@sap/cds-compiler": ">=5.1",
|
|
@@ -280,7 +290,7 @@
|
|
|
280
290
|
}
|
|
281
291
|
},
|
|
282
292
|
"node_modules/@sap/cds-fiori": {
|
|
283
|
-
"version": "1.4.
|
|
293
|
+
"version": "1.4.1",
|
|
284
294
|
"license": "SEE LICENSE IN LICENSE",
|
|
285
295
|
"peerDependencies": {
|
|
286
296
|
"@sap/cds": ">=7.6",
|