@sap/cds-dk 8.7.0 → 8.7.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 +26 -1
- package/bin/cds.js +10 -5
- package/bin/compile/index.js +9 -1
- package/bin/import.js +7 -7
- package/bin/watch.js +7 -6
- package/lib/build/util.js +9 -10
- package/lib/import/common.js +6 -8
- package/lib/import/importapi.js +1 -1
- package/lib/import/odata/ParserContext.js +1 -0
- package/lib/import/odata/v4parser.js +3 -2
- package/lib/init/constants.js +1 -1
- package/lib/init/template/ias/index.js +10 -7
- package/lib/init/template/mta/files/mta.yaml.hbs +1 -4
- package/lib/init/template/multitenancy/index.js +0 -5
- package/lib/init/template/workzone-standard/index.js +0 -7
- package/lib/util/cf.js +19 -8
- package/lib/util/write.js +1 -1
- package/npm-shrinkwrap.json +29 -19
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,31 @@ 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.7.2 - 2024-02-14
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- `cds compile -o` with a file name such as `cds c srv/cat-service.cds -o srv/cat-service.json`.
|
|
15
|
+
- `cds compile` without `-o` doesn't print the file name header for single services any more.
|
|
16
|
+
- `cds add workzone` in combination with multitenancy doesn't throw an error any more.
|
|
17
|
+
- `cds import --from rfc` stores the input file again in `srv/external/<destination>/...` instead of `srv/external/...`.
|
|
18
|
+
- `cds import --name` no longer crashes with a `TypeError`.
|
|
19
|
+
- `cds import --out <filename>` no longer crashes with a `Error: EEXIST`.
|
|
20
|
+
- `BuildError` no longer cuts off its stack.
|
|
21
|
+
- `cds bind -a` doesn't concurrently try to check the Cloud Foundry version or OAuth token.
|
|
22
|
+
- `cds import` now resolves target of association/composition correctly for multiple schema files.
|
|
23
|
+
|
|
24
|
+
## Version 8.7.1 - 2024-02-04
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- `cds add mta` now sets `parameters.instances` explicitly to `1` in Java projects, same as for Node.js projects.
|
|
29
|
+
- `cds add mta` does not add the `readiness-health-check-type` and `readiness-health-check-http-endpoint` properties to the `mta.yaml` any more.
|
|
30
|
+
- `cds add -p` correctly parses plugin-contributed options.
|
|
31
|
+
- `cds watch` correctly escapes its default ignored directories on Windows.
|
|
32
|
+
- `cds compile` correctly uses `--service=all` as its default.
|
|
33
|
+
- `cds add ias` correctly writes MTX sidecar config in combination with `cds add multitenancy`.
|
|
34
|
+
|
|
10
35
|
## Version 8.7.0 - 2025-01-28
|
|
11
36
|
|
|
12
37
|
### Added
|
|
@@ -15,7 +40,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
15
40
|
- `cds import` now updates configuration for Java projects (in `application.yaml` etc.)
|
|
16
41
|
- `cds import --config` now also accepts a string with flat key-value pairs (like `--config "credentials.destination=foo"`), which is easier to write than the current JSON string (`--config "{\"credentials\": {\"destination\": \"foo\"}}"`).
|
|
17
42
|
- `cds debug` now supports Java applications, both local and remote.
|
|
18
|
-
- `cds import` can now import an odata-V4 file with external dependencies(odata-V4 file). Dependencies has to be provided with -d/--dependencies option and must not have any external dependencies.
|
|
43
|
+
- `cds import` can now import an odata-V4 file with external dependencies(odata-V4 file). Dependencies has to be provided with -d/--dependencies option and must not have any external dependencies.
|
|
19
44
|
|
|
20
45
|
### Changed
|
|
21
46
|
|
package/bin/cds.js
CHANGED
|
@@ -63,13 +63,18 @@ const cli = {
|
|
|
63
63
|
if (cmd === 'add') {
|
|
64
64
|
cds.cli = { command: 'add' }
|
|
65
65
|
if (argv.includes('-p') || argv.includes('--package')) {
|
|
66
|
-
const
|
|
66
|
+
const pIndex = argv.indexOf('-p') + 1 || argv.indexOf('--package') + 1
|
|
67
|
+
const p = argv[pIndex]
|
|
67
68
|
console.log(`running with --package, adding dependency ${p}`)
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
try {
|
|
70
|
+
const { execSync } = require('child_process')
|
|
71
|
+
execSync(`npm add ${p}`, { stdio: 'inherit', cwd: cds.root })
|
|
72
|
+
argv.splice(pIndex - 1, 2)
|
|
73
|
+
return execSync(`cds add ${argv.join(' ')}`, { stdio: 'inherit', cwd: cds.root })
|
|
74
|
+
} catch (e) {
|
|
75
|
+
throw e.message
|
|
76
|
+
}
|
|
70
77
|
}
|
|
71
|
-
cds.env.plugins = cds.env.for('cds').plugins // reload plugin env
|
|
72
|
-
cds.add = require('../lib/init/add')
|
|
73
78
|
await cds.plugins
|
|
74
79
|
for (const [, Plugin] of cds.add.registered) {
|
|
75
80
|
const all = Object.entries((new Plugin).options())
|
package/bin/compile/index.js
CHANGED
|
@@ -217,7 +217,15 @@ async function compile_all (root='.') {
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
async function compile (models, options={}) {
|
|
220
|
-
|
|
220
|
+
const { dest } = options
|
|
221
|
+
if (dest) {
|
|
222
|
+
options.service ??= 'all'
|
|
223
|
+
const ext = path.extname(dest)
|
|
224
|
+
if (ext) {
|
|
225
|
+
options.file ??= path.basename(dest, ext)
|
|
226
|
+
options.dest = path.dirname(dest)
|
|
227
|
+
}
|
|
228
|
+
}
|
|
221
229
|
if (options.all) return compile_all (models[0])
|
|
222
230
|
|
|
223
231
|
const { inspect } = require('util')
|
package/bin/import.js
CHANGED
|
@@ -28,7 +28,6 @@ module.exports = Object.assign(_import, {
|
|
|
28
28
|
|
|
29
29
|
*-o | --out* <filename/dirname>
|
|
30
30
|
Skips copying to ./srv/external and writes to the specified location.
|
|
31
|
-
Dirname is only applicable for importing odata-V4 file with dependencies.
|
|
32
31
|
|
|
33
32
|
*- | --dry*
|
|
34
33
|
Writes the converted csn to stdout only.
|
|
@@ -70,7 +69,7 @@ module.exports = Object.assign(_import, {
|
|
|
70
69
|
*-d | --dependencies* <comma-separated list of dependencies>
|
|
71
70
|
Imports the given list of dependencies along with the main file. Valid for OData V4 only.
|
|
72
71
|
The dependencies are written to the given dirname(-o option) or ./srv/external.
|
|
73
|
-
If the cds files of dependencies are already present in the destination, it will be skipped
|
|
72
|
+
If the cds files of dependencies are already present in the destination, it will be skipped
|
|
74
73
|
if -f option is not given.
|
|
75
74
|
NOTE: The dependencies must not have any dependency.
|
|
76
75
|
|
|
@@ -106,7 +105,7 @@ async function _import(args, options = {}) {
|
|
|
106
105
|
const messages = require('../lib/import/message').getMessages();
|
|
107
106
|
const common = require('../lib/import/common');
|
|
108
107
|
const cds = require('../lib/index');
|
|
109
|
-
|
|
108
|
+
|
|
110
109
|
// check if dependencies are provided and import them first
|
|
111
110
|
if (options.dependencies) {
|
|
112
111
|
const dependencies = options.dependencies.split(',');
|
|
@@ -133,10 +132,11 @@ async function _import(args, options = {}) {
|
|
|
133
132
|
input = await common.preProcess(file, options, cwd);
|
|
134
133
|
}
|
|
135
134
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
if (input) {
|
|
136
|
+
const fileType = await common.identifyFile(input);
|
|
137
|
+
if ((options.isDependency || options.isDependent) && fileType !== 'edmx') {
|
|
138
|
+
throw messages.DEPENDENCY_NOT_SUPPORTED;
|
|
139
|
+
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
let csn
|
package/bin/watch.js
CHANGED
|
@@ -75,19 +75,20 @@ const fs = require ('fs')
|
|
|
75
75
|
|
|
76
76
|
const extDefaults = 'cds,csn,csv,ts,mjs,cjs,js,json,properties,edmx,xml,env'
|
|
77
77
|
|
|
78
|
+
const escapedSep = sep === '\\' ? '\\\\' : sep // escape backslash for windows
|
|
78
79
|
const ignoreDefaults = [
|
|
79
80
|
/\.git/,
|
|
80
81
|
/node_modules/,
|
|
81
82
|
/_out/,
|
|
82
83
|
/@types/,
|
|
83
84
|
/@cds-models/,
|
|
84
|
-
new RegExp(`app${
|
|
85
|
-
new RegExp(`app${
|
|
86
|
-
new RegExp(`app${
|
|
87
|
-
new RegExp(`app${
|
|
88
|
-
new RegExp(`app${
|
|
85
|
+
new RegExp(`app${escapedSep}.+?${escapedSep}webapp${escapedSep}`),
|
|
86
|
+
new RegExp(`app${escapedSep}.+?${escapedSep}dist${escapedSep}`),
|
|
87
|
+
new RegExp(`app${escapedSep}.+?${escapedSep}target${escapedSep}`),
|
|
88
|
+
new RegExp(`app${escapedSep}.+?${escapedSep}tsconfig\\.json$`),
|
|
89
|
+
new RegExp(`app${escapedSep}.+?${escapedSep}.*\\.tsbuildinfo$`),
|
|
89
90
|
/package-lock\.json$/,
|
|
90
|
-
new RegExp(
|
|
91
|
+
new RegExp(`${escapedSep}gen${escapedSep}`)
|
|
91
92
|
]
|
|
92
93
|
|
|
93
94
|
async function watch ([cwd], {
|
package/lib/build/util.js
CHANGED
|
@@ -207,7 +207,7 @@ async function getWorkspaces(wsRoot, resolve = false, devDependencies = true) {
|
|
|
207
207
|
// read npm workspaces
|
|
208
208
|
const pkgs = await _execNpmWs(wsRoot)
|
|
209
209
|
pkgs.forEach(pkg => {
|
|
210
|
-
// only create tarball archives for dependencies with version '*'
|
|
210
|
+
// only create tarball archives for dependencies with version '*'
|
|
211
211
|
if (!resolve || devDependencies && pgkJson.devDependencies?.[pkg] === '*' || pgkJson.dependencies?.[pkg] === '*') {
|
|
212
212
|
const workspace = _getWorkspace(wsRoot, pkg)
|
|
213
213
|
if (workspace) {
|
|
@@ -240,11 +240,11 @@ function findWorkspaceRoot(currentPath, depth = 0) {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
/**
|
|
243
|
-
* This JavaScript function filterFeaturePaths is used to filter and categorize file paths
|
|
243
|
+
* This JavaScript function filterFeaturePaths is used to filter and categorize file paths
|
|
244
244
|
* from a given model into two categories: base and features.
|
|
245
245
|
* @param {*} model - represents a data model. It's expected to have a $sources property which is an array of file paths.
|
|
246
246
|
* @param {*} modelPaths - an array of file paths.
|
|
247
|
-
* @returns
|
|
247
|
+
* @returns
|
|
248
248
|
*/
|
|
249
249
|
function filterFeaturePaths(model, modelPaths) {
|
|
250
250
|
const ftsName = path.dirname(cds.env.features.folders || 'fts/*')
|
|
@@ -278,8 +278,8 @@ function filterFeaturePaths(model, modelPaths) {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
/**
|
|
281
|
-
* Read installed npm workspaces using 'npm ls -ws --json'.
|
|
282
|
-
* @returns {Array} list of package paths, or an empty array if either
|
|
281
|
+
* Read installed npm workspaces using 'npm ls -ws --json'.
|
|
282
|
+
* @returns {Array} list of package paths, or an empty array if either
|
|
283
283
|
* no workspaces are defined or have not been installed.
|
|
284
284
|
*/
|
|
285
285
|
async function _execNpmWs(wsRoot) {
|
|
@@ -331,7 +331,7 @@ function _validateWsDependencies(wsRoot, dependencies, devDependencies) {
|
|
|
331
331
|
/**
|
|
332
332
|
* Returns a flat array of existing files and folders, trailing '/' or '\\' characters have been removed.
|
|
333
333
|
* @param {Array} modelPaths array of files and folders - optionally nested
|
|
334
|
-
* @returns
|
|
334
|
+
* @returns
|
|
335
335
|
*/
|
|
336
336
|
function _filterModelPaths(modelPaths, filter) {
|
|
337
337
|
const model = new Set()
|
|
@@ -424,7 +424,7 @@ class BuildMessage {
|
|
|
424
424
|
* @param {string} message The message text
|
|
425
425
|
* @param {string} [severity='Error'] Severity: Debug, Info, Warning, Error
|
|
426
426
|
* @param {any} location Location of the message
|
|
427
|
-
*
|
|
427
|
+
*
|
|
428
428
|
* @memberOf BuildMessage
|
|
429
429
|
*/
|
|
430
430
|
constructor(message, severity = SEVERITY_ERROR, location) {
|
|
@@ -439,9 +439,9 @@ class BuildMessage {
|
|
|
439
439
|
}
|
|
440
440
|
|
|
441
441
|
/**
|
|
442
|
-
* Class for combined build and compiler errors.
|
|
442
|
+
* Class for combined build and compiler errors.
|
|
443
443
|
* Additional members:
|
|
444
|
-
* messages:
|
|
444
|
+
* messages: array of detailed build messages
|
|
445
445
|
* @class BuildError
|
|
446
446
|
* @extends {Error}
|
|
447
447
|
*/
|
|
@@ -450,7 +450,6 @@ class BuildError extends Error {
|
|
|
450
450
|
super(message)
|
|
451
451
|
this.name = "BuildError"
|
|
452
452
|
this.messages = Array.isArray(messages) ? messages : [messages]
|
|
453
|
-
this.stack = ""
|
|
454
453
|
}
|
|
455
454
|
|
|
456
455
|
// for compatibility reasons
|
package/lib/import/common.js
CHANGED
|
@@ -444,13 +444,8 @@ function _findPackageJson(dir, cwd) {
|
|
|
444
444
|
|
|
445
445
|
async function postProcess(filePath, options, csn, cwd) {
|
|
446
446
|
const services = _getServiceNames(csn);
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
if (options.isDependency || options.isDependent) {
|
|
450
|
-
destFilePath = path.resolve(cwd, options.out ? path.join(options.out, path.basename(filePath)) : path.join(cds.env.folders.srv, 'external', path.basename(filePath)));
|
|
451
|
-
} else {
|
|
452
|
-
destFilePath = path.resolve(cwd, options.out ? path.join(path.dirname(options.out), path.basename(filePath)) : path.join(cds.env.folders.srv, 'external', path.basename(filePath)));
|
|
453
|
-
}
|
|
447
|
+
const out = options.out || path.join(cds.env.folders.srv, 'external');
|
|
448
|
+
let destFilePath = path.resolve(cwd, path.join(out, path.basename(filePath)));
|
|
454
449
|
|
|
455
450
|
if (options.out) {
|
|
456
451
|
options.out = _validateAndComputeOutputFilePath(options.out, options.as, destFilePath);
|
|
@@ -465,7 +460,7 @@ async function postProcess(filePath, options, csn, cwd) {
|
|
|
465
460
|
const kind = options.inputFileKind;
|
|
466
461
|
let result;
|
|
467
462
|
try {
|
|
468
|
-
result = await _getResult(csn, options.as, options.out || destFilePath.replace(/\.[^.]+$/, ''), options.force, kind, options.isDependent);
|
|
463
|
+
result = await _getResult(csn, options.as, options.out || destFilePath.replace(/\.[^.]+$/, ''), options.force, kind, options.isDependent);
|
|
469
464
|
} catch (error) {
|
|
470
465
|
if (options.isDependency && error.message === messages.FILE_MODIFIED) {
|
|
471
466
|
return console.log(info(`[cds] - skipping import of ${path.basename(filePath)} as it is already imported`));
|
|
@@ -476,6 +471,9 @@ async function postProcess(filePath, options, csn, cwd) {
|
|
|
476
471
|
|
|
477
472
|
const [serviceCsn, csnFile] = result;
|
|
478
473
|
|
|
474
|
+
// destFilePath might be wrongly computed and contain the csn file name in the path. Fix it here.
|
|
475
|
+
destFilePath = destFilePath.replace(csnFile, path.dirname(csnFile));
|
|
476
|
+
|
|
479
477
|
if (!options.dry && !options.no_save) {
|
|
480
478
|
if (cds.env['project-nature'] === 'java') {
|
|
481
479
|
await _updateJavaConfig(kind, services, csn, options)
|
package/lib/import/importapi.js
CHANGED
|
@@ -28,7 +28,7 @@ module.exports = Object.assign(cds_import, {
|
|
|
28
28
|
*/
|
|
29
29
|
async function cds_import(filepath, options = { keepNamespace: false }) {
|
|
30
30
|
// identifies the file and calls the respective api
|
|
31
|
-
let fileType = await common.identifyFile(filepath);
|
|
31
|
+
let fileType = filepath && await common.identifyFile(filepath);
|
|
32
32
|
|
|
33
33
|
let csn;
|
|
34
34
|
switch (fileType) {
|
|
@@ -37,6 +37,7 @@ module.exports = class ParserContext {
|
|
|
37
37
|
this.primarySchema = "";
|
|
38
38
|
this.schemaAliasToNamespace = {};
|
|
39
39
|
this.schemaToSchemaDataIndex = {};
|
|
40
|
+
this.schemaToPrimarySchema = {};
|
|
40
41
|
this.vocabNamespaceToAlias = {};
|
|
41
42
|
this.entityToBoundActions = {};
|
|
42
43
|
this.entityToBoundFunctions = {};
|
|
@@ -641,11 +641,11 @@ function _parseAssociationProperty(foreignReference, associationNode, parserCont
|
|
|
641
641
|
if (entityTypeMapping.length > 1) {
|
|
642
642
|
for (let j = 0; j < entityTypeMapping.length; j++) {
|
|
643
643
|
if (entityTypeMapping[j] === foreignReference) {
|
|
644
|
-
associationProperty.target = schemaName + '.' + entityTypeMapping[j];
|
|
644
|
+
associationProperty.target = parserContext.schemaToPrimarySchema[schemaName] + '.' + entityTypeMapping[j];
|
|
645
645
|
}
|
|
646
646
|
}
|
|
647
647
|
} else {
|
|
648
|
-
associationProperty.target = schemaName + '.' + entityTypeMapping;
|
|
648
|
+
associationProperty.target = parserContext.schemaToPrimarySchema[schemaName] + '.' + entityTypeMapping;
|
|
649
649
|
}
|
|
650
650
|
} else {
|
|
651
651
|
associationProperty.target = resolvedEntityName;
|
|
@@ -1554,6 +1554,7 @@ function _preProcess(edmxAsJson, parserContext, importerContext) {
|
|
|
1554
1554
|
parserContext.schemaAliasToNamespace[schemaData.$Alias] = schemaName;
|
|
1555
1555
|
}
|
|
1556
1556
|
parserContext.schemaToSchemaDataIndex[schemaName] = indexOfSchema;
|
|
1557
|
+
parserContext.schemaToPrimarySchema[schemaName] = parserContext.primarySchema;
|
|
1557
1558
|
indexOfSchema++;
|
|
1558
1559
|
}
|
|
1559
1560
|
// if mock server use case & traversing primary schema, collect relevant mappings
|
package/lib/init/constants.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { readProject } = require('../../projectReader')
|
|
2
|
-
const { merge } = require('../../merge')
|
|
2
|
+
const { merge, sort } = require('../../merge')
|
|
3
3
|
const { srv4, approuter, mtxSidecar4 } = require('../../registries/mta')
|
|
4
4
|
const cds = require('../../../cds')
|
|
5
5
|
const { read, write } = cds.utils
|
|
@@ -20,8 +20,9 @@ module.exports = class IasTemplate extends require('../../plugin') {
|
|
|
20
20
|
|
|
21
21
|
async run() {
|
|
22
22
|
const project = readProject()
|
|
23
|
-
const { configFile } = project
|
|
23
|
+
const { configFile, isNodejs } = project
|
|
24
24
|
await merge(__dirname, 'files/package.json.hbs').into(configFile, { project, forceOverwrite: true })
|
|
25
|
+
if (isNodejs) await sort('package.json', 'dependencies')
|
|
25
26
|
if (project.hasMultitenancy) {
|
|
26
27
|
await merge(__dirname, 'files/package.json.hbs').into('mtx/sidecar/package.json', { project, forceOverwrite: true })
|
|
27
28
|
}
|
|
@@ -33,11 +34,13 @@ module.exports = class IasTemplate extends require('../../plugin') {
|
|
|
33
34
|
const { isJava, hasMta, hasCfManifest, hasHelm, hasHelmUnifiedRuntime, hasApprouter, hasMultitenancy, srvPath } = project
|
|
34
35
|
|
|
35
36
|
if (hasMultitenancy) {
|
|
36
|
-
const conf = (await read('mtx/sidecar/package.json'))
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
37
|
+
const conf = (await read('mtx/sidecar/package.json')) ?? {}
|
|
38
|
+
conf.cds ??= {}
|
|
39
|
+
const profile = conf.cds.profile
|
|
40
|
+
if (profile) delete conf.cds.profile
|
|
41
|
+
conf.cds.profiles ??= profile ? [profile] : []
|
|
42
|
+
if (!conf.cds.profiles.includes('subscription-manager')) {
|
|
43
|
+
conf.cds.profiles.push('subscription-manager')
|
|
41
44
|
}
|
|
42
45
|
await write('mtx/sidecar/package.json', conf, { spaces: 2 })
|
|
43
46
|
}
|
|
@@ -21,16 +21,13 @@ modules:
|
|
|
21
21
|
parameters:
|
|
22
22
|
instances: 1
|
|
23
23
|
buildpack: nodejs_buildpack
|
|
24
|
-
readiness-health-check-type: http
|
|
25
|
-
readiness-health-check-http-endpoint: /health
|
|
26
24
|
build-parameters:
|
|
27
25
|
builder: npm-ci
|
|
28
26
|
{{/isNodejs}}
|
|
29
27
|
{{#isJava}}
|
|
30
28
|
parameters:
|
|
29
|
+
instances: 1
|
|
31
30
|
buildpack: sap_java_buildpack_jakarta
|
|
32
|
-
readiness-health-check-type: http
|
|
33
|
-
readiness-health-check-http-endpoint: /actuator/health/readiness
|
|
34
31
|
properties:
|
|
35
32
|
SPRING_PROFILES_ACTIVE: cloud,sandbox
|
|
36
33
|
JBP_CONFIG_COMPONENTS: "jres: ['com.sap.xs.java.buildpack.jre.SAPMachineJRE']"
|
|
@@ -24,11 +24,6 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
|
|
|
24
24
|
return options?.add?.has('mtx') || options?.add?.has('multitenancy') || !!env.requires?.multitenancy || false
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
canRun() {
|
|
28
|
-
if (cds.requires.workzone) throw `There is no 'cds add multitenancy' support for SAP BTP WorkZone yet.`
|
|
29
|
-
return true
|
|
30
|
-
}
|
|
31
|
-
|
|
32
27
|
async run() {
|
|
33
28
|
const project = readProject()
|
|
34
29
|
const { isNodejs, isJava, configFile } = project
|
|
@@ -19,13 +19,6 @@ module.exports = class extends require('../../plugin') {
|
|
|
19
19
|
return !!env.requires?.workzone || cds.cli.options.add.has('workzone-standard')
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
canRun() {
|
|
23
|
-
if (cds.requires.multitenancy) {
|
|
24
|
-
throw `SAP BTP Work Zone, Standard Edition does not support multitenancy yet.`
|
|
25
|
-
}
|
|
26
|
-
return true
|
|
27
|
-
}
|
|
28
|
-
|
|
29
22
|
async run() {
|
|
30
23
|
const project = readProject()
|
|
31
24
|
const { appUIPaths, appPath } = project
|
package/lib/util/cf.js
CHANGED
|
@@ -44,7 +44,7 @@ module.exports = new class CfUtil {
|
|
|
44
44
|
args = args.map(arg => arg.replace(/"/g, '\\"'));
|
|
45
45
|
const cmdLine = `${CF_COMMAND} "${args.join('" "')}"`;
|
|
46
46
|
DEBUG?.time(cmdLine);
|
|
47
|
-
|
|
47
|
+
DEBUG?.('>>>', cmdLine);
|
|
48
48
|
|
|
49
49
|
try {
|
|
50
50
|
const result = await execAsync(cmdLine, {
|
|
@@ -146,13 +146,21 @@ module.exports = new class CfUtil {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
#token
|
|
149
150
|
async _getCfAuthorization() {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
if (this.#token) return this.#token
|
|
152
|
+
if (!this._tokenPromise) {
|
|
153
|
+
this._tokenPromise = this.cfRun('oauth-token')
|
|
154
|
+
.then(result => {
|
|
155
|
+
this.#token = result.stdout
|
|
156
|
+
return this.#token
|
|
157
|
+
})
|
|
158
|
+
.catch(err => {
|
|
159
|
+
this._tokenPromise = null
|
|
160
|
+
throw err.message
|
|
161
|
+
})
|
|
155
162
|
}
|
|
163
|
+
return this._tokenPromise
|
|
156
164
|
}
|
|
157
165
|
|
|
158
166
|
async getCfTarget() {
|
|
@@ -163,7 +171,10 @@ module.exports = new class CfUtil {
|
|
|
163
171
|
return target;
|
|
164
172
|
}
|
|
165
173
|
|
|
174
|
+
#checkedVersion = false
|
|
166
175
|
async _checkCliVersion() {
|
|
176
|
+
if (this.#checkedVersion) return
|
|
177
|
+
this.#checkedVersion = true
|
|
167
178
|
const result = await this.cfRun('-v');
|
|
168
179
|
const version = result?.stdout?.match(/version.*(\d+\.\d+\.\d+)/i)
|
|
169
180
|
if (parseInt(version?.[1]) < CF_CLIENT_MINIMUM_VERSION) {
|
|
@@ -358,7 +369,7 @@ Deployment will stop in the near future for Cloud Foundry client versions < ${CF
|
|
|
358
369
|
async getOrCreateServiceKey(serviceInstance, serviceKeyName, parameters, { silent = false, create = true } = {}) {
|
|
359
370
|
const serviceKey = await this._getServiceKey(serviceInstance, serviceKeyName, false);
|
|
360
371
|
if (serviceKey || !create) {
|
|
361
|
-
if (serviceKey && !silent)
|
|
372
|
+
if (serviceKey && !silent) DEBUG?.(`getting service key ${bold(serviceKeyName)}`);
|
|
362
373
|
return serviceKey;
|
|
363
374
|
}
|
|
364
375
|
|
|
@@ -389,4 +400,4 @@ Deployment will stop in the near future for Cloud Foundry client versions < ${CF
|
|
|
389
400
|
|
|
390
401
|
throw `Could not create service key ${bold(serviceKeyName)}`;
|
|
391
402
|
}
|
|
392
|
-
}
|
|
403
|
+
}
|
package/lib/util/write.js
CHANGED
|
@@ -88,7 +88,7 @@ function _write (content, /*to:*/ dest, _many) { // NOSONAR
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
file = path.resolve (cds.root,file)
|
|
91
|
-
// write to the target file, creating parent folders if
|
|
91
|
+
// write to the target file, creating parent folders if necessary
|
|
92
92
|
return mkdirp (dirname(file))
|
|
93
93
|
.then (()=> fs.writeFile (file, typeof content === 'string' ? content : JSON.stringify (content, null, 2)))
|
|
94
94
|
.then (()=> dest.foreach && dest.foreach(file))
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap/cds-dk",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@sap/cds-dk",
|
|
9
|
-
"version": "8.7.
|
|
9
|
+
"version": "8.7.2",
|
|
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.17.
|
|
46
|
+
"version": "1.17.2",
|
|
47
47
|
"license": "SEE LICENSE",
|
|
48
48
|
"optional": true,
|
|
49
49
|
"dependencies": {
|
|
@@ -109,10 +109,10 @@
|
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
"node_modules/@eslint/config-array": {
|
|
112
|
-
"version": "0.19.
|
|
112
|
+
"version": "0.19.2",
|
|
113
113
|
"license": "Apache-2.0",
|
|
114
114
|
"dependencies": {
|
|
115
|
-
"@eslint/object-schema": "^2.1.
|
|
115
|
+
"@eslint/object-schema": "^2.1.6",
|
|
116
116
|
"debug": "^4.3.1",
|
|
117
117
|
"minimatch": "^3.1.2"
|
|
118
118
|
},
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"node_modules/@eslint/core": {
|
|
124
|
-
"version": "0.
|
|
124
|
+
"version": "0.11.0",
|
|
125
125
|
"license": "Apache-2.0",
|
|
126
126
|
"dependencies": {
|
|
127
127
|
"@types/json-schema": "^7.0.15"
|
|
@@ -152,14 +152,14 @@
|
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
154
|
"node_modules/@eslint/js": {
|
|
155
|
-
"version": "9.
|
|
155
|
+
"version": "9.20.0",
|
|
156
156
|
"license": "MIT",
|
|
157
157
|
"engines": {
|
|
158
158
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
161
|
"node_modules/@eslint/object-schema": {
|
|
162
|
-
"version": "2.1.
|
|
162
|
+
"version": "2.1.6",
|
|
163
163
|
"license": "Apache-2.0",
|
|
164
164
|
"engines": {
|
|
165
165
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
@@ -176,6 +176,16 @@
|
|
|
176
176
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
177
177
|
}
|
|
178
178
|
},
|
|
179
|
+
"node_modules/@eslint/plugin-kit/node_modules/@eslint/core": {
|
|
180
|
+
"version": "0.10.0",
|
|
181
|
+
"license": "Apache-2.0",
|
|
182
|
+
"dependencies": {
|
|
183
|
+
"@types/json-schema": "^7.0.15"
|
|
184
|
+
},
|
|
185
|
+
"engines": {
|
|
186
|
+
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
179
189
|
"node_modules/@humanfs/core": {
|
|
180
190
|
"version": "0.19.1",
|
|
181
191
|
"license": "Apache-2.0",
|
|
@@ -228,7 +238,7 @@
|
|
|
228
238
|
}
|
|
229
239
|
},
|
|
230
240
|
"node_modules/@sap/cds": {
|
|
231
|
-
"version": "8.7.
|
|
241
|
+
"version": "8.7.2",
|
|
232
242
|
"license": "SEE LICENSE IN LICENSE",
|
|
233
243
|
"dependencies": {
|
|
234
244
|
"@sap/cds-compiler": ">=5.1",
|
|
@@ -258,7 +268,7 @@
|
|
|
258
268
|
}
|
|
259
269
|
},
|
|
260
270
|
"node_modules/@sap/cds-compiler": {
|
|
261
|
-
"version": "5.7.
|
|
271
|
+
"version": "5.7.4",
|
|
262
272
|
"license": "SEE LICENSE IN LICENSE",
|
|
263
273
|
"dependencies": {
|
|
264
274
|
"antlr4": "4.9.3"
|
|
@@ -294,7 +304,7 @@
|
|
|
294
304
|
}
|
|
295
305
|
},
|
|
296
306
|
"node_modules/@sap/cds-mtxs": {
|
|
297
|
-
"version": "2.5.
|
|
307
|
+
"version": "2.5.1",
|
|
298
308
|
"license": "SEE LICENSE IN LICENSE",
|
|
299
309
|
"dependencies": {
|
|
300
310
|
"@sap/hdi-deploy": ">=4",
|
|
@@ -626,7 +636,7 @@
|
|
|
626
636
|
}
|
|
627
637
|
},
|
|
628
638
|
"node_modules/call-bind-apply-helpers": {
|
|
629
|
-
"version": "1.0.
|
|
639
|
+
"version": "1.0.2",
|
|
630
640
|
"license": "MIT",
|
|
631
641
|
"dependencies": {
|
|
632
642
|
"es-errors": "^1.3.0",
|
|
@@ -906,15 +916,15 @@
|
|
|
906
916
|
}
|
|
907
917
|
},
|
|
908
918
|
"node_modules/eslint": {
|
|
909
|
-
"version": "9.
|
|
919
|
+
"version": "9.20.1",
|
|
910
920
|
"license": "MIT",
|
|
911
921
|
"dependencies": {
|
|
912
922
|
"@eslint-community/eslint-utils": "^4.2.0",
|
|
913
923
|
"@eslint-community/regexpp": "^4.12.1",
|
|
914
924
|
"@eslint/config-array": "^0.19.0",
|
|
915
|
-
"@eslint/core": "^0.
|
|
925
|
+
"@eslint/core": "^0.11.0",
|
|
916
926
|
"@eslint/eslintrc": "^3.2.0",
|
|
917
|
-
"@eslint/js": "9.
|
|
927
|
+
"@eslint/js": "9.20.0",
|
|
918
928
|
"@eslint/plugin-kit": "^0.2.5",
|
|
919
929
|
"@humanfs/node": "^0.16.6",
|
|
920
930
|
"@humanwhocodes/module-importer": "^1.0.1",
|
|
@@ -1443,7 +1453,7 @@
|
|
|
1443
1453
|
}
|
|
1444
1454
|
},
|
|
1445
1455
|
"node_modules/import-fresh": {
|
|
1446
|
-
"version": "3.3.
|
|
1456
|
+
"version": "3.3.1",
|
|
1447
1457
|
"license": "MIT",
|
|
1448
1458
|
"dependencies": {
|
|
1449
1459
|
"parent-module": "^1.0.0",
|
|
@@ -1699,7 +1709,7 @@
|
|
|
1699
1709
|
"license": "MIT"
|
|
1700
1710
|
},
|
|
1701
1711
|
"node_modules/node-abi": {
|
|
1702
|
-
"version": "3.
|
|
1712
|
+
"version": "3.74.0",
|
|
1703
1713
|
"license": "MIT",
|
|
1704
1714
|
"optional": true,
|
|
1705
1715
|
"dependencies": {
|
|
@@ -1727,7 +1737,7 @@
|
|
|
1727
1737
|
}
|
|
1728
1738
|
},
|
|
1729
1739
|
"node_modules/object-inspect": {
|
|
1730
|
-
"version": "1.13.
|
|
1740
|
+
"version": "1.13.4",
|
|
1731
1741
|
"license": "MIT",
|
|
1732
1742
|
"engines": {
|
|
1733
1743
|
"node": ">= 0.4"
|
|
@@ -2012,7 +2022,7 @@
|
|
|
2012
2022
|
"license": "ISC"
|
|
2013
2023
|
},
|
|
2014
2024
|
"node_modules/semver": {
|
|
2015
|
-
"version": "7.
|
|
2025
|
+
"version": "7.7.1",
|
|
2016
2026
|
"license": "ISC",
|
|
2017
2027
|
"bin": {
|
|
2018
2028
|
"semver": "bin/semver.js"
|