@jsreport/jsreport-cli 4.1.0 → 4.1.2

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/README.md CHANGED
@@ -7,6 +7,15 @@ See http://jsreport.net/learn/cli for documentation
7
7
 
8
8
  ## Changelog
9
9
 
10
+ ### 4.1.2
11
+
12
+ - update deps to fix audit
13
+
14
+ ### 4.1.1
15
+
16
+ - update deps to fix audit
17
+ - print nested errors from error.cause
18
+
10
19
  ### 4.1.0
11
20
 
12
21
  - update deps to fix audit
@@ -30,15 +30,15 @@ function addStack (err, stack, { stackPrefix = '', stripMessage = false } = {})
30
30
  }
31
31
 
32
32
  function getErrors (err) {
33
- let parent = err
33
+ let currentErr = err
34
34
  const errors = []
35
35
 
36
- while (parent != null) {
37
- const customProps = Object.assign({}, parent)
38
- let currentStack = parent.stack || ''
36
+ while (currentErr != null) {
37
+ const customProps = Object.assign({}, currentErr)
38
+ let currentStack = currentErr.stack || ''
39
39
  let cleanState = false
40
40
 
41
- if (parent.cleanState === true) {
41
+ if (currentErr.cleanState === true) {
42
42
  cleanState = true
43
43
  }
44
44
 
@@ -47,34 +47,34 @@ function getErrors (err) {
47
47
  delete customProps.disableExit
48
48
  delete customProps.cleanState
49
49
 
50
- const fakeE = { message: parent.message, stack: '' }
50
+ const fakeE = { message: currentErr.message, stack: '' }
51
51
 
52
- addStack(fakeE, parent.stack || '', {
52
+ addStack(fakeE, currentErr.stack || '', {
53
53
  stripMessage: true
54
54
  })
55
55
 
56
56
  currentStack = fakeE.stack
57
57
 
58
58
  errors.push({
59
- message: parent.message,
59
+ message: currentErr.message,
60
60
  stack: currentStack || '',
61
61
  meta: Object.keys(customProps).length > 0 ? getSimpleProperties(customProps) : undefined,
62
62
  cleanState
63
63
  })
64
64
 
65
- parent = parent.originalError
65
+ currentErr = currentErr.originalError ?? currentErr.cause
66
66
  }
67
67
 
68
68
  return errors
69
69
  }
70
70
 
71
- function getErrorMessages (err) {
71
+ function getErrorMessagesAndStacks (err) {
72
72
  const errors = getErrors(err)
73
73
  let cleanState = false
74
74
  const messages = []
75
75
  const stacks = []
76
76
 
77
- errors.forEach((error) => {
77
+ for (const error of errors) {
78
78
  let customProps = error.meta || {}
79
79
  const currentStack = error.stack
80
80
 
@@ -97,7 +97,7 @@ function getErrorMessages (err) {
97
97
  stacks.push(`-> stack\n${currentStack}`)
98
98
  }
99
99
  }
100
- })
100
+ }
101
101
 
102
102
  if (!cleanState && stacks.length > 0) {
103
103
  return [messages, stacks]
@@ -129,7 +129,7 @@ function getSimpleProperties (obj) {
129
129
  }
130
130
 
131
131
  function printError (err, logger) {
132
- const [messages, stacks] = getErrorMessages(err)
132
+ const [messages, stacks] = getErrorMessagesAndStacks(err)
133
133
 
134
134
  for (let idx = 0; idx < messages.length; idx++) {
135
135
  messages[idx] += ` (${messages.length - idx})`
@@ -164,5 +164,5 @@ function lowerCaseFirstLetter (str) {
164
164
 
165
165
  module.exports.printError = printError
166
166
  module.exports.getErrors = getErrors
167
- module.exports.getErrorMessages = getErrorMessages
167
+ module.exports.getErrorMessages = getErrorMessagesAndStacks
168
168
  module.exports.addStack = addStack
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsreport/jsreport-cli",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "description": "Command line interface for jsreport",
5
5
  "keywords": [
6
6
  "jsreport",
@@ -50,10 +50,10 @@
50
50
  "test:watch": "mocha --recursive \"./test/*.spec.js\" \"./test/commands/**/*.spec.js\" --timeout 28000 --exit --watch"
51
51
  },
52
52
  "dependencies": {
53
- "@jsreport/nodejs-client": "4.0.4",
53
+ "@jsreport/nodejs-client": "4.0.5",
54
54
  "chalk": "2.4.2",
55
55
  "cliui": "7.0.4",
56
- "inquirer": "8.2.0",
56
+ "inquirer": "8.2.7",
57
57
  "ip-address": "5.8.9",
58
58
  "is-absolute-url": "2.1.0",
59
59
  "is-promise": "2.1.0",
@@ -71,11 +71,11 @@
71
71
  },
72
72
  "devDependencies": {
73
73
  "@jsreport/jsreport-authentication": "4.2.3",
74
- "@jsreport/jsreport-core": "4.6.0",
75
- "@jsreport/jsreport-express": "4.2.0",
76
- "@jsreport/jsreport-fs-store": "4.1.0",
74
+ "@jsreport/jsreport-core": "4.7.1",
75
+ "@jsreport/jsreport-express": "4.2.3",
76
+ "@jsreport/jsreport-fs-store": "4.1.1",
77
77
  "@jsreport/jsreport-handlebars": "4.0.1",
78
- "cross-env": "5.2.1",
78
+ "cross-env": "7.0.3",
79
79
  "execa": "1.0.0",
80
80
  "handlebars": "4.7.7",
81
81
  "mkdirp": "0.5.5",