@sap/cds-dk 7.3.2 → 7.4.0
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/bin/build.js +22 -13
- package/bin/cds.js +3 -3
- package/bin/migrate.js +2 -2
- package/bin/repl.js +0 -2
- package/bin/subscribe.js +10 -5
- package/bin/unsubscribe.js +10 -5
- package/bin/upgrade.js +10 -5
- package/bin/watch.js +5 -0
- package/bin/watched.js +1 -1
- package/lib/build/buildTaskFactory.js +1 -1
- package/lib/build/constants.js +1 -0
- package/lib/build/provider/hana/2migration.js +4 -4
- package/lib/build/provider/hana/index.js +20 -10
- package/lib/build/provider/java/index.js +2 -2
- package/lib/build/provider/nodejs/index.js +74 -54
- package/lib/client/auth_manager.js +1 -1
- package/lib/client/pull.js +9 -1
- package/lib/compile/asyncapi/components/schemas/annotations.js +20 -0
- package/lib/compile/openapi/csdl2openapi.js +3 -3
- package/lib/index.js +5 -3
- package/lib/init/constants.js +1 -3
- package/lib/init/index.js +9 -4
- package/lib/init/template/approuter/files/package.json +1 -1
- package/lib/init/template/hana/files/db/package.json +1 -1
- package/lib/init/template/multitenancy/index.js +3 -5
- package/lib/init/template/postgres/index.js +4 -3
- package/lib/init/template/templateBase.js +0 -13
- package/npm-shrinkwrap.json +306 -299
- package/package.json +1 -1
|
@@ -479,7 +479,7 @@ module.exports.csdl2openapi = function (
|
|
|
479
479
|
if (description) tag.description = description;
|
|
480
480
|
tags.push(tag);
|
|
481
481
|
})
|
|
482
|
-
return tags.sort(function(pre, next){return pre.name.localeCompare(next.name)});
|
|
482
|
+
return tags.sort(function (pre, next) { return pre.name.localeCompare(next.name) });
|
|
483
483
|
}
|
|
484
484
|
|
|
485
485
|
/**
|
|
@@ -655,7 +655,7 @@ module.exports.csdl2openapi = function (
|
|
|
655
655
|
schema: ref(element.$Type, SUFFIX.create),
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
|
-
},
|
|
658
|
+
},
|
|
659
659
|
responses: response(201, 'Created ' + lname, { $Type: element.$Type }, insertRestrictions.ErrorResponses, !countRestrictions),
|
|
660
660
|
};
|
|
661
661
|
if (insertRestrictions.LongDescription) pathItem.post.description = insertRestrictions.LongDescription;
|
|
@@ -1620,7 +1620,7 @@ see [Expand](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-prot
|
|
|
1620
1620
|
r[code] = {
|
|
1621
1621
|
description: description
|
|
1622
1622
|
};
|
|
1623
|
-
let CountPropertyObj = {[csdl.$Version > '4.0' ? '@count' : '@odata.count']
|
|
1623
|
+
let CountPropertyObj = { [csdl.$Version > '4.0' ? '@count' : '@odata.count']: ref('count') };
|
|
1624
1624
|
if (code != 204) {
|
|
1625
1625
|
const s = getSchema(type);
|
|
1626
1626
|
r[code].content = {
|
package/lib/index.js
CHANGED
|
@@ -19,13 +19,15 @@ if (cds.compile.to.constructor.name === 'Object') { // not a class as in cds 7
|
|
|
19
19
|
cds.compile.to.xsuaa = require('./compile/to-xsuaa')
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
cds
|
|
22
|
+
// add overlay4 method to cds.schema to retrieve schema with cds-dk features
|
|
23
|
+
// schema is cds version specific; add cds-dk parts not present in cds, e.g. build
|
|
24
|
+
// failsafe for legacy cds without schema.constructor
|
|
25
|
+
cds.extend(cds.schema?.constructor || {}).with(class {
|
|
24
26
|
get overlay4() { return super.overlay4 = require('./env/schema') }
|
|
25
27
|
})
|
|
26
28
|
|
|
27
29
|
// set build API, potentially removing the old API facade from sap/cds 7
|
|
28
|
-
delete cds.__proto__?.build
|
|
30
|
+
// delete cds.__proto__?.build //> not required, as its overriden below anyways
|
|
29
31
|
cds.extend (cds.constructor) .with (class {
|
|
30
32
|
get build() { return super.build = require('./build') }
|
|
31
33
|
})
|
package/lib/init/constants.js
CHANGED
|
@@ -4,7 +4,7 @@ module.exports = {
|
|
|
4
4
|
COMMAND_INIT: 'init',
|
|
5
5
|
COMMAND_ADD: 'add',
|
|
6
6
|
|
|
7
|
-
MAVEN_ARCHETYPE_VERSION: '2.
|
|
7
|
+
MAVEN_ARCHETYPE_VERSION: '2.4.0',
|
|
8
8
|
|
|
9
9
|
OPTIONS: Object.freeze({
|
|
10
10
|
JAVA: 'java',
|
|
@@ -45,8 +45,6 @@ module.exports = {
|
|
|
45
45
|
NOTIFICATIONS: 'notifications'
|
|
46
46
|
}),
|
|
47
47
|
|
|
48
|
-
PROJECT_TYPE: Object.freeze({ nodejs: 1, java: 2, unknown: 3 }),
|
|
49
|
-
|
|
50
48
|
REGEX_JAVA_PACKAGE: /^[a-z_][a-z0-9_]*(\.[a-z_][a-z0-9_]*)*$/g,
|
|
51
49
|
// copied from mbt error message
|
|
52
50
|
REGEX_JAVA_VERSION: /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$/,
|
package/lib/init/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const { OPTIONS, COMMAND_INIT, PROJECT_FILES, REGEX_PROJECT_NAME } = require('./
|
|
|
6
6
|
const {
|
|
7
7
|
NODEJS, JAVA,
|
|
8
8
|
HANA, APPROUTER, XSUAA, KIBANA, ENTERPRISE_MESSAGING,
|
|
9
|
-
MTA,
|
|
9
|
+
MTA, MULTITENANCY, PIPELINE,
|
|
10
10
|
TINY_SAMPLE, SAMPLE
|
|
11
11
|
} = OPTIONS
|
|
12
12
|
|
|
@@ -23,7 +23,7 @@ module.exports = class CDSGenerator {
|
|
|
23
23
|
default: '',
|
|
24
24
|
target: 'projectName',
|
|
25
25
|
validate: async (value) => {
|
|
26
|
-
try {
|
|
26
|
+
try {
|
|
27
27
|
cds.root = path.resolve(this.cwd, value || '.');
|
|
28
28
|
|
|
29
29
|
await this._validateProjectName(value);
|
|
@@ -74,7 +74,7 @@ module.exports = class CDSGenerator {
|
|
|
74
74
|
default: '',
|
|
75
75
|
choices: [
|
|
76
76
|
{ name: 'Cloud Foundry: MTA Deployment', value: MTA },
|
|
77
|
-
{ name: 'Kyma: Helm Deployment', value: HELM },
|
|
77
|
+
// { name: 'Kyma: Helm Deployment', value: HELM },
|
|
78
78
|
{ name: 'Multitenancy', value: MULTITENANCY },
|
|
79
79
|
{ name: 'CI/CD Pipeline Integration', value: PIPELINE },
|
|
80
80
|
],
|
|
@@ -182,7 +182,11 @@ module.exports = class CDSGenerator {
|
|
|
182
182
|
|
|
183
183
|
if (cds.cli.command === COMMAND_INIT) {
|
|
184
184
|
const relativeProjectPath = path.relative(this.cwd, cds.root)
|
|
185
|
-
|
|
185
|
+
let message = 'Successfully created project.'
|
|
186
|
+
if (relativeProjectPath) {
|
|
187
|
+
message = message + ` Continue with '${term.bold('cd ' + relativeProjectPath)}'.`
|
|
188
|
+
}
|
|
189
|
+
console.log('\n' + message)
|
|
186
190
|
} else {
|
|
187
191
|
console.log(`\nSuccessfully added features to your project.`)
|
|
188
192
|
}
|
|
@@ -219,6 +223,7 @@ module.exports = class CDSGenerator {
|
|
|
219
223
|
// Compat
|
|
220
224
|
if (facet === 'sample-tiny') facet = 'tiny-sample'
|
|
221
225
|
if (facet === 'kibana-logging') facet = 'kibana'
|
|
226
|
+
if (facet === 'postgresql') facet = 'postgres'
|
|
222
227
|
|
|
223
228
|
if (!templates.has(facet)) {
|
|
224
229
|
const template = await this._createTemplate(facet)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
|
-
const {
|
|
3
|
+
const { read, write } = cds.utils
|
|
4
4
|
const { APPROUTER, HANA, KIBANA } = require('../../constants').OPTIONS
|
|
5
5
|
const mvn = require('../../util/mvn')
|
|
6
6
|
const { readProject } = require('../../util/projectReader')
|
|
@@ -17,11 +17,9 @@ const {
|
|
|
17
17
|
module.exports = class MultitenancyTemplate extends require('../templateBase') {
|
|
18
18
|
|
|
19
19
|
static hasFacet(env) {
|
|
20
|
-
// REVISIT: Check if this can be simplified
|
|
21
20
|
const { options } = cds.cli.options
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
exists(join('mtx', 'sidecar')) || false
|
|
21
|
+
// REVISIT: Check if this can be simplified
|
|
22
|
+
return options?.add?.has('mtx') || options?.add?.has('multitenancy') || !!env.requires?.multitenancy || false
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
getRelatedFacets() {
|
|
@@ -3,13 +3,13 @@ const cds = require('../../../cds')
|
|
|
3
3
|
const { read } = cds.utils
|
|
4
4
|
const { readProject } = require('../../util/projectReader')
|
|
5
5
|
const { mergeJSON, mergeYAML } = require('../../util/merge')
|
|
6
|
+
const mvn = require('../../util/mvn')
|
|
6
7
|
const { srvNode4, srvJava4, postgres, postgresDeployer } = require('../_merging/registry-mta')
|
|
7
8
|
|
|
8
9
|
module.exports = class PostgresTemplate extends require('../templateBase') {
|
|
9
10
|
|
|
10
11
|
async canRun() {
|
|
11
|
-
const { hasMta, hasHelm
|
|
12
|
-
if (isJava) throw `'cds add postgres' is not available for Java yet`
|
|
12
|
+
const { hasMta, hasHelm } = await readProject(this.options)
|
|
13
13
|
if (hasHelm && !hasMta) throw `'cds add postgres' is not available for Kyma yet`
|
|
14
14
|
return true
|
|
15
15
|
}
|
|
@@ -20,9 +20,10 @@ module.exports = class PostgresTemplate extends require('../templateBase') {
|
|
|
20
20
|
|
|
21
21
|
async run() {
|
|
22
22
|
const project = await readProject(this.options)
|
|
23
|
-
const { configFile } = project
|
|
23
|
+
const { configFile, isJava } = project
|
|
24
24
|
project.shortcut = !(await read(configFile)).cds?.requires?.db?.kind
|
|
25
25
|
await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), project)
|
|
26
|
+
if (isJava) await mvn.add('postgresql')
|
|
26
27
|
await this.runDependentMerging()
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
const cds = require('../../cds')
|
|
2
|
-
const { exists } = require('../../cds').utils
|
|
3
|
-
const { PROJECT_TYPE } = require('../constants')
|
|
4
2
|
|
|
5
3
|
module.exports = class TemplateBase {
|
|
6
4
|
|
|
@@ -99,15 +97,4 @@ module.exports = class TemplateBase {
|
|
|
99
97
|
*/
|
|
100
98
|
async finalize() {
|
|
101
99
|
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Returns the project type
|
|
105
|
-
* @see PROJECT_TYPE
|
|
106
|
-
* @returns PROJECT_TYPE for current project
|
|
107
|
-
*/
|
|
108
|
-
getProjectType() {
|
|
109
|
-
if (exists('pom.xml')) return PROJECT_TYPE.java;
|
|
110
|
-
if (exists('package.json')) return PROJECT_TYPE.nodejs;
|
|
111
|
-
return PROJECT_TYPE.unknown;
|
|
112
|
-
}
|
|
113
100
|
}
|