@sap/cds-dk 10.0.6 → 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.
Files changed (38) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/lib/import/asyncapi/parserContext.js +136 -54
  3. package/lib/init/template/nodejs/index.js +4 -2
  4. package/node_modules/@cap-js/openapi/lib/compile/csdl.js +3 -3
  5. package/node_modules/@cap-js/openapi/lib/compile/csdl2openapi.js +111 -103
  6. package/node_modules/@cap-js/openapi/lib/compile/diagram.js +4 -4
  7. package/node_modules/@cap-js/openapi/lib/compile/types.d.ts +3 -1
  8. package/node_modules/@cap-js/openapi/package.json +3 -3
  9. package/node_modules/@sap/cds/CHANGELOG.md +7 -0
  10. package/node_modules/@sap/cds/lib/compile/for/nodejs.js +1 -0
  11. package/node_modules/@sap/cds/libx/_runtime/messaging/common-utils/authorizedRequest.js +3 -2
  12. package/node_modules/@sap/cds/package.json +1 -1
  13. package/node_modules/@sap/cds-mtxs/CHANGELOG.md +36 -0
  14. package/node_modules/@sap/cds-mtxs/bin/cds-mtx-migrate.js +32 -48
  15. package/node_modules/@sap/cds-mtxs/bin/cds-mtx.js +1 -0
  16. package/node_modules/@sap/cds-mtxs/cds-plugin.js +18 -0
  17. package/node_modules/@sap/cds-mtxs/lib/migration/migration.js +3 -408
  18. package/node_modules/@sap/cds-mtxs/package.json +1 -1
  19. package/node_modules/@sap/cds-mtxs/srv/cf/abstract-provisioning-service.js +5 -6
  20. package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/annotations.js +5 -2
  21. package/node_modules/@sap/cds-mtxs/srv/extensibility/linter/index.js +6 -5
  22. package/node_modules/@sap/cds-mtxs/srv/extensibility-service.cds +0 -11
  23. package/node_modules/@sap/cds-mtxs/srv/extensibility-service.js +12 -22
  24. package/node_modules/@sap/cds-mtxs/srv/jobs-service.js +30 -24
  25. package/node_modules/@sap/cds-mtxs/srv/model-provider.js +2 -2
  26. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/ctnr-mgr-base.js +5 -2
  27. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/hdi.js +5 -3
  28. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/srv-mgr.js +3 -2
  29. package/node_modules/@sap/cds-mtxs/srv/plugins/hana/tms.js +17 -0
  30. package/node_modules/@sap/cds-mtxs/srv/plugins/hana.js +14 -13
  31. package/node_modules/sax/lib/sax.js +27 -9
  32. package/node_modules/sax/package.json +1 -1
  33. package/node_modules/ws/package.json +1 -1
  34. package/package.json +4 -4
  35. package/lib/init/template/nodejs/files/.gitignore.hbs +0 -34
  36. package/node_modules/@sap/cds-mtxs/lib/migration/extension-project-builder.js +0 -129
  37. package/node_modules/@sap/cds-mtxs/lib/migration/extension-project.js +0 -89
  38. 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 {object} typedElement Typed model element, e.g. property
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 {import('./csdl').CSDLMeta} */
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 {object} entityContainer Entity Container object
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 {object} overload Action or function overload
89
+ * @param {*} overload Action or function overload
90
90
  * @return diagram part
91
91
  */
92
92
  #overloadDiagram(name, overload) {
@@ -23,7 +23,9 @@ type BooleanSchema = {
23
23
 
24
24
  type ArraySchema = {
25
25
  type: 'array',
26
- items: Schema
26
+ items: Schema,
27
+ minItems?: number,
28
+ maxItems?: number
27
29
  }
28
30
 
29
31
  type ObjectSchema = {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/openapi",
3
- "version": "1.5.0",
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": "^25.0.3",
39
+ "@types/node": "^26.1.1",
40
40
  "eslint": "^10.4.1",
41
41
  "globals": "^17.6.0",
42
- "typescript": "^6.0.3"
42
+ "typescript": "^7.0.2"
43
43
  }
44
44
  }
@@ -4,6 +4,13 @@
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
+
7
14
  ## Version 10.0.4 - 2026-07-21
8
15
 
9
16
  ### 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
@@ -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
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds",
3
- "version": "10.0.4",
3
+ "version": "10.0.5",
4
4
  "description": "SAP Cloud Application Programming Model - CDS for Node.js",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [
@@ -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 { migrate, cleanupMetatenants, syncTenantList: synchronizeTenantList, _hasMtEnv, getDbId } = require('../lib/migration/migration')
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 (cleanup) {
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
- run(tenants, { directory, dry, force, tag, tagRule, "skip-verification": skipVerification, cleanup, genTenantList, syncTenantList }).catch(console.error)
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
- module.exports.run = run
98
+ module.exports.run = run
115
99
  }
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ /* eslint-disable no-console */
2
3
 
3
4
  const cds = require('@sap/cds')
4
5
  const { _import, isfile, local, path } = cds.utils
@@ -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
+ }