@sap/cds-dk 4.9.0 → 4.9.3

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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,36 @@ This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
7
  The format is based on [Keep a Changelog](http://keepachangelog.com/).
8
8
 
9
+ ## Version 4.9.3 - 2022-04-27
10
+
11
+ ### Changed
12
+
13
+ - `cds init` uses latest Maven Java archetype version 1.23.1 for creating Java projects.
14
+ - Include `@sap/cds` 5.9.3
15
+
16
+ ### Fixed
17
+
18
+ - `cds add cf-manifest` now uses the correct `application` plan for the `xsuaa` service
19
+ - `cds login`, `cds activate`: correctly include response in auth errors
20
+ - The SAP HANA and MTA options in the project wizard in BAS now work again
21
+
22
+ ## Version 4.9.2 - 2022-04-11
23
+
24
+ ### Changed
25
+
26
+ - Include `moment` 2.29.2, fixing CVE-2022-24785
27
+ - Include `@sap/cds` 5.9.2
28
+ - Include `@sap/eslint-plugin` 2.3.5
29
+
30
+ ## Version 4.9.1 - 2022-04-01
31
+
32
+ ### Changed
33
+
34
+ - `cds init` uses latest Maven Java archetype version 1.23.0 for creating Java projects.
35
+ - Include `@sap/cds` 5.9.1
36
+ - Include `@sap/cds-compiler` 2.13.8
37
+ - Include `@sap/eslint-plugin` 2.3.4
38
+
9
39
  ## Version 4.9.0 - 2022-03-28
10
40
 
11
41
  ### Added
@@ -24,7 +24,6 @@ function addUrlInfo(params, authData) {
24
24
  function getTokenUrl(params) {
25
25
  const tokenUrl = new URL(params.get('tokenUrl'));
26
26
  tokenUrl.search = `subdomain=${params.get('subdomain')}`;
27
- console.log(tokenUrl);
28
27
 
29
28
  if (params.has('refreshToken')) {
30
29
  tokenUrl.search += `&refresh_token=${encodeURIComponent(params.get('refreshToken'))}`;
@@ -61,7 +60,7 @@ async function retrieveTokenOrPasscodeUrl(params) {
61
60
  try {
62
61
  response = await axios.get(tokenUrl);
63
62
  } catch (error) {
64
- throw new Error(`Failed to get authentication token: ${error}.\nResponse body: ${util.inspect(response && response.data)}`);
63
+ throw new Error(`Failed to get authentication token: ${error}.\nResponse body: ${util.inspect(error.response && error.response.data)}`);
65
64
  }
66
65
  authData = response.data;
67
66
 
@@ -35,7 +35,6 @@ module.exports = class Extend extends BaseCommand {
35
35
  filesToWrite.set(filepath, filecontent);
36
36
  }
37
37
  }
38
- console.log('filepath', filesToWrite.keys());
39
38
  for (const [filepath, content] of [...filesToWrite.entries()]) {
40
39
  const normalizedFilepath = normalizePath(filepath);
41
40
  fse.mkdirpSync(path.dirname(normalizedFilepath));
@@ -209,9 +209,9 @@ class AllParams extends BasicParams {
209
209
 
210
210
  // `logout` PARAMS
211
211
  this.deleteSettings = new Param('deleteSettings', false);
212
- this["delete-settings"] = this.deleteSettings.newAlias('delete-settings');
212
+ this["delete-settings"] = this.deleteSettings.newAlias('delete-settings');
213
213
  this.clearInvalid = new Param('clearInvalid', false);
214
- this["clear-invalid"] = this.clearInvalid.newAlias('clear-invalid');
214
+ this["clear-invalid"] = this.clearInvalid.newAlias('clear-invalid');
215
215
  }
216
216
  }
217
217
 
@@ -1,6 +1,6 @@
1
1
  const os = require('os');
2
2
 
3
- const MAVEN_ARCHETYPE_VERSION = '1.22.2';
3
+ const MAVEN_ARCHETYPE_VERSION = '1.23.1';
4
4
 
5
5
  const constants = {
6
6
  IS_WIN: (os.platform() === 'win32'),
@@ -13,7 +13,7 @@ create-services:
13
13
  {{/resource.isHana}}
14
14
  {{#resource.isXsuaa}}
15
15
  broker: {{resource.service}}
16
- plan: "broker"
16
+ plan: application
17
17
  {{/resource.isXsuaa}}
18
18
  {{#resource.vcap.name}}
19
19
  broker: {{resource.service}}
@@ -106,7 +106,7 @@ module.exports = class HanaTemplate extends TemplateBase {
106
106
  const projectType = await this.getProjectType();
107
107
  switch (projectType) {
108
108
  case PROJECT_TYPE.java: {
109
- await this.templateUtil.copyFiles('java', path.join(this.projectPath, env.folders.db), {}, this.options.force);
109
+ await this.templateUtil.copyFiles(path.join('java', 'db'), path.join(this.projectPath, env.folders.db), {}, this.options.force);
110
110
  await this._updatePomXml();
111
111
  const cdsrcJsonPath = path.join(this.projectPath, '.cdsrc.json');
112
112
  await this._updateCdsrcJson(cdsrcJsonPath, env.folders.db, env);
@@ -118,7 +118,7 @@ module.exports = class LintTemplate extends TemplateBase {
118
118
  this.logger.log("\n");
119
119
  }
120
120
  });
121
- this._promptInstallDependencies(task);
121
+ await this._promptInstallDependencies(task);
122
122
  }
123
123
  }
124
124
  }
@@ -168,7 +168,10 @@ module.exports = class LintTemplate extends TemplateBase {
168
168
  return;
169
169
  }
170
170
 
171
- _promptInstallDependencies(task) {
171
+ async _promptInstallDependencies(task) {
172
+ if (!process.stdin.isTTY) {
173
+ return; // non-interactive shell, like in tests
174
+ }
172
175
  const rl = readline.createInterface({
173
176
  input: process.stdin,
174
177
  output: process.stdout,
@@ -183,23 +186,26 @@ module.exports = class LintTemplate extends TemplateBase {
183
186
  let todos = `${term.error(
184
187
  "Aborted!\nPlease install the following components manually:"
185
188
  )}\n\n${term.warn(task)}`;
186
- rl.question(question, (answer) => {
187
- rl.close();
188
- clearTimeout(timerID);
189
- received = answer.trim().toLowerCase();
190
- // If user confirms or force flag is set, install dependencies
191
- if (["y", "yes"].includes(received) || this.options.force) {
192
- this._runTask(task);
193
- // If use declines or question timeout is reached, print todos
194
- } else if (["n", "no"].includes(received.toLowerCase())) {
195
- this.logger.log(todos);
196
- } else {
197
- // Close and restart question (with new timeout)
189
+ return new Promise((resolve, reject) => {
190
+ rl.question(question, (answer) => {
198
191
  rl.close();
199
192
  clearTimeout(timerID);
200
- this._promptInstallDependencies(task);
201
- }
202
- });
193
+ received = answer.trim().toLowerCase();
194
+ // If user confirms or force flag is set, install dependencies
195
+ if (["y", "yes"].includes(received) || this.options.force) {
196
+ resolve(this._runTask(task));
197
+ // If use declines or question timeout is reached, print todos
198
+ } else if (["n", "no"].includes(received.toLowerCase())) {
199
+ this.logger.log(todos);
200
+ resolve();
201
+ } else {
202
+ // Close and restart question (with new timeout)
203
+ rl.close();
204
+ clearTimeout(timerID);
205
+ this._promptInstallDependencies(task).then(resolve).catch(reject);
206
+ }
207
+ });
208
+ })
203
209
  }
204
210
 
205
211
  _runTask(task) {
@@ -237,9 +237,6 @@ module.exports = class TemplateUtil {
237
237
  if (actions.mergeCollection) actions.mergeCollection(targetNode, templateNode)
238
238
  if (targetNode) {
239
239
  _traverseYAMLNode(targetNode, templateIndex, actions, templateNode);
240
- } else if (!actions.mergeCollection) {
241
- collection.add(YAML.createNode(templateNode))
242
- //this.fsUtil.writeYAML(targetPath, target)
243
240
  }
244
241
  }
245
242
  })
@@ -294,7 +291,7 @@ module.exports = class TemplateUtil {
294
291
  mergePair: (collection, templateNode) => {
295
292
  const childIsArray = false//templateNode.value.type !== 'MAP' && !!templateNode.value.items
296
293
  if (collection.type === 'MAP' && !childIsArray) {
297
- collection.add(YAML.createNode(templateNode))
294
+ collection.add(templateNode)
298
295
  //this.fsUtil.writeYAML(targetPath, target)
299
296
  }
300
297
  },
@@ -314,9 +311,8 @@ module.exports = class TemplateUtil {
314
311
  .filter(({ref}) => !existenceMap.get(ref))
315
312
  missingExistences.forEach(existence => {
316
313
  const templateNode = templateExistenceMap.get(existence.ref).node
317
- const templateExistence = YAML.createNode(templateNode)
318
- templateExistence.spaceBefore = existence.spaceBefore
319
- targetNode.add(templateExistence)
314
+ templateNode.spaceBefore = existence.spaceBefore
315
+ targetNode.add(templateNode)
320
316
  //this.fsUtil.writeYAML(targetPath, target)
321
317
  })
322
318
  }