@sap/cds-dk 7.5.1 → 7.6.1

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 (74) 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/import.js +2 -2
  7. package/bin/init.js +7 -3
  8. package/bin/logout.js +2 -2
  9. package/bin/migrate.js +1 -1
  10. package/bin/version.js +1 -0
  11. package/bin/watch.js +8 -1
  12. package/lib/bind/bindingUtil.js +14 -20
  13. package/lib/bind/cfKeyProvider.js +8 -10
  14. package/lib/bind/index.js +4 -2
  15. package/lib/build/buildTaskFactory.js +31 -20
  16. package/lib/build/constants.js +9 -8
  17. package/lib/build/provider/featureToggleBuildPlugin.js +1 -7
  18. package/lib/build/provider/hana/index.js +44 -9
  19. package/lib/build/provider/internalBuildTaskProvider.js +7 -5
  20. package/lib/build/provider/java/index.js +0 -6
  21. package/lib/build/provider/mtx-sidecar/index.js +5 -0
  22. package/lib/build/provider/nodejs/index.js +32 -47
  23. package/lib/build/util.js +134 -33
  24. package/lib/deploy/to-hana/hana.js +47 -77
  25. package/lib/deploy/to-hana/hdiDeployUtil.js +15 -18
  26. package/lib/deploy/to-hana/mtaUtil.js +1 -1
  27. package/lib/env/schema.js +157 -17
  28. package/lib/env/schemas/cds-rc.js +118 -0
  29. package/lib/import/common.js +18 -23
  30. package/lib/import/odata/metadataconverter/MetadataConverter.js +12 -8
  31. package/lib/import/odata/v4parser.js +67 -12
  32. package/lib/init/constants.js +2 -4
  33. package/lib/init/merge.js +2 -1
  34. package/lib/init/template/application-logging/index.js +1 -2
  35. package/lib/init/template/approuter/files/mta.yaml.hbs +2 -0
  36. package/lib/init/template/approuter/files/package.json +1 -1
  37. package/lib/init/template/approuter/files/values.yaml.hbs +8 -1
  38. package/lib/init/template/hana/files/undeploy.json +3 -2
  39. package/lib/init/template/helm/files/chart/templates/NOTES.txt +2 -0
  40. package/lib/init/template/helm/files/chart/templates/_deployment_helpers.tpl +10 -2
  41. package/lib/init/template/helm/files/content-deployment/Chart.yaml +1 -1
  42. package/lib/init/template/helm/files/content-deployment/templates/_helpers.tpl +6 -5
  43. package/lib/init/template/helm/files/content-deployment/values.yaml +1 -1
  44. package/lib/init/template/helm/files/service-instance/Chart.yaml +1 -1
  45. package/lib/init/template/helm/files/service-instance/templates/_helpers.tpl +6 -5
  46. package/lib/init/template/helm/files/service-instance/values.yaml +1 -1
  47. package/lib/init/template/helm/files/web-application/Chart.yaml +1 -1
  48. package/lib/init/template/helm/files/web-application/templates/_api.tpl +6 -5
  49. package/lib/init/template/helm/files/web-application/values.yaml +1 -1
  50. package/lib/init/template/helm/index.js +1 -12
  51. package/lib/init/template/helm-unified-runtime/index.js +3 -2
  52. package/lib/init/template/html5-repo/files/values.yaml.hbs +9 -0
  53. package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +1 -2
  54. package/lib/init/template/multitenancy/index.js +3 -2
  55. package/lib/init/template/xsuaa/files/package.json.hbs +1 -2
  56. package/lib/lint/Linter.js +2 -2
  57. package/lib/lint/checks.js +0 -51
  58. package/lib/mtx/activate.js +1 -1
  59. package/lib/mtx/auth_manager.js +50 -57
  60. package/lib/mtx/download_legacy.js +1 -1
  61. package/lib/mtx/extend.js +2 -2
  62. package/lib/mtx/pull.js +1 -1
  63. package/lib/mtx/push.js +1 -1
  64. package/lib/mtx/settings_manager.js +90 -44
  65. package/lib/mtx/tenant_action.js +1 -1
  66. package/lib/mtx/util/dependencies.js +1 -1
  67. package/lib/mtx/util/legacy_ext.js +0 -1
  68. package/lib/mtx/util/logging.js +10 -8
  69. package/lib/util/axios.js +6 -19
  70. package/lib/util/cf.js +15 -10
  71. package/npm-shrinkwrap.json +104 -48
  72. package/package.json +1 -10
  73. package/lib/env/schemas/cds-rc.json +0 -101
  74. package/lib/init/template/helm-unified-runtime/lib/build.js +0 -0
@@ -148,30 +148,11 @@ async function _copyToSrvExternal(file, dst, cwd) {
148
148
  return file;
149
149
  }
150
150
 
151
- async function isValidJsonObject(options){
152
- let config;
153
- try {
154
- if (options.config) {
155
- config = JSON.parse(options.config);
156
- return config;
157
- }
158
- } catch (error) {
159
- throw new Error(messages.SPECIFY_CONFIG);
160
- }
161
- }
162
-
163
151
  async function preProcess(file, options, cwd) {
164
152
  let srcFilePath = await isValidInputFile(path.resolve(cwd, file));
165
153
  if (options.as && !_supportedAsFormats().includes(options.as))
166
154
  throw new Error(messages.INVALID_AS_OPTION);
167
-
168
- const external = path.resolve(cwd, 'srv/external');
169
- const destFilePath = path.join(external, path.basename(srcFilePath));
170
-
171
- if (!options.dry && !options.no_copy)
172
- srcFilePath = await _copyToSrvExternal(srcFilePath, destFilePath, cwd);
173
-
174
- return [srcFilePath, destFilePath];
155
+ return srcFilePath;
175
156
  }
176
157
 
177
158
  async function processOptions(cliOptions, odataOptions) {
@@ -359,14 +340,28 @@ async function _updatePackageJson(dest, services, kind, cwd, config) {
359
340
  }
360
341
  }
361
342
 
343
+ function _parseValidJsonConfig(config) {
344
+ try {
345
+ if (config) {
346
+ return JSON.parse(config);
347
+ }
348
+ } catch (error) {
349
+ throw new Error(messages.SPECIFY_CONFIG);
350
+ }
351
+ }
352
+
362
353
  async function postProcess(filePath, options, csn, cwd) {
363
354
  const services = _getServiceNames(csn);
364
- let config = await isValidJsonObject(options);
365
- if (options.out) options.out = _validateAndComputeOutputFilePath(options.out, options.as, filePath);
355
+ let config = _parseValidJsonConfig(options.config);
356
+ const external = path.resolve(cwd, 'srv/external');
357
+ const destFilePath = path.join(external, path.basename(filePath));
358
+ if (options.out) options.out = _validateAndComputeOutputFilePath(options.out, options.as, destFilePath);
366
359
  const kind = options.inputFileKind;
367
- const result = await _getResult(csn, options.as, options.out || filePath.replace(/\.[^.]+$/, ''), options.force, kind);
360
+ const result = await _getResult(csn, options.as, options.out || destFilePath.replace(/\.[^.]+$/, ''), options.force, kind);
368
361
  const written = options.dry || await _write(result, services, cwd);
369
362
  const registered = options.dry || options.no_save || await _updatePackageJson(result[1].replace(/\.[^.]+$/, ''), services, kind, cwd, config);
363
+ if (!options.dry && !options.no_copy)
364
+ await _copyToSrvExternal(filePath, destFilePath, cwd);
370
365
  if (options.dry) return console.log(result[0]);
371
366
  return Promise.all([written, registered]);
372
367
  }
@@ -1025,7 +1025,6 @@ MetadataConverter.Context = Context;
1025
1025
  * @param {Object} result The metadata abstract syntax tree of the depended metadata document
1026
1026
  */
1027
1027
 
1028
-
1029
1028
  /**
1030
1029
  * This callback is displayed as part of the DefaultXmlStrategy class.
1031
1030
  * This factory is called when the converter can not find a needed type within the current metadata document.
@@ -1073,7 +1072,6 @@ The result must be returned via 'return' statement.
1073
1072
  * @returns {Expression} The expression to interpret the current element node
1074
1073
  */
1075
1074
 
1076
-
1077
1075
  /**
1078
1076
  * This callback is displayed as part of the DefaultXmlStrategy class.
1079
1077
  * This callback is called on finishing a strategy.
@@ -1083,7 +1081,6 @@ The result must be returned via 'return' statement.
1083
1081
  * @param {Any} result The output of the Strategy
1084
1082
  */
1085
1083
 
1086
-
1087
1084
  class DefaultXmlStrategy extends Strategy {
1088
1085
  constructor(options) {
1089
1086
  super(undefined, options);
@@ -1243,7 +1240,6 @@ class DefaultXmlStrategy extends Strategy {
1243
1240
  }
1244
1241
  MetadataConverter.DefaultXmlStrategy = DefaultXmlStrategy;
1245
1242
 
1246
-
1247
1243
  class EdmxRootExpression extends Expression {
1248
1244
  constructor(element, expression, context) { super(element, expression, context); }
1249
1245
  interpret() {
@@ -1441,7 +1437,6 @@ class AbstractLogicalExpression extends Expression {
1441
1437
  }
1442
1438
  }
1443
1439
 
1444
-
1445
1440
  class AndExpression extends AbstractLogicalExpression {
1446
1441
  constructor(element, expression, context) { super(element, expression, context, '$And'); }
1447
1442
  }
@@ -1671,8 +1666,18 @@ class PropertyValueExpression extends Expression {
1671
1666
  this.setTarget(target);
1672
1667
  this.buildTypeCollectionAndFacets('$Type');
1673
1668
 
1669
+ /**
1670
+ * We can have instances of EDMX where we see value for a particular attribute as:
1671
+ * AnnotationPath="part/icipants/@UI.LineItem" or Path="SAP__Messages/random”, etc
1672
+ *
1673
+ * In such cases we need to replace '/' with '.' and only then the CSN generated will
1674
+ * be treated correctly in the later steps.
1675
+ * * For now this is only done for AnnotationPath value in #1680 to resolve an issue
1676
+ * * TODO: In future we might have to do it for many such value.
1677
+ */
1674
1678
  if (element.attributes.Path) target[name] = { "=": element.attributes.Path };
1675
1679
  if (element.attributes.PropertyPath) target[name] = { "=": element.attributes.PropertyPath };
1680
+ if (element.attributes.AnnotationPath) target[name] = { "=": (element.attributes.AnnotationPath).replaceAll('/', '.') };
1676
1681
  if (element.attributes.EnumMember) target[name] = { "#": element.attributes.EnumMember.substring(element.attributes.EnumMember.lastIndexOf('/') + 1) };
1677
1682
  if (element.attributes.NavigationPropertyPath) target[name] = { "=": element.attributes.NavigationPropertyPath };
1678
1683
  if (element.attributes.String) target[name] = element.attributes.String;
@@ -1684,8 +1689,8 @@ class PropertyValueExpression extends Expression {
1684
1689
  if (element.attributes.Bool) target[name] = element.attributes.Bool === 'true';
1685
1690
  /**
1686
1691
  * If the property valus is of type `Date`, import it as a string itself
1687
- * <PropertyValue Property="Date" Date="2021-08-24" />
1688
- * We might have to have a strict check in the futore.. 'YYYY-MM_DD`
1692
+ * <PropertyValue Property="Date" Date="2021-08-24"/>
1693
+ * We might have to have a strict check in the future.. 'YYYY-MM_DD`
1689
1694
  */
1690
1695
  if (element.attributes.Date) target[name] = element.attributes.Date;
1691
1696
 
@@ -2411,7 +2416,6 @@ class OnDeleteExpression extends Expression {
2411
2416
 
2412
2417
  }
2413
2418
 
2414
-
2415
2419
  MetadataConverter.createOdataV4MetadataXmlToOdataV4CsdlStrategy = (name_space) => {
2416
2420
  MetadataConverter.custom_namespace = name_space;
2417
2421
  return new MetadataConverter.DefaultXmlStrategy()
@@ -426,8 +426,8 @@ function _parseAnnotationTerms(annotationTerm, annotationTermObject, csnDefsTarg
426
426
  function _resolveAnotationTerm(schemaDataAnnotation, parserContext) {
427
427
  // Case 1: We have the Namespace and Alias for the vocabulary
428
428
  for (const [alias, namespace] of Object.entries(parserContext.vocabAliasToNamespace)) {
429
- if (schemaDataAnnotation.includes('@' + alias)) {
430
- schemaDataAnnotation = schemaDataAnnotation.split('@' + alias).join('@' + known_vocabularies[namespace]);
429
+ if (schemaDataAnnotation.includes('@' + alias + '.')) {
430
+ schemaDataAnnotation = schemaDataAnnotation.split('@' + alias + '.').join('@' + known_vocabularies[namespace] + '.');
431
431
  }
432
432
  }
433
433
  /**
@@ -1225,6 +1225,15 @@ function _addSuffixForCollisionTypes(fqName, suffix) {
1225
1225
  function _parseEntityContainer(csnDefs, entityContainerElements, parserContext) {
1226
1226
  const entityContainerElementNames = Object.keys(entityContainerElements);
1227
1227
  const redundantElementNames = [];
1228
+ let possibleAnnotations = {};
1229
+
1230
+ // filter entries starting with '@', they can be possible annotation
1231
+ entityContainerElementNames.filter(
1232
+ elementName => elementName.startsWith('@')
1233
+ ).forEach(elementName => {
1234
+ possibleAnnotations[elementName] = entityContainerElements[elementName];
1235
+ delete entityContainerElements[elementName];
1236
+ });
1228
1237
 
1229
1238
  entityContainerElementNames.forEach(ecElement => {
1230
1239
  if (entityContainerElements[ecElement] instanceof Object) {
@@ -1294,6 +1303,49 @@ function _parseEntityContainer(csnDefs, entityContainerElements, parserContext)
1294
1303
  delete csnDefs[name];
1295
1304
  });
1296
1305
 
1306
+ // check for possible annotations present within the entity container
1307
+ if (Object.keys(possibleAnnotations).length > 0) {
1308
+ let entityContainerAnnotations = {};
1309
+ let annotationTarget = parserContext.primarySchema + '.' + parserContext.entityContainerName;
1310
+ possibleAnnotations = _resolveAnotationTerm(
1311
+ JSON.stringify(possibleAnnotations), parserContext
1312
+ );
1313
+ /**
1314
+ * If the same annotation target already exists because of the annotation present outside
1315
+ * of the EntityContainer, then append the possible annotations to it and parse all of them.
1316
+ * Few exact same annotation term if exists, will result in information being overwritten
1317
+ * by the annotation term present within the EntityContainer.
1318
+ */
1319
+ if (Object.keys(parserContext.entityContainerAnnotations).length > 0) {
1320
+ entityContainerAnnotations = parserContext.entityContainerAnnotations;
1321
+ /**
1322
+ * When the parserContext.entityContainerAnnotations contains the annotation target,
1323
+ * and we have unique information present within EntityContainer as well as indipendent
1324
+ * annotation, we have to merge them.
1325
+ */
1326
+ if (parserContext.entityContainerAnnotations[annotationTarget] &&
1327
+ Object.keys(parserContext.entityContainerAnnotations[annotationTarget]).length > 0
1328
+ ) {
1329
+ entityContainerAnnotations[annotationTarget] = Object.assign(
1330
+ entityContainerAnnotations[annotationTarget],
1331
+ possibleAnnotations
1332
+ );
1333
+ }
1334
+ /**
1335
+ * If the annotation target name is different, we can expand all of the information
1336
+ * into a single object itself
1337
+ */
1338
+ else {
1339
+ entityContainerAnnotations[annotationTarget] = possibleAnnotations;
1340
+ }
1341
+ }
1342
+ // Simply add the possible annotations to the object with the target
1343
+ else {
1344
+ entityContainerAnnotations[annotationTarget] = possibleAnnotations;
1345
+ }
1346
+ parserContext.entityContainerAnnotations = entityContainerAnnotations;
1347
+ }
1348
+
1297
1349
  // parse all the entity container annotations
1298
1350
  if (parserContext.entityContainerAnnotations) {
1299
1351
  _parseAnnotations(parserContext.entityContainerAnnotations, csnDefs, parserContext);
@@ -1450,6 +1502,17 @@ function _collectSchemaElements(edmxAsJson, schemaDataList, parserContext) {
1450
1502
 
1451
1503
  _collectUnboundedActionFunction(schemaDataList, parserContext);
1452
1504
 
1505
+ // capture all the references
1506
+ if (edmxAsJson.$Reference) {
1507
+ Object.entries(edmxAsJson.$Reference).forEach(ref => {
1508
+ if (ref[1].$Include[0].$Alias &&
1509
+ known_vocabularies.hasOwnProperty(ref[1].$Include[0].$Namespace)
1510
+ ) {
1511
+ parserContext.vocabAliasToNamespace[ref[1].$Include[0].$Alias] = ref[1].$Include[0].$Namespace;
1512
+ }
1513
+ });
1514
+ }
1515
+
1453
1516
  // collect entityType, enumType, complexType, typeDefinition, bounded action/function, annotations
1454
1517
  for (let schemaData of schemaDataList) {
1455
1518
  let currNamespace = schemaData.$SchemaNamespace;
@@ -1472,15 +1535,6 @@ function _collectSchemaElements(edmxAsJson, schemaDataList, parserContext) {
1472
1535
  }
1473
1536
  // annotations
1474
1537
  else if (elementName === '$Annotations') {
1475
- if (edmxAsJson.$Reference) {
1476
- Object.entries(edmxAsJson.$Reference).forEach(ref => {
1477
- if (ref[1].$Include[0].$Alias &&
1478
- known_vocabularies.hasOwnProperty(ref[1].$Include[0].$Namespace)
1479
- ) {
1480
- parserContext.vocabAliasToNamespace[ref[1].$Include[0].$Alias] = ref[1].$Include[0].$Namespace;
1481
- }
1482
- });
1483
- }
1484
1538
  schemaData.$Annotations = _resolveAnotationTerm(JSON.stringify(schemaData.$Annotations), parserContext);
1485
1539
  /**
1486
1540
  * collect entity container annotations with the assumption that
@@ -1552,7 +1606,8 @@ function _preProcess(edmxAsJson, parserContext, importerContext) {
1552
1606
  parserContext.entityToEntitySetMap._.size === 0 &&
1553
1607
  parserContext.entityToSingletonMap._.size === 0 &&
1554
1608
  parserContext.actionToActionImportMap._.size === 0 &&
1555
- parserContext.functionToFunctionImportMap._.size === 0) {
1609
+ parserContext.functionToFunctionImportMap._.size === 0)
1610
+ {
1556
1611
  parserContext.mockServerUc = false;
1557
1612
  }
1558
1613
 
@@ -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',
@@ -57,9 +57,7 @@ module.exports = {
57
57
  SAMPLES: 'https://github.com/SAP-samples/cloud-cap-samples',
58
58
  CAPIRE: 'https://cap.cloud.sap',
59
59
  MAVEN_ARCHETYPE_HELP: `https://cap.cloud.sap/docs/java/development/#the-maven-archetype`,
60
- MAVEN_INSTALL_HELP: `https://maven.apache.org/install.html`,
61
- VSCODE: 'https://code.visualstudio.com/',
62
- VSCODE_ESLINT: 'https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint'
60
+ MAVEN_INSTALL_HELP: `https://maven.apache.org/install.html`
63
61
  }),
64
62
 
65
63
  PROJECT_FILES: ['package.json', 'pom.xml', '.cdsrc.json']
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
 
@@ -1,8 +1,7 @@
1
1
  {
2
2
  {{#isNodejs}}
3
3
  "dependencies": {
4
- "@sap/xssec": "^3",
5
- "passport": "^0"
4
+ "@sap/xssec": "^3"
6
5
  },
7
6
  "cds": {
8
7
  {{/isNodejs}}
@@ -38,7 +38,7 @@ class Linter {
38
38
  /**
39
39
  * Initializes `cds lint` call and generates the required content
40
40
  * object for `cds` executable
41
- * @returns object continaing help, options, flags and shortcuts
41
+ * @returns object containing help, options, flags and shortcuts
42
42
  */
43
43
  init(help = "", options = [], flags = [], shortcuts = []) {
44
44
  this.eslintCmd = checks.resolveEslint(this.cdsdkPath, this.globalPath);
@@ -56,7 +56,7 @@ class Linter {
56
56
 
57
57
  /**
58
58
  * Runner for 'cds lint' which is a wrapper for eslint cmd calls
59
- * that detecs and adds the required cmd line arguments
59
+ * that detects and adds the required cmd line arguments
60
60
  * @param {*} args files/globs for eslint to lint
61
61
  * @param {*} options options/flag passed by user
62
62
  */