@sap/cds-dk 6.3.1 → 6.4.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 (93) hide show
  1. package/CHANGELOG.md +37 -5
  2. package/bin/cds.js +2 -0
  3. package/bin/compile/index.js +2 -1
  4. package/bin/deploy/index.js +2 -2
  5. package/bin/deploy/to-sqlite.js +17 -15
  6. package/bin/help.js +7 -4
  7. package/bin/init.js +1 -1
  8. package/bin/login.js +3 -4
  9. package/bin/migrate.js +33 -0
  10. package/bin/pull.js +4 -4
  11. package/bin/push.js +1 -1
  12. package/bin/subscribe.js +58 -66
  13. package/bin/unsubscribe.js +67 -0
  14. package/bin/watch.js +4 -3
  15. package/lib/bind/bindingUtil.js +2 -0
  16. package/lib/bind/cfKeyProvider.js +5 -1
  17. package/lib/client/activate.js +3 -3
  18. package/lib/client/auth_manager.js +2 -2
  19. package/lib/client/base_command.js +7 -6
  20. package/lib/client/extend.js +2 -2
  21. package/lib/client/helper/errors.js +8 -2
  22. package/lib/client/helper/logging.js +13 -11
  23. package/lib/client/params.js +3 -0
  24. package/lib/client/pull.js +1 -1
  25. package/lib/client/push.js +4 -4
  26. package/lib/client/settings_manager.js +13 -6
  27. package/lib/client/subscription.js +81 -0
  28. package/lib/compile/to-xsuaa.js +25 -19
  29. package/lib/import/odata/metadataconverter/MetadataConverter.js +3 -3
  30. package/lib/import/odata/v2parser.js +37 -24
  31. package/lib/import/odata/v4parser.js +106 -37
  32. package/lib/init/constants.js +1 -1
  33. package/lib/init/index.js +2 -2
  34. package/lib/init/template/_merging/registry-mta.js +0 -3
  35. package/lib/init/template/approuter/files/approuter-configmap.yaml +10 -0
  36. package/lib/init/template/approuter/files/approuter-mtxs-configmap.yaml +15 -0
  37. package/lib/init/template/approuter/files/chart.yaml +4 -0
  38. package/lib/init/template/approuter/files/package.json +1 -1
  39. package/lib/init/template/approuter/files/values.yaml.hbs +31 -0
  40. package/lib/init/template/approuter/index.js +60 -12
  41. package/lib/init/template/auditlog/index.js +16 -8
  42. package/lib/init/template/cf-manifest/index.js +3 -3
  43. package/lib/init/template/connectivity/index.js +19 -10
  44. package/lib/init/template/destinations/index.js +23 -7
  45. package/lib/init/template/enterprise-messaging/files/cds.package.json +1 -2
  46. package/lib/init/template/enterprise-messaging/files/cds.profile.package.json.hbs +1 -2
  47. package/lib/init/template/enterprise-messaging/files/cdsrc.json +1 -2
  48. package/lib/init/template/enterprise-messaging/files/cdsrc.json.hbs +1 -2
  49. package/lib/init/template/enterprise-messaging/files/event-mesh.json.hbs +31 -0
  50. package/lib/init/template/enterprise-messaging/files/mta.yaml.hbs +1 -0
  51. package/lib/init/template/enterprise-messaging/index.js +26 -13
  52. package/lib/init/template/extensibility/index.js +19 -10
  53. package/lib/init/template/hana/files/mta.yaml.hbs +0 -4
  54. package/lib/init/template/hana/index.js +58 -22
  55. package/lib/init/template/helm/chart/templates/NOTES.txt +4 -3
  56. package/lib/init/template/helm/chart/templates/_deployment_helpers.tpl +25 -2
  57. package/lib/init/template/helm/chart/values.root.schema.json +5 -0
  58. package/lib/init/template/helm/chart/values.schema.json +27 -0
  59. package/lib/init/template/helm/files/values.yaml.hbs +1 -1
  60. package/lib/init/template/helm/index.js +25 -23
  61. package/lib/init/template/helm/subchart/templates/_helpers.tpl +29 -0
  62. package/lib/init/template/helm/subchart/templates/api-rule.yaml +5 -5
  63. package/lib/init/template/helm/subchart/templates/deployment.yaml +12 -9
  64. package/lib/init/template/helm/subchart/values.md +258 -88
  65. package/lib/init/template/helm/subchart/values.schema.json +96 -13
  66. package/lib/init/template/helm/subchart/values.yaml +6 -2
  67. package/lib/init/template/html5-repo/index.js +28 -11
  68. package/lib/init/template/java/index.js +5 -5
  69. package/lib/init/template/kibana-logging/index.js +5 -4
  70. package/lib/init/template/mta/index.js +2 -2
  71. package/lib/init/template/mtx/index.js +1 -1
  72. package/lib/init/template/multitenancy/files/chart.yaml +4 -0
  73. package/lib/init/template/multitenancy/files/java/mtxs-configmap.yaml +20 -0
  74. package/lib/init/template/multitenancy/files/java/package.json +6 -9
  75. package/lib/init/template/multitenancy/files/mtxs-configmap.yaml +15 -0
  76. package/lib/init/template/multitenancy/files/saas-registry.yaml +17 -19
  77. package/lib/init/template/multitenancy/files/values.yaml.hbs +47 -0
  78. package/lib/init/template/multitenancy/files/xs-security.json.hbs +0 -7
  79. package/lib/init/template/multitenancy/index.js +83 -37
  80. package/lib/init/template/nodejs/files/.eslintrc +26 -0
  81. package/lib/init/template/nodejs/files/package.json.hbs +0 -28
  82. package/lib/init/template/nodejs/index.js +7 -10
  83. package/lib/init/template/pipeline/index.js +4 -4
  84. package/lib/init/template/samples/index.js +5 -5
  85. package/lib/init/template/templateBase.js +1 -4
  86. package/lib/init/template/toggles/index.js +5 -5
  87. package/lib/init/template/xsuaa/files/values.yaml.hbs +21 -0
  88. package/lib/init/template/xsuaa/index.js +34 -24
  89. package/lib/init/util/md5Tracking.js +113 -0
  90. package/lib/init/util/merge.js +19 -2
  91. package/lib/init/util/projectReader.js +15 -12
  92. package/npm-shrinkwrap.json +70 -572
  93. package/package.json +3 -3
@@ -55,7 +55,7 @@ async function mergeJSON(into, from, projectDescriptor, semantics) {
55
55
  return result
56
56
  }
57
57
 
58
- async function mergeYAML(into, from, projectDescriptor, semantics) {
58
+ async function mergeYAML(into, from, projectDescriptor, semantics = {}) {
59
59
  const target =
60
60
  typeof into === 'string' ? await readYAML(into) :
61
61
  into instanceof YAML.Document ? into :
@@ -312,8 +312,25 @@ async function mergeYAML(into, from, projectDescriptor, semantics) {
312
312
  return target
313
313
  }
314
314
 
315
+ async function removeFromYAML(name, keyPaths) {
316
+ const yaml = await readYAML(name)
317
+ for (const keyPath of keyPaths) {
318
+ let node = yaml
319
+ const keys = keyPath.split('.')
320
+ for (const [index, key] of keys.entries()) {
321
+ if (index === keys.length - 1) {
322
+ node.delete(key)
323
+ } else {
324
+ node = node.get(key)
325
+ }
326
+ }
327
+ }
328
+ await writeYAML(name, yaml)
329
+ }
330
+
315
331
  module.exports = {
316
332
  sortDependencies,
317
333
  mergeJSON,
318
- mergeYAML
334
+ mergeYAML,
335
+ removeFromYAML
319
336
  }
@@ -89,18 +89,21 @@ module.exports = class ProjectReader {
89
89
  cds.env // make sure env is initialized, otherwise we cannot set it (exotic case)
90
90
  cds.env = env
91
91
 
92
- const root = this.projectPath
93
- const nullLogger = { debug: () => {}, log: () => {}, warn: () => {}, error: () => {}, write: () => {}}
94
- const buildTasks = await new BuildTaskFactory(nullLogger, cds).getTasks({ root, resolve: true, mta: false })
92
+ const nullLogger = { debug: () => { }, log: () => { }, warn: () => { }, error: () => { }, write: () => { } }
93
+
94
+ // no file path resolving as the directories might not exist - e.g. cds add will create the mtx/sidecar folder
95
+ const buildTasks = await new BuildTaskFactory(nullLogger, cds).getTasks({ root: this.projectPath, resolve: false, mta: false })
95
96
 
96
97
  await Promise.all(buildTasks.map(async (task) => {
97
- const relDestPath = path.relative(root, task.dest)?.replace(/\\/g, '/')
98
+ const srcPath = path.resolve(this.projectPath, task.src)
99
+ const srcFolder = path.basename(srcPath)
100
+ const relDestPath = path.join(env?.build?.target ?? "gen", task.dest || task.src)?.replace(/\\/g, '/')
98
101
 
99
102
  switch (task.for) {
100
103
  case BUILD_TASK_HANA:
101
104
  // check whether we have a hana service binding defined as a hana build task is returned by default for compatibility reasons if neither hana, nor sqlite has been defined
102
105
  if (this._hasHanaServiceBinding(env)) {
103
- cap.db.push({ path: relDestPath, name: path.basename(task.src) })
106
+ cap.db.push({ path: relDestPath, name: srcFolder })
104
107
  }
105
108
  break
106
109
 
@@ -109,8 +112,8 @@ module.exports = class ProjectReader {
109
112
  cap.pLanguage = P_LANGUAGE_JAVA
110
113
  cap.srv = {
111
114
  path: relDestPath,
112
- name: path.basename(task.src),
113
- ext: await this._getJavaExtDescriptor(task)
115
+ name: srcFolder,
116
+ ext: await this._getJavaExtDescriptor(srcPath)
114
117
  }
115
118
  break
116
119
 
@@ -118,7 +121,7 @@ module.exports = class ProjectReader {
118
121
  case BUILD_TASK_NODE_CF:
119
122
  cap.srv = {
120
123
  path: relDestPath,
121
- name: path.basename(task.src)
124
+ name: srcFolder
122
125
  }
123
126
  break
124
127
 
@@ -142,12 +145,12 @@ module.exports = class ProjectReader {
142
145
  }
143
146
 
144
147
  /**
145
- * Determines java specific properties for the given build task.
146
- * @param {object} task
148
+ * Determines java specific properties for the given module source path.
149
+ * @param {object} srcPath
147
150
  */
148
- async _getJavaExtDescriptor(task) {
151
+ async _getJavaExtDescriptor(srcPath) {
149
152
  // by default spring-boot:repackage is used creating an executable jar archive
150
- const pomJson = await this._parseXml(path.join(task.src, 'pom.xml'))
153
+ const pomJson = await this._parseXml(path.join(srcPath, 'pom.xml'))
151
154
  if (pomJson) {
152
155
  const dependencies = pomJson?.project?.dependencies?.[0]?.dependency
153
156
  const isOldJavaRuntime = [...dependencies].some(d => /com\.sap\.cloud\.servicesdk/.test(d?.groupId?.[0]))