@sap/cds-dk 7.8.0 → 7.8.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 (33) hide show
  1. package/bin/add.js +4 -6
  2. package/bin/cds.js +9 -0
  3. package/lib/build/provider/internalBuildTaskProvider.js +4 -6
  4. package/lib/build/util.js +6 -6
  5. package/lib/compile/openapi/csdl2openapi.js +4 -0
  6. package/lib/init/constants.js +2 -2
  7. package/lib/init/template/approuter/files/values.yaml.hbs +6 -0
  8. package/lib/init/template/approuter/index.js +1 -7
  9. package/lib/init/template/data/index.js +2 -1
  10. package/lib/init/template/enterprise-messaging/files/package.json.hbs +2 -1
  11. package/lib/init/template/enterprise-messaging/index.js +16 -3
  12. package/lib/init/template/enterprise-messaging-shared/files/package.json.hbs +2 -1
  13. package/lib/init/template/enterprise-messaging-shared/index.js +16 -3
  14. package/lib/init/template/helm/files/web-application/Chart.yaml +1 -1
  15. package/lib/init/template/helm/files/web-application/templates/_helpers.tpl +23 -0
  16. package/lib/init/template/helm/files/web-application/templates/deployment.yaml +3 -29
  17. package/lib/init/template/helm/files/web-application/values.schema.json +17 -1
  18. package/lib/init/template/helm/files/web-application/values.yaml +10 -2
  19. package/lib/init/template/helm/index.js +5 -2
  20. package/lib/init/template/helm-unified-runtime/files/templates/NOTES.txt +2 -0
  21. package/lib/init/template/helm-unified-runtime/files/templates/_deployment_helpers.tpl +10 -2
  22. package/lib/init/template/helm-unified-runtime/index.js +4 -1
  23. package/lib/init/template/html5-repo/index.js +0 -1
  24. package/lib/init/template/kafka/files/values.yaml +10 -0
  25. package/lib/init/template/kafka/index.js +5 -6
  26. package/lib/init/template/multitenancy/files/mtxs-configmap-java.yaml +1 -1
  27. package/lib/init/template/multitenancy/index.js +3 -3
  28. package/lib/util/fs.js +1 -1
  29. package/npm-shrinkwrap.json +10 -10
  30. package/package.json +1 -1
  31. package/lib/init/template/approuter/files/approuter-mtxs-configmap.yaml +0 -19
  32. /package/lib/init/template/{approuter/files/mtxs-configmap-java.yaml → multitenancy/files/mtxs-configmap-java-approuter.yaml} +0 -0
  33. /package/lib/init/template/{approuter/files/mtxs-configmap-nodejs.yaml → multitenancy/files/mtxs-configmap-nodejs-approuter.yaml} +0 -0
package/bin/add.js CHANGED
@@ -120,12 +120,10 @@ ${Object.entries(conf).sort(([a], [b]) => a.localeCompare(b)).flatMap(([pluginNa
120
120
 
121
121
  `})
122
122
 
123
- async function add(features) {
124
- await cds.plugins
123
+ async function add(args) {
124
+ // await cds.plugins
125
125
  const CDSGenerator = require('../lib/init')
126
126
  const generator = new CDSGenerator()
127
-
128
- const args = features.map(f => f.split(/[,\s+]/)).flat()
129
-
130
- await generator.add(args)
127
+ const features = args.map(f => f.split(/[,\s+]/)).flat()
128
+ await generator.add(features)
131
129
  }
package/bin/cds.js CHANGED
@@ -43,6 +43,14 @@ const cli = {
43
43
  appendArgs = argv.slice(endOfOptions + 1)
44
44
  argv = argv.slice(0, endOfOptions)
45
45
  }
46
+ // REVISIT: Have to do it here to allow custom flags for plugins!
47
+ if (cmd === 'add') {
48
+ await cds.plugins
49
+ for (const [_, Plugin] of cds.add.registered) {
50
+ task.options.push(...Object.keys((new Plugin).options()).map(key => '--'+key))
51
+ }
52
+ }
53
+
46
54
  const args = this.args(task, argv)
47
55
  args[0].push(...appendArgs)
48
56
  cds.cli = {
@@ -122,6 +130,7 @@ async function _resolveBindings(options) {
122
130
  const bindingEnv = await bindingManager.bindingEnv()
123
131
  Object.assign(process.env, bindingEnv)
124
132
  cds.env = cds.env.for('cds') // reload env // FIXME: This is too early!
133
+ cds.requires = cds.env.requires // REVISIT: We should clean this up!
125
134
  }
126
135
 
127
136
  function _local (id, _else) {
@@ -309,6 +309,8 @@ Upgrade to @sap/cds-mtxs following the migration guide https://cap.cloud.sap/doc
309
309
 
310
310
  static async _setDefaultModel(task) {
311
311
  const ws = hasOptionValue(task.options?.[CONTENT_WS], true) || cds.cli.options?.ws
312
+ // REVISIT: filter nodejs bootstrap service models for Java - issues/12770#issuecomment-1805719
313
+ const filter = this._hasJavaNature() ? (m) => !NODEJS_MODEL_EXCLUDE_LIST.includes(m) : null
312
314
  let taskModelPaths = task.options?.model
313
315
  if (taskModelPaths && !Array.isArray(taskModelPaths)) {
314
316
  taskModelPaths = [taskModelPaths]
@@ -318,21 +320,17 @@ Upgrade to @sap/cds-mtxs following the migration guide https://cap.cloud.sap/doc
318
320
  let defaultModelPaths = []
319
321
  if (taskModelPaths?.length) {
320
322
  if (!hasOptionValue(task.options?.[IGNORE_DEFAULT_MODELS], true)) {
321
- defaultModelPaths = await getDefaultModelOptions(ws)
323
+ defaultModelPaths = await getDefaultModelOptions(ws, filter)
322
324
  defaultModelPaths = defaultModelPaths.filter(p => p.match(allowList))
323
325
  }
324
326
  } else {
325
- defaultModelPaths = await getDefaultModelOptions(ws)
327
+ defaultModelPaths = await getDefaultModelOptions(ws, filter)
326
328
  defaultModelPaths.push(task.src)
327
329
  if (hasOptionValue(task.options?.[IGNORE_DEFAULT_MODELS], true)) {
328
330
  // all default models except the built-in models
329
331
  defaultModelPaths = defaultModelPaths.filter(p => !p.match(allowList))
330
332
  }
331
333
  }
332
- // REVISIT: filter nodejs bootstrap service models for Java - issues/12770#issuecomment-1805719
333
- if (this._hasJavaNature()) {
334
- defaultModelPaths = defaultModelPaths.filter(p => !NODEJS_MODEL_EXCLUDE_LIST.includes(p))
335
- }
336
334
  if (defaultModelPaths.length) {
337
335
  task.options.model = [...new Set(taskModelPaths?.length ? taskModelPaths.concat(defaultModelPaths) : defaultModelPaths)]
338
336
  }
package/lib/build/util.js CHANGED
@@ -117,10 +117,10 @@ function resolveRequiredSapModels(modelPaths) {
117
117
  })
118
118
  }
119
119
 
120
- async function getDefaultModelOptions(ws = false) {
120
+ async function getDefaultModelOptions(ws = false, filter) {
121
121
  // Note: requires.toggles holds the actual kind representation and not the value 'true'
122
122
  const wildcards = cds.env.requires.toggles && cds.env.features.folders ? ['*', cds.env.features.folders] : '*'
123
- let paths = _filterModelPaths(cds.resolve(wildcards, false))
123
+ let paths = _filterModelPaths(cds.resolve(wildcards, false), filter)
124
124
 
125
125
  if (ws) {
126
126
  const workspaces = await getWorkspaces()
@@ -130,7 +130,7 @@ async function getDefaultModelOptions(ws = false) {
130
130
  workspaces.forEach(workspace => {
131
131
  cds.root = path.join(root, workspace)
132
132
  cds.env = cds.env.for('cds', cds.root)
133
- paths = paths.concat(_filterModelPaths(cds.resolve(cds.env.requires.toggles ? wildcards : '*', false)).map(p => path.join(workspace, p)))
133
+ paths = paths.concat(_filterModelPaths(cds.resolve(cds.env.requires.toggles ? wildcards : '*', false), filter).map(p => path.join(workspace, p)))
134
134
  })
135
135
  } finally {
136
136
  cds.root = root
@@ -254,10 +254,10 @@ function _validateWsDependencies(wsRoot, dependencies, devDependencies) {
254
254
 
255
255
  /**
256
256
  * Returns a flat array of existing files and folders, trailing '/' or '\\' characters have been removed.
257
- * @param {...any} modelPaths array of files and folders - optionally nested
257
+ * @param {Array} modelPaths array of files and folders - optionally nested
258
258
  * @returns
259
259
  */
260
- function _filterModelPaths(...modelPaths) {
260
+ function _filterModelPaths(modelPaths, filter) {
261
261
  const model = new Set()
262
262
  // may contain nested arrays
263
263
  modelPaths = flatten(modelPaths)
@@ -277,7 +277,7 @@ function _filterModelPaths(...modelPaths) {
277
277
  }
278
278
  }
279
279
  })
280
- return [...model].map(m => normalizePath(m))
280
+ return [...model].filter(m => filter ? filter(m) : true).map(m => normalizePath(m))
281
281
  }
282
282
 
283
283
  /**
@@ -2267,6 +2267,10 @@ see [Expand](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-prot
2267
2267
  s.description = element[voc.Core.LongDescription];
2268
2268
  }
2269
2269
 
2270
+ if (element['@ODM.oidReference']?.entityName) {
2271
+ s['x-sap-odm-oid-reference-entity-name'] = element['@ODM.oidReference'].entityName
2272
+ }
2273
+
2270
2274
  return s;
2271
2275
  }
2272
2276
 
@@ -4,7 +4,7 @@ module.exports = {
4
4
  COMMAND_INIT: 'init',
5
5
  COMMAND_ADD: 'add',
6
6
 
7
- MAVEN_ARCHETYPE_VERSION: '2.7.1',
7
+ MAVEN_ARCHETYPE_VERSION: '2.8.1',
8
8
 
9
9
  OPTIONS: Object.freeze({
10
10
  JAVA: 'java',
@@ -57,7 +57,7 @@ module.exports = {
57
57
  PIPELINE_HELP: 'https://sap.github.io/jenkins-library/',
58
58
  SAMPLES: 'https://github.com/SAP-samples/cloud-cap-samples',
59
59
  CAPIRE: 'https://cap.cloud.sap',
60
- MAVEN_ARCHETYPE_HELP: `https://cap.cloud.sap/docs/java/development/#the-maven-archetype`,
60
+ MAVEN_ARCHETYPE_HELP: `https://cap.cloud.sap/docs/java/developing-applications/building#the-maven-archetype`,
61
61
  MAVEN_INSTALL_HELP: `https://maven.apache.org/install.html`
62
62
  }),
63
63
 
@@ -15,6 +15,12 @@ approuter:
15
15
  image:
16
16
  repository: <your-container-registry>/{{appName}}-approuter
17
17
  tag: latest
18
+ {{#hasMultitenancy}}
19
+ {{=<% %>=}}
20
+ env:
21
+ TENANT_HOST_PATTERN: ^(.*)-{{ .Release.Name }}-approuter-{{ .Release.Namespace }}.{{ .Values.global.domain }} # change if expose.host is set
22
+ <%={{ }}=%>
23
+ {{/hasMultitenancy}}
18
24
  resources:
19
25
  limits:
20
26
  ephemeral-storage: 1G
@@ -63,13 +63,7 @@ module.exports = class ApprouterTemplate extends require('../../plugin') {
63
63
  }
64
64
  }]}}).into('chart/values.yaml', { with: project })
65
65
 
66
- const fileName = hasMultitenancy ? 'approuter-mtxs-configmap.yaml' : 'approuter-configmap.yaml'
67
- await copy(join(__dirname, 'files', fileName)).to('chart', 'templates', 'approuter-configmap.yaml')
68
-
69
- if (hasMultitenancy) {
70
- const mtxsConfigMapFileName = isNodejs ? 'mtxs-configmap-nodejs.yaml' : 'mtxs-configmap-java.yaml'
71
- await copy(join(__dirname, 'files', mtxsConfigMapFileName)).to('chart', 'templates', 'mtxs-configmap.yaml')
72
- }
66
+ await copy(join(__dirname, 'files/approuter-configmap.yaml')).to('chart', 'templates', 'approuter-configmap.yaml')
73
67
  }
74
68
 
75
69
  const xsAppPath = join(approuterPath, 'xs-app.json')
@@ -74,7 +74,8 @@ module.exports = class DataTemplate extends require('../../plugin') {
74
74
 
75
75
  if (contentType === 'csv') {
76
76
  const headerOnly = !cds.cli.options['records'] // compat to old behavior which only creates headers
77
- await asCsv(data, csn, Object.assign({ headerOnly }, dataForParams))
77
+ const queries = false // old behavior excluded queries
78
+ await asCsv(data, csn, Object.assign({ headerOnly, queries }, dataForParams))
78
79
  }
79
80
 
80
81
  // write files
@@ -7,7 +7,8 @@
7
7
  "[{{profile}}]": {
8
8
  {{/profile}}
9
9
  "messaging": {
10
- "kind": "enterprise-messaging"
10
+ "kind": "enterprise-messaging"{{#cloudevents}},
11
+ "format": "cloudevents"{{/cloudevents}}
11
12
  }
12
13
  {{#profile}}
13
14
  }
@@ -7,6 +7,16 @@ const { srv4, enterpriseMessaging } = require('../../registries/mta')
7
7
 
8
8
  module.exports = class EnterpriseMessagingTemplate extends require('../../plugin') {
9
9
 
10
+ options() {
11
+ return {
12
+ 'cloudevents': {
13
+ type: 'boolean',
14
+ short: 'c',
15
+ help: 'Use CloudEvents formatting',
16
+ }
17
+ }
18
+ }
19
+
10
20
  async canRun() {
11
21
  const { isJava } = readProject()
12
22
  if (isJava) throw `'cds add enterprise-messaging' is not available for Java yet`
@@ -19,9 +29,12 @@ module.exports = class EnterpriseMessagingTemplate extends require('../../plugin
19
29
 
20
30
  async run() {
21
31
  const project = readProject()
22
- const { configFile } = project
23
- await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
24
- await merge(__dirname, 'files/event-mesh.json.hbs').into('event-mesh.json', { with: project })
32
+ const { configFile, isNodejs } = project
33
+ if (isNodejs) {
34
+ project.cloudevents = cds.cli.options.cloudevents
35
+ await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
36
+ }
37
+ await merge(__dirname, 'files/event-mesh.json.hbs').into('event-mesh.json', { project })
25
38
  }
26
39
 
27
40
  async combine() {
@@ -10,7 +10,8 @@
10
10
  "[{{profile}}]": {
11
11
  {{/profile}}
12
12
  "messaging": {
13
- "kind": "enterprise-messaging-shared"
13
+ "kind": "enterprise-messaging-shared"{{#cloudevents}},
14
+ "format": "cloudevents"{{/cloudevents}}
14
15
  }
15
16
  {{#profile}}
16
17
  }
@@ -6,6 +6,16 @@ const { srv4, enterpriseMessaging } = require('../../registries/mta')
6
6
 
7
7
  module.exports = class EnterpriseMessagingSharedTemplate extends require('../../plugin') {
8
8
 
9
+ options() {
10
+ return {
11
+ 'cloudevents': {
12
+ type: 'boolean',
13
+ short: 'c',
14
+ help: 'Use CloudEvents formatting',
15
+ }
16
+ }
17
+ }
18
+
9
19
  async canRun() {
10
20
  const { isJava } = readProject()
11
21
  if (isJava) throw `'cds add enterprise-messaging-shared' is not available for Java yet`
@@ -18,9 +28,12 @@ module.exports = class EnterpriseMessagingSharedTemplate extends require('../../
18
28
 
19
29
  async run() {
20
30
  const project = readProject()
21
- const { configFile } = project
22
- project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
23
- await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
31
+ const { configFile, isNodejs } = project
32
+ if (isNodejs) {
33
+ project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
34
+ project.cloudevents = cds.cli.options.cloudevents
35
+ await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
36
+ }
24
37
  await merge(__dirname, 'files/event-mesh.json.hbs').into('event-mesh.json', { project })
25
38
  }
26
39
 
@@ -5,4 +5,4 @@ name: web-application
5
5
  sources:
6
6
  - https://github.tools.sap/unified-runtime/web-application
7
7
  type: application
8
- version: 1.12.0
8
+ version: 1.13.1
@@ -189,3 +189,26 @@ If release name contains chart name it will be used as service instance name.
189
189
  {{- $_ := set $result "vars" $variables }}
190
190
  {{- (fromYaml (tpl (toYaml $result) .context)) | mustToJson }}
191
191
  {{- end }}
192
+
193
+ {{- define "web-application.internal.healthCheck" }}
194
+ {{ .checkName }}:
195
+ {{- if .checkValues.path }}
196
+ httpGet:
197
+ path: {{ .checkValues.path }}
198
+ port: http
199
+ {{- else }}
200
+ tcpSocket:
201
+ port: {{ .context.Values.port }}
202
+ {{- end }}
203
+ {{- if eq .checkName "startupProbe" }}
204
+ periodSeconds: 2
205
+ failureThreshold: {{ div (add1 .context.Values.startupTimeoutSeconds) 2 }}
206
+ {{- else }}
207
+ {{- if .checkValues.periodSeconds }}
208
+ periodSeconds: {{ .checkValues.periodSeconds }}
209
+ {{- end }}
210
+ {{- if .checkValues.failureThreshold }}
211
+ failureThreshold: {{ .checkValues.failureThreshold }}
212
+ {{- end }}
213
+ {{- end }}
214
+ {{- end }}
@@ -71,35 +71,9 @@ spec:
71
71
  {{- if not (eq (len $envVars.vars) 0) }}
72
72
  {{- $envVars.vars | toYaml | nindent 8}}
73
73
  {{- end }}
74
- livenessProbe:
75
- {{- if .Values.health.liveness.path }}
76
- httpGet:
77
- path: {{ .Values.health.liveness.path }}
78
- port: http
79
- {{- else }}
80
- tcpSocket:
81
- port: {{ .Values.port }}
82
- {{- end }}
83
- readinessProbe:
84
- {{- if .Values.health.readiness.path }}
85
- httpGet:
86
- path: {{ .Values.health.readiness.path }}
87
- port: http
88
- {{- else }}
89
- tcpSocket:
90
- port: {{ .Values.port }}
91
- {{- end }}
92
- startupProbe:
93
- {{- if .Values.health.liveness.path }}
94
- httpGet:
95
- path: {{ .Values.health.liveness.path }}
96
- port: http
97
- {{- else }}
98
- tcpSocket:
99
- port: {{ .Values.port }}
100
- {{- end }}
101
- failureThreshold: {{ div (add1 .Values.startupTimeoutSeconds) 2 }}
102
- periodSeconds: 2
74
+ {{ include "web-application.internal.healthCheck" (dict "checkName" "livenessProbe" "checkValues" .Values.health.liveness "context" $) | nindent 8}}
75
+ {{ include "web-application.internal.healthCheck" (dict "checkName" "readinessProbe" "checkValues" .Values.health.readiness "context" $) | nindent 8}}
76
+ {{ include "web-application.internal.healthCheck" (dict "checkName" "startupProbe" "checkValues" .Values.health.liveness "context" $) | nindent 8}}
103
77
  volumeMounts:
104
78
  - name: tmp
105
79
  mountPath: /tmp
@@ -354,6 +354,14 @@
354
354
  "path": {
355
355
  "type": "string",
356
356
  "default": "/healthz"
357
+ },
358
+ "periodSeconds": {
359
+ "type": "integer",
360
+ "minimum": 1
361
+ },
362
+ "failureThreshold": {
363
+ "type": "integer",
364
+ "minimum": 1
357
365
  }
358
366
  }
359
367
  },
@@ -365,6 +373,14 @@
365
373
  "path": {
366
374
  "type": "string",
367
375
  "default": "/healthz"
376
+ },
377
+ "periodSeconds": {
378
+ "type": "integer",
379
+ "minimum": 1
380
+ },
381
+ "failureThreshold": {
382
+ "type": "integer",
383
+ "minimum": 1
368
384
  }
369
385
  }
370
386
  }
@@ -599,7 +615,7 @@
599
615
  "gateway": {
600
616
  "$id": "#/properties/expose/properties/gateway",
601
617
  "type": "string",
602
- "default": "kyma-gateway.kyma-system.svc.cluster.local"
618
+ "default": "kyma-system/kyma-gateway"
603
619
  },
604
620
  "tenantGateway": {
605
621
  "$id": "#/properties/expose/properties/gateway",
@@ -15,7 +15,7 @@ global:
15
15
  _internal:
16
16
  web-application:
17
17
  versions:
18
- 1.12.0: true
18
+ 1.13.1: true
19
19
  ## Will be used instead of the `.Chart.Name`, e.g. when generating the Deployment name.
20
20
  # nameOverride: name
21
21
 
@@ -97,10 +97,18 @@ health:
97
97
  liveness:
98
98
  # HTTP path used by Kubernetes, to perform liveness-probe calls.
99
99
  path: /healthz
100
+ ## How often (in seconds) to perform the probe.
101
+ # periodSeconds: 3
102
+ ## Number of probes to fail in a row, in order to consider the check failed.
103
+ # failureThreshold: 5
100
104
  # Readiness-probe configuration.
101
105
  readiness:
102
106
  # HTTP path used by Kubernetes, to perform readiness-probe calls.
103
107
  path: /healthz
108
+ ## How often (in seconds) to perform the probe.
109
+ # periodSeconds: 3
110
+ ## Number of probes to fail in a row, in order to consider the check failed.
111
+ # failureThreshold: 5
104
112
  # Initial timeout in seconds, during which the app must start giving the response to the liveness-probe.
105
113
  startupTimeoutSeconds: 30
106
114
  ## Use read only filesystem for the Deployment.
@@ -141,7 +149,7 @@ expose:
141
149
  # Expose the application to the internet.
142
150
  enabled: true
143
151
  # Use this istio gateway for incoming traffic.
144
- gateway: kyma-gateway.kyma-system.svc.cluster.local
152
+ gateway: kyma-system/kyma-gateway
145
153
  ## Custom Istio Gateway to use with the VirtualService created using the TENANT_HOST_PATTERN.
146
154
  ## If your TENANT_HOST_PATTERN uses top level domain for the tenants (like tenant-name.<provider>.<cluster-domain>), you need to create custom Certificate and Gateway since the default Kyma Gateway will not work.
147
155
  # tenantGateway: tenants-gateway.my-ns.svc.cluster.local
@@ -31,10 +31,10 @@ module.exports = class HelmTemplate extends require('../../plugin') {
31
31
  }
32
32
 
33
33
  async combine() {
34
- const { hasDestination, hasEnterpriseMessaging, hasHana, hasMultitenancy, hasXsuaa, hasHtml5Repo, hasApprouter } = readProject()
34
+ const { hasDestination, hasEnterpriseMessaging, hasHana, hasMultitenancy, hasXsuaa, hasHtml5Repo, hasApprouter, hasKafka } = readProject()
35
35
  let hasContentDeployment = false
36
36
 
37
- if (!exists('chart/charts/service-instance') && (hasHtml5Repo || hasMultitenancy || hasDestination || hasEnterpriseMessaging || hasXsuaa || hasHana)) {
37
+ if (!exists('chart/charts/service-instance') && (hasHtml5Repo || hasMultitenancy || hasDestination || hasEnterpriseMessaging || hasXsuaa || hasHana || hasKafka)) {
38
38
  await copy(join(__dirname, 'files', 'service-instance')).to('chart/charts/service-instance')
39
39
  }
40
40
  if (hasApprouter) {
@@ -71,6 +71,9 @@ module.exports = class HelmTemplate extends require('../../plugin') {
71
71
  await this._mergeDependency('content-deployment', 'hana-deployer')
72
72
  }
73
73
  }
74
+ if (hasKafka) {
75
+ await this._mergeDependency('service-instance', 'kafka')
76
+ }
74
77
  if(!exists('chart/charts/content-deployment') && hasContentDeployment) {
75
78
  await copy(join(__dirname, 'files', 'content-deployment')).to('chart/charts/content-deployment')
76
79
  }
@@ -6,7 +6,9 @@ Your services are available at:
6
6
  {{- $root := . }}
7
7
  {{- range $name := include "cap.deploymentNames" . | split ";" }}
8
8
  {{- $deployment := (get $root.Values $name) }}
9
+ {{- if $deployment.expose.enabled }}
9
10
  {{- $ := merge (dict "name" $name "deployment" $deployment) $root }}
10
11
  {{- $url := include "cap.deploymentHostFull" $ }}
11
12
  {{ printf "%s - https://%s" $name $url }}
13
+ {{- end -}}
12
14
  {{- end }}
@@ -51,7 +51,11 @@ copied from web-application: web-application.fullname
51
51
  Get FQDN of a deployment
52
52
  */}}
53
53
  {{- define "cap.deploymentHostFull" -}}
54
- {{ include "cap.deploymentHost" $ }}.{{ $.Values.global.domain }}
54
+ {{- if not .deployment.expose.enabled }}
55
+ {{- printf "%s-%s.%s.svc.cluster.local:8080" .Release.Name .name .Release.Namespace }}
56
+ {{- else }}
57
+ {{- include "cap.deploymentHost" $ }}.{{ $.Values.global.domain }}
58
+ {{- end -}}
55
59
  {{- end -}}
56
60
 
57
61
  {{/*
@@ -73,7 +77,11 @@ Backend Destinations
73
77
  {{- $deployment := (get $root.Values $destination.service) -}}
74
78
  {{- $srv := merge (dict "name" $destination.service "destination" $destination "deployment" $deployment) $root -}}
75
79
  {{- $destinationHost := include "cap.deploymentHostFull" $srv -}}
76
- {{- $currentDestination := dict $nameKey $destination.name $urlKey (print "https://" $destinationHost ) -}}
80
+ {{- $protocol := "https" -}}
81
+ {{- if not $deployment.expose.enabled }}
82
+ {{- $protocol = "http" -}}
83
+ {{- end -}}
84
+ {{- $currentDestination := dict $nameKey $destination.name $urlKey (print $protocol "://" $destinationHost ) -}}
77
85
  {{- $currentDestination := merge $currentDestination $.defaultParameters -}}
78
86
  {{- $destinations = (append $destinations $currentDestination) -}}
79
87
  {{- end -}}
@@ -40,7 +40,7 @@ module.exports = class HelmUnifiedRuntimeTemplate extends require('../../plugin'
40
40
  }
41
41
 
42
42
  async combine() {
43
- const { hasDestination, hasEnterpriseMessaging, hasHana, hasMultitenancy, hasXsuaa, hasHtml5Repo, hasApprouter } = readProject()
43
+ const { hasDestination, hasEnterpriseMessaging, hasHana, hasMultitenancy, hasXsuaa, hasHtml5Repo, hasApprouter, hasKafka } = readProject()
44
44
 
45
45
  if (hasApprouter) {
46
46
  await this._mergeDependency('web-application', 'approuter')
@@ -65,6 +65,9 @@ module.exports = class HelmUnifiedRuntimeTemplate extends require('../../plugin'
65
65
  if (hasXsuaa) {
66
66
  await this._mergeDependency('service-instance', 'xsuaa')
67
67
  }
68
+ if (hasKafka) {
69
+ await this._mergeDependency('service-instance', 'kafka')
70
+ }
68
71
  if (hasHana) {
69
72
  if (hasMultitenancy) {
70
73
  await this._mergeDependency('service-instance', 'service-manager')
@@ -57,7 +57,6 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
57
57
  into: [appContent, 'requires', 'name'],
58
58
  }]
59
59
  if (hasApprouter) {
60
- console.log('aaddd')
61
60
  additions.push(approuter, html5Runtime)
62
61
  relationships.push({
63
62
  insert: [html5Runtime, 'name'],
@@ -0,0 +1,10 @@
1
+ srv:
2
+ bindings:
3
+ kafka:
4
+ serviceInstanceName: kafka
5
+ kafka:
6
+ serviceOfferingName: kafka
7
+ servicePlanName: standard
8
+ parameters:
9
+ public_ip: true
10
+ allow_access: []
@@ -6,7 +6,7 @@ const mvn = require('../../mvn')
6
6
  module.exports = class KafkaTemplate extends require('../../plugin') {
7
7
 
8
8
  static hasInProduction(env) {
9
- return !!env.requires?.messaging?.kind === 'kafka'
9
+ return !!(env.requires?.messaging?.kind === 'kafka')
10
10
  }
11
11
 
12
12
  async run() {
@@ -18,7 +18,7 @@ module.exports = class KafkaTemplate extends require('../../plugin') {
18
18
 
19
19
  async combine() {
20
20
  const project = readProject()
21
- const { hasMta, srvPath } = project
21
+ const { hasMta, srvPath, hasHelm, hasHelmUnifiedRuntime } = project
22
22
 
23
23
  if (hasMta) {
24
24
  const srv = srv4(srvPath)
@@ -32,9 +32,8 @@ module.exports = class KafkaTemplate extends require('../../plugin') {
32
32
  })
33
33
  }
34
34
 
35
- // REVISIT: Helm support
36
- // if (hasHelm || hasHelmUnifiedRuntime) {
37
- // await merge(__dirname, 'files', 'values.yaml').into('chart/values.yaml')
38
- // }
35
+ if (hasHelm || hasHelmUnifiedRuntime) {
36
+ await merge(__dirname, 'files/values.yaml').into('chart/values.yaml')
37
+ }
39
38
  }
40
39
  }
@@ -1,6 +1,6 @@
1
1
  # Please do not modify this file. This file may be overwritten.
2
2
 
3
- {{- $ := merge (dict "name" "approuter" "deployment" .Values.srv ) . }}
3
+ {{- $ := merge (dict "name" "srv" "deployment" .Values.srv ) . }}
4
4
  {{- $srvUrl := (include "cap.deploymentHostFull" $ )}}
5
5
 
6
6
  {{- $ = merge (dict "name" "sidecar" "deployment" .Values.sidecar ) . }}
@@ -36,7 +36,7 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
36
36
 
37
37
  async combine() {
38
38
  const project = readProject()
39
- const { isNodejs, isJava, hasMta, hasHelm, hasHelmUnifiedRuntime, hasXsuaa, hasHana, srvPath } = project
39
+ const { isNodejs, isJava, hasMta, hasHelm, hasHelmUnifiedRuntime, hasXsuaa, hasHana, srvPath, hasApprouter } = project
40
40
 
41
41
  if (hasMta) {
42
42
  const srv = srv4(srvPath)
@@ -103,8 +103,8 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
103
103
  }}).into('chart/values.yaml', { with: project })
104
104
 
105
105
  await removeFromYAML(join('chart', 'values.yaml'), ['srv.expose', 'srv.networkSecurity'])
106
- await copy(join(__dirname, 'files', `mtxs-configmap-${isJava ? 'java' : 'nodejs'}.yaml`)).to('chart', 'templates', 'mtxs-configmap.yaml') // REVISIT: Move to build task
107
- await copy(join(__dirname, 'files', 'saas-registry-secret.yaml')).to('chart', 'templates', 'saas-registry-secret.yaml') // REVISIT: Move to build task
106
+ await copy(join(__dirname, 'files', `mtxs-configmap-${isJava ? 'java' : 'nodejs'}${hasApprouter ? '-approuter' : ''}.yaml`)).to('chart', 'templates', 'mtxs-configmap.yaml') // REVISIT: Move to build task
107
+ await copy(join(__dirname, 'files', 'saas-registry-secret.yaml')).to('chart', 'templates', 'saas-registry-secret.yaml') // REVISIT: Move to build task
108
108
  }
109
109
 
110
110
  if (hasXsuaa) {
package/lib/util/fs.js CHANGED
@@ -28,7 +28,7 @@ module.exports = new class FsUtil {
28
28
  }
29
29
 
30
30
  async writeYAML(dst, yaml) {
31
- const content = YAML.stringify(yaml, { collectionStyle: 'block' })
31
+ const content = YAML.stringify(yaml, { collectionStyle: 'block', lineWidth: 120 })
32
32
  await write(content).to(dst)
33
33
  }
34
34
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@sap/cds-dk",
3
- "version": "7.8.0",
3
+ "version": "7.8.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@sap/cds-dk",
9
- "version": "7.8.0",
9
+ "version": "7.8.2",
10
10
  "license": "SEE LICENSE IN LICENSE",
11
11
  "dependencies": {
12
12
  "@sap/cds": "^7",
@@ -161,7 +161,7 @@
161
161
  }
162
162
  },
163
163
  "node_modules/@humanwhocodes/object-schema": {
164
- "version": "2.0.2",
164
+ "version": "2.0.3",
165
165
  "license": "BSD-3-Clause"
166
166
  },
167
167
  "node_modules/@nodelib/fs.scandir": {
@@ -215,7 +215,7 @@
215
215
  }
216
216
  },
217
217
  "node_modules/@sap/cds": {
218
- "version": "7.8.0",
218
+ "version": "7.8.1",
219
219
  "license": "SEE LICENSE IN LICENSE",
220
220
  "dependencies": {
221
221
  "@cap-js/cds-types": "<1",
@@ -280,7 +280,7 @@
280
280
  }
281
281
  },
282
282
  "node_modules/@sap/eslint-plugin-cds": {
283
- "version": "2.6.7",
283
+ "version": "2.7.0",
284
284
  "license": "See LICENSE file",
285
285
  "dependencies": {
286
286
  "@sap/cds": ">=5.6.0",
@@ -294,7 +294,7 @@
294
294
  }
295
295
  },
296
296
  "node_modules/@sap/hana-client": {
297
- "version": "2.19.21",
297
+ "version": "2.20.15",
298
298
  "hasInstallScript": true,
299
299
  "license": "SEE LICENSE IN developer-license-3_1.txt",
300
300
  "dependencies": {
@@ -327,10 +327,10 @@
327
327
  }
328
328
  },
329
329
  "node_modules/@sap/hdi-deploy": {
330
- "version": "4.9.2",
330
+ "version": "4.9.4",
331
331
  "license": "See LICENSE file",
332
332
  "dependencies": {
333
- "@sap/hana-client": "2.19.21",
333
+ "@sap/hana-client": "2.20.15",
334
334
  "@sap/hdi": "4.5.2",
335
335
  "@sap/xsenv": "4.2.0",
336
336
  "async": "3.2.3",
@@ -2221,7 +2221,7 @@
2221
2221
  "license": "MIT"
2222
2222
  },
2223
2223
  "node_modules/node-abi": {
2224
- "version": "3.56.0",
2224
+ "version": "3.57.0",
2225
2225
  "license": "MIT",
2226
2226
  "optional": true,
2227
2227
  "dependencies": {
@@ -2886,7 +2886,7 @@
2886
2886
  }
2887
2887
  },
2888
2888
  "node_modules/socks": {
2889
- "version": "2.8.1",
2889
+ "version": "2.8.3",
2890
2890
  "license": "MIT",
2891
2891
  "optional": true,
2892
2892
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap/cds-dk",
3
- "version": "7.8.0",
3
+ "version": "7.8.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": [
@@ -1,19 +0,0 @@
1
- # Please do not modify this file. This file may be overwritten.
2
-
3
- {{- $deployment := .Values.approuter }}
4
- {{- $ := merge (dict "name" "approuter" "deployment" $deployment) . }}
5
- {{- $approuterUrl := (include "cap.deploymentHostFull" $ )}}
6
-
7
-
8
- {{- $defaultParameters := dict "forwardAuthToken" true }}
9
- {{- $destinations := dict "root" . "defaultParameters" $defaultParameters }}
10
-
11
- apiVersion: v1
12
- kind: ConfigMap
13
- metadata:
14
- name: "{{ .Release.Name }}-approuter-configmap"
15
- namespace: "{{ .Release.Namespace }}"
16
- data:
17
- destinations: >
18
- {{ include "cap.backendDestinations" $destinations }}
19
- TENANT_HOST_PATTERN: {{ printf "^(.*)-%s" $approuterUrl }}