@ntlab/sipd-agr 3.6.0 → 3.7.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.
package/app/index.js CHANGED
@@ -22,7 +22,6 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- const Cmd = require('@ntlab/ntlib/cmd');
26
25
  const Configuration = require('./configuration');
27
26
  const Sipd = require('../sipd');
28
27
 
@@ -66,22 +65,29 @@ class App {
66
65
  }
67
66
  const works = sipd.getWorks();
68
67
  if (works) {
68
+ const done = (err, message) => {
69
+ if (err) {
70
+ console.error(err);
71
+ }
72
+ if (this.config.autoClose) {
73
+ return sipd.close();
74
+ } else {
75
+ if (message) {
76
+ return sipd.app.showMessage('Information', message);
77
+ } else {
78
+ return Promise.resolve();
79
+ }
80
+ }
81
+ }
69
82
  sipd.works(works, {
70
83
  callback(next) {
71
84
  setTimeout(() => next(), 500);
72
85
  }
73
86
  })
74
- .then(() => {
75
- sipd.app.showMessage('Information', 'The process has been completed! :)');
76
- console.log('Done');
77
- })
87
+ .then(() => done(null, 'The process has been completed! :)'))
78
88
  .catch(err => {
79
89
  process.exitCode = 2;
80
- if (err) {
81
- console.error(err);
82
- } else {
83
- console.error('Unknown error, aborting!!!');
84
- }
90
+ done(err ?? 'Unknown error, aborting!!!');
85
91
  });
86
92
  } else {
87
93
  process.exitCode = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ntlab/sipd-agr",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "SIPD RI Kemendagri Automation is a web automation using Selenium to help manage data such as budgeting download",
5
5
  "main": "main.js",
6
6
  "author": "Toha <tohenk@yahoo.com>",
@@ -150,9 +150,9 @@ class SipdApp {
150
150
 
151
151
  showMessage(title, message) {
152
152
  if (this.owner._url) {
153
- this.owner.getDriver().executeScript(SipdScript.bootstrapModal(title, message));
153
+ return this.owner.getDriver().executeScript(SipdScript.bootstrapModal(title, message));
154
154
  } else {
155
- console.log(message);
155
+ return Promise.resolve(console.log(message));
156
156
  }
157
157
  }
158
158
  }