@sap/cds-dk 9.4.1 → 9.4.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/bin/up.js +2 -2
  3. package/lib/build/plugins/helm/index.js +0 -1
  4. package/lib/init/constants.js +3 -1
  5. package/lib/init/index.js +4 -5
  6. package/lib/init/projectReader.js +64 -55
  7. package/lib/init/template/ams/index.js +7 -6
  8. package/lib/init/template/app-frontend/files/mta.yaml.hbs +0 -7
  9. package/lib/init/template/app-frontend/index.js +2 -2
  10. package/lib/init/template/application-logging/index.js +13 -10
  11. package/lib/init/template/approuter/index.js +15 -9
  12. package/lib/init/template/attachments/index.js +3 -3
  13. package/lib/init/template/audit-logging/index.js +4 -4
  14. package/lib/init/template/cloud-logging/index.js +13 -10
  15. package/lib/init/template/connectivity/index.js +3 -3
  16. package/lib/init/template/destination/index.js +6 -6
  17. package/lib/init/template/dynatrace/index.js +13 -10
  18. package/lib/init/template/enterprise-messaging/index.js +5 -5
  19. package/lib/init/template/enterprise-messaging-shared/index.js +4 -4
  20. package/lib/init/template/extensibility/index.js +2 -2
  21. package/lib/init/template/file-based-messaging/index.js +2 -2
  22. package/lib/init/template/github-actions/index.js +3 -3
  23. package/lib/init/template/hana/index.js +19 -22
  24. package/lib/init/template/helm/index.js +31 -22
  25. package/lib/init/template/html5-repo/files/containerize.yaml.hbs +0 -1
  26. package/lib/init/template/html5-repo/files/mta.yaml.hbs +3 -0
  27. package/lib/init/template/html5-repo/index.js +8 -6
  28. package/lib/init/template/http/index.js +31 -10
  29. package/lib/init/template/ias/files/mta.yaml.hbs +3 -0
  30. package/lib/init/template/ias/files/values.yaml.hbs +4 -1
  31. package/lib/init/template/ias/index.js +8 -8
  32. package/lib/init/template/kafka/index.js +3 -3
  33. package/lib/init/template/local-messaging/index.js +2 -2
  34. package/lib/init/template/malware-scanner/index.js +3 -7
  35. package/lib/init/template/mta/files/mta.yaml.hbs +10 -0
  36. package/lib/init/template/multitenancy/index.js +8 -10
  37. package/lib/init/template/notifications/index.js +2 -2
  38. package/lib/init/template/portal/files/mta.yaml.hbs +6 -0
  39. package/lib/init/template/portal/index.js +7 -7
  40. package/lib/init/template/postgres/index.js +4 -4
  41. package/lib/init/template/redis/index.js +2 -2
  42. package/lib/init/template/redis-messaging/index.js +2 -2
  43. package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +2 -2
  44. package/lib/init/template/sample/files/javascript/admin-service.js.hbs +24 -0
  45. package/lib/init/template/sample/files/javascript/cat-service.js.hbs +43 -0
  46. package/lib/init/template/sample/files/typescript/admin-service.ts.hbs +16 -0
  47. package/lib/init/template/sample/files/typescript/cat-service.ts.hbs +31 -0
  48. package/lib/init/template/test/files/test/test.xs.hbs +1 -1
  49. package/lib/init/template/test/index.js +2 -2
  50. package/lib/init/template/tiny-sample/index.js +1 -1
  51. package/lib/init/template/workzone-standard/index.js +5 -6
  52. package/lib/init/template/xsuaa/files/mta.yaml.hbs +0 -2
  53. package/lib/init/template/xsuaa/index.js +23 -18
  54. package/lib/lint/eslintHelp.json +1 -1
  55. package/npm-shrinkwrap.json +9 -9
  56. package/package.json +1 -1
@@ -19,9 +19,7 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
19
19
  }
20
20
 
21
21
  static hasInProduction(env) {
22
- const { options } = cds.cli.options
23
- // REVISIT: Check if this can be simplified
24
- return options?.add?.has('mtx') || options?.add?.has('multitenancy') || !!env.requires?.multitenancy || false
22
+ return env.requires?.multitenancy
25
23
  }
26
24
 
27
25
  async run() {
@@ -44,12 +42,12 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
44
42
  async combine() {
45
43
  const project = readProject()
46
44
  const {
47
- isNodejs, isJava, hasMta, hasHelm, hasHelmUnifiedRuntime,
48
- hasXsuaa, hasIas, hasHana, hasContainerize, hasApprouter,
45
+ isNodejs, isJava, addMta, addHelm, addHelmUnifiedRuntime,
46
+ addXsuaa, hasXsuaa, addIas, hasIas, hasHana, addContainerize, hasApprouter,
49
47
  srvPath, appName
50
48
  } = project
51
49
 
52
- if (hasMta) {
50
+ if (addMta || addIas || addXsuaa) {
53
51
  const srv = srv4(srvPath)
54
52
  const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
55
53
  const modules = [srv, mtxSidecar]
@@ -60,7 +58,7 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
60
58
  if (isJava) apis.push(requiredMtxSidecarApi4(srv))
61
59
  const additions = [...modules, ...services, ...apis]
62
60
  const relationships = []
63
- if (hasXsuaa) {
61
+ if (addXsuaa) {
64
62
  relationships.push({
65
63
  insert: [saasRegistry, 'name'],
66
64
  into: [isJava ? srv : mtxSidecar, 'requires', 'name']
@@ -82,7 +80,7 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
82
80
  await merge(templateMtaPath).into('mta.yaml', { with: project, additions, relationships })
83
81
  }
84
82
 
85
- if (hasHelm || hasHelmUnifiedRuntime) {
83
+ if (addHelm || addHelmUnifiedRuntime) {
86
84
  await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
87
85
  const applicationWorkload = hasApprouter ? 'approuter' : 'srv'
88
86
  await merge({
@@ -96,7 +94,7 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
96
94
  }).into('chart/values.yaml',{ forceOverwrite: true })
97
95
  }
98
96
 
99
- if (hasContainerize) {
97
+ if (addContainerize) {
100
98
  const deletions = []
101
99
  if (hasHana) {
102
100
  deletions.push({
@@ -113,7 +111,7 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
113
111
  await merge(__dirname, '/files/containerize.yaml.hbs').into('containerize.yaml', { with: project, additions, deletions })
114
112
  }
115
113
 
116
- if (hasXsuaa) {
114
+ if (addXsuaa) {
117
115
  await merge(__dirname, 'files/xs-security.json.hbs').into('xs-security.json', {
118
116
  project,
119
117
  additions: [{
@@ -35,9 +35,9 @@ module.exports = class NotificationsTemplate extends require('../../plugin') {
35
35
 
36
36
  async combine() {
37
37
  const project = readProject()
38
- const { hasMta } = project
38
+ const { addMta } = project
39
39
 
40
- if (hasMta) {
40
+ if (addMta) {
41
41
  await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { project, additions: [notificationTypesDeployer] })
42
42
  }
43
43
  }
@@ -73,3 +73,9 @@ resources:
73
73
  type: org.cloudfoundry.managed-service
74
74
  parameters:
75
75
  service: identity
76
+
77
+ - name: {{appName}}-html5-repo-host
78
+ type: org.cloudfoundry.managed-service
79
+ parameters:
80
+ service: html5-apps-repo
81
+ service-plan: app-host
@@ -28,13 +28,13 @@ module.exports = class PortalTemplate extends require('../../plugin') {
28
28
 
29
29
  async combine() {
30
30
  const project = readProject()
31
- const { appName, isJava, hasMta, srvPath, hasHtml5Repo, hasXsuaa, hasApprouter, hasMultitenancy, hasHelm, hasHelmUnifiedRuntime, hasContainerize } = project
31
+ const { appName, isJava, addMta, hasMta, srvPath, addHtml5Repo, addXsuaa, addApprouter, addMultitenancy, addHelm, addHelmUnifiedRuntime, addContainerize, hasApprouter, hasHtml5Repo } = project
32
32
 
33
- if (hasMultitenancy) {
33
+ if (addMultitenancy) {
34
34
  await merge(__dirname, 'files/package.sidecar.json').into('mtx/sidecar/package.json')
35
35
  }
36
36
 
37
- if (hasMta) {
37
+ if (addMta || (addXsuaa || addHtml5Repo || addApprouter || addMultitenancy) && hasMta) {
38
38
  const srv = srv4(srvPath)
39
39
  const additions = [srv, portal, appDeployer, portalDeployer]
40
40
  const relationships = [{
@@ -45,7 +45,7 @@ module.exports = class PortalTemplate extends require('../../plugin') {
45
45
  into: [portalDeployer, 'requires', 'name']
46
46
  }]
47
47
 
48
- if (hasXsuaa) {
48
+ if (addXsuaa) {
49
49
  additions.push(xsuaa)
50
50
  relationships.push({
51
51
  insert: [xsuaa, 'name'],
@@ -68,7 +68,7 @@ module.exports = class PortalTemplate extends require('../../plugin') {
68
68
  })
69
69
  }
70
70
 
71
- if (hasMultitenancy) {
71
+ if (addMultitenancy) {
72
72
  relationships.push({
73
73
  insert: [portal, 'name'],
74
74
  into: [isJava ? srv : mtxSidecar4('gen/mtx/sidecar'), 'requires', 'name']
@@ -80,7 +80,7 @@ module.exports = class PortalTemplate extends require('../../plugin') {
80
80
  })
81
81
  }
82
82
 
83
- if (hasContainerize) {
83
+ if (addContainerize) {
84
84
  const additions = [{
85
85
  in: 'modules',
86
86
  where: { name: `${appName}-portal-deployer` }
@@ -88,7 +88,7 @@ module.exports = class PortalTemplate extends require('../../plugin') {
88
88
  await merge(__dirname, '/files/containerize.yaml.hbs').into('containerize.yaml', { with: project, additions })
89
89
  }
90
90
 
91
- if (hasHelm || hasHelmUnifiedRuntime) {
91
+ if (addHelm || addHelmUnifiedRuntime) {
92
92
  await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
93
93
  }
94
94
  }
@@ -1,5 +1,5 @@
1
1
  const cds = require('../../../cds')
2
- const { read } = cds.utils
2
+ const { read, exists } = cds.utils
3
3
  const { readProject } = require('../../projectReader')
4
4
  const { merge } = require('../../merge')
5
5
  const mvn = require('../../mvn')
@@ -24,16 +24,16 @@ module.exports = class PostgresTemplate extends require('../../plugin') {
24
24
  async run() {
25
25
  const project = readProject()
26
26
  const { configFile, isJava } = project
27
- project.shortcut = typeof (await read(configFile)).cds?.requires?.db !== 'object'
27
+ project.shortcut = !exists(configFile) || typeof (await read(configFile)).cds?.requires?.db !== 'object'
28
28
  await merge(__dirname, 'files/package.json.hbs').into('package.json', { project })
29
29
  if (isJava) await mvn.add('postgresql')
30
30
  }
31
31
 
32
32
  async combine() {
33
33
  const project = readProject()
34
- const { hasMta, srvPath } = project
34
+ const { addMta, srvPath } = project
35
35
 
36
- if (hasMta) {
36
+ if (addMta) {
37
37
  const srv = srv4(srvPath)
38
38
  await merge(__dirname, 'files/mta.yml.hbs').into('mta.yaml', {
39
39
  project,
@@ -27,9 +27,9 @@ module.exports = class extends require('../../plugin') {
27
27
 
28
28
  async combine() {
29
29
  const project = readProject()
30
- const { hasMta, srvPath } = project
30
+ const { addMta, srvPath } = project
31
31
 
32
- if (hasMta) {
32
+ if (addMta) {
33
33
  const srv = srv4(srvPath)
34
34
  await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
35
35
  project,
@@ -1,5 +1,5 @@
1
1
  const cds = require('../../../cds')
2
- const { read } = cds.utils
2
+ const { read, exists } = cds.utils
3
3
  const { readProject } = require('../../projectReader')
4
4
  const { merge } = require('../../merge')
5
5
 
@@ -28,7 +28,7 @@ module.exports = class RedisMessagingTemplate extends require('../../plugin') {
28
28
  async run() {
29
29
  const project = readProject()
30
30
  const { configFile } = project
31
- project.shortcut = typeof (await read(configFile)).cds?.requires?.messaging !== 'object'
31
+ project.shortcut = !exists(configFile) || typeof (await read(configFile)).cds?.requires?.messaging !== 'object'
32
32
  await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
33
33
  }
34
34
  }
@@ -109,8 +109,8 @@ extend service AdminService {
109
109
  }
110
110
 
111
111
  // Workaround for Fiori popups for asking user to enter a valid UUID on Create
112
- annotate AdminService.Authors : ID with @Core.Computed @odata.Type: 'Edm.String';
113
- annotate AdminService.Books : ID with @Core.Computed @odata.Type: 'Edm.String';
112
+ annotate AdminService.Authors : ID with @Core.Computed;
113
+ annotate AdminService.Books : ID with @Core.Computed;
114
114
 
115
115
  // Show Genre as drop down, not a dialog
116
116
  annotate AdminService.Books with {
@@ -0,0 +1,24 @@
1
+ {{#isESM}}
2
+ import cds from '@sap/cds'
3
+
4
+ export class AdminService extends cds.ApplicationService { init() {
5
+ {{/isESM}}
6
+ {{^isESM}}
7
+ const cds = require('@sap/cds')
8
+
9
+ module.exports = class AdminService extends cds.ApplicationService { init() {
10
+ {{/isESM}}
11
+
12
+ const { Books } = this.entities
13
+
14
+ /**
15
+ * Generate IDs for new Books drafts
16
+ */
17
+ this.before ('NEW', Books.drafts, async (req) => {
18
+ if (req.data.ID) return
19
+ const { ID:id1 } = await SELECT.one.from(Books).columns('max(ID) as ID')
20
+ const { ID:id2 } = await SELECT.one.from(Books.drafts).columns('max(ID) as ID')
21
+ req.data.ID = Math.max(id1||0, id2||0) + 1
22
+ })
23
+ return super.init()
24
+ }}
@@ -0,0 +1,43 @@
1
+ {{#isESM}}
2
+ import cds from '@sap/cds'
3
+
4
+ export class CatalogService extends cds.ApplicationService { init() {
5
+ {{/isESM}}
6
+ {{^isESM}}
7
+ const cds = require('@sap/cds')
8
+
9
+ module.exports = class CatalogService extends cds.ApplicationService { init() {
10
+ {{/isESM}}
11
+
12
+ const { Books } = cds.entities('sap.capire.bookshop')
13
+ const { ListOfBooks } = this.entities
14
+
15
+ // Add some discount for overstocked books
16
+ this.after('each', ListOfBooks, book => {
17
+ if (book.stock > 111) book.title += ` -- 11% discount!`
18
+ })
19
+
20
+ // Reduce stock of ordered books if available stock suffices
21
+ this.on('submitOrder', async req => {
22
+ let { book:id, quantity } = req.data
23
+ let book = await SELECT.one.from (Books, id, b => b.stock)
24
+
25
+ // Validate input data
26
+ if (!book) return req.error (404, `Book #${id} doesn't exist`)
27
+ if (quantity < 1) return req.error (400, `quantity has to be 1 or more`)
28
+ if (!book.stock || quantity > book.stock) return req.error (409, `${quantity} exceeds stock for book #${id}`)
29
+
30
+ // Reduce stock in database and return updated stock value
31
+ await UPDATE (Books, id) .with ({ stock: book.stock -= quantity })
32
+ return book
33
+ })
34
+
35
+ // Emit event when an order has been submitted
36
+ this.after('submitOrder', async (_,req) => {
37
+ let { book, quantity } = req.data
38
+ await this.emit('OrderedBook', { book, quantity, buyer: req.user.id })
39
+ })
40
+
41
+ // Delegate requests to the underlying generic service
42
+ return super.init()
43
+ }}
@@ -0,0 +1,16 @@
1
+ import cds from '@sap/cds'
2
+
3
+ import { Authors, Books } from '#cds-models/AdminService'
4
+
5
+ export class AdminService extends cds.ApplicationService { init(){
6
+ this.before (['NEW','CREATE'], Authors, genid)
7
+ this.before (['NEW','CREATE'], Books, genid)
8
+ return super.init()
9
+ }}
10
+
11
+ /** Generate primary keys for target entity in request */
12
+ async function genid (req:any) {
13
+ if (req.data.ID) return
14
+ const {id} = await SELECT.one.from(req.target).columns('max(ID) as id')
15
+ req.data.ID = id + 4 // Note: that is not safe! ok for this sample only.
16
+ }
@@ -0,0 +1,31 @@
1
+ import cds from '@sap/cds'
2
+
3
+ import { Books } from '#cds-models/sap/capire/bookshop'
4
+ import { submitOrder, ListOfBooks } from '#cds-models/CatalogService'
5
+
6
+ export class CatalogService extends cds.ApplicationService { async init() {
7
+
8
+ // Add some discount for overstocked books
9
+ this.after('each', ListOfBooks, book => {
10
+ if (book?.stock === undefined || book.stock === null) return
11
+ if (book?.stock > 111) book.title += ` -- 11% discount!`
12
+ })
13
+
14
+ // Reduce stock of ordered books if available stock suffices
15
+ this.on(submitOrder, async req => {
16
+ let { book:id, quantity } = req.data
17
+ let book = await SELECT.from (Books, id!, b => b.stock)
18
+
19
+ // Validate input data
20
+ if (!book) return req.error (404, `Book #${id} doesn't exist`)
21
+ if (!quantity || quantity < 1) return req.error (400, `quantity has to be 1 or more`)
22
+ if (quantity > book.stock!) return req.error (409, `${quantity} exceeds stock for book #${id}`)
23
+
24
+ // Reduce stock in database and return updated stock value
25
+ await UPDATE (Books, id) .with ({ stock: book.stock! -= quantity })
26
+ return book
27
+ })
28
+
29
+ // Delegate requests to the underlying generic service
30
+ return super.init()
31
+ }}
@@ -13,7 +13,7 @@ const { GET, POST, expect, axios } = cds.test (__dirname+'/..')
13
13
  axios.defaults.auth = { username: '{{user}}', password: '{{password}}' }
14
14
  {{/user}}
15
15
 
16
- describe('OData APIs', () => {
16
+ describe('{{serviceName}} OData APIs', () => {
17
17
 
18
18
  {{#entities}}{{=<% %>=}}
19
19
  it('serves <%name%>', async () => {
@@ -69,7 +69,7 @@ async function createNodeTest(proj) {
69
69
  .filter(([name]) => name.match(nameFilter))
70
70
  .filter(([name]) => !name.match(/[._]texts$/))
71
71
  .filter(([, e]) => !e['@cds.autoexposed']) // only consider non-autoexposed entities to reduce clutter
72
- .map(([, e]) => e)
72
+ .map(([name, e]) => {e._nameUnqualified = name; return e})
73
73
 
74
74
  let entity // use one entity only (don't want to make users test all entities)
75
75
  if (entities.length) entity = entities[0]
@@ -99,7 +99,7 @@ async function createNodeTest(proj) {
99
99
 
100
100
  proj.entities = [{
101
101
  name: entity.name,
102
- urlPath: `/${sInfo.endpoints[0].path}${entity.name}`,
102
+ urlPath: `/${sInfo.endpoints[0].path}${entity._nameUnqualified}`,
103
103
  selectString: selectElements.join(','),
104
104
  elementsString: JSON.stringify(
105
105
  Object.entries(sampleData[entity.name][0])
@@ -14,7 +14,7 @@ module.exports = class TinySampleTemplate extends require('../../plugin') {
14
14
  async run() {
15
15
  const { isJava } = readProject()
16
16
  if (isJava) {
17
- if (!cds.cli.options.add.has(JAVA)) {
17
+ if (!cds.cli.options.add?.has(JAVA)) {
18
18
  await mvn.add('tiny_sample')
19
19
  }
20
20
  } else {
@@ -26,7 +26,7 @@ module.exports = class extends require('../../plugin') {
26
26
  }
27
27
 
28
28
  static hasInProduction(env) {
29
- return !!env.requires?.workzone || cds.cli.options.add.has('workzone-standard')
29
+ return !!env.requires?.workzone || cds.cli.options.add?.has('workzone-standard')
30
30
  }
31
31
 
32
32
  async run() {
@@ -41,7 +41,7 @@ module.exports = class extends require('../../plugin') {
41
41
 
42
42
  async combine() {
43
43
  const project = readProject()
44
- const { isJava, hasMta, srvPath, apps, appPath, appUIPaths, hasMultitenancy, strippedAppName } = project
44
+ const { isJava, addMta, hasMta, srvPath, apps, appPath, appUIPaths, addMultitenancy, strippedAppName } = project
45
45
 
46
46
  await Promise.all(appUIPaths.map(async p => {
47
47
  project.uiApp = p
@@ -67,7 +67,7 @@ module.exports = class extends require('../../plugin') {
67
67
  await merge(__dirname, 'files/xs-app.json.hbs').into(join(appPath, app, 'xs-app.json'), { with: project, additions, overwrites })
68
68
  }))
69
69
 
70
- if (hasMultitenancy) {
70
+ if (addMultitenancy) {
71
71
  const mtxPackageJson = await read('mtx/sidecar/package.json')
72
72
  mtxPackageJson.cds ??= {}
73
73
  mtxPackageJson.cds.requires ??= {}
@@ -78,14 +78,14 @@ module.exports = class extends require('../../plugin') {
78
78
  await write('mtx/sidecar/package.json', mtxPackageJson, { spaces: 2 })
79
79
  }
80
80
 
81
- if (hasMta) {
81
+ if (addMta || addMultitenancy && hasMta) {
82
82
  const srv = srv4(srvPath)
83
83
  const additions = [srv, destinations, destination, {
84
84
  in: [destination, 'requires'],
85
85
  where: { name: 'srv-api' }
86
86
  }]
87
87
  const relationships = []
88
- if (hasMultitenancy) {
88
+ if (addMultitenancy) {
89
89
  additions.push(html5RepoHost)
90
90
  relationships.push({
91
91
  insert: [html5RepoHost, 'name'],
@@ -93,7 +93,6 @@ module.exports = class extends require('../../plugin') {
93
93
  })
94
94
  }
95
95
 
96
-
97
96
  await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { with: project, additions, relationships })
98
97
  }
99
98
  }
@@ -6,13 +6,11 @@ modules:
6
6
  requires:
7
7
  - name: {{appName}}-auth
8
8
 
9
- {{#hasMultitenancy}}
10
9
  - name: {{appName}}-mtx
11
10
  type: nodejs
12
11
  path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
13
12
  requires:
14
13
  - name: {{appName}}-auth
15
- {{/hasMultitenancy}}
16
14
 
17
15
  resources:
18
16
  - name: {{appName}}-auth{{#servicePlan}}-{{servicePlan}}{{/servicePlan}}
@@ -33,7 +33,7 @@ module.exports = class XsuaaTemplate extends require('../../plugin') {
33
33
 
34
34
  async combine() {
35
35
  const project = readProject()
36
- const { hasMultitenancy, hasMta, hasHelm, hasHelmUnifiedRuntime, isJava, srvPath } = project
36
+ const { addMultitenancy, addMta, hasMta, addHelm, hasHelm, addHelmUnifiedRuntime, isJava, srvPath } = project
37
37
 
38
38
  const cds = require('../../../../lib')
39
39
  const xsSecurity = await (async () => {
@@ -46,22 +46,28 @@ module.exports = class XsuaaTemplate extends require('../../plugin') {
46
46
  const additions = xsSecurity.scopes.map(scope => ({ in: 'scopes', where: { name: scope.name } }))
47
47
  await merge(xsSecurity).into('xs-security.json', { project, additions })
48
48
 
49
- if (hasMta) {
50
- const srv = srv4(srvPath)
49
+ if (addMta || addMultitenancy && hasMta) {
50
+ const additions = [], overwrites = [], relationships = []
51
51
  const { plan } = cds.cli.options
52
52
  const xsuaa = plan ? xsuaa4(plan) : xsuaaDefault
53
- const additions = [srv, xsuaa]
54
- const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
55
- if (hasMultitenancy && isJava) additions.push(mtxSidecar)
56
- const overwrites = hasMultitenancy ? [{ item: [xsuaa, 'parameters.config.tenant-mode'], withValue: 'shared' }] : []
57
- const relationships = [{
58
- insert: [xsuaa, 'name'],
59
- into: [srv, 'requires', 'name']
60
- }]
61
- if (hasMultitenancy) relationships.push({
62
- insert: [xsuaa, 'name'],
63
- into: [mtxSidecar, 'requires', 'name']
64
- })
53
+ additions.push(xsuaa)
54
+ if (addMta) {
55
+ const srv = srv4(srvPath)
56
+ additions.push(srv)
57
+ relationships.push({
58
+ insert: [xsuaa, 'name'],
59
+ into: [srv, 'requires', 'name']
60
+ })
61
+ }
62
+ if (addMultitenancy) {
63
+ const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
64
+ additions.push(mtxSidecar)
65
+ overwrites.push({ item: [mtxSidecar, 'parameters.tenant-mode'], withValue: 'shared' })
66
+ relationships.push({
67
+ insert: [xsuaa, 'name'],
68
+ into: [mtxSidecar, 'requires', 'name']
69
+ })
70
+ }
65
71
  if (plan) project.servicePlan = plan
66
72
 
67
73
  project.hasRoles = xsSecurity['role-templates'].length > 0
@@ -75,12 +81,11 @@ module.exports = class XsuaaTemplate extends require('../../plugin') {
75
81
  })
76
82
  }
77
83
  }
78
-
79
84
  await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { project, additions, overwrites, relationships })
80
85
  }
81
86
 
82
- if (hasHelm || hasHelmUnifiedRuntime) {
83
- const overwrites = hasMultitenancy ? [{ item: 'xsuaa.parameters.tenant-mode', withValue: 'shared' }] : []
87
+ if (addHelm || addHelmUnifiedRuntime || addMultitenancy && hasHelm) {
88
+ const overwrites = addMultitenancy ? [{ item: 'xsuaa.parameters.tenant-mode', withValue: 'shared' }] : []
84
89
  await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project, overwrites })
85
90
  await merge({
86
91
  xsuaa: {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "9.37.0",
2
+ "version": "9.38.0",
3
3
  "help": "\n# SYNOPSIS\n\n *cds lint* [options] file.js [file.js] [dir]\n\n Runs environment checks and/or checks the specified models\n based on the ESLint framework\n\n# OPTIONS\n \n Basic configuration:\n --no-config-lookup Disable look up for eslint.config.js\n -c, --config path::String Use this configuration instead of eslint.config.js, eslint.config.mjs, or eslint.config.cjs\n --inspect-config Open the config inspector with the current configuration\n --ext [String] Specify additional file extensions to lint\n --global [String] Define global variables\n --parser String Specify the parser to be used\n --parser-options Object Specify parser options\n \n Specify Rules and Plugins:\n --plugin [String] Specify plugins\n --rule Object Specify rules\n \n Fix Problems:\n --fix Automatically fix problems\n --fix-dry-run Automatically fix problems without saving the changes to the file system\n --fix-type Array Specify the types of fixes to apply (directive, problem, suggestion, layout)\n \n Ignore Files:\n --no-ignore Disable use of ignore files and patterns\n --ignore-pattern [String] Patterns of files to ignore\n \n Use stdin:\n --stdin Lint code provided on <STDIN> - default: false\n --stdin-filename String Specify filename to process STDIN as\n \n Handle Warnings:\n --quiet Report errors only - default: false\n --max-warnings Int Number of warnings to trigger nonzero exit code - default: -1\n \n Output:\n -o, --output-file path::String Specify file to write report to\n -f, --format String Use a specific output format - default: stylish\n --color, --no-color Force enabling/disabling of color\n \n Inline configuration comments:\n --no-inline-config Prevent comments from changing config or rules\n --report-unused-disable-directives Adds reported errors for unused eslint-disable and eslint-enable directives\n --report-unused-disable-directives-severity String Chooses severity level for reporting unused eslint-disable and eslint-enable directives - either: off, warn, error, 0, 1, or 2\n --report-unused-inline-configs String Adds reported errors for unused eslint inline config comments - either: off, warn, error, 0, 1, or 2\n \n Caching:\n --cache Only check changed files - default: false\n --cache-file path::String Path to the cache file. Deprecated: use --cache-location - default: .eslintcache\n --cache-location path::String Path to the cache file or directory\n --cache-strategy String Strategy to use for detecting changed files in the cache - either: metadata or content - default: metadata\n \n Suppressing Violations:\n --suppress-all Suppress all violations - default: false\n --suppress-rule [String] Suppress specific rules\n --suppressions-location path::String Specify the location of the suppressions file\n --prune-suppressions Prune unused suppressions - default: false\n --pass-on-unpruned-suppressions Ignore unused suppressions - default: false\n \n Miscellaneous:\n --init Run config initialization wizard - default: false\n --env-info Output execution environment information - default: false\n --no-error-on-unmatched-pattern Prevent errors when pattern is unmatched\n --exit-on-fatal-error Exit with exit code 2 in case of fatal error - default: false\n --no-warn-ignored Suppress warnings when the file list includes ignored files\n --pass-on-no-patterns Exit with exit code 0 in case no file patterns are passed\n --debug Output debugging information\n -h, --help Show help\n -v, --version Output the version number\n --print-config path::String Print the configuration for the given file\n --stats Add statistics to the lint report - default: false\n --flag [String] Enable a feature flag\n --mcp Start the ESLint MCP server\n --concurrency Int|String Number of linting threads, auto to choose automatically, off for no multithreading - default: off\n \n",
4
4
  "options": [
5
5
  "--config",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@sap/cds-dk",
3
- "version": "9.4.1",
3
+ "version": "9.4.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@sap/cds-dk",
9
- "version": "9.4.1",
9
+ "version": "9.4.2",
10
10
  "license": "SEE LICENSE IN LICENSE",
11
11
  "dependencies": {
12
12
  "@cap-js/asyncapi": "^1.0.0",
@@ -78,8 +78,8 @@
78
78
  }
79
79
  },
80
80
  "node_modules/@eslint/js": {
81
- "version": "9.37.0",
82
- "integrity": "sha512-jaS+NJ+hximswBG6pjNX0uEJZkrT0zwpVi3BA3vX22aFGjJjmgSTSmPpZCRKmoBL5VY/M6p0xsSJx7rk7sy5gg==",
81
+ "version": "9.38.0",
82
+ "integrity": "sha512-UZ1VpFvXf9J06YG9xQBdnzU+kthors6KjhMAl6f4gH4usHyh31rUf2DLGInT8RFYIReYXNSydgPY0V2LuWgl7A==",
83
83
  "license": "MIT",
84
84
  "peer": true,
85
85
  "engines": {
@@ -90,11 +90,11 @@
90
90
  }
91
91
  },
92
92
  "node_modules/@sap/cds": {
93
- "version": "9.4.2",
94
- "integrity": "sha512-+MtNRviAgyZnPkSkT9sZ52rKRrNcTSpjIL88HfPtS5VzWX17Niu9PRANba/dd8aF4lxSQEEqb85zqJkga6MwKA==",
93
+ "version": "9.4.4",
94
+ "integrity": "sha512-JJCHeEJF4xzFyZSf2ToocvVE9dyHfNLTRXOauOxlmpfyaLg97G7Qp+L4bD132eB0onBG9bQj3eH8DzBm0hVvIw==",
95
95
  "license": "SEE LICENSE IN LICENSE",
96
96
  "dependencies": {
97
- "@sap/cds-compiler": "^6.1",
97
+ "@sap/cds-compiler": "^6.3",
98
98
  "@sap/cds-fiori": "^2",
99
99
  "js-yaml": "^4.1.0"
100
100
  },
@@ -142,8 +142,8 @@
142
142
  }
143
143
  },
144
144
  "node_modules/@sap/cds-mtxs": {
145
- "version": "3.3.1",
146
- "integrity": "sha512-66yWxkVlqu5FsOHxDF8w2JJSlcbgtT2PTegBSECEq9+fjMOaqlxnBHpXXTODCUgK762Ad3kyCUZqW///gmpuMA==",
145
+ "version": "3.4.2",
146
+ "integrity": "sha512-bpKHKbehDSZpe9IoY1Vn2LQ5kgQns6RdlMsTOE9rw9zP//Yq5hFtl7SKFEM0A0/+WL3E+Rp/7Y2tc76erKYqdA==",
147
147
  "license": "SEE LICENSE IN LICENSE",
148
148
  "dependencies": {
149
149
  "@sap/hdi-deploy": "^5"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds-dk",
3
- "version": "9.4.1",
3
+ "version": "9.4.2",
4
4
  "description": "Command line client and development toolkit for the SAP Cloud Application Programming Model",
5
5
  "homepage": "https://cap.cloud.sap/",
6
6
  "keywords": [