@sap/cds-dk 9.3.2 → 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 (113) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/bin/bind.js +1 -1
  3. package/bin/cds.js +3 -0
  4. package/bin/compile/index.js +53 -3
  5. package/bin/data-products/get-csn-via-dp-cli.js +41 -0
  6. package/bin/data-products/get-csn.js +76 -0
  7. package/bin/data-products/import.js +114 -0
  8. package/bin/data-products/index.js +30 -0
  9. package/bin/data-products/merge-csns.js +46 -0
  10. package/bin/data-products/prepare-csn.js +282 -0
  11. package/bin/data-products/prepare-files.js +69 -0
  12. package/bin/export.js +240 -0
  13. package/bin/help/export.md +37 -0
  14. package/bin/help/import.md +11 -0
  15. package/bin/help/minify.md +23 -0
  16. package/bin/import.js +13 -3
  17. package/bin/inspect.js +226 -0
  18. package/bin/minify.js +123 -0
  19. package/bin/up.js +2 -2
  20. package/bin/util/cli.js +132 -0
  21. package/bin/util/log.js +2 -0
  22. package/bin/version.js +2 -1
  23. package/bin/watch.js +21 -3
  24. package/lib/bind/shared.js +3 -1
  25. package/lib/build/buildTaskEngine.js +2 -1
  26. package/lib/build/plugins/helm/files/templates/NOTES.txt +1 -1
  27. package/lib/build/plugins/helm/index.js +1 -2
  28. package/lib/build/provider/internalBuildTaskProvider.js +3 -3
  29. package/lib/build/provider/nodejs/index.js +62 -3
  30. package/lib/deploy/index.js +1 -1
  31. package/lib/deploy/to-hana/hana.js +18 -16
  32. package/lib/import/odata/v2parser.js +2 -2
  33. package/lib/import/odata/v4parser.js +21 -2
  34. package/lib/import/odata.package.json +4 -4
  35. package/lib/init/constants.js +4 -1
  36. package/lib/init/index.js +6 -5
  37. package/lib/init/mvn.js +3 -2
  38. package/lib/init/projectReader.js +65 -55
  39. package/lib/init/registries/mta.js +6 -0
  40. package/lib/init/template/ams/files/manifest.yml.hbs +1 -1
  41. package/lib/init/template/ams/files/mta.yaml.hbs +1 -1
  42. package/lib/init/template/ams/index.js +7 -6
  43. package/lib/init/template/app-frontend/files/app-package.json.hbs +20 -0
  44. package/lib/init/template/app-frontend/files/index.html.hbs +34 -0
  45. package/lib/init/template/app-frontend/files/manifest.json +13 -0
  46. package/lib/init/template/app-frontend/files/mta.yaml.hbs +64 -0
  47. package/lib/init/template/app-frontend/files/package.json.hbs +17 -0
  48. package/lib/init/template/app-frontend/files/ui5-deploy.yaml.hbs +25 -0
  49. package/lib/init/template/app-frontend/files/ui5.yaml.hbs +6 -0
  50. package/lib/init/template/app-frontend/files/values.yaml.hbs +20 -0
  51. package/lib/init/template/app-frontend/files/xs-app.json.hbs +17 -0
  52. package/lib/init/template/app-frontend/index.js +98 -0
  53. package/lib/init/template/application-logging/index.js +13 -10
  54. package/lib/init/template/approuter/files/mta.yaml.hbs +0 -2
  55. package/lib/init/template/approuter/index.js +15 -9
  56. package/lib/init/template/attachments/index.js +7 -13
  57. package/lib/init/template/audit-logging/files/package.json.hbs +5 -0
  58. package/lib/init/template/audit-logging/index.js +4 -4
  59. package/lib/init/template/cloud-logging/index.js +13 -10
  60. package/lib/init/template/connectivity/index.js +3 -3
  61. package/lib/init/template/destination/index.js +6 -6
  62. package/lib/init/template/dynatrace/index.js +13 -10
  63. package/lib/init/template/enterprise-messaging/index.js +5 -5
  64. package/lib/init/template/enterprise-messaging-shared/index.js +4 -4
  65. package/lib/init/template/extensibility/index.js +2 -2
  66. package/lib/init/template/file-based-messaging/index.js +2 -2
  67. package/lib/init/template/github-actions/index.js +3 -3
  68. package/lib/init/template/hana/index.js +19 -22
  69. package/lib/init/template/handler/index.js +1 -0
  70. package/lib/init/template/helm/index.js +34 -21
  71. package/lib/init/template/html5-repo/files/containerize.yaml.hbs +0 -1
  72. package/lib/init/template/html5-repo/files/mta.yaml.hbs +10 -2
  73. package/lib/init/template/html5-repo/index.js +8 -6
  74. package/lib/init/template/http/index.js +31 -10
  75. package/lib/init/template/ias/files/manifest.yml.hbs +1 -1
  76. package/lib/init/template/ias/files/mta.yaml.hbs +9 -5
  77. package/lib/init/template/ias/files/values.yaml.hbs +14 -2
  78. package/lib/init/template/ias/index.js +8 -8
  79. package/lib/init/template/kafka/index.js +3 -3
  80. package/lib/init/template/local-messaging/index.js +2 -2
  81. package/lib/init/template/malware-scanner/index.js +3 -7
  82. package/lib/init/template/mta/files/mta.yaml.hbs +10 -0
  83. package/lib/init/template/multitenancy/files/mta.yaml.hbs +16 -3
  84. package/lib/init/template/multitenancy/files/package.json.hbs +5 -0
  85. package/lib/init/template/multitenancy/files/values.yaml.hbs +1 -6
  86. package/lib/init/template/multitenancy/index.js +8 -10
  87. package/lib/init/template/notifications/index.js +2 -2
  88. package/lib/init/template/portal/files/mta.yaml.hbs +18 -2
  89. package/lib/init/template/portal/index.js +7 -7
  90. package/lib/init/template/postgres/index.js +4 -4
  91. package/lib/init/template/redis/index.js +2 -2
  92. package/lib/init/template/redis-messaging/index.js +2 -2
  93. package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +2 -2
  94. package/lib/init/template/sample/files/db/schema.cds +5 -8
  95. package/lib/init/template/sample/files/javascript/admin-service.js.hbs +24 -0
  96. package/lib/init/template/sample/files/javascript/cat-service.js.hbs +43 -0
  97. package/lib/init/template/sample/files/typescript/admin-service.ts.hbs +16 -0
  98. package/lib/init/template/sample/files/typescript/cat-service.ts.hbs +31 -0
  99. package/lib/init/template/test/files/test/test.xs.hbs +1 -1
  100. package/lib/init/template/test/index.js +2 -2
  101. package/lib/init/template/tiny-sample/index.js +1 -1
  102. package/lib/init/template/typer/files/xsconfig.json +2 -1
  103. package/lib/init/template/typescript/files/package.json +1 -1
  104. package/lib/init/template/typescript/files/tsconfig.json +4 -1
  105. package/lib/init/template/workzone-standard/files/mta.yaml.hbs +4 -0
  106. package/lib/init/template/workzone-standard/index.js +8 -8
  107. package/lib/init/template/xsuaa/files/mta.yaml.hbs +0 -2
  108. package/lib/init/template/xsuaa/files/package.json.hbs +3 -0
  109. package/lib/init/template/xsuaa/index.js +23 -18
  110. package/lib/lint/eslintHelp.json +1 -1
  111. package/lib/util/term.js +2 -4
  112. package/npm-shrinkwrap.json +28 -28
  113. package/package.json +1 -1
@@ -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` }
@@ -56,6 +56,7 @@ async function createNodeHandler(proj) {
56
56
  const nameFilter = filterStringAsRegex(filter)
57
57
 
58
58
  for (const service of csn.services) {
59
+ if (service['@cds.external']) continue
59
60
  if (!service.$location.file) continue
60
61
 
61
62
  proj.serviceName = service.name
@@ -86,40 +86,50 @@ module.exports = class HelmTemplate extends require('../../plugin') {
86
86
  }
87
87
 
88
88
  async combine() {
89
- const { hasDestination, hasEnterpriseMessaging, hasEnterpriseMessagingShared, hasHana, hasMultitenancy, hasXsuaa, hasHtml5Repo, hasApprouter, hasKafka, hasAttachments, hasPortal, hasMalwareScanner, hasDynatrace, hasCloudLogging } = readProject()
90
-
91
- if (hasApprouter) {
89
+ // REVISIT: This must be moved to the respective plugins
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) {
92
98
  await this._mergeDependency('web-application', 'approuter')
93
99
  }
94
100
 
95
- if (hasHtml5Repo) {
96
- await this._mergeDependency('service-instance', 'html5-apps-repo-host')
97
- await this._mergeDependency('content-deployment', 'html5-apps-deployer')
98
- 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) {
99
107
  await this._mergeDependency('service-instance', 'html5-apps-repo-runtime')
100
108
  }
101
109
  }
102
- if (hasMultitenancy) {
103
- await this._mergeDependency('web-application', 'sidecar')
104
- if (hasXsuaa) {
110
+ if (addMultitenancy || addXsuaa || addIas || addAms) {
111
+ if (addMultitenancy) {
112
+ await this._mergeDependency('web-application', 'sidecar')
113
+ }
114
+ if (hasXsuaa && hasMultitenancy) {
105
115
  await this._mergeDependency('service-instance', 'saas-registry')
106
- } else {
116
+ } else if (hasMultitenancy) {
107
117
  await this._mergeDependency('service-instance', 'subscription-manager')
108
118
  }
109
119
  }
110
- if (hasDestination) {
120
+ if (addDestination) {
111
121
  await this._mergeDependency('service-instance', 'destination')
112
122
  }
113
- if (hasAttachments) {
123
+ if (addAttachments) {
114
124
  await this._mergeDependency('service-instance', 'attachments')
115
125
  }
116
- if (hasEnterpriseMessaging || hasEnterpriseMessagingShared) {
126
+ if (addEnterpriseMessaging || addEnterpriseMessagingShared) {
117
127
  await this._mergeDependency('service-instance', 'event-mesh')
118
128
  }
119
- if (hasXsuaa) {
129
+ if (addXsuaa) {
120
130
  await this._mergeDependency('service-instance', 'xsuaa')
121
131
  }
122
- if (hasHana) {
132
+ if (addHana || addMultitenancy) {
123
133
  if (hasMultitenancy) {
124
134
  await this._mergeDependency('service-instance', 'service-manager')
125
135
  } else {
@@ -127,22 +137,25 @@ module.exports = class HelmTemplate extends require('../../plugin') {
127
137
  await this._mergeDependency('content-deployment', 'hana-deployer')
128
138
  }
129
139
  }
130
- if (hasKafka) {
140
+ if (addKafka) {
131
141
  await this._mergeDependency('service-instance', 'kafka')
132
142
  }
133
- if (hasPortal) {
143
+ if (addPortal) {
134
144
  await this._mergeDependency('service-instance', 'portal')
135
145
  await this._mergeDependency('content-deployment', 'portal-deployer')
136
146
  }
137
- if (hasMalwareScanner) {
147
+ if (addMalwareScanner) {
138
148
  await this._mergeDependency('service-instance', 'malware-scanner')
139
149
  }
140
- if (hasCloudLogging) {
150
+ if (addCloudLogging) {
141
151
  await this._mergeDependency('service-instance', 'cloud-logging')
142
152
  }
143
- if (hasDynatrace) {
153
+ if (addDynatrace) {
144
154
  await this._mergeDependency('service-instance', 'dynatrace')
145
155
  }
156
+ if (addAuditLogging) {
157
+ await this._mergeDependency('service-instance', 'auditlog')
158
+ }
146
159
  }
147
160
 
148
161
  async _mergeDependency(name, alias) {
@@ -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
@@ -25,11 +25,16 @@ modules:
25
25
  type: com.sap.application.content
26
26
  path: {{#isNodejs}}gen{{/isNodejs}}{{#isJava}}.{{/isJava}}
27
27
  requires:
28
- - name: {{appName}}-auth{{#hasIas}}
28
+ {{#hasXsuaa}}
29
+ - name: {{appName}}-auth
30
+ {{/hasXsuaa}}
31
+ {{#hasIas}}
32
+ - name: {{appName}}-ias
29
33
  parameters:
30
34
  config:
31
35
  credential-type: X509_GENERATED
32
- app-identifier: app-deployer{{/hasIas}}
36
+ app-identifier: app-deployer
37
+ {{/hasIas}}
33
38
  - name: srv-api
34
39
  - name: {{appName}}-html5-repo-host
35
40
  parameters:
@@ -47,6 +52,7 @@ modules:
47
52
  target-path: {{#isNodejs}}{{& appPath }}{{/isNodejs}}{{#isJava}}resources{{/isJava}}
48
53
  {{/apps}}
49
54
  {{#hasWorkzoneStandard}}
55
+ {{#hasMultitenancy}}
50
56
  parameters:
51
57
  config:
52
58
  HTML5Runtime_enabled: true
@@ -61,11 +67,13 @@ modules:
61
67
  ProxyType: Internet
62
68
  HTML5.ForwardAuthToken: true
63
69
  HTML5.DynamicDestination: true
70
+ {{#hasIas}}HTML5.IASDependencyName: {{appName}}-ias-api{{/hasIas}}
64
71
  - Name: ui5
65
72
  URL: https://ui5.sap.com
66
73
  Authentication: NoAuthentication
67
74
  Type: HTTP
68
75
  ProxyType: Internet
76
+ {{/hasMultitenancy}}
69
77
  {{/hasWorkzoneStandard}}
70
78
 
71
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
  */
@@ -2,7 +2,7 @@
2
2
  applications:
3
3
  - name: {{appName}}-srv
4
4
  services:
5
- - name: {{appName}}-auth
5
+ - name: {{appName}}-ias
6
6
  parameters:
7
7
  credential-type: X509_GENERATED
8
8
  app-identifier: srv
@@ -4,7 +4,7 @@ modules:
4
4
  type: {{language}}
5
5
  path: {{& srvPath}}
6
6
  requires:
7
- - name: {{appName}}-auth
7
+ - name: {{appName}}-ias
8
8
  parameters:
9
9
  config:
10
10
  credential-type: X509_GENERATED
@@ -22,7 +22,7 @@ modules:
22
22
  type: approuter.nodejs
23
23
  path: {{& approuterPath}}
24
24
  requires:
25
- - name: {{appName}}-auth
25
+ - name: {{appName}}-ias
26
26
  parameters:
27
27
  config:
28
28
  credential-type: X509_GENERATED
@@ -32,20 +32,21 @@ modules:
32
32
  properties:
33
33
  url: ~{srv-cert-url}
34
34
  forwardAuthCertificates: true
35
+ forwardAuthToken: true
35
36
  strictSSL: true
36
37
 
37
38
  - name: {{appName}}-mtx
38
39
  type: nodejs
39
40
  path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
40
41
  requires:
41
- - name: {{appName}}-auth
42
+ - name: {{appName}}-ias
42
43
  parameters:
43
44
  config:
44
45
  credential-type: X509_GENERATED
45
46
  app-identifier: mtx
46
47
 
47
48
  resources:
48
- - name: {{appName}}-auth
49
+ - name: {{appName}}-ias
49
50
  type: org.cloudfoundry.managed-service
50
51
  {{#hasApprouter}}
51
52
  requires:
@@ -53,9 +54,12 @@ resources:
53
54
  {{/hasApprouter}}
54
55
  parameters:
55
56
  service: identity
56
- service-name: {{appName}}-auth
57
+ service-name: {{appName}}-ias
57
58
  service-plan: application
58
59
  config:
60
+ provided-apis:
61
+ - name: {{appName}}-ias-api
62
+ description: API exposed by the application
59
63
  display-name: {{appName}}
60
64
  oauth2-configuration:
61
65
  token-policy:
@@ -1,5 +1,8 @@
1
1
  {{#hasMultitenancy}}
2
2
  sidecar:
3
+ expose:
4
+ gateway: default/kyma-mtls-gateway
5
+ host: {{#literal}}"{{ .Release.Name }}-sidecar-{{ .Release.Namespace }}.cert"{{/literal}}
3
6
  bindings:
4
7
  auth:
5
8
  serviceInstanceName: identity
@@ -9,6 +12,9 @@ sidecar:
9
12
  {{/hasMultitenancy}}
10
13
  {{#hasApprouter}}
11
14
  approuter:
15
+ expose:
16
+ gateway: default/kyma-mtls-gateway
17
+ host: {{#literal}}"{{ .Release.Name }}-approuter-{{ .Release.Namespace }}.cert"{{/literal}}
12
18
  bindings:
13
19
  auth:
14
20
  serviceInstanceName: identity
@@ -17,6 +23,9 @@ approuter:
17
23
  app-identifier: approuter
18
24
  {{/hasApprouter}}
19
25
  srv:
26
+ expose:
27
+ gateway: default/kyma-mtls-gateway
28
+ host: {{#literal}}"{{ .Release.Name }}-srv-{{ .Release.Namespace }}.cert"{{/literal}}
20
29
  bindings:
21
30
  auth:
22
31
  serviceInstanceName: identity
@@ -35,13 +44,16 @@ identity:
35
44
  {{#hasXsuaa}}
36
45
  xsuaa-cross-consumption: true
37
46
  {{/hasXsuaa}}
38
- {{#hasApprouter}}
47
+ provided-apis:
48
+ - name: {{appName}}-ias-api
49
+ description: API exposed by the application
39
50
  oauth2-configuration:
40
51
  token-policy:
41
52
  access-token-format: "jwt"
53
+ {{#hasApprouter}}
42
54
  redirect-uris:
43
55
  {{=<% %>=}}
44
- - https://*.{{ tpl .Values.global.domain . }}/login/callback
56
+ - https://*.{{ tpl .Values.global.domain . }}/**
45
57
  <%={{ }}=%>
46
58
  post-logout-redirect-uris:
47
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
  []