@sap/cds-dk 10.0.5 → 10.0.7
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 +28 -0
- package/bin/export.js +1 -1
- package/bin/version.js +7 -3
- package/lib/build/plugins/hana/index.js +19 -2
- package/lib/import/asyncapi/parserContext.js +136 -54
- package/lib/init/projectReader.js +4 -2
- package/lib/init/template/ams/files/package.json.hbs +1 -1
- package/lib/init/template/nodejs/index.js +4 -2
- package/lib/init/template/test/files/test/test.xs.hbs +3 -2
- package/lib/init/template/xsuaa/index.js +11 -7
- package/node_modules/@cap-js/openapi/lib/compile/csdl.js +3 -3
- package/node_modules/@cap-js/openapi/lib/compile/csdl2openapi.js +111 -103
- package/node_modules/@cap-js/openapi/lib/compile/diagram.js +4 -4
- package/node_modules/@cap-js/openapi/lib/compile/types.d.ts +3 -1
- package/node_modules/@cap-js/openapi/package.json +3 -3
- package/node_modules/@sap/cds/CHANGELOG.md +16 -0
- package/node_modules/@sap/cds/lib/compile/for/nodejs.js +1 -0
- package/node_modules/@sap/cds/lib/env/defaults.js +1 -0
- package/node_modules/@sap/cds/lib/plugins.js +4 -2
- package/node_modules/@sap/cds/lib/srv/srv-handlers.js +1 -1
- package/node_modules/@sap/cds/libx/_runtime/common/Service.js +1 -1
- package/node_modules/@sap/cds/libx/_runtime/messaging/common-utils/authorizedRequest.js +3 -2
- package/node_modules/@sap/cds/libx/_runtime/remote/Service.js +1 -1
- package/node_modules/@sap/cds/package.json +1 -1
- package/node_modules/@sap/cds-compiler/CHANGELOG.md +12 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/populate.js +1 -0
- package/node_modules/@sap/cds-compiler/lib/compiler/resolve.js +1 -1
- package/node_modules/@sap/cds-compiler/lib/model/csnUtils.js +13 -8
- package/node_modules/@sap/cds-compiler/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/CHANGELOG.md +36 -0
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx-migrate.js +32 -48
- package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +1 -0
- package/node_modules/@sap/cds-mtxs/cds-plugin.js +18 -0
- package/node_modules/@sap/cds-mtxs/lib/migration/migration.js +3 -408
- package/node_modules/@sap/cds-mtxs/package.json +1 -1
- package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +5 -6
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/annotations.js +5 -2
- package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/index.js +6 -5
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.cds +0 -11
- package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +12 -22
- package/node_modules/@sap/cds-mtxs/srv/jobs-service.js +30 -24
- package/node_modules/@sap/cds-mtxs/srv/model-provider.js +2 -2
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +5 -2
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/hdi.js +5 -3
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/srv-mgr.js +3 -2
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana/tms.js +17 -0
- package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +14 -13
- package/node_modules/media-typer/README.md +15 -14
- package/node_modules/media-typer/index.js +0 -8
- package/node_modules/media-typer/package.json +16 -12
- package/node_modules/sax/lib/sax.js +27 -9
- package/node_modules/sax/package.json +1 -1
- package/node_modules/ws/package.json +1 -1
- package/package.json +4 -4
- package/lib/init/template/nodejs/files/.gitignore.hbs +0 -34
- package/node_modules/@sap/cds-mtxs/lib/migration/extension-project-builder.js +0 -129
- package/node_modules/@sap/cds-mtxs/lib/migration/extension-project.js +0 -89
- package/node_modules/@sap/cds-mtxs/lib/migration/mtx-adapter.js +0 -230
|
@@ -6,7 +6,7 @@ const { isIdentifier, nameParts } = require('./csdl');
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Diagram representation of property cardinality
|
|
9
|
-
* @param {
|
|
9
|
+
* @param {*} typedElement Typed model element, e.g. property
|
|
10
10
|
* @return {string} cardinality
|
|
11
11
|
*/
|
|
12
12
|
function cardinality(typedElement) {
|
|
@@ -14,7 +14,7 @@ function cardinality(typedElement) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
class Diagram {
|
|
17
|
-
/** @type {
|
|
17
|
+
/** @type {*} */
|
|
18
18
|
#meta
|
|
19
19
|
#comma = ''
|
|
20
20
|
// TODO: make colors configurable
|
|
@@ -26,7 +26,7 @@ class Diagram {
|
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Construct resource diagram using web service at https://yuml.me
|
|
29
|
-
* @param {
|
|
29
|
+
* @param {*} entityContainer Entity Container object
|
|
30
30
|
* @return {string} resource diagram
|
|
31
31
|
*/
|
|
32
32
|
getResourceDiagram(entityContainer) {
|
|
@@ -86,7 +86,7 @@ class Diagram {
|
|
|
86
86
|
/**
|
|
87
87
|
* Diagram representation of action or function overload
|
|
88
88
|
* @param {string} name Name of action or function import
|
|
89
|
-
* @param {
|
|
89
|
+
* @param {*} overload Action or function overload
|
|
90
90
|
* @return diagram part
|
|
91
91
|
*/
|
|
92
92
|
#overloadDiagram(name, overload) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cap-js/openapi",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "CAP tool for OpenAPI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@mermaid-js/mermaid-cli": "^11.12.0",
|
|
39
|
-
"@types/node": "^
|
|
39
|
+
"@types/node": "^26.1.1",
|
|
40
40
|
"eslint": "^10.4.1",
|
|
41
41
|
"globals": "^17.6.0",
|
|
42
|
-
"typescript": "^
|
|
42
|
+
"typescript": "^7.0.2"
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -4,6 +4,22 @@
|
|
|
4
4
|
- The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
5
5
|
- This project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## Version 10.0.5 - 2026-07-28
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Messaging management requests to SAP Event Mesh or Event Mesh in SAP Integration Suite (EMIS) now always send a (possibly empty) body for `PUT`/`POST` requests, as required by EMIS (and compatible with SAP Event Mesh)
|
|
12
|
+
- Only convert `@Common.Text` to `@cds.search` for service entities
|
|
13
|
+
|
|
14
|
+
## Version 10.0.4 - 2026-07-21
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Default language fallbacks for incomplete `i18n` bundles in Java projects
|
|
19
|
+
- `srv.on/before('READ',...)` handlers registered with a cds-typer singular entity proxy were erroneously rewritten to event `each`
|
|
20
|
+
- Asynchronous plugins (exporting a Promise) were not awaited in ESM projects
|
|
21
|
+
- Fixed context propagation for local app and remote service calls
|
|
22
|
+
|
|
7
23
|
## Version 10.0.3 - 2026-07-02
|
|
8
24
|
|
|
9
25
|
### Fixed
|
|
@@ -13,6 +13,7 @@ function _compile_for_nodejs (csn, o) {
|
|
|
13
13
|
// @Common.Text → @cds.search
|
|
14
14
|
text_to_search: for (const name in dsn.definitions) {
|
|
15
15
|
const def = dsn.definitions[name]
|
|
16
|
+
if (!def._service) continue
|
|
16
17
|
if (!def.associations) continue
|
|
17
18
|
|
|
18
19
|
// if any @cds.search.* === true, @Common.Text should be ignored
|
|
@@ -36,9 +36,11 @@ exports.activate = async function (plugins = cds.env?.plugins || exports.fetch()
|
|
|
36
36
|
}
|
|
37
37
|
await Promise.all (all.map (([n,c]) => n in prioritized && _load(n,c)))
|
|
38
38
|
await Promise.all (all.map (([n,c]) => n in prioritized || _load(n,c)))
|
|
39
|
-
function _load (plugin, conf) {
|
|
39
|
+
async function _load (plugin, conf) {
|
|
40
40
|
DEBUG?.log(`[cds.plugins] - loading ${plugin}:`, { impl: local(conf.impl) })
|
|
41
|
-
|
|
41
|
+
const module = await cds.utils._import (conf.impl)
|
|
42
|
+
if (module?.default) await module.default
|
|
43
|
+
return module
|
|
42
44
|
}
|
|
43
45
|
DEBUG?.timeEnd ('[cds.plugins] - loaded plugins in')
|
|
44
46
|
return plugins
|
|
@@ -48,7 +48,7 @@ class EventHandlers {
|
|
|
48
48
|
return srv
|
|
49
49
|
}
|
|
50
50
|
else if (typeof path === 'object') {
|
|
51
|
-
if (path.is_singular && event === 'READ') event = 'each' //> srv.after ('READ', Book, ...) w/ Book is a singular def from cds-typer
|
|
51
|
+
if (phase === 'after' && path.is_singular && event === 'READ') event = 'each' //> srv.after ('READ', Book, ...) w/ Book is a singular def from cds-typer
|
|
52
52
|
path = path.name || cds.error.expected `${{path}} to be a string or an entity's CSN definition`
|
|
53
53
|
}
|
|
54
54
|
else if (typeof path === 'string') {
|
|
@@ -66,7 +66,7 @@ class ApplicationService extends cds.Service {
|
|
|
66
66
|
// we need to provide target explicitly because it's cached within ensure_target
|
|
67
67
|
const target = cds.infer.target(query, this)
|
|
68
68
|
const _req = new cds.Request({ query, target, _resolved: true })
|
|
69
|
-
return this.
|
|
69
|
+
return this.dispatch(_req).then(result => postProcess(_req, result, this))
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
// async
|
|
@@ -22,9 +22,10 @@ const authorizedRequest = ({ method, uri, path, oa2, tenant, dataObj, headers, t
|
|
|
22
22
|
method
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
// EMIS management API requires a body for write requests, even if empty
|
|
25
26
|
let data
|
|
26
|
-
if (dataObj) {
|
|
27
|
-
data = JSON.stringify(dataObj)
|
|
27
|
+
if (dataObj || method === 'PUT' || method === 'POST') {
|
|
28
|
+
data = JSON.stringify(dataObj ?? {})
|
|
28
29
|
httpOptions.headers['Content-Type'] = 'application/json'
|
|
29
30
|
httpOptions.headers['Content-Length'] = Buffer.byteLength(data)
|
|
30
31
|
}
|
|
@@ -317,7 +317,7 @@ class RemoteService extends cds.Service {
|
|
|
317
317
|
// we need to provide target explicitly because it's cached within ensure_target
|
|
318
318
|
const target = cds.infer.target(query, this)
|
|
319
319
|
const _req = new cds.Request({ query, target, _resolved: true, headers: req.headers, method: req.method })
|
|
320
|
-
return this.
|
|
320
|
+
return this.dispatch(_req).then(result => postProcess(_req, result, this, true))
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
// we need to post process if alias was explicitly set in query
|
|
@@ -15,6 +15,18 @@ might use a deprecated flag only for a limited period of time.
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
## Version 7.0.3 - 2026-07-21
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
- **compiler:** When a backlink target is at least distantly related to the entity
|
|
23
|
+
embedding an association with a backlink comparison, the compiler issues a
|
|
24
|
+
warning ref-deprecated-backlink instead of reporting an error ref-invalid-backlink;
|
|
25
|
+
this is now also the case if the target entity is auto-exposed.
|
|
26
|
+
- **sql:** Avoid dump in to.sql.migration with complex models.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
18
30
|
## Version 7.0.2 - 2026-07-14
|
|
19
31
|
|
|
20
32
|
### Bug Fixes
|
|
@@ -1094,6 +1094,7 @@ function populate( model ) {
|
|
|
1094
1094
|
elem._main?._ancestors?.includes( target )) {
|
|
1095
1095
|
// source and target of the model association are the same entity, and
|
|
1096
1096
|
// the current main artifact is a suitable auto-redirection target → return it
|
|
1097
|
+
// TODO: check with auto-exposed entities (which do not have _ancestors)
|
|
1097
1098
|
return elem._main;
|
|
1098
1099
|
}
|
|
1099
1100
|
const elemScope = preferredElemScope( target, service, elem, assoc._main || assoc );
|
|
@@ -1240,7 +1240,7 @@ function resolve( model ) {
|
|
|
1240
1240
|
if (chain) // standard correct case
|
|
1241
1241
|
return;
|
|
1242
1242
|
|
|
1243
|
-
if (target._ancestors
|
|
1243
|
+
if (target._ancestors || target.$inferred === 'autoexposed') {
|
|
1244
1244
|
// with non-cyclic projection ancestors, not only for managed assoc, but also
|
|
1245
1245
|
// unmanaged, see test3/Associations/Backlinks/CrossEyedBacklink.sql-err.cds
|
|
1246
1246
|
// Current entity is no valid redirection target for the backlink association
|
|
@@ -920,12 +920,10 @@ const _dependents = Symbol('_dependents');
|
|
|
920
920
|
* _dependencies: All artifacts this artifact depends on (because it has a ref to it)
|
|
921
921
|
*
|
|
922
922
|
* @param {CSN.Model} csn A CSN to enrich in-place
|
|
923
|
-
* @param {object} refs csnRefs, only used for artifactRef
|
|
924
923
|
* @returns {object} CSN with _dependents/_dependencies set, "cleanup" function, _dependents/_dependencies Symbol used
|
|
925
924
|
*/
|
|
926
|
-
function setDependencies( csn
|
|
925
|
+
function setDependencies( csn ) {
|
|
927
926
|
const cleanup = [];
|
|
928
|
-
const { artifactRef } = refs;
|
|
929
927
|
|
|
930
928
|
forEachDefinition(csn, (artifact, artifactName) => {
|
|
931
929
|
const queries = getNormalizedQuery(artifact).query;
|
|
@@ -933,11 +931,18 @@ function setDependencies( csn, refs = csnRefs(csn) ) {
|
|
|
933
931
|
initDependencies(artifact);
|
|
934
932
|
forAllQueries(queries, (query) => {
|
|
935
933
|
if (query.SELECT?.from) {
|
|
936
|
-
if (query.SELECT.from.args)
|
|
934
|
+
if (query.SELECT.from.args) {
|
|
937
935
|
handleArgs(artifact, artifactName, query.SELECT.from.args);
|
|
938
|
-
|
|
939
|
-
else if (typeof query.SELECT.from === 'string'
|
|
940
|
-
handleDependency(
|
|
936
|
+
}
|
|
937
|
+
else if (typeof query.SELECT.from === 'string') {
|
|
938
|
+
handleDependency(csn.definitions[query.SELECT.from], artifact, artifactName);
|
|
939
|
+
}
|
|
940
|
+
else if (query.SELECT.from.ref) {
|
|
941
|
+
if (query.SELECT.from.ref[0].id)
|
|
942
|
+
handleDependency(csn.definitions[query.SELECT.from.ref[0].id], artifact, artifactName);
|
|
943
|
+
else
|
|
944
|
+
handleDependency(csn.definitions[query.SELECT.from.ref[0]], artifact, artifactName);
|
|
945
|
+
}
|
|
941
946
|
}
|
|
942
947
|
}, [ 'definitions', artifactName, (artifact.projection ? 'projection' : 'query') ]);
|
|
943
948
|
}
|
|
@@ -952,7 +957,7 @@ function setDependencies( csn, refs = csnRefs(csn) ) {
|
|
|
952
957
|
if (arg.args)
|
|
953
958
|
handleArgs(artifact, artifactName, arg.args);
|
|
954
959
|
else if (arg.ref)
|
|
955
|
-
handleDependency(
|
|
960
|
+
handleDependency(csn.definitions[arg.ref[0].id ? arg.ref[0].id : arg.ref[0]], artifact, artifactName);
|
|
956
961
|
}
|
|
957
962
|
}
|
|
958
963
|
|
|
@@ -6,6 +6,42 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
8
8
|
|
|
9
|
+
## Version 4.0.2 - 2026-08-07
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- `PUT /-/cds/extensibility/Extensions/<id>` with a status that is not active (0 or 1), now returns the correct entry.
|
|
14
|
+
- Extensions table is now resolved properly again when `cds.sql.names = quoted` is set.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- When updating from `@sap/cds-mtxs@<3.6.0`, you now need to upgrade your tenant database before you can add new extensions.
|
|
18
|
+
|
|
19
|
+
## Version 4.0.1 - 2026-06-23
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Migration from `@sap/cds-mtx` has been removed.
|
|
24
|
+
- Annotation `@Common.FieldControl` is now also blocked for extensions.
|
|
25
|
+
- Annotations `@Capabilities.*` are now also blocked for extensions.
|
|
26
|
+
- The MTX sidecar now logs a warning if `cds.sql` is configured differently in both the project root and the sidecar. By setting `cds.env.requires['cds.xt.ModelProviderService']['use-root-sql-config'] === true`,
|
|
27
|
+
you can enforce the configuration of the project root.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- Default value 3 for `cds.requires.multitenancy.jobs.clusterSize` is now effective for upgrade. When using HANA TMS v2, the default for `clusterSize` is set to 1.
|
|
32
|
+
|
|
33
|
+
## Version 3.9.6 - 2026-08-07
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- Parallel single-tenant upgrades no longer fail with `tar: Cannot open: File exists` when extensibility is disabled.
|
|
38
|
+
- Deployment to tenant containers is more stable with a large number of service bindings provided via `VCAP_SERVICES_FILE_PATH`.
|
|
39
|
+
- More robust error handling for HDI deployment logs on read-only file system on Kyma.
|
|
40
|
+
- Configuration `cds.requires.multitenancy.retries` is now effective.
|
|
41
|
+
- Reading tenants no longer logs a spurious `Failed to parse metadata to JSON` error for tenants without metadata.
|
|
42
|
+
- A tenant's HANA connection pool now reliably recovers once valid credentials are restored, as cache-bypassing Service Manager lookups no longer overwrite the shared bindings cache with transiently invalid credentials.
|
|
43
|
+
- More robust handling of Service Manager errors.
|
|
44
|
+
|
|
9
45
|
## Version 3.9.5 - 2026-07-01
|
|
10
46
|
|
|
11
47
|
### Changed
|
|
@@ -2,9 +2,32 @@
|
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
3
|
|
|
4
4
|
async function run(param, options) {
|
|
5
|
+
const { dry, genTenantList, syncTenantList, cleanup, directory, tag, tagRule } = options
|
|
6
|
+
const skipVerification = options['skip-verification'] || options.skipVerification
|
|
7
|
+
|
|
8
|
+
function _handleError(message) {
|
|
9
|
+
console.log(message)
|
|
10
|
+
process.exit(1)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Check for removed migration options
|
|
14
|
+
const removedOptions = []
|
|
15
|
+
if (cleanup) removedOptions.push('--cleanup')
|
|
16
|
+
if (directory) removedOptions.push('--directory')
|
|
17
|
+
if (tag) removedOptions.push('--tag')
|
|
18
|
+
if (tagRule) removedOptions.push('--tagRule')
|
|
19
|
+
if (skipVerification) removedOptions.push('--skip-verification')
|
|
20
|
+
|
|
21
|
+
if (removedOptions.length) {
|
|
22
|
+
_handleError(`The option(s) ${removedOptions.join(', ')} are no longer supported. The migration from @sap/cds-mtx to @sap/cds-mtxs has been removed.`)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!genTenantList && !syncTenantList) {
|
|
26
|
+
_handleError(`The migration from @sap/cds-mtx to @sap/cds-mtxs has been removed. Only --init-tenant-list and --sync-tenant-list are still supported.`)
|
|
27
|
+
}
|
|
28
|
+
|
|
5
29
|
const cds = require('@sap/cds')
|
|
6
|
-
const {
|
|
7
|
-
const { dry, cleanup, genTenantList, syncTenantList } = options
|
|
30
|
+
const { syncTenantList: synchronizeTenantList, _hasMtEnv } = require('../lib/migration/migration')
|
|
8
31
|
|
|
9
32
|
async function cds_mtx_migrate(tenants, options) {
|
|
10
33
|
if (!_hasMtEnv()) _handleError(`cds-mtx-migrate operation can only be run inside a multitenant application environment using @sap/cds-mtxs.`)
|
|
@@ -26,35 +49,9 @@ async function run(param, options) {
|
|
|
26
49
|
await cds.serve(services)
|
|
27
50
|
cds.env.requires.multitenancy = cds.env.requires.multitenancy || true // needed for current sidecar config that only enables services
|
|
28
51
|
|
|
29
|
-
// get and set database id
|
|
30
|
-
const deploymentServiceConfig = cds.env.requires['cds.xt.DeploymentService'] || {}
|
|
31
|
-
if (!deploymentServiceConfig.hdi?.create?.database_id) {
|
|
32
|
-
const foundDbId = await getDbId()
|
|
33
|
-
if (foundDbId) {
|
|
34
|
-
cds.env.requires['cds.xt.DeploymentService'] = {
|
|
35
|
-
...deploymentServiceConfig,
|
|
36
|
-
hdi: { ...deploymentServiceConfig.hdi,
|
|
37
|
-
create: {
|
|
38
|
-
...deploymentServiceConfig.hdi?.create,
|
|
39
|
-
database_id: foundDbId
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
52
|
await cds.emit('served')
|
|
47
53
|
|
|
48
|
-
if (
|
|
49
|
-
const deletedTenants = await cleanupMetatenants(tenantList, options)
|
|
50
|
-
for (let t of deletedTenants.connectedTenants) await cds.db.disconnect(t)
|
|
51
|
-
await cds.db.disconnect()
|
|
52
|
-
|
|
53
|
-
deletedTenants.logResult(dry)
|
|
54
|
-
|
|
55
|
-
// always fail gracefully
|
|
56
|
-
// if (deletedTenants.hasError) process.exit(1)
|
|
57
|
-
} else if (genTenantList) {
|
|
54
|
+
if (genTenantList) {
|
|
58
55
|
const tenantListResult = await synchronizeTenantList(tenantList, options)
|
|
59
56
|
for (let t of tenantListResult.connectedTenants) await cds.db.disconnect(t)
|
|
60
57
|
await cds.db.disconnect()
|
|
@@ -66,22 +63,9 @@ async function run(param, options) {
|
|
|
66
63
|
await cds.db.disconnect()
|
|
67
64
|
|
|
68
65
|
tenantListResult.logResult(dry)
|
|
69
|
-
}else {
|
|
70
|
-
const migratedTenants = await migrate(tenantList, options)
|
|
71
|
-
for (let t of migratedTenants.connectedTenants) await cds.db.disconnect(t)
|
|
72
|
-
await cds.db.disconnect()
|
|
73
|
-
|
|
74
|
-
migratedTenants.logResult()
|
|
75
|
-
// make sure to get result != 0 so that potential followup scripts know of problems
|
|
76
|
-
if (migratedTenants.hasError) process.exit(1)
|
|
77
66
|
}
|
|
78
67
|
}
|
|
79
68
|
|
|
80
|
-
function _handleError(message) {
|
|
81
|
-
console.log(message)
|
|
82
|
-
process.exit(1)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
69
|
function _splitTenants(tenants) {
|
|
86
70
|
return tenants.split(',')
|
|
87
71
|
}
|
|
@@ -100,16 +84,16 @@ if (require.main === module) {
|
|
|
100
84
|
// TODO use command line parser to get arguments
|
|
101
85
|
// comma separated list of tenants
|
|
102
86
|
const [, , tenants, ...options] = process.argv
|
|
103
|
-
const directory = getParameterValue(options, '-d')
|
|
104
|
-
const tag = getParameterValue(options, '--tag')
|
|
105
|
-
const tagRule = getParameterValue(options, '--tagRule')
|
|
106
87
|
const dry = options.includes('--dry')
|
|
107
|
-
const cleanup = options.includes('--cleanup')
|
|
108
88
|
const genTenantList = options.includes('--init-tenant-list')
|
|
109
89
|
const syncTenantList = options.includes('--sync-tenant-list')
|
|
110
90
|
const force = options.includes('--force')
|
|
91
|
+
const cleanup = options.includes('--cleanup')
|
|
111
92
|
const skipVerification = options.includes('--skip-verification')
|
|
112
|
-
|
|
93
|
+
const directory = getParameterValue(options, '-d') || getParameterValue(options, '--directory')
|
|
94
|
+
const tag = getParameterValue(options, '--tag')
|
|
95
|
+
const tagRule = getParameterValue(options, '--tagRule')
|
|
96
|
+
run(tenants, { dry, force, genTenantList, syncTenantList, cleanup, directory, tag, tagRule, 'skip-verification': skipVerification }).catch(console.error)
|
|
113
97
|
} else {
|
|
114
|
-
|
|
98
|
+
module.exports.run = run
|
|
115
99
|
}
|
|
@@ -6,6 +6,9 @@ if (major < 9) throw new Error('@sap/cds-mtxs 3 requires @sap/cds version 9 or h
|
|
|
6
6
|
const cdscDefaults = Object.fromEntries(
|
|
7
7
|
Object.entries(cds.env.defaults?.cdsc || {}).filter(([key]) => !key.startsWith('[') )
|
|
8
8
|
)
|
|
9
|
+
const sqlDefaults = Object.fromEntries(
|
|
10
|
+
Object.entries(cds.env.defaults?.sql || {}).filter(([key]) => !key.startsWith('[') )
|
|
11
|
+
)
|
|
9
12
|
|
|
10
13
|
require('./srv/extensibility/linter').legacyCheck()
|
|
11
14
|
|
|
@@ -28,3 +31,18 @@ if (main.env.cdsc && cds.env.requires['cds.xt.ModelProviderService']?._in_sideca
|
|
|
28
31
|
} else {
|
|
29
32
|
cds.env.cdsc = main.env.cdsc
|
|
30
33
|
}
|
|
34
|
+
|
|
35
|
+
if (cds.env.requires['cds.xt.ModelProviderService']?._in_sidecar === true) {
|
|
36
|
+
if (!(cds.env.requires['cds.xt.ModelProviderService']?.['use-root-sql-config'] === true)) {
|
|
37
|
+
const stringifiedSql = JSON.stringify(cds.env.sql)
|
|
38
|
+
|
|
39
|
+
if (stringifiedSql !== JSON.stringify(main.env.sql) && stringifiedSql !== JSON.stringify(sqlDefaults)) {
|
|
40
|
+
LOG.warn('inconsistent sql configuration: using cds.sql configuration of mtx sidecar')
|
|
41
|
+
}
|
|
42
|
+
// LATER: cds.env.sql = main.env.sql
|
|
43
|
+
} else {
|
|
44
|
+
cds.env.sql = main.env.sql
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
cds.env.sql = main.env.sql
|
|
48
|
+
}
|