@sap/cds-dk 6.5.1 → 6.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 (123) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/bin/activate.js +7 -0
  3. package/bin/add.js +1 -2
  4. package/bin/build/all.js +14 -9
  5. package/bin/cds.js +11 -8
  6. package/bin/compile/index.js +13 -3
  7. package/bin/env.js +16 -25
  8. package/bin/extend.js +8 -0
  9. package/bin/init.js +0 -3
  10. package/bin/login.js +3 -7
  11. package/bin/logout.js +2 -7
  12. package/bin/migrate.js +5 -2
  13. package/bin/watch.js +4 -5
  14. package/lib/client/activate.js +1 -1
  15. package/lib/client/helper/errors.js +2 -1
  16. package/lib/client/params.js +4 -3
  17. package/lib/client/pull.js +31 -5
  18. package/lib/client/push.js +3 -3
  19. package/lib/client/settings_manager.js +6 -6
  20. package/lib/client/subscription.js +1 -1
  21. package/lib/compile/asyncapi/channels.js +22 -0
  22. package/lib/compile/asyncapi/components/messageTraits/index.js +89 -0
  23. package/lib/compile/asyncapi/components/messages/index.js +150 -0
  24. package/lib/compile/asyncapi/components/schemas/annotations.js +13 -0
  25. package/lib/compile/asyncapi/components/schemas/array.js +8 -0
  26. package/lib/compile/asyncapi/components/schemas/cache.js +14 -0
  27. package/lib/compile/asyncapi/components/schemas/definition.js +187 -0
  28. package/lib/compile/asyncapi/components/schemas/enum.js +16 -0
  29. package/lib/compile/asyncapi/components/schemas/examples.js +10 -0
  30. package/lib/compile/asyncapi/components/schemas/index.js +14 -0
  31. package/lib/compile/asyncapi/components/schemas/localized.js +29 -0
  32. package/lib/compile/asyncapi/components/schemas/primitiveElement.js +41 -0
  33. package/lib/compile/asyncapi/components/schemas/ref.js +45 -0
  34. package/lib/compile/asyncapi/components/schemas/utils.js +108 -0
  35. package/lib/compile/asyncapi/index.js +226 -0
  36. package/lib/compile/asyncapi/message.js +13 -0
  37. package/lib/compile/asyncapi/utils.js +27 -0
  38. package/lib/compile/index.js +1 -0
  39. package/lib/compile/openapi/csdl2openapi.js +40 -18
  40. package/lib/import/message.js +3 -1
  41. package/lib/import/odata/metadataconverter/MetadataConverter.js +1 -1
  42. package/lib/import/odata/v2parser.js +131 -50
  43. package/lib/import/odata/v4parser.js +160 -68
  44. package/lib/import/openapi/importOpenAPI.js +14 -14
  45. package/lib/init/constants.js +1 -1
  46. package/lib/init/index.js +11 -21
  47. package/lib/init/template/_merging/registry-mta.js +15 -26
  48. package/lib/init/template/approuter/files/package.json +2 -2
  49. package/lib/init/template/approuter/index.js +6 -12
  50. package/lib/init/template/auditlog/files/auditlog.yaml +4 -1
  51. package/lib/init/template/auditlog/index.js +23 -8
  52. package/lib/init/template/cf-manifest/index.js +4 -14
  53. package/lib/init/template/connectivity/files/connectivity-proxy-info.yaml +2 -6
  54. package/lib/init/template/connectivity/files/values.yaml.hbs +5 -8
  55. package/lib/init/template/connectivity/index.js +2 -9
  56. package/lib/init/template/data/index.js +0 -4
  57. package/lib/init/template/destinations/files/destination.yaml +4 -1
  58. package/lib/init/template/destinations/index.js +25 -10
  59. package/lib/init/template/enterprise-messaging/files/event-mesh.yaml +4 -1
  60. package/lib/init/template/enterprise-messaging/files/values.yaml +1 -2
  61. package/lib/init/template/enterprise-messaging/index.js +28 -20
  62. package/lib/init/template/extensibility/index.js +23 -31
  63. package/lib/init/template/hana/files/hana.yaml +4 -1
  64. package/lib/init/template/hana/index.js +44 -24
  65. package/lib/init/template/helm/chart/templates/_helpers.tpl +12 -0
  66. package/lib/init/template/helm/chart/values.root.schema.json +40 -0
  67. package/lib/init/template/helm/chart/values.schema.json +32 -69
  68. package/lib/init/template/helm/index.js +26 -16
  69. package/lib/init/template/helm/subcharts/content-deployment/templates/_helpers.tpl +13 -26
  70. package/lib/init/template/helm/subcharts/content-deployment/templates/job.yaml +3 -3
  71. package/lib/init/template/helm/subcharts/content-deployment/templates/service-account.yaml +2 -0
  72. package/lib/init/template/helm/subcharts/content-deployment/templates/service-binding.yaml +3 -3
  73. package/lib/init/template/helm/subcharts/content-deployment/templating.md +37 -0
  74. package/lib/init/template/helm/subcharts/content-deployment/values.md +182 -185
  75. package/lib/init/template/helm/subcharts/content-deployment/values.schema.json +18 -22
  76. package/lib/init/template/helm/subcharts/content-deployment/values.yaml +2 -0
  77. package/lib/init/template/helm/subcharts/service-instance/Chart.yaml +5 -0
  78. package/lib/init/template/helm/subcharts/service-instance/templates/_helpers.tpl +65 -0
  79. package/lib/init/template/helm/subcharts/service-instance/templates/serviceinstance.yaml +23 -0
  80. package/lib/init/template/helm/subcharts/service-instance/templating.md +18 -0
  81. package/lib/init/template/helm/subcharts/service-instance/values-lint.yaml +2 -0
  82. package/lib/init/template/helm/subcharts/service-instance/values.md +186 -0
  83. package/lib/init/template/helm/subcharts/service-instance/values.schema.json +102 -0
  84. package/lib/init/template/helm/subcharts/service-instance/values.yaml +15 -0
  85. package/lib/init/template/html5-repo/files/html5-apps-repo-host.yaml +4 -1
  86. package/lib/init/template/html5-repo/index.js +30 -21
  87. package/lib/init/template/java/index.js +2 -5
  88. package/lib/init/template/kibana-logging/index.js +7 -10
  89. package/lib/init/template/lint/index.js +2 -3
  90. package/lib/init/template/mta/files/mta.yaml.hbs +4 -2
  91. package/lib/init/template/mta/index.js +7 -11
  92. package/lib/init/template/mtx/index.js +0 -5
  93. package/lib/init/template/multitenancy/files/java/package.json +16 -7
  94. package/lib/init/template/multitenancy/files/mta.yaml.hbs +11 -3
  95. package/lib/init/template/multitenancy/files/saas-registry-secret.yaml +9 -0
  96. package/lib/init/template/multitenancy/files/saas-registry.yaml +4 -17
  97. package/lib/init/template/multitenancy/files/service-manager.yaml +4 -1
  98. package/lib/init/template/multitenancy/files/values.yaml.hbs +15 -3
  99. package/lib/init/template/multitenancy/index.js +56 -31
  100. package/lib/init/template/nodejs/index.js +4 -7
  101. package/lib/init/template/notebook/index.js +1 -3
  102. package/lib/init/template/pipeline/index.js +2 -5
  103. package/lib/init/template/samples/index.js +6 -11
  104. package/lib/init/template/templateBase.js +10 -17
  105. package/lib/init/template/toggles/index.js +2 -6
  106. package/lib/init/template/xsuaa/files/values.yaml.hbs +0 -1
  107. package/lib/init/template/xsuaa/files/xsuaa.yaml +4 -1
  108. package/lib/init/template/xsuaa/index.js +27 -23
  109. package/lib/init/types.d.ts +0 -81
  110. package/lib/init/util/merge.js +23 -25
  111. package/lib/init/util/projectReader.js +27 -24
  112. package/lib/lint/Linter.js +31 -13
  113. package/lib/watch/livereload-server.js +21 -14
  114. package/lib/watch/node-watch.js +51 -49
  115. package/npm-shrinkwrap.json +546 -453
  116. package/package.json +2 -2
  117. package/readme.md +5 -0
  118. package/lib/init/template/connectivity/files/connectivity-binding.yaml +0 -9
  119. package/lib/init/template/connectivity/files/connectivity.yaml +0 -1
  120. package/lib/init/template/multitenancy/files/xsuaa.yaml +0 -1
  121. /package/lib/init/template/hana/files/{chart.yaml → hana-deployer.yaml} +0 -0
  122. /package/lib/init/template/html5-repo/files/{chart.yaml → html5-apps-deployer.yaml} +0 -0
  123. /package/lib/init/template/multitenancy/files/{chart.yaml → sidecar.yaml} +0 -0
@@ -1,7 +1,6 @@
1
1
  // Registry of sequence matchers in mta.yaml files
2
2
 
3
3
  const srvNode = {
4
- ref: 'srv',
5
4
  in: 'modules',
6
5
  where: [{
7
6
  property: 'type',
@@ -10,7 +9,6 @@ const srvNode = {
10
9
  }
11
10
 
12
11
  const srvJava = {
13
- ref: 'srv',
14
12
  in: 'modules',
15
13
  where: [{
16
14
  property: 'type',
@@ -19,7 +17,6 @@ const srvJava = {
19
17
  }
20
18
 
21
19
  const approuter = {
22
- ref: 'approuter',
23
20
  in: 'modules',
24
21
  where: [{
25
22
  property: 'type',
@@ -28,7 +25,6 @@ const approuter = {
28
25
  }
29
26
 
30
27
  const xsuaa = {
31
- ref: 'uaa-resource',
32
28
  in: 'resources',
33
29
  where: [{
34
30
  property: 'type',
@@ -43,7 +39,6 @@ const xsuaa = {
43
39
  }
44
40
 
45
41
  const auditlog = {
46
- ref: 'auditlog-resource',
47
42
  in: 'resources',
48
43
  where: [{
49
44
  property: 'type',
@@ -55,7 +50,6 @@ const auditlog = {
55
50
  }
56
51
 
57
52
  const enterpriseMessaging = {
58
- ref: 'enterprise-messaging-resource',
59
53
  in: 'resources',
60
54
  where: [{
61
55
  property: 'type',
@@ -67,7 +61,6 @@ const enterpriseMessaging = {
67
61
  }
68
62
 
69
63
  const kibanaLogging = {
70
- ref: 'cf-logging',
71
64
  in: 'resources',
72
65
  where: [{
73
66
  property: 'type',
@@ -82,7 +75,6 @@ const kibanaLogging = {
82
75
  }
83
76
 
84
77
  const hdbDeployer = {
85
- ref: 'deployer',
86
78
  in: 'modules',
87
79
  where: [{
88
80
  property: 'type',
@@ -91,7 +83,6 @@ const hdbDeployer = {
91
83
  }
92
84
 
93
85
  const hdiContainer = {
94
- ref: 'hdi-container-resource',
95
86
  in: 'resources',
96
87
  where: [{
97
88
  property: 'type',
@@ -100,7 +91,6 @@ const hdiContainer = {
100
91
  }
101
92
 
102
93
  const serviceManager = {
103
- ref: 'service-manager-resource',
104
94
  in: 'resources',
105
95
  where: [{
106
96
  property: 'type',
@@ -115,7 +105,6 @@ const serviceManager = {
115
105
  }
116
106
 
117
107
  const saasRegistry = {
118
- ref: 'registry-resource',
119
108
  in: 'resources',
120
109
  where: [{
121
110
  property: 'type',
@@ -127,7 +116,6 @@ const saasRegistry = {
127
116
  }
128
117
 
129
118
  const srvAPI = {
130
- ref: 'srvAPI',
131
119
  in: 'provides',
132
120
  where: [{
133
121
  property: 'name',
@@ -139,7 +127,6 @@ const srvAPI = {
139
127
  }
140
128
 
141
129
  const mtxSidecar = {
142
- ref: 'sidecar',
143
130
  in: 'modules',
144
131
  where: [{
145
132
  property: 'type',
@@ -150,9 +137,19 @@ const mtxSidecar = {
150
137
  }]
151
138
  }
152
139
 
153
- const providedMtxAPI = {
154
- ref: 'provided-mtx-api',
155
- in: 'provides',
140
+ const providedMtxAPISrv = {
141
+ in: [srvNode, 'provides'],
142
+ where: [{
143
+ property: 'name',
144
+ isEqualTo: 'mtx-api'
145
+ }, {
146
+ property: 'properties.mtx-url',
147
+ isEqualTo: '${default-url}'
148
+ }]
149
+ }
150
+
151
+ const providedMtxAPISidecar = {
152
+ in: [mtxSidecar, 'provides'],
156
153
  where: [{
157
154
  property: 'name',
158
155
  isEqualTo: 'mtx-api'
@@ -163,7 +160,6 @@ const providedMtxAPI = {
163
160
  }
164
161
 
165
162
  const requiredMtxAPI = {
166
- ref: 'required-mtx-api',
167
163
  in: [approuter, 'requires'],
168
164
  where: [{
169
165
  property: 'properties.name',
@@ -175,7 +171,6 @@ const requiredMtxAPI = {
175
171
  }
176
172
 
177
173
  const providedAppAPI = {
178
- ref: 'provided-app-api',
179
174
  in: [approuter, 'provides'],
180
175
  where: [{
181
176
  property: 'name',
@@ -190,7 +185,6 @@ const providedAppAPI = {
190
185
  }
191
186
 
192
187
  const requiredAppAPI = {
193
- ref: 'required-app-api',
194
188
  in: [srvNode, 'requires'],
195
189
  where: [{
196
190
  property: 'name',
@@ -202,7 +196,6 @@ const requiredAppAPI = {
202
196
  }
203
197
 
204
198
  const providedMtxSidecarAPI = {
205
- ref: 'provided-mtx-sidecar-api',
206
199
  in: [mtxSidecar, 'provides'],
207
200
  where: [{
208
201
  property: 'properties.url',
@@ -211,7 +204,6 @@ const providedMtxSidecarAPI = {
211
204
  }
212
205
 
213
206
  const requiredMtxSidecarAPI = {
214
- ref: 'required-mtx-sidecar-api',
215
207
  in: [srvJava, 'requires'],
216
208
  where: [{
217
209
  property: 'properties.CDS_MULTITENANCY_SIDECAR_URL',
@@ -220,7 +212,6 @@ const requiredMtxSidecarAPI = {
220
212
  }
221
213
 
222
214
  const requiredJavaApprouterAPI = {
223
- ref: 'required-java-approuter-api',
224
215
  in: [srvJava, 'requires'],
225
216
  where: [{
226
217
  property: 'properties.CDS_MULTITENANCY_APPUI_URL',
@@ -229,7 +220,6 @@ const requiredJavaApprouterAPI = {
229
220
  }
230
221
 
231
222
  const providedJavaApprouterAPI = {
232
- ref: 'provided-java-approuter-api',
233
223
  in: [approuter, 'requires'],
234
224
  where: [{
235
225
  property: 'properties.url',
@@ -238,7 +228,6 @@ const providedJavaApprouterAPI = {
238
228
  }
239
229
 
240
230
  const approuterExtensibility = {
241
- ref: 'approuter-extensibility',
242
231
  in: 'routes',
243
232
  where: [{
244
233
  property: 'source',
@@ -253,7 +242,6 @@ const approuterExtensibility = {
253
242
  }
254
243
 
255
244
  const approuterExtensibilityJava = {
256
- ref: 'approuter-extensibility-java',
257
245
  in: 'routes',
258
246
  where: [{
259
247
  property: 'source',
@@ -280,7 +268,8 @@ module.exports = {
280
268
  saasRegistry,
281
269
  srvAPI,
282
270
  mtxSidecar,
283
- providedMtxAPI,
271
+ providedMtxAPISrv,
272
+ providedMtxAPISidecar,
284
273
  requiredMtxAPI,
285
274
  providedMtxSidecarAPI,
286
275
  requiredMtxSidecarAPI,
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "approuter",
3
3
  "dependencies": {
4
- "@sap/approuter": "^13.0.0"
4
+ "@sap/approuter": "^14.0.0"
5
5
  },
6
6
  "engines": {
7
- "node": "^16"
7
+ "node": "^18.0.0"
8
8
  },
9
9
  "scripts": {
10
10
  "start": "node node_modules/@sap/approuter/approuter.js"
@@ -1,5 +1,5 @@
1
1
  const { join } = require('path')
2
- const ProjectReader = require('../../util/projectReader')
2
+ const { readProject } = require('../../util/projectReader')
3
3
  const { mergeJSON, mergeYAML, sortDependencies } = require('../../util/merge')
4
4
  const { OPTION_XSUAA, PROJECT_TYPE } = require('../../constants')
5
5
  const {
@@ -13,11 +13,6 @@ const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5Trac
13
13
 
14
14
  module.exports = class ApprouterTemplate extends require('../templateBase') {
15
15
 
16
- constructor(projectPath, generator) {
17
- super(projectPath, generator, __dirname)
18
- this.projectReader = new ProjectReader(projectPath)
19
- }
20
-
21
16
  static hasFacet(env) {
22
17
  return !!env.requires?.approuter
23
18
  }
@@ -27,9 +22,9 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
27
22
  }
28
23
 
29
24
  async run() {
30
- const projectDescriptor = await this.projectReader.read(this.options)
25
+ const projectDescriptor = await readProject(this.options)
31
26
  const { for: forProfile } = projectDescriptor.cap
32
- const appPath = join(this.projectPath, projectDescriptor.ui.appPath || 'app')
27
+ const appPath = join(this.projectPath, projectDescriptor.ui.appPath ?? 'app')
33
28
  const appPackageJSONPath = join(appPath, 'package.json')
34
29
 
35
30
  await mergeJSON(appPackageJSONPath, join(__dirname, 'files', 'package.json'))
@@ -37,7 +32,7 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
37
32
 
38
33
  await mergeJSON(join(appPath, 'default-env.json'), join(__dirname, 'files', 'default-env.json'))
39
34
 
40
- const projectType = await this.getProjectType()
35
+ const projectType = this.getProjectType()
41
36
  switch (projectType) {
42
37
  case PROJECT_TYPE.java: {
43
38
  const cdsrcJSONPath = join(this.projectPath, '.cdsrc.json')
@@ -59,7 +54,7 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
59
54
  }
60
55
 
61
56
  async runDependentMerging(context = {}) {
62
- const projectDescriptor = await this.projectReader.read(this.options)
57
+ const projectDescriptor = await readProject(this.options)
63
58
  const { isNodejs, isJava, isExtensible, isMultitenant, hasMta, hasHelm } = projectDescriptor.cap
64
59
 
65
60
  if (hasMta) {
@@ -100,7 +95,6 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
100
95
  join(__dirname, 'files', 'chart.yaml'),
101
96
  projectDescriptor,
102
97
  { additions: [{
103
- ref: `web-application-approuter`,
104
98
  in: `dependencies`,
105
99
  where: [{
106
100
  property: 'alias',
@@ -136,7 +130,7 @@ module.exports = class ApprouterTemplate extends require('../templateBase') {
136
130
  if (isIndependentCommand) await writeMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'), context.newTrackingData);
137
131
  }
138
132
 
139
- const appPath = join(this.projectPath, projectDescriptor.ui.appPath || 'app')
133
+ const appPath = join(this.projectPath, projectDescriptor.ui.appPath ?? 'app')
140
134
  const additions = isExtensible && isJava ? [{ ...approuterExtensibilityJava, at: 0 }] :
141
135
  isExtensible && isNodejs ? [{ ...approuterExtensibility, at: 0 }] : []
142
136
  await mergeJSON(join(appPath, 'xs-app.json'), join(__dirname, 'files', 'xs-app.json.hbs'), projectDescriptor, { additions })
@@ -1 +1,4 @@
1
- {{- include "cap.service-instance" . }}
1
+ dependencies:
2
+ - name: service-instance
3
+ alias: auditlog
4
+ version: 0.1.0
@@ -1,14 +1,10 @@
1
1
  const { join } = require('path')
2
- const ProjectReader = require('../../util/projectReader')
2
+ const { readProject } = require('../../util/projectReader')
3
3
  const { mergeYAML } = require('../../util/merge')
4
- const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5Tracking')
4
+ const { parseMd5File, writeMd5File } = require('../../util/md5Tracking')
5
5
  const { srvNode, srvJava, auditlog } = require('../_merging/registry-mta')
6
6
 
7
7
  module.exports = class AuditlogTemplate extends require('../templateBase') {
8
- constructor(projectPath, generator) {
9
- super(projectPath, generator, __dirname)
10
- this.projectReader = new ProjectReader(projectPath)
11
- }
12
8
 
13
9
  static hasFacet() {
14
10
  return false // TODO: Need a `cds.requires.auditlog` or some other way to detect if enabled.
@@ -19,7 +15,7 @@ module.exports = class AuditlogTemplate extends require('../templateBase') {
19
15
  }
20
16
 
21
17
  async runDependentMerging(context = {}) {
22
- const projectDescriptor = await this.projectReader.read(this.options)
18
+ const projectDescriptor = await readProject(this.options)
23
19
  const { isNodejs, hasMta, hasHelm } = projectDescriptor.cap
24
20
 
25
21
  if (hasMta) {
@@ -60,7 +56,26 @@ module.exports = class AuditlogTemplate extends require('../templateBase') {
60
56
  }
61
57
  }
62
58
  )
63
- await copyAndTrack(join(__dirname, 'files', 'auditlog.yaml'), join(this.projectPath, 'chart', 'templates', 'auditlog.yaml'), context)
59
+
60
+ // copy service instance chart if it is not present
61
+ const HelmTemplate = require(`../helm`);
62
+ const helmTemplate = new HelmTemplate(this.generator, context.oldTrackingData, context.newTrackingData);
63
+ isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
64
+
65
+ // add dependency entry in chart.yaml
66
+ await mergeYAML(
67
+ join(this.projectPath, 'chart', 'Chart.yaml'),
68
+ join(__dirname, 'files', 'auditlog.yaml'),
69
+ projectDescriptor,
70
+ { additions: [{
71
+ in: `dependencies`,
72
+ where: [{
73
+ property: 'alias',
74
+ isEqualTo: 'auditlog'
75
+ }]
76
+ }]}
77
+ )
78
+
64
79
  if(isIndependentCommand) await writeMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'), context.newTrackingData)
65
80
  }
66
81
  }
@@ -1,34 +1,24 @@
1
1
  const { join } = require('path')
2
2
  const { exists } = require('../../../cds').utils
3
- const ProjectReader = require('../../util/projectReader');
3
+ const { readProject } = require('../../util/projectReader')
4
4
  const { copyFiles } = require('../../util/templateUtil')
5
- const { OPTION_CF_MANIFEST } = require('../../constants')
6
5
  const MANIFEST_FILE = 'manifest.yml'
7
6
  const SERVICES_MANIFEST_FILE = 'services-manifest.yml'
8
7
 
9
- module.exports = class ManifestTemplate extends require('../templateBase') {
10
- constructor(projectPath, generator) {
11
- super(projectPath, generator, __dirname)
12
- this.projectReader = new ProjectReader(projectPath)
13
- }
8
+ module.exports = class CfManifestTemplate extends require('../templateBase') {
14
9
 
15
10
  async canRun() {
16
- if (!this.options.add.has(OPTION_CF_MANIFEST)) {
17
- return false;
18
- }
19
-
20
11
  if (this.options.force) {
21
12
  return true;
22
13
  }
23
-
24
- if (exists(join(this.projectPath, MANIFEST_FILE)) || exists(join(this.projectPath, SERVICES_MANIFEST_FILE))) {
14
+ if (exists(MANIFEST_FILE) || exists(SERVICES_MANIFEST_FILE)) {
25
15
  throw new Error(`File ${MANIFEST_FILE} or ${SERVICES_MANIFEST_FILE} already exist in current folder. Use --force to overwrite.`);
26
16
  }
27
17
  return true;
28
18
  }
29
19
 
30
20
  async run() {
31
- const projectDescriptor = await this.projectReader.read()
21
+ const projectDescriptor = await readProject()
32
22
  await copyFiles(join(__dirname, 'files'), this.projectPath, projectDescriptor, this.options.force);
33
23
  }
34
24
  }
@@ -1,10 +1,8 @@
1
- {{- if .Values.connectivity }}
2
- {{- if or (not (hasKey .Values.connectivity "enabled")) .Values.connectivity.enabled }}
3
- {{- $ := merge (dict "name" "connectivity-proxy-info") . }}
1
+ {{- $ := merge (dict "name" "connectivity-proxy-info") . }}
4
2
  apiVersion: v1
5
3
  kind: ConfigMap
6
4
  metadata:
7
- name: {{ .Values.connectivity.configMapName }}
5
+ name: {{ .Release.Name }}-connectivity-proxy-info
8
6
  namespace: {{ .Release.Namespace }}
9
7
  labels: {{- include "cap.labels" $ | nindent 4 }}
10
8
  data:
@@ -16,5 +14,3 @@ data:
16
14
  onpremise_proxy_port: "20003"
17
15
  onpremise_proxy_rfc_port: "20001"
18
16
  onpremise_socks5_proxy_port: "20004"
19
- {{- end }}
20
- {{- end }}
@@ -8,19 +8,16 @@ srv:
8
8
  projected:
9
9
  sources:
10
10
  - secret:
11
- name: {{cap.appName}}-connectivity-binding
11
+ name: <your-connectivity-binding>
12
12
  optional: false
13
13
  - secret:
14
- name: {{cap.appName}}-connectivity-binding
14
+ name: <your-connectivity-binding>
15
15
  optional: false
16
16
  items:
17
17
  - key: token_service_url
18
18
  path: url
19
+ {{=<% %>=}}
19
20
  - configMap:
20
- name: {{cap.appName}}-connectivity-proxy-info
21
+ name: "{{ .Release.Name }}-connectivity-proxy-info"
21
22
  optional: false
22
- connectivity:
23
- serviceOfferingName: connectivity
24
- servicePlanName: connectivity_proxy
25
- secretName: {{cap.appName}}-connectivity-binding
26
- configMapName: {{cap.appName}}-connectivity-proxy-info
23
+ <%={{ }}=%>
@@ -1,20 +1,16 @@
1
1
  const { join } = require('path')
2
- const ProjectReader = require('../../util/projectReader')
2
+ const { readProject } = require('../../util/projectReader')
3
3
  const { mergeYAML } = require('../../util/merge')
4
4
  const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5Tracking')
5
5
 
6
6
  module.exports = class ConnectivityTemplate extends require('../templateBase') {
7
- constructor(projectPath, generator) {
8
- super(projectPath, generator, __dirname)
9
- this.projectReader = new ProjectReader(projectPath)
10
- }
11
7
 
12
8
  async run() {
13
9
  await this.runDependentMerging()
14
10
  }
15
11
 
16
12
  async runDependentMerging(context = {}) {
17
- const projectDescriptor = await this.projectReader.read(this.options)
13
+ const projectDescriptor = await readProject(this.options)
18
14
  const { hasHelm } = projectDescriptor.cap
19
15
 
20
16
  if (hasHelm) {
@@ -31,7 +27,6 @@ module.exports = class ConnectivityTemplate extends require('../templateBase') {
31
27
  join(__dirname, 'files', 'values.yaml.hbs'),
32
28
  projectDescriptor,
33
29
  { additions: [{
34
- ref: `srv-additional-volumes`,
35
30
  in: `srv.additionalVolumes`,
36
31
  where: [{
37
32
  property: 'name',
@@ -41,9 +36,7 @@ module.exports = class ConnectivityTemplate extends require('../templateBase') {
41
36
  )
42
37
  const filesPath = join(__dirname, 'files')
43
38
  const templatesPath = join(this.projectPath, 'chart', 'templates')
44
- await copyAndTrack(join(filesPath, 'connectivity-binding.yaml'), join(templatesPath, 'connectivity-binding.yaml'), context)
45
39
  await copyAndTrack(join(filesPath, 'connectivity-proxy-info.yaml'), join(templatesPath, 'connectivity-proxy-info.yaml'), context)
46
- await copyAndTrack(join(filesPath, 'connectivity.yaml'), join(templatesPath, 'connectivity.yaml'), context)
47
40
  if(isIndependentCommand) await writeMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'), context.newTrackingData)
48
41
  }
49
42
  }
@@ -6,9 +6,6 @@ const LOG = console
6
6
  const DEBUG = /\b(y|all|cli)\b/.test(process.env.DEBUG) && console.debug
7
7
 
8
8
  module.exports = class DataTemplate extends require('../templateBase') {
9
- constructor(projectPath, generator) {
10
- super(projectPath, generator, __dirname);
11
- }
12
9
 
13
10
  async run() {
14
11
  const env = await this.getEnv();
@@ -21,7 +18,6 @@ module.exports = class DataTemplate extends require('../templateBase') {
21
18
  const nameFilter = asRegex(this.options['data:for'] || this.options.for)
22
19
  const force = this.options.force;
23
20
 
24
- cds.root = this.projectPath;
25
21
  let csn = await cds.compile.to.csn(cds.env.roots); // normal CSN
26
22
 
27
23
  // Also include 'external' entities w/ cds.persistence.skip (similar to 'mocked' option of serve).
@@ -1 +1,4 @@
1
- {{- include "cap.service-instance" . }}
1
+ dependencies:
2
+ - name: service-instance
3
+ alias: destination
4
+ version: 0.1.0
@@ -1,16 +1,12 @@
1
1
  const { join } = require('path')
2
- const ProjectReader = require('../../util/projectReader')
2
+ const { readProject } = require('../../util/projectReader')
3
3
  const { mergeYAML } = require('../../util/merge')
4
- const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5Tracking')
4
+ const { parseMd5File, writeMd5File } = require('../../util/md5Tracking')
5
5
 
6
6
  module.exports = class DestinationsTemplate extends require('../templateBase') {
7
- constructor(projectPath, generator) {
8
- super(projectPath, generator, __dirname)
9
- this.projectReader = new ProjectReader(projectPath)
10
- }
11
7
 
12
8
  async canRun() {
13
- const projectDescriptor = await this.projectReader.read(this.options)
9
+ const projectDescriptor = await readProject(this.options)
14
10
  const { hasMta, hasHelm } = projectDescriptor.cap
15
11
  if (!hasHelm && hasMta) {
16
12
  throw `'cds add destinations' is not available for Cloud Foundry yet`
@@ -28,12 +24,12 @@ module.exports = class DestinationsTemplate extends require('../templateBase') {
28
24
  }
29
25
 
30
26
  async runDependentMerging(context = {}) {
31
- const projectDescriptor = await this.projectReader.read(this.options)
27
+ const projectDescriptor = await readProject(this.options)
32
28
  const { hasHelm, hasDestination, hasHtml5Repo } = projectDescriptor.cap
33
29
 
34
30
  if (hasHelm) {
35
31
  //const env = await this.getEnv()
36
- const binding = hasDestination && { srv: { bindings: { destination: { serviceInstanceName: 'destinations' }}}}
32
+ const binding = hasDestination && { srv: { bindings: { destination: { serviceInstanceName: 'destination' }}}}
37
33
  const html5Binding = hasHtml5Repo && { 'html5-apps-deployer': { bindings: { destination: { serviceInstanceName: 'destination' }}}}
38
34
 
39
35
  //in case facet is being added to the already exisiting charts folder
@@ -58,7 +54,26 @@ module.exports = class DestinationsTemplate extends require('../templateBase') {
58
54
  }
59
55
  }
60
56
  )
61
- await copyAndTrack(join(__dirname, 'files', 'destination.yaml'), join(this.projectPath, 'chart', 'templates', 'destination.yaml'), context)
57
+
58
+ // copy service instance chart if it is not present
59
+ const HelmTemplate = require(`../helm`);
60
+ const helmTemplate = new HelmTemplate(this.generator, context.oldTrackingData, context.newTrackingData);
61
+ isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
62
+
63
+ // add dependency entry in chart.yaml
64
+ await mergeYAML(
65
+ join(this.projectPath, 'chart', 'Chart.yaml'),
66
+ join(__dirname, 'files', 'destination.yaml'),
67
+ projectDescriptor,
68
+ { additions: [{
69
+ in: `dependencies`,
70
+ where: [{
71
+ property: 'alias',
72
+ isEqualTo: 'destination'
73
+ }]
74
+ }]}
75
+ )
76
+
62
77
  if(isIndependentCommand) await writeMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'), context.newTrackingData)
63
78
  }
64
79
  }
@@ -1 +1,4 @@
1
- {{- include "cap.service-instance" . }}
1
+ dependencies:
2
+ - name: service-instance
3
+ alias: event-mesh
4
+ version: 0.1.0
@@ -2,7 +2,6 @@ srv:
2
2
  bindings:
3
3
  messaging:
4
4
  serviceInstanceName: event-mesh
5
- event_mesh:
5
+ event-mesh:
6
6
  serviceOfferingName: enterprise-messaging
7
7
  servicePlanName: default
8
- config: event-mesh.json
@@ -1,39 +1,36 @@
1
1
  const { join } = require('path')
2
- const ProjectReader = require('../../util/projectReader')
2
+ const { readProject } = require('../../util/projectReader')
3
3
  const { mergeJSON, mergeYAML } = require('../../util/merge')
4
- const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5Tracking')
4
+ const { parseMd5File, writeMd5File } = require('../../util/md5Tracking')
5
5
  const { srvNode, srvJava, enterpriseMessaging } = require('../_merging/registry-mta')
6
6
 
7
7
  module.exports = class EnterpriseMessagingTemplate extends require('../templateBase') {
8
- constructor(projectPath, generator) {
9
- super(projectPath, generator, __dirname)
10
- this.projectReader = new ProjectReader(projectPath)
11
- }
8
+
12
9
 
13
10
  static hasFacet(env) {
14
- return env.requires?.messaging === 'enterprise-messaging'
11
+ return env.requires?.messaging?.kind === 'enterprise-messaging-http'
15
12
  }
16
13
 
17
14
  async run() {
18
- const projectDescriptor = await this.projectReader.read(this.options)
15
+ const projectDescriptor = await readProject(this.options)
19
16
  const { for: forProfile, isNodejs } = projectDescriptor.cap
20
17
  const templatePath = join(__dirname, 'files')
21
18
  const cdsTemplateFile = (isNodejs ? 'cds.package.json' : 'cdsrc.json') + (forProfile ? '.hbs' : '')
22
19
  const cdsTemplatePath = join(templatePath, cdsTemplateFile)
23
20
  const configPath = join(this.projectPath, isNodejs ? 'package.json' : '.cdsrc.json')
24
21
  await mergeJSON(configPath, cdsTemplatePath, projectDescriptor)
22
+ await mergeJSON('event-mesh.json', join(__dirname, 'files', 'event-mesh.json.hbs'), projectDescriptor)
25
23
  await this.runDependentMerging()
26
24
  }
27
25
 
28
26
  async runDependentMerging(context = {}) {
29
- const projectDescriptor = await this.projectReader.read(this.options)
27
+ const projectDescriptor = await readProject(this.options)
30
28
  const { hasHelm, hasMta, isNodejs } = projectDescriptor.cap
31
29
 
32
30
  if (hasMta) {
33
- const mtaYAMLPath = join(this.projectPath, 'mta.yaml')
34
31
  const srv = isNodejs ? srvNode : srvJava
35
32
  await mergeYAML(
36
- mtaYAMLPath,
33
+ 'mta.yaml',
37
34
  join(__dirname, 'files', 'mta.yaml.hbs'),
38
35
  projectDescriptor,
39
36
  {
@@ -44,11 +41,6 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
44
41
  }]
45
42
  }
46
43
  )
47
- await mergeJSON(
48
- join(this.projectPath, 'event-mesh.json'),
49
- join(__dirname, 'files', 'event-mesh.json.hbs'),
50
- projectDescriptor
51
- )
52
44
  }
53
45
 
54
46
  if (hasHelm) {
@@ -59,15 +51,31 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
59
51
  context.projectPath = this.projectPath
60
52
  context.oldTrackingData = context.newTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'))
61
53
  }
54
+
62
55
  await mergeYAML(
63
56
  join(this.projectPath, 'chart', 'values.yaml'),
64
57
  join(__dirname, 'files', 'values.yaml')
65
58
  )
66
- await copyAndTrack(
67
- join(__dirname, 'files', 'event-mesh.yaml'),
68
- join(this.projectPath, 'chart', 'templates', 'event-mesh.yaml'),
69
- context
59
+
60
+ // copy service instance chart if it is not present
61
+ const HelmTemplate = require(`../helm`);
62
+ const helmTemplate = new HelmTemplate(this.generator, context.oldTrackingData, context.newTrackingData);
63
+ isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
64
+
65
+ // add dependency entry in chart.yaml
66
+ await mergeYAML(
67
+ join(this.projectPath, 'chart', 'Chart.yaml'),
68
+ join(__dirname, 'files', 'event-mesh.yaml'),
69
+ projectDescriptor,
70
+ { additions: [{
71
+ in: `dependencies`,
72
+ where: [{
73
+ property: 'alias',
74
+ isEqualTo: 'event-mesh'
75
+ }]
76
+ }]}
70
77
  )
78
+
71
79
  if(isIndependentCommand) await writeMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'), context.newTrackingData)
72
80
  }
73
81
  }