@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
@@ -41,9 +41,9 @@ module.exports = class EnterpriseMessagingTemplate extends require('../../plugin
41
41
 
42
42
  async combine() {
43
43
  const project = readProject()
44
- const { hasXsuaa, hasHelm, hasHelmUnifiedRuntime, hasMta, srvPath, appName } = project
44
+ const { addXsuaa, addHelm, addHelmUnifiedRuntime, addMta, srvPath, appName } = project
45
45
 
46
- if (hasMta) {
46
+ if (addMta) {
47
47
  const srv = srv4(srvPath)
48
48
  await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
49
49
  project,
@@ -55,8 +55,8 @@ module.exports = class EnterpriseMessagingTemplate extends require('../../plugin
55
55
  })
56
56
  }
57
57
 
58
- if (hasXsuaa) {
59
- if (hasMta) {
58
+ if (addXsuaa || addMta) {
59
+ if (addMta) {
60
60
  await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
61
61
  project,
62
62
  additions: [xsuaa]
@@ -72,7 +72,7 @@ module.exports = class EnterpriseMessagingTemplate extends require('../../plugin
72
72
  })
73
73
  }
74
74
 
75
- if (hasHelm || hasHelmUnifiedRuntime) {
75
+ if (addHelm || addHelmUnifiedRuntime) {
76
76
  await merge(__dirname, 'files', 'values.yaml').into('chart/values.yaml')
77
77
  }
78
78
 
@@ -34,7 +34,7 @@ module.exports = class EnterpriseMessagingSharedTemplate extends require('../../
34
34
  const project = readProject()
35
35
  const { configFile, isNodejs } = project
36
36
  if (isNodejs) {
37
- project.shortcut = typeof (await read(configFile)).cds?.requires?.messaging !== 'object'
37
+ project.shortcut = !exists(configFile) || typeof (await read(configFile)).cds?.requires?.messaging !== 'object'
38
38
  project.cloudevents = cds.cli.options.cloudevents
39
39
  await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
40
40
  }
@@ -42,9 +42,9 @@ module.exports = class EnterpriseMessagingSharedTemplate extends require('../../
42
42
 
43
43
  async combine() {
44
44
  const project = readProject()
45
- const { hasMta, hasHelm, hasHelmUnifiedRuntime, srvPath } = project
45
+ const { addMta, addHelm, addHelmUnifiedRuntime, srvPath } = project
46
46
 
47
- if (hasMta) {
47
+ if (addMta) {
48
48
  const srv = srv4(srvPath)
49
49
  await merge(__dirname, 'files', 'mta.yaml.hbs').into('mta.yaml', {
50
50
  project,
@@ -56,7 +56,7 @@ module.exports = class EnterpriseMessagingSharedTemplate extends require('../../
56
56
  })
57
57
  }
58
58
 
59
- if (hasHelm || hasHelmUnifiedRuntime) {
59
+ if (addHelm || addHelmUnifiedRuntime) {
60
60
  await merge(__dirname, 'files/values.yaml').into('chart/values.yaml')
61
61
  }
62
62
 
@@ -26,8 +26,8 @@ module.exports = class ExtensibilityTemplate extends require('../../plugin') {
26
26
 
27
27
  async combine() {
28
28
  const project = readProject()
29
- const { hasXsuaa } = project
30
- if (hasXsuaa) {
29
+ const { addXsuaa } = project
30
+ if (addXsuaa) {
31
31
  await merge(__dirname, 'files', 'xs-security.json.hbs').into('xs-security.json', {
32
32
  project,
33
33
  additions: [
@@ -1,4 +1,4 @@
1
- const cds = require('../../../cds'), { read } = cds.utils
1
+ const cds = require('../../../cds'), { exists, read } = cds.utils
2
2
  const { readProject } = require('../../projectReader')
3
3
  const { merge } = require('../../merge')
4
4
 
@@ -21,7 +21,7 @@ module.exports = class FileBasedMessagingTemplate extends require('../../plugin'
21
21
  async run() {
22
22
  const project = readProject()
23
23
  const { configFile } = project
24
- project.shortcut = typeof (await read(configFile)).cds?.requires?.messaging !== 'object'
24
+ project.shortcut = !exists(configFile) || typeof (await read(configFile)).cds?.requires?.messaging !== 'object'
25
25
  await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
26
26
  }
27
27
  }
@@ -50,9 +50,9 @@ module.exports = class GitHubActionTemplate extends require('../../plugin') {
50
50
 
51
51
  async combine() {
52
52
  const project = readProject()
53
- const { hasMta, hasHelm } = project, { force } = cds.cli.options
53
+ const { addMta, addHelm } = project, { force } = cds.cli.options
54
54
  project.sap = cds.cli.options.sap
55
- if (hasMta) {
55
+ if (addMta) {
56
56
  const cf = '.github/workflows/cf.yaml'
57
57
  if (force || !exists(cf)) {
58
58
  await renderAndCopy(path.join(__dirname, 'files/workflows/cf.yaml.hbs'), cf, project)
@@ -62,7 +62,7 @@ module.exports = class GitHubActionTemplate extends require('../../plugin') {
62
62
  await copy(path.join(__dirname, 'files/cf-setup'), cfSetup)
63
63
  }
64
64
  }
65
- if (hasHelm) {
65
+ if (addHelm) {
66
66
  const kyma = '.github/workflows/kyma.yaml'
67
67
  if (force || !exists(kyma)) {
68
68
  await renderAndCopy(path.join(__dirname, 'files/workflows/kyma.yaml.hbs'), kyma, project)
@@ -1,6 +1,6 @@
1
1
  const { join } = require('path')
2
2
  const cds = require('../../../cds')
3
- const { read, write, exists, copy, rimraf } = cds.utils
3
+ const { read, write, exists, copy } = cds.utils
4
4
  const { readProject } = require('../../projectReader')
5
5
  const { merge, sort } = require('../../merge')
6
6
  const mvn = require('../../mvn')
@@ -21,7 +21,7 @@ module.exports = class HanaTemplate extends require('../../plugin') {
21
21
  async run() {
22
22
  const project = readProject()
23
23
  const { isJava, configFile, db } = project
24
- project.shortcut = typeof (await read(configFile)).cds?.requires?.db !== 'object'
24
+ project.shortcut = !exists(configFile) || typeof (await read(configFile)).cds?.requires?.db !== 'object'
25
25
 
26
26
  // REVISIT: Let cds build generate those by default
27
27
  await merge(__dirname, 'files/src/.hdiconfig').into(join(db.folder, 'src/.hdiconfig'))
@@ -44,9 +44,9 @@ module.exports = class HanaTemplate extends require('../../plugin') {
44
44
 
45
45
  async combine() {
46
46
  const project = readProject()
47
- const { hasMta, hasHelm, hasHelmUnifiedRuntime, hasHtml5Repo, hasContainerize, isJava, hasMultitenancy, srvPath } = project
47
+ const { addMta, addHelm, addHelmUnifiedRuntime, addMultitenancy, addContainerize, isJava, hasHelm, hasMultitenancy, srvPath } = project
48
48
 
49
- if (hasMta) {
49
+ if (addMta || addMultitenancy) {
50
50
  const srv = srv4(srvPath)
51
51
  const db = hasMultitenancy ? serviceManager : hdiContainer
52
52
  const deletions = hasMultitenancy ? [{
@@ -86,26 +86,23 @@ module.exports = class HanaTemplate extends require('../../plugin') {
86
86
  })
87
87
  }
88
88
 
89
- if (hasHelm || hasHelmUnifiedRuntime) {
90
- if (hasMultitenancy) {
91
- await merge('chart/values.yaml')
92
- .remove(['hana-deployer', 'srv.bindings.db', 'hana'])
93
-
94
- await merge('chart/Chart.yaml')
95
- .remove([
96
- { dependencies: { alias: 'hana' } },
97
- { dependencies: { alias: 'hana-deployer' } }
98
- ])
99
-
100
- if (!hasHtml5Repo) {
101
- await rimraf('chart/charts/content-deployment') // REVISIT: Move to build task
102
- }
103
- } else {
104
- await merge(__dirname, 'files', 'values.yaml.hbs').into('chart/values.yaml', { with: project })
105
- }
89
+ if (!hasMultitenancy && (addHelm || addHelmUnifiedRuntime)) {
90
+ await merge(__dirname, 'files', 'values.yaml.hbs').into('chart/values.yaml', { with: project })
91
+
92
+ }
93
+
94
+ if (addMultitenancy && hasHelm) {
95
+ await merge('chart/values.yaml')
96
+ .remove(['hana-deployer', 'srv.bindings.db', 'hana'])
97
+
98
+ await merge('chart/Chart.yaml')
99
+ .remove([
100
+ { dependencies: { alias: 'hana' } },
101
+ { dependencies: { alias: 'hana-deployer' } }
102
+ ])
106
103
  }
107
104
 
108
- if (hasContainerize && !hasMultitenancy) {
105
+ if (addContainerize && !hasMultitenancy) {
109
106
  const additions = [{
110
107
  in: 'modules',
111
108
  where: { name: `${project.appName}-hana-deployer` }
@@ -87,40 +87,49 @@ module.exports = class HelmTemplate extends require('../../plugin') {
87
87
 
88
88
  async combine() {
89
89
  // REVISIT: This must be moved to the respective plugins
90
- const { hasDestination, hasEnterpriseMessaging, hasEnterpriseMessagingShared, hasHana, hasMultitenancy, hasXsuaa, hasHtml5Repo, hasApprouter, hasKafka, hasAttachments, hasPortal, hasMalwareScanner, hasDynatrace, hasCloudLogging, hasAuditLogging } = readProject()
91
-
92
- if (hasApprouter) {
90
+ const {
91
+ addHana, addMultitenancy, addXsuaa,
92
+ addApprouter, addIas, addAms, hasXsuaa, hasMultitenancy,
93
+ addDestination, addEnterpriseMessaging, addEnterpriseMessagingShared, addHtml5Repo, hasHtml5Repo, addKafka, addAttachments, addPortal, addMalwareScanner,
94
+ addDynatrace, addCloudLogging, addAuditLogging,
95
+ } = readProject()
96
+
97
+ if (addApprouter) {
93
98
  await this._mergeDependency('web-application', 'approuter')
94
99
  }
95
100
 
96
- if (hasHtml5Repo) {
97
- await this._mergeDependency('service-instance', 'html5-apps-repo-host')
98
- await this._mergeDependency('content-deployment', 'html5-apps-deployer')
99
- if (hasApprouter) {
101
+ if (addHtml5Repo || addApprouter && hasHtml5Repo) {
102
+ if (addHtml5Repo) {
103
+ await this._mergeDependency('service-instance', 'html5-apps-repo-host')
104
+ await this._mergeDependency('content-deployment', 'html5-apps-deployer')
105
+ }
106
+ if (addApprouter) {
100
107
  await this._mergeDependency('service-instance', 'html5-apps-repo-runtime')
101
108
  }
102
109
  }
103
- if (hasMultitenancy) {
104
- await this._mergeDependency('web-application', 'sidecar')
105
- if (hasXsuaa) {
110
+ if (addMultitenancy || addXsuaa || addIas || addAms) {
111
+ if (addMultitenancy) {
112
+ await this._mergeDependency('web-application', 'sidecar')
113
+ }
114
+ if (hasXsuaa && hasMultitenancy) {
106
115
  await this._mergeDependency('service-instance', 'saas-registry')
107
- } else {
116
+ } else if (hasMultitenancy) {
108
117
  await this._mergeDependency('service-instance', 'subscription-manager')
109
118
  }
110
119
  }
111
- if (hasDestination) {
120
+ if (addDestination) {
112
121
  await this._mergeDependency('service-instance', 'destination')
113
122
  }
114
- if (hasAttachments) {
123
+ if (addAttachments) {
115
124
  await this._mergeDependency('service-instance', 'attachments')
116
125
  }
117
- if (hasEnterpriseMessaging || hasEnterpriseMessagingShared) {
126
+ if (addEnterpriseMessaging || addEnterpriseMessagingShared) {
118
127
  await this._mergeDependency('service-instance', 'event-mesh')
119
128
  }
120
- if (hasXsuaa) {
129
+ if (addXsuaa) {
121
130
  await this._mergeDependency('service-instance', 'xsuaa')
122
131
  }
123
- if (hasHana) {
132
+ if (addHana || addMultitenancy) {
124
133
  if (hasMultitenancy) {
125
134
  await this._mergeDependency('service-instance', 'service-manager')
126
135
  } else {
@@ -128,23 +137,23 @@ module.exports = class HelmTemplate extends require('../../plugin') {
128
137
  await this._mergeDependency('content-deployment', 'hana-deployer')
129
138
  }
130
139
  }
131
- if (hasKafka) {
140
+ if (addKafka) {
132
141
  await this._mergeDependency('service-instance', 'kafka')
133
142
  }
134
- if (hasPortal) {
143
+ if (addPortal) {
135
144
  await this._mergeDependency('service-instance', 'portal')
136
145
  await this._mergeDependency('content-deployment', 'portal-deployer')
137
146
  }
138
- if (hasMalwareScanner) {
147
+ if (addMalwareScanner) {
139
148
  await this._mergeDependency('service-instance', 'malware-scanner')
140
149
  }
141
- if (hasCloudLogging) {
150
+ if (addCloudLogging) {
142
151
  await this._mergeDependency('service-instance', 'cloud-logging')
143
152
  }
144
- if (hasDynatrace) {
153
+ if (addDynatrace) {
145
154
  await this._mergeDependency('service-instance', 'dynatrace')
146
155
  }
147
- if (hasAuditLogging) {
156
+ if (addAuditLogging) {
148
157
  await this._mergeDependency('service-instance', 'auditlog')
149
158
  }
150
159
  }
@@ -3,7 +3,6 @@ before-all:
3
3
  {{#hasUI5}}
4
4
  - mkdir -p app/html5-deployer/resources
5
5
  {{#apps}}
6
- - npm i --prefix app/{{app}}
7
6
  - npm run build --prefix app/{{app}}
8
7
  # zip filename should match the archiveName specified in ui5-deploy.yaml
9
8
  - cp -f app/{{app}}/dist/{{app}}.zip app/html5-deployer/resources/{{app}}.zip
@@ -52,6 +52,7 @@ modules:
52
52
  target-path: {{#isNodejs}}{{& appPath }}{{/isNodejs}}{{#isJava}}resources{{/isJava}}
53
53
  {{/apps}}
54
54
  {{#hasWorkzoneStandard}}
55
+ {{#hasMultitenancy}}
55
56
  parameters:
56
57
  config:
57
58
  HTML5Runtime_enabled: true
@@ -66,11 +67,13 @@ modules:
66
67
  ProxyType: Internet
67
68
  HTML5.ForwardAuthToken: true
68
69
  HTML5.DynamicDestination: true
70
+ {{#hasIas}}HTML5.IASDependencyName: {{appName}}-ias-api{{/hasIas}}
69
71
  - Name: ui5
70
72
  URL: https://ui5.sap.com
71
73
  Authentication: NoAuthentication
72
74
  Type: HTTP
73
75
  ProxyType: Internet
76
+ {{/hasMultitenancy}}
74
77
  {{/hasWorkzoneStandard}}
75
78
 
76
79
  {{#apps}}
@@ -37,8 +37,8 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
37
37
  const project = readProject()
38
38
  const {
39
39
  isJava, srvPath, appPath, apps,
40
- hasApprouter, hasContainerize, hasMultitenancy, hasWorkzoneStandard,
41
- hasMta, hasXsuaa, hasHelm, hasHelmUnifiedRuntime, hasUI5
40
+ hasApprouter, addApprouter, addContainerize, addMultitenancy, addWorkzoneStandard,
41
+ addSample, hasMta, addMta, hasXsuaa, hasMultitenancy, hasWorkzoneStandard, addHelm, addHelmUnifiedRuntime, hasUI5
42
42
  } = project
43
43
 
44
44
  await Promise.all(apps.map(async ({ app }) => {
@@ -65,11 +65,11 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
65
65
  }
66
66
  }
67
67
 
68
- if (hasMultitenancy) {
68
+ if (addMultitenancy) {
69
69
  await merge({ cds: { requires: { 'html5-repo': true } } }).into('mtx/sidecar/package.json')
70
70
  }
71
71
 
72
- if (hasMta) {
72
+ if (addMta || (addApprouter || addWorkzoneStandard || addMultitenancy || addSample) && hasMta) {
73
73
  const srv = srv4(srvPath)
74
74
  project.apps = apps
75
75
  const relationships = [{
@@ -114,14 +114,16 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
114
114
  relationships
115
115
  })
116
116
  }
117
- if (hasContainerize) {
117
+
118
+ if (addContainerize) {
118
119
  const additions = [{
119
120
  in: 'modules',
120
121
  where: { name: `${project.appName}-html5-deployer` }
121
122
  }]
122
123
  await merge(__dirname, '/files/containerize.yaml.hbs').into('containerize.yaml', { with: project, additions })
123
124
  }
124
- if (hasHelm || hasHelmUnifiedRuntime) {
125
+
126
+ if (addHelm || addHelmUnifiedRuntime) {
125
127
  await renderAndCopy(join(__dirname, 'files/html5-deployer.package.json.hbs'), 'app/html5-deployer/package.json', project)
126
128
  await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
127
129
  }
@@ -77,10 +77,40 @@ module.exports = class HttpTemplate extends require('../../plugin') {
77
77
  let entities = []
78
78
  let actions = []
79
79
 
80
+ const containedTargets = new Set()
81
+ for (const c of csn.childrenOf(s.name)) {
82
+ if (c.kind !== 'entity' || !c.elements) continue
83
+ for (const e of Object.values(c.elements)) {
84
+ if (e?.type !== 'cds.Composition' || !e.target) continue
85
+ const containment = Array.isArray(e.on) && e.on.some(t => t?.ref?.[0] === '$self')
86
+ if (!containment) continue
87
+ const target = csn.definitions?.[e.target] || csn.childrenOf(s.name).find(x => x.name === e.target)
88
+ const struct_key = Object.values(target?.keys || {}).some(k => k?.is_struct)
89
+ const struct_up = target?.elements?.up_?.is_struct === true
90
+ if (struct_key || struct_up) containedTargets.add(e.target)
91
+ }
92
+ }
93
+
94
+ const exposed = new Set((sInfo?.entities || []).map(e => e?.name || e).filter(Boolean))
80
95
  for (const c of csn.childrenOf(s.name)) {
81
96
  if (c.name.match(filterStringAsRegex(filter))) {
82
97
  if (c.name.includes('.texts')) continue
83
- c.kind === 'entity' ? entities.push(this.#addEntityInfo(c)) : c.kind === 'action' ? actions.push(c) : null
98
+ if (c.kind === 'entity') {
99
+ // Skip composition targets – they are not exposed as entity sets
100
+ if (containedTargets.has(c.name)) continue
101
+ if (exposed.size && !exposed.has(c.name)) continue
102
+ const autoexposed = c['@cds.autoexposed'] || c['@cds.autoexpose']
103
+ const valuelist = c['@cds.odata.valuelist'] === true
104
+ if (!exposed.size && autoexposed && !valuelist) continue
105
+ entities.push({
106
+ name: c.name,
107
+ readOnly: (c["@readonly"] || autoexposed || c['@odata.singleton']) ?? false,
108
+ isDraft: c['@odata.draft.enabled'] ?? false,
109
+ keys: c.keys
110
+ })
111
+ } else if (c.kind === 'action') {
112
+ actions.push(c)
113
+ }
84
114
  }
85
115
  }
86
116
  if (entities.length === 0 && actions.length === 0) return
@@ -96,15 +126,6 @@ module.exports = class HttpTemplate extends require('../../plugin') {
96
126
  return services
97
127
  }
98
128
 
99
- #addEntityInfo(e) {
100
- return {
101
- name: e.name,
102
- readOnly: (e["@readonly"] || e["@cds.autoexpose"] || e['@odata.singleton']) ?? false,
103
- isDraft: e['@odata.draft.enabled'] ?? false,
104
- keys: e.keys
105
- }
106
- }
107
-
108
129
  /**
109
130
  * @param {ServiceMap} services
110
131
  */
@@ -57,6 +57,9 @@ resources:
57
57
  service-name: {{appName}}-ias
58
58
  service-plan: application
59
59
  config:
60
+ provided-apis:
61
+ - name: {{appName}}-ias-api
62
+ description: API exposed by the application
60
63
  display-name: {{appName}}
61
64
  oauth2-configuration:
62
65
  token-policy:
@@ -44,13 +44,16 @@ identity:
44
44
  {{#hasXsuaa}}
45
45
  xsuaa-cross-consumption: true
46
46
  {{/hasXsuaa}}
47
+ provided-apis:
48
+ - name: {{appName}}-ias-api
49
+ description: API exposed by the application
47
50
  oauth2-configuration:
48
51
  token-policy:
49
52
  access-token-format: "jwt"
50
53
  {{#hasApprouter}}
51
54
  redirect-uris:
52
55
  {{=<% %>=}}
53
- - https://*.{{ tpl .Values.global.domain . }}/login/callback
56
+ - https://*.{{ tpl .Values.global.domain . }}/**
54
57
  <%={{ }}=%>
55
58
  post-logout-redirect-uris:
56
59
  {{=<% %>=}}
@@ -21,16 +21,16 @@ module.exports = class IasTemplate extends require('../../plugin') {
21
21
  const project = readProject()
22
22
  const { configFile, isNodejs } = project
23
23
  project.profile ??= 'production'
24
- project.shortcut = typeof (await read(configFile)).cds?.requires?.auth !== 'object'
24
+ project.shortcut = exists(configFile) ? typeof (await read(configFile)).cds?.requires?.db !== 'object' : true
25
25
  await merge(__dirname, 'files/package.json.hbs').into(configFile, { project, forceOverwrite: true })
26
26
  if (isNodejs) await sort('package.json', 'dependencies')
27
27
  }
28
28
 
29
29
  async combine() {
30
30
  const project = readProject()
31
- const { isJava, hasMta, hasCfManifest, hasHelm, hasHelmUnifiedRuntime, hasApprouter, hasMultitenancy, srvPath } = project
31
+ const { isJava, addMta, addCfManifest, addHelm, addHelmUnifiedRuntime, addApprouter, addMultitenancy, srvPath } = project
32
32
 
33
- if (hasMultitenancy) {
33
+ if (addMultitenancy) {
34
34
  const conf = exists('mtx/sidecar/package.json') ? await read('mtx/sidecar/package.json') : {}
35
35
  conf.cds ??= {}
36
36
  const profile = conf.cds.profile
@@ -43,7 +43,7 @@ module.exports = class IasTemplate extends require('../../plugin') {
43
43
  await merge(__dirname, 'files/sidecar.package.json.hbs').into('mtx/sidecar/package.json')
44
44
  }
45
45
 
46
- if (hasMta) {
46
+ if (addMta || addApprouter || addMultitenancy) {
47
47
  const srv = srv4(srvPath)
48
48
  const identity = { in: 'resources', where: { 'parameters.service': 'identity' } }
49
49
  const srvIdentityBinding = { in: [srv, 'requires'], where: { 'parameters.config.app-identifier': 'srv' } }
@@ -51,7 +51,7 @@ module.exports = class IasTemplate extends require('../../plugin') {
51
51
  const additions = [srv, identity, srvIdentityBinding, srvCertUrlApi]
52
52
  const overwrites = []
53
53
 
54
- if (hasApprouter) {
54
+ if (addApprouter) {
55
55
  additions.push(approuter)
56
56
  additions.push({ in: [approuter, 'requires'], where: { 'parameters.config.app-identifier': 'approuter' }})
57
57
  const approuterSrvApi = { in: [approuter, 'requires'], where: { 'name': 'srv-api' } }
@@ -60,7 +60,7 @@ module.exports = class IasTemplate extends require('../../plugin') {
60
60
  overwrites.push({ item: [approuterSrvApi, 'properties.forwardAuthCertificates'], withValue: true })
61
61
  overwrites.push({ item: [approuterSrvApi, 'properties.strictSSL'], withValue: true })
62
62
  }
63
- if (hasMultitenancy) {
63
+ if (addMultitenancy) {
64
64
  const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
65
65
  const mtxIdentityBinding = { in: [mtxSidecar, 'requires'], where: { 'parameters.config.app-identifier': 'mtx' } }
66
66
  additions.push(mtxSidecar, mtxIdentityBinding)
@@ -68,13 +68,13 @@ module.exports = class IasTemplate extends require('../../plugin') {
68
68
  await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { project, additions, overwrites })
69
69
  }
70
70
 
71
- if (hasHelm || hasHelmUnifiedRuntime) {
71
+ if (addHelm || addHelmUnifiedRuntime) {
72
72
  const identity = { in: 'dependencies', where: { 'alias': 'identity' } }
73
73
  await merge(__dirname, 'files/Chart.yaml.hbs').into('chart/Chart.yaml', { project, additions: [identity] })
74
74
  await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { project })
75
75
  }
76
76
 
77
- if (hasCfManifest) {
77
+ if (addCfManifest) {
78
78
  await this.#combineWithCfManifest(project) // REVISIT: we shouldn't overly promote cf-manifest
79
79
  }
80
80
  }
@@ -28,9 +28,9 @@ module.exports = class KafkaTemplate extends require('../../plugin') {
28
28
 
29
29
  async combine() {
30
30
  const project = readProject()
31
- const { hasMta, srvPath, hasHelm, hasHelmUnifiedRuntime } = project
31
+ const { addMta, srvPath, addHelm, addHelmUnifiedRuntime } = project
32
32
 
33
- if (hasMta) {
33
+ if (addMta) {
34
34
  const srv = srv4(srvPath)
35
35
  await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
36
36
  project,
@@ -42,7 +42,7 @@ module.exports = class KafkaTemplate extends require('../../plugin') {
42
42
  })
43
43
  }
44
44
 
45
- if (hasHelm || hasHelmUnifiedRuntime) {
45
+ if (addHelm || addHelmUnifiedRuntime) {
46
46
  await merge(__dirname, 'files/values.yaml').into('chart/values.yaml')
47
47
  }
48
48
  }
@@ -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
 
@@ -22,7 +22,7 @@ module.exports = class LocalMessagingTemplate extends require('../../plugin') {
22
22
  async run() {
23
23
  const project = readProject()
24
24
  const { configFile } = project
25
- project.shortcut = typeof (await read(configFile)).cds?.requires?.messaging !== 'object'
25
+ project.shortcut = !exists(configFile) || typeof (await read(configFile)).cds?.requires?.messaging !== 'object'
26
26
  await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
27
27
  }
28
28
  }
@@ -12,10 +12,6 @@ module.exports = class MalwareScannerTemplate extends require('../../plugin') {
12
12
  return !!env.requires['malware-scanner']
13
13
  }
14
14
 
15
- async canRun() {
16
- return true
17
- }
18
-
19
15
  async run() {
20
16
  const project = readProject()
21
17
  const { isNodejs } = project
@@ -26,9 +22,9 @@ module.exports = class MalwareScannerTemplate extends require('../../plugin') {
26
22
 
27
23
  async combine() {
28
24
  const project = readProject()
29
- const { hasMta, hasHelm, hasHelmUnifiedRuntime, srvPath } = project
25
+ const { addMta, addHelm, addHelmUnifiedRuntime, srvPath } = project
30
26
 
31
- if (hasMta) {
27
+ if (addMta) {
32
28
  const srv = srv4(srvPath)
33
29
  const additions = [srv, malwareScanner ]
34
30
  const relationships = [{
@@ -40,7 +36,7 @@ module.exports = class MalwareScannerTemplate extends require('../../plugin') {
40
36
  })
41
37
  }
42
38
 
43
- if (hasHelm || hasHelmUnifiedRuntime) {
39
+ if (addHelm || addHelmUnifiedRuntime) {
44
40
  await merge(__dirname, 'files', 'values.yaml').into('chart/values.yaml')
45
41
  }
46
42
  }
@@ -43,6 +43,16 @@ modules:
43
43
  properties:
44
44
  srv-url: ${default-url}
45
45
  requires: []
46
+ {{#externalServices}}
47
+ - name: {{name}}
48
+ type: nodejs
49
+ path: {{& path }}
50
+ parameters:
51
+ instances: 1
52
+ buildpack: nodejs_buildpack
53
+ build-parameters:
54
+ builder: npm-ci
55
+ {{/externalServices}}
46
56
 
47
57
  resources:
48
58
  []