@sap/cds-dk 7.5.1 → 7.6.0

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 (64) hide show
  1. package/bin/add.js +28 -24
  2. package/bin/bind.js +59 -32
  3. package/bin/build.js +1 -1
  4. package/bin/cds.js +1 -1
  5. package/bin/env.js +1 -6
  6. package/bin/init.js +7 -3
  7. package/bin/logout.js +2 -2
  8. package/bin/migrate.js +1 -1
  9. package/bin/version.js +1 -0
  10. package/bin/watch.js +8 -1
  11. package/lib/bind/bindingUtil.js +14 -20
  12. package/lib/bind/cfKeyProvider.js +8 -10
  13. package/lib/bind/index.js +4 -2
  14. package/lib/build/buildTaskFactory.js +31 -20
  15. package/lib/build/constants.js +9 -8
  16. package/lib/build/provider/featureToggleBuildPlugin.js +1 -7
  17. package/lib/build/provider/hana/index.js +44 -9
  18. package/lib/build/provider/internalBuildTaskProvider.js +7 -5
  19. package/lib/build/provider/java/index.js +0 -6
  20. package/lib/build/provider/mtx-sidecar/index.js +5 -0
  21. package/lib/build/provider/nodejs/index.js +32 -47
  22. package/lib/build/util.js +134 -33
  23. package/lib/deploy/to-hana/hana.js +1 -1
  24. package/lib/env/schema.js +157 -17
  25. package/lib/env/schemas/cds-rc.js +118 -0
  26. package/lib/init/constants.js +1 -1
  27. package/lib/init/merge.js +2 -1
  28. package/lib/init/template/application-logging/index.js +1 -2
  29. package/lib/init/template/approuter/files/mta.yaml.hbs +2 -0
  30. package/lib/init/template/approuter/files/package.json +1 -1
  31. package/lib/init/template/approuter/files/values.yaml.hbs +8 -1
  32. package/lib/init/template/hana/files/undeploy.json +3 -2
  33. package/lib/init/template/helm/files/chart/templates/NOTES.txt +2 -0
  34. package/lib/init/template/helm/files/chart/templates/_deployment_helpers.tpl +10 -2
  35. package/lib/init/template/helm/files/content-deployment/Chart.yaml +1 -1
  36. package/lib/init/template/helm/files/content-deployment/templates/_helpers.tpl +6 -5
  37. package/lib/init/template/helm/files/content-deployment/values.yaml +1 -1
  38. package/lib/init/template/helm/files/service-instance/Chart.yaml +1 -1
  39. package/lib/init/template/helm/files/service-instance/templates/_helpers.tpl +6 -5
  40. package/lib/init/template/helm/files/service-instance/values.yaml +1 -1
  41. package/lib/init/template/helm/files/web-application/Chart.yaml +1 -1
  42. package/lib/init/template/helm/files/web-application/templates/_api.tpl +6 -5
  43. package/lib/init/template/helm/files/web-application/values.yaml +1 -1
  44. package/lib/init/template/helm/index.js +1 -12
  45. package/lib/init/template/helm-unified-runtime/index.js +3 -2
  46. package/lib/init/template/html5-repo/files/values.yaml.hbs +9 -0
  47. package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +1 -2
  48. package/lib/init/template/multitenancy/index.js +3 -2
  49. package/lib/init/template/xsuaa/files/package.json.hbs +1 -2
  50. package/lib/mtx/activate.js +1 -1
  51. package/lib/mtx/auth_manager.js +4 -2
  52. package/lib/mtx/download_legacy.js +1 -1
  53. package/lib/mtx/extend.js +2 -2
  54. package/lib/mtx/pull.js +1 -1
  55. package/lib/mtx/push.js +1 -1
  56. package/lib/mtx/settings_manager.js +77 -26
  57. package/lib/mtx/tenant_action.js +1 -1
  58. package/lib/mtx/util/legacy_ext.js +0 -1
  59. package/lib/util/axios.js +1 -19
  60. package/lib/util/cf.js +15 -10
  61. package/npm-shrinkwrap.json +306 -278
  62. package/package.json +1 -1
  63. package/lib/env/schemas/cds-rc.json +0 -101
  64. package/lib/init/template/helm-unified-runtime/lib/build.js +0 -0
package/lib/env/schema.js CHANGED
@@ -1,35 +1,175 @@
1
- const { merge } = require('../init/merge')
2
- const { readJSON } = require('../util/fs')
3
1
 
4
- module.exports = async function overlay4(schemaName, cwd = process.cwd()) {
2
+ function _local(id) {
3
+ return require.resolve(id, {
4
+ paths: [
5
+ process.cwd(), // project-local module is preferred
6
+ __dirname // otherwise from our own dependencies
7
+ ]
8
+ })
9
+ }
10
+
11
+ function _robustRequire(file) {
12
+ const fs = require('fs')
13
+ const path = require('path')
14
+
15
+ file = path.normalize(file)
16
+ let content
17
+ try {
18
+ content = fs.readFileSync(file, 'utf8')
19
+ } catch (e) {
20
+ // file is not readable -> nothing to do
21
+ return
22
+ }
23
+
24
+ try {
25
+ return JSON.parse(content)
26
+ } catch (e) {
27
+ // invalid json -> ignore and try regex
28
+ }
29
+
30
+ const result = {}
31
+ try {
32
+ const deps = JSON.parse(content.match(/"dependencies"\s*:\s*({[^}]*})/)[1])
33
+ result.dependencies = deps
34
+ } catch (e) { /* ignore */ }
35
+
36
+ try {
37
+ const devDeps = JSON.parse(content.match(/"devDependencies"\s*:\s*({[^}]*})/)[1])
38
+ result.devDependencies = devDeps
39
+ } catch (e) { /* ignore */ }
40
+
41
+ return result
42
+ }
43
+
44
+ _robustRequire.resolve = function (id, options = {}) {
45
+ const fs = require('fs')
46
+ const path = require('path')
47
+
48
+ try {
49
+ return require.resolve(id, options)
50
+ } catch (err) {
51
+ // ignore
52
+ }
53
+
54
+ const [, mod, file] = /(.+)\/([^/]+)$/.exec(id)
55
+ let modPath = path.join(process.cwd(), 'node_modules', mod, file)
56
+ const ext = path.extname(modPath)
57
+ if (!ext) {
58
+ modPath = modPath + '.js'
59
+ }
60
+ if (fs.existsSync(modPath)) {
61
+ return modPath
62
+ }
63
+
64
+ throw new Error('not found')
65
+ }
66
+
67
+ function mergePluginSchema(pluginSchema) {
68
+ return {
69
+ into: async (targetSchema) => {
70
+ if (pluginSchema.buildTaskType) {
71
+ targetSchema.$defs?.buildTaskType?.enum?.push(pluginSchema.buildTaskType.name);
72
+ targetSchema.$defs?.buildTaskType?.enumDescriptions?.push(pluginSchema.buildTaskType.description);
73
+ targetSchema._cds_schema_overlays.push('buildTaskType')
74
+ }
75
+
76
+ if (pluginSchema.databaseType) {
77
+ targetSchema.$defs?.databaseType?.enum?.push(pluginSchema.databaseType.name);
78
+ targetSchema.$defs?.databaseType?.enumDescriptions?.push(pluginSchema.databaseType.description);
79
+ targetSchema._cds_schema_overlays.push('databaseType')
80
+ }
81
+
82
+ if (pluginSchema.cds) {
83
+ if (targetSchema.$defs?.cdsRoot?.properties) {
84
+ Object.assign(targetSchema.$defs.cdsRoot.properties, pluginSchema.cds)
85
+ targetSchema._cds_schema_overlays.push('cdsRoot')
86
+ }
87
+
88
+ // backwards compatibility
89
+ if (targetSchema.properties) {
90
+ Object.assign(targetSchema.properties, pluginSchema.cds)
91
+ targetSchema._cds_schema_overlays.push('root')
92
+ }
93
+ }
94
+ }
95
+ }
96
+ }
97
+
98
+ module.exports = async function overlay4(schemaName) {
99
+ const path = require('path')
100
+ const { merge } = require('../init/merge')
5
101
 
6
- // need to load @sap/cds from current cwd which might
7
- // differ from initial cwd to get project specific cds version
8
- const cds = require(require.resolve('@sap/cds', {
9
- paths: [cwd, __dirname]
10
- }))
102
+ const cds = require('../cds')
103
+ cds.root = process.cwd()
11
104
 
12
- // force cds.root to be project root
13
- cds.root = cwd
105
+ const { readJSON } = require('../util/fs')
14
106
 
15
- // load defaults, throw err if schema not found
16
107
  let result;
17
108
  if (typeof cds.schema?.default4 === 'function') {
18
109
  result = await cds.schema.default4(schemaName)
19
110
  } else if (cds.env?.schemas?.[schemaName]) {
20
- // backwards compatibility
111
+ // backwards compatibility, fails for invalid json files
21
112
  result = await readJSON(cds.env.schemas[schemaName])
22
113
  } else {
23
- throw new Error(`cds ${cds.version} in ${cwd} does not support schema retrieval.`)
114
+ throw new Error(`cds ${cds.version} in ${cds.root} does not support schema retrieval.`)
115
+ }
116
+
117
+ if (schemaName !== 'cds-rc.json') {
118
+ return result
119
+ }
120
+
121
+ const oldTitle = result.title
122
+ const oldDescription = result.description
123
+ result._cds_schema_overlays = []
124
+
125
+ try {
126
+ const scheamFile = path.join(__dirname, 'schemas', schemaName.replace(/\.json$/, '.js'))
127
+ const schema = require(scheamFile)
128
+
129
+ await merge(schema).into(result)
130
+ result._cds_schema_overlays.push('cdsRoot')
131
+
132
+ if (result.properties) {
133
+ // backwards compatibility
134
+ await merge(schema.$defs.cdsRoot.properties).into(result.properties)
135
+ result._cds_schema_overlays.push('root')
136
+ }
137
+ } catch (err) {
138
+ console.error(err.message)
24
139
  }
25
140
 
26
- // optional, don't throw if file not found
27
141
  try {
28
- await merge(__dirname, 'schemas', schemaName).into(result)
29
- result.description = result.description + ' - overlaid'
142
+ const pluginsLib = require(_local('@sap/cds/lib/plugins.js'))
143
+ if (pluginsLib) {
144
+ const oldRequire = pluginsLib.require
145
+ try {
146
+ pluginsLib.require = _robustRequire
147
+ const plugins = pluginsLib.fetch?.()
148
+ if (plugins) {
149
+ for (const [key, { impl, packageJson }] of Object.entries(plugins)) {
150
+ const pluginPackageJsonFile = packageJson || path.join(path.dirname(impl), 'package.json')
151
+ try {
152
+ const pluginPackageJson = require(pluginPackageJsonFile)
153
+ if (pluginPackageJson.cds?.schema) {
154
+ await mergePluginSchema(pluginPackageJson.cds.schema).into(result);
155
+ }
156
+ } catch (err) {
157
+ if (err.code !== 'ENOENT') {
158
+ console.error(`Error loading schema from plugin ${key}: ${err.message}`)
159
+ }
160
+ }
161
+ }
162
+ }
163
+ } finally {
164
+ pluginsLib.require = oldRequire
165
+ }
166
+ }
30
167
  } catch (err) {
31
- if (err.code !== 'ENOENT') throw err
168
+ console.error(err.message)
32
169
  }
33
170
 
171
+
172
+ result.title = oldTitle
173
+ result.description = oldDescription
34
174
  return result
35
175
  }
@@ -0,0 +1,118 @@
1
+ module.exports = {
2
+ title: "JSON schema for CDS-DK configuration",
3
+ $schema: "https://json-schema.org/draft/2020-12/schema",
4
+ description: "Build overlay",
5
+ $defs: {
6
+ cdsRoot: {
7
+ properties: {
8
+ // build specific schema
9
+ build: {
10
+ type: "object",
11
+ description: "Customize CDS build settings.",
12
+ additionalProperties: true,
13
+ properties: {
14
+ target: {
15
+ type: "string",
16
+ description: "Specify the folder which contains generated build results. Defaults to './gen'.",
17
+ format: "uri-reference"
18
+ },
19
+ tasks: {
20
+ type: "array",
21
+ description: "Control which tasks 'cds build' will execute on your project modules. This is a typical task configuration: '\"tasks\": [{ \"for\": \"hana\"}];",
22
+ uniqueItems: true,
23
+ default: [
24
+ {}
25
+ ],
26
+ items: {
27
+ type: "object",
28
+ additionalProperties: true,
29
+ properties: {
30
+ dest: {
31
+ type: "string",
32
+ description: "Optional: Define the destination folder for this build task, relative to build target folder. \nFor example: Destination defined as 'custom' results in an output written to 'gen/custom'.",
33
+ format: "uri-reference"
34
+ },
35
+ src: {
36
+ type: "string",
37
+ description: "Optional: Prefer defining 'cds.folders'. Use 'src' if you want it only to be valid for this specific build task, which excludes, for example, 'cds watch'.",
38
+ format: "uri-reference"
39
+ },
40
+ for: {
41
+ type: "string",
42
+ description: "Define the target technology for this build task.",
43
+ minLength: 1,
44
+ $ref: "#/$defs/buildTaskType"
45
+ },
46
+ options: {
47
+ type: "object",
48
+ description: "Optional: Set target technology specific options for this build task.",
49
+ additionalProperties: true,
50
+ properties: {
51
+ model: {
52
+ $ref: "#/$defs/foldersStringArray"
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
60
+ },
61
+
62
+ // deploy specific schema
63
+ deploy: {
64
+ type: "object",
65
+ description: "Customize 'cds deploy' settings.",
66
+ additionalProperties: true,
67
+ properties: {
68
+ no_save: {
69
+ type: "boolean",
70
+ description: "Do / don't update configuration in package.json.",
71
+ default: true
72
+ }
73
+ }
74
+ }
75
+ }
76
+ },
77
+
78
+ buildTaskType: {
79
+ enum: [
80
+ "nodejs",
81
+ "java",
82
+ "hana",
83
+ "mtx-sidecar",
84
+ "mtx-extension",
85
+ "mtx",
86
+ "node-cf",
87
+ "java-cf"
88
+ ],
89
+ enumDescriptions: [
90
+ "Node.js build plugin",
91
+ "Java build plugin",
92
+ "SAP HANA build plugin",
93
+ "MTX sidecar build plugin",
94
+ "MTX extension build plugin",
95
+ "MTX build plugin",
96
+ "Node.js Cloud Foundry build plugin",
97
+ "Java Cloud Foundry build plugin"
98
+ ]
99
+ },
100
+
101
+ foldersStringArray: {
102
+ oneOf: [
103
+ {
104
+ type: "string",
105
+ format: "uri-reference"
106
+ },
107
+ {
108
+ type: "array",
109
+ uniqueItems: true,
110
+ items: {
111
+ type: "string",
112
+ format: "uri-reference"
113
+ }
114
+ }
115
+ ]
116
+ }
117
+ }
118
+ }
@@ -4,7 +4,7 @@ module.exports = {
4
4
  COMMAND_INIT: 'init',
5
5
  COMMAND_ADD: 'add',
6
6
 
7
- MAVEN_ARCHETYPE_VERSION: '2.4.1',
7
+ MAVEN_ARCHETYPE_VERSION: '2.5.0',
8
8
 
9
9
  OPTIONS: Object.freeze({
10
10
  JAVA: 'java',
package/lib/init/merge.js CHANGED
@@ -234,7 +234,7 @@ async function _mergeYAML(into, from, project, semantics = {}) {
234
234
  if (!templateCollection) _traverseYAMLNode(node, i, actions)
235
235
  })
236
236
 
237
- if (!templateCollection) return
237
+ if (!templateCollection?.items) return
238
238
 
239
239
  templateCollection.items.forEach((templateNode, templateIndex) => {
240
240
  if (YAML.isScalar(templateNode)) {
@@ -381,6 +381,7 @@ async function removeFromYAML(name, keyPaths) {
381
381
  node.delete(key)
382
382
  } else {
383
383
  node = node.get(key)
384
+ if(node === undefined) break;
384
385
  }
385
386
  }
386
387
  }
@@ -9,9 +9,8 @@ module.exports = class ApplicationLoggingTemplate extends require('../../plugin'
9
9
  }
10
10
 
11
11
  async canRun() {
12
- const { hasMta, hasHelm, hasHelmUnifiedRuntime, isJava } = readProject()
12
+ const { hasMta, hasHelm, hasHelmUnifiedRuntime } = readProject()
13
13
  if ((hasHelmUnifiedRuntime || hasHelm) && !hasMta) throw `'cds add application-logging' is not available for Kyma yet`
14
- if (isJava) throw `'cds add application-logging' is not available for Java yet`
15
14
  return true
16
15
  }
17
16
 
@@ -62,10 +62,12 @@ modules:
62
62
  - name: {{appName}}-mtx
63
63
  type: nodejs
64
64
  path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
65
+ {{#isNodejs}}
65
66
  requires:
66
67
  - name: app-api
67
68
  properties:
68
69
  SUBSCRIPTION_URL: ~{app-protocol}://\${tenant_subdomain}-~{app-uri}
70
+ {{/isNodejs}}
69
71
  {{/hasMultitenancy}}
70
72
 
71
73
  resources:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "approuter",
3
3
  "dependencies": {
4
- "@sap/approuter": "^14.0.0"
4
+ "@sap/approuter": "^16.0.0"
5
5
  },
6
6
  "engines": {
7
7
  "node": "^20.0.0"
@@ -28,4 +28,11 @@ approuter:
28
28
  path: /
29
29
  readiness:
30
30
  path: /
31
- backendDestinations: {}
31
+ backendDestinations: {}
32
+ {{^hasMultitenancy}}
33
+ srv:
34
+ expose:
35
+ enabled: false
36
+ networkSecurity:
37
+ allowNamespaceInternal: true
38
+ {{/hasMultitenancy}}
@@ -1,5 +1,6 @@
1
1
  [
2
2
  "src/gen/**/*.hdbview",
3
3
  "src/gen/**/*.hdbindex",
4
- "src/gen/**/*.hdbconstraint"
5
- ]
4
+ "src/gen/**/*.hdbconstraint",
5
+ "src/gen/**/*_drafts.hdbtable"
6
+ ]
@@ -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 -}}
@@ -4,4 +4,4 @@ name: content-deployment
4
4
  sources:
5
5
  - https://github.tools.sap/unified-runtime/content-deployment
6
6
  type: application
7
- version: 1.3.0
7
+ version: 1.4.0
@@ -2,7 +2,7 @@
2
2
  Expand the name of the chart.
3
3
  */}}
4
4
  {{- define "content-deployment.internal.name" -}}
5
- {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
5
+ {{- tpl (default .Chart.Name .Values.nameOverride) . | trunc 63 | trimSuffix "-" }}
6
6
  {{- end }}
7
7
 
8
8
  {{/*
@@ -12,12 +12,13 @@ If release name contains chart name it will be used as a full name.
12
12
  */}}
13
13
  {{- define "content-deployment.internal.fullname" -}}
14
14
  {{- if .Values.fullnameOverride }}
15
- {{- if gt (len .Values.fullnameOverride) 63 }}
16
- {{- fail (printf "name exceeds 63 characters: '%s'" .Values.fullnameOverride) }}
15
+ {{- $name := tpl .Values.fullnameOverride . }}
16
+ {{- if gt (len $name) 63 }}
17
+ {{- fail (printf "name exceeds 63 characters: '%s'" $name) }}
17
18
  {{- end }}
18
- {{- .Values.fullnameOverride }}
19
+ {{- $name }}
19
20
  {{- else }}
20
- {{- $name := default .Chart.Name .Values.nameOverride }}
21
+ {{- $name := tpl (default .Chart.Name .Values.nameOverride) . }}
21
22
  {{- if not (eq .Release.Name $name)}}
22
23
  {{- $name = printf "%s-%s" .Release.Name $name }}
23
24
  {{- end }}
@@ -15,7 +15,7 @@ global:
15
15
  _internal:
16
16
  content-deployment:
17
17
  versions:
18
- 1.3.0: true
18
+ 1.4.0: true
19
19
  # Will be used instead of the `.Chart.Name`, e.g. when generating the Deployment name.
20
20
  # nameOverride: name
21
21
 
@@ -4,4 +4,4 @@ name: service-instance
4
4
  sources:
5
5
  - https://github.tools.sap/unified-runtime/service-instance
6
6
  type: application
7
- version: 1.1.1
7
+ version: 1.2.0
@@ -2,7 +2,7 @@
2
2
  Expand the name of the chart.
3
3
  */}}
4
4
  {{- define "service-instance.internal.name" -}}
5
- {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
5
+ {{- tpl (default .Chart.Name .Values.nameOverride) . | trunc 63 | trimSuffix "-" }}
6
6
  {{- end }}
7
7
 
8
8
  {{/*
@@ -12,12 +12,13 @@ If release name contains chart name it will be used as a full name.
12
12
  */}}
13
13
  {{- define "service-instance.internal.fullname" -}}
14
14
  {{- if .Values.fullnameOverride }}
15
- {{- if gt (len .Values.fullnameOverride) 63 }}
16
- {{- fail (printf "name exceeds 63 characters: '%s'" .Values.fullnameOverride) }}
15
+ {{- $name := tpl .Values.fullnameOverride . }}
16
+ {{- if gt (len $name) 63 }}
17
+ {{- fail (printf "name exceeds 63 characters: '%s'" $name) }}
17
18
  {{- end }}
18
- {{- .Values.fullnameOverride }}
19
+ {{- $name }}
19
20
  {{- else }}
20
- {{- $name := default .Chart.Name .Values.nameOverride }}
21
+ {{- $name := tpl (default .Chart.Name .Values.nameOverride) . }}
21
22
  {{- if not (eq .Release.Name $name)}}
22
23
  {{- $name = printf "%s-%s" .Release.Name $name }}
23
24
  {{- end }}
@@ -40,4 +40,4 @@ global:
40
40
  _internal:
41
41
  service-instance:
42
42
  versions:
43
- 1.1.1: true
43
+ 1.2.0: true
@@ -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.9.0
8
+ version: 1.10.0
@@ -2,7 +2,7 @@
2
2
  Expand the name of the chart.
3
3
  */}}
4
4
  {{- define "web-application.name" -}}
5
- {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
5
+ {{- tpl (default .Chart.Name .Values.nameOverride) . | trunc 63 | trimSuffix "-" }}
6
6
  {{- end }}
7
7
 
8
8
  {{/*
@@ -12,12 +12,13 @@ If release name contains chart name it will be used as a full name.
12
12
  */}}
13
13
  {{- define "web-application.fullname" -}}
14
14
  {{- if .Values.fullnameOverride }}
15
- {{- if gt (len .Values.fullnameOverride) 63 }}
16
- {{- fail (printf "name exceeds 63 characters: '%s'" .Values.fullnameOverride) }}
15
+ {{- $name := tpl .Values.fullnameOverride . }}
16
+ {{- if gt (len $name) 63 }}
17
+ {{- fail (printf "name exceeds 63 characters: '%s'" $name) }}
17
18
  {{- end }}
18
- {{- .Values.fullnameOverride }}
19
+ {{- $name }}
19
20
  {{- else }}
20
- {{- $name := default .Chart.Name .Values.nameOverride }}
21
+ {{- $name := tpl (default .Chart.Name .Values.nameOverride) . }}
21
22
  {{- if not (eq .Release.Name $name)}}
22
23
  {{- $name = printf "%s-%s" .Release.Name $name }}
23
24
  {{- end }}
@@ -15,7 +15,7 @@ global:
15
15
  _internal:
16
16
  web-application:
17
17
  versions:
18
- 1.9.0: true
18
+ 1.10.0: true
19
19
  ## Will be used instead of the `.Chart.Name`, e.g. when generating the Deployment name.
20
20
  # nameOverride: name
21
21
 
@@ -14,6 +14,7 @@ module.exports = class HelmTemplate extends require('../../plugin') {
14
14
  return true
15
15
  }
16
16
 
17
+ // Won't need this any more with plugin approach: package not there -> plugin not pulled
17
18
  static hasInProduction() {
18
19
  const { add } = cds.cli.options
19
20
  return exists(join('chart', 'charts', 'web-application')) && exists(join('chart', 'values.yaml') || add.has('helm'))
@@ -44,20 +45,8 @@ module.exports = class HelmTemplate extends require('../../plugin') {
44
45
  hasContentDeployment = true
45
46
  await this._mergeDependency('service-instance', 'html5-apps-repo-host')
46
47
  await this._mergeDependency('content-deployment', 'html5-apps-deployer')
47
-
48
48
  if (hasApprouter) {
49
49
  await this._mergeDependency('service-instance', 'html5-apps-repo-runtime')
50
- await merge({
51
- 'html5-apps-repo-runtime': {
52
- serviceOfferingName: 'html5-apps-repo',
53
- servicePlanName: 'app-runtime'
54
- },
55
- approuter: {
56
- bindings: {
57
- 'html5-apps-repo-runtime': { serviceInstanceName: 'html5-apps-repo-runtime' }
58
- }
59
- },
60
- }).into('chart/values.yaml')
61
50
  }
62
51
  }
63
52
  if (hasMultitenancy) {
@@ -1,5 +1,5 @@
1
1
  const cds = require('../../..')
2
- const { copy, rimraf, exists } = cds.utils
2
+ const { copy, rimraf, exists, fs } = cds.utils
3
3
  const { join } = require('path')
4
4
 
5
5
  // cds.build?.register('helm-unified-runtime', {
@@ -19,7 +19,8 @@ module.exports = class HelmUnifiedRuntimeTemplate extends cds.add.Plugin {
19
19
  }
20
20
 
21
21
  static hasInProduction() {
22
- return exists(join('chart', 'values.yaml')) && !exists(join('chart', 'charts', 'web-application')) || cds.cli.options.add.has('helm-unified-runtime')
22
+ const chart = exists(join('chart/Chart.yaml')) ? fs.readFileSync(join(cds.root, 'chart/Chart.yaml'), 'utf8') : ''
23
+ return chart.includes('https://int.repositories.cloud.sap/artifactory/virtual-unified-runtime-helm-dmz') || cds.cli.options.add.has('helm-unified-runtime')
23
24
  }
24
25
 
25
26
  async run() {
@@ -26,3 +26,12 @@ backendDestinations: {}
26
26
  destination:
27
27
  parameters:
28
28
  HTML5Runtime_enabled: true
29
+ {{#hasApprouter}}
30
+ html5-apps-repo-runtime:
31
+ serviceOfferingName: html5-apps-repo
32
+ servicePlanName: app-runtime
33
+ approuter:
34
+ bindings:
35
+ html5-apps-repo-runtime:
36
+ serviceInstanceName: 'html5-apps-repo-runtime'
37
+ {{/hasApprouter}}
@@ -5,8 +5,7 @@
5
5
  "@sap/cds-hana": "^2",
6
6
  "@sap/cds-mtxs": "^1.9",
7
7
  "@sap/xssec": "^3",
8
- "express": "^4",
9
- "passport": ">=0.6.0"
8
+ "express": "^4"
10
9
  },
11
10
  "devDependencies": {
12
11
  "@cap-js/sqlite": "^1"
@@ -3,7 +3,7 @@ const cds = require('../../../cds')
3
3
  const { read, write, copy } = cds.utils
4
4
  const mvn = require('../../mvn')
5
5
  const { readProject } = require('../../projectReader')
6
- const { merge, sort } = require('../../merge')
6
+ const { merge, sort, removeFromYAML } = require('../../merge')
7
7
  const { copyRenderedJSON } = require('../../../util/fs')
8
8
  const {
9
9
  srv4, // Server
@@ -102,7 +102,8 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
102
102
  ]
103
103
  }}).into('chart/values.yaml', { with: project })
104
104
 
105
- await copy(join(__dirname, 'files', `mtxs-configmap-${isJava ? 'java' : 'nodejs'}.yaml`)).to('chart', 'templates', 'mtxs-configmap.yaml') // REVISIT: Move to build task
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
106
107
  await copy(join(__dirname, 'files', 'saas-registry-secret.yaml')).to('chart', 'templates', 'saas-registry-secret.yaml') // REVISIT: Move to build task
107
108
  }
108
109