@ntlab/sipd-agr 3.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Toha
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,236 @@
1
+ # SIPD RI Kemendagri Automation
2
+
3
+ SIPD RI Kemendagri Automation is a web automation using [Selenium](https://selenium.dev) to help
4
+ manage data such as budgeting download. It provides functionality to download government budgeting
5
+ as Microsoft Excel worksheet as well as to download programs or accounts database.
6
+
7
+ Currently, supported features are:
8
+
9
+ * Download budgeting as Microsoft Excel worksheet
10
+ * Download programs as Microsoft Excel
11
+ * Download accounts as Microsoft Excel
12
+
13
+ ## Installation
14
+
15
+ The app installation is described as follows:
16
+
17
+ * Install [Nodejs](https://nodejs.org)
18
+ * Get the app source code
19
+
20
+ ```sh
21
+ git clone https://github.com/tohenk/node-sipd-agr-bridge.git
22
+ ```
23
+
24
+ * Install dependencies
25
+
26
+ ```sh
27
+ cd node-sipd-agr-bridge
28
+ npm install
29
+ ```
30
+
31
+ * To run the app, execute
32
+
33
+ ```sh
34
+ node main.js --help
35
+ ```
36
+
37
+ ```
38
+ Usage:
39
+ node main.js [options]
40
+
41
+ Options:
42
+ --config=filename, -c=filename Set configuration file
43
+ --mode=mode Processing mode, can be download or upload
44
+ --url=url Set SIPD url
45
+ --username=username, -u=username Set username
46
+ --password=password, -p=password Set password
47
+ --year=year, -y=year Set year
48
+ --dir=filename-or-folder, -d=filename-or-folder Set input or output directory
49
+ --no-download Do not download from SIPD instead use previously downloaded files
50
+ --help Show program usage
51
+
52
+ ```
53
+
54
+ ## Configuration
55
+
56
+ Before you can use the app, you need to adjust its [/config/default.json](/config/default.json) configuration accordingly:
57
+
58
+ ```json
59
+ {
60
+ "url":"https://sipd-ri.kemendagri.go.id",
61
+ "mode":"download",
62
+ "provinsi":"CHANGEME",
63
+ "username":"CHANGEME",
64
+ "password":"CHANGEME",
65
+ "year":"2025"
66
+ }
67
+ ```
68
+
69
+ ## Usage
70
+
71
+ ### Download Budgeting as Microsoft Excel
72
+
73
+ Make sure `mode` set to `download` then run the app and pay attention if app needs to solve
74
+ the captcha.
75
+
76
+ ```sh
77
+ node main.js
78
+ ```
79
+
80
+ ```
81
+ Reading configuration D:\Docs\Anggaran\sipd-agr\config.json
82
+ Using profile slow
83
+ Processing agr download, please wait...
84
+
85
+ DevTools listening on ws://127.0.0.1:58760/devtools/browser/3f701a9d-7fd2-4ad9-9512-c94792449a2d
86
+ Downloading list...
87
+ Downloading Penyusunan Dokumen Perencanaan Perangkat Daerah...
88
+ Downloading Koordinasi dan Penyusunan Dokumen RKA- SKPD...
89
+ Downloading Koordinasi dan Penyusunan Dokumen Perubahan RKA-SKPD...
90
+ Downloading Koordinasi dan Penyusunan DPA-SKPD...
91
+ Downloading Koordinasi dan Penyusunan Perubahan DPA- SKPD...
92
+ Downloading Koordinasi dan Penyusunan Laporan Capaian Kinerja dan Ikhtisar Realisasi Kinerja SKPD...
93
+ Downloading Evaluasi Kinerja Perangkat Daerah...
94
+ Downloading Penyediaan Gaji dan Tunjangan ASN...
95
+ Downloading Penyediaan Administrasi Pelaksanaan Tugas ASN...
96
+ Downloading Pelaksanaan Penatausahaan dan Pengujian/Verifikasi Keuangan SKPD...
97
+ Downloading Koordinasi dan Pelaksanaan Akuntansi SKPD...
98
+ Downloading Koordinasi dan Penyusunan Laporan Keuangan Akhir Tahun SKPD...
99
+ Downloading Pengelolaan dan Penyiapan Bahan Tanggapan Pemeriksaan...
100
+ Downloading Koordinasi dan Penyusunan Laporan Keuangan Bulanan/ Triwulanan/Semesteran SKPD...
101
+ Downloading Penyusunan Pelaporan dan Analisis Prognosis Realisasi Anggaran...
102
+ Downloading Peningkatan Sarana dan Prasarana Disiplin Pegawai...
103
+ Downloading Pendataan dan Pengolahan Administrasi Kepegawaian...
104
+ Downloading Koordinasi dan Pelaksanaan Sistem Informasi Kepegawaian...
105
+ Downloading Monitoring, Evaluasi, dan Penilaian Kinerja Pegawai...
106
+ Downloading Pendidikan dan Pelatihan Pegawai Berdasarkan Tugas dan Fungsi...
107
+ Downloading Penyediaan Komponen Instalasi Listrik/Penerangan Bangunan Kantor...
108
+ Downloading Penyediaan Peralatan dan Perlengkapan Kantor...
109
+ Downloading Penyediaan Bahan Logistik Kantor...
110
+ Downloading Penyediaan Barang Cetakan dan Penggandaan...
111
+ Downloading Penyediaan Bahan Bacaan dan Peraturan Perundang-Undangan...
112
+ Downloading Fasilitasi Kunjungan Tamu...
113
+ Downloading Penatausahaan Arsip Dinamis pada SKPD...
114
+ Downloading Dukungan Pelaksanaan Sistem Pemerintahan Berbasis Elektronik pada SKPD...
115
+ Downloading Pengadaan Sarana dan Prasarana Gedung Kantor atau Bangunan Lainnya...
116
+ Downloading Penyediaan Jasa Surat Menyurat...
117
+ Downloading Penyediaan Jasa Komunikasi, Sumber Daya Air dan Listrik...
118
+ Downloading Penyediaan Jasa Peralatan dan Perlengkapan Kantor...
119
+ Downloading Penyediaan Jasa Pelayanan Umum Kantor...
120
+ Downloading Penyediaan Jasa Pemeliharaan, Biaya Pemeliharaan dan Pajak Kendaraan Perorangan Dinas atau Kendaraan Dinas Jabatan...
121
+ Downloading Pemeliharaan Peralatan dan Mesin Lainnya...
122
+ Downloading Pemeliharaan/Rehabilitasi Gedung Kantor dan Bangunan Lainnya...
123
+ Downloading Pengelolaan Sarana dan Prasarana Spiritual...
124
+ Downloading Fasilitasi Kelembagaan Bina Spiritual...
125
+ Downloading Fasilitasi, Koordinasi, Sinkronisasi, Evaluasi dan Capaian Kinerja Kebijakan Kesejahteraan Rakyat Bidang Pendidikan...
126
+ Downloading Fasilitasi, Koordinasi dan Sinkronisasi, Evaluasi dan Capaian Kinerja Kebijakan Kesejahteraan Rakyat Bidang Kesehatan...
127
+ Downloading Fasilitasi, Koordinasi dan Sinkronisasi, Evaluasi dan Capaian Kinerja Kebijakan Kesejahteraan Rakyat Bidang Sosial...
128
+ Downloading Koordinasi dan Sinkronisasi Kebijakan Kesejahteraan Rakyat Bidang Kepemudaan, Olahraga, Kebudayaan, dan Pariwisata...
129
+ Downloading Koordinasi dan Sinkronisasi Kebijakan Kesejahteraan Rakyat Bidang Pemberdayaan Perempuan dan Perlindungan Anak, Pengendalian Penduduk dan Keluarga Berencana, Administrasi Kependudukan dan Pencatatan Sipil, Pemberdayaan Masyarakat dan Desa, Transmigrasi dan Tenaga Kerja...
130
+ Done importing 43 files...
131
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401041030002.xlsx...
132
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401041030001.xlsx...
133
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401041020003.xlsx...
134
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401041020002.xlsx...
135
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401041020001.xlsx...
136
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401041010002.xlsx...
137
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401041010001.xlsx...
138
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011090009.xlsx...
139
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011090006.xlsx...
140
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011090001.xlsx...
141
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011080004.xlsx...
142
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011080003.xlsx...
143
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011080002.xlsx...
144
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011080001.xlsx...
145
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011070010.xlsx...
146
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011060011.xlsx...
147
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011060010.xlsx...
148
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011060008.xlsx...
149
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011060006.xlsx...
150
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011060005.xlsx...
151
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011060004.xlsx...
152
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011060002.xlsx...
153
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011060001.xlsx...
154
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011050009.xlsx...
155
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011050005.xlsx...
156
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011050004.xlsx...
157
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011050003.xlsx...
158
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011050001.xlsx...
159
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011020008.xlsx...
160
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011020007.xlsx...
161
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011020006.xlsx...
162
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011020005.xlsx...
163
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011020004.xlsx...
164
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011020003.xlsx...
165
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011020002.xlsx...
166
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011020001.xlsx...
167
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011010007.xlsx...
168
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011010006.xlsx...
169
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011010005.xlsx...
170
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011010004.xlsx...
171
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011010003.xlsx...
172
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011010002.xlsx...
173
+ Writing D:\Docs\Anggaran\sipd-agr\agr\401011010001.xlsx...
174
+ Done
175
+ ```
176
+
177
+ ### Download Programs and Accounts as Microsoft Excel
178
+
179
+ Make sure `mode` set to `refs` then run the app and pay attention if app needs to solve
180
+ the captcha.
181
+
182
+ ```sh
183
+ node main.js
184
+ ```
185
+
186
+ ```
187
+ Reading configuration D:\Docs\Anggaran\sipd-agr\config.json
188
+ Using profile slow
189
+ Processing references update, please wait...
190
+
191
+ DevTools listening on ws://127.0.0.1:58851/devtools/browser/4e4dd3d8-cff3-4b7d-8869-a66d014adb1b
192
+ Downloading file rek.json...
193
+ Downloading file keg.json...
194
+ Downloading file asb.json...
195
+ Downloading file hspk.json...
196
+ Downloading file sbu.json...
197
+ Downloading file ssh.json...
198
+ Creating ref D:\Docs\Anggaran\sipd-agr\refs\M_KODEREK.xlsx...
199
+ Creating ref D:\Docs\Anggaran\sipd-agr\refs\M_KEG.xlsx...
200
+ Done
201
+ ```
202
+
203
+ ## Summarize Downloaded Budgeting
204
+
205
+ There is a tool called [Agr](/tools/Agr.xlsm) which can be used to summarize downloaded budgeting
206
+ worksheets for easy reading. To do so, follow this steps:
207
+
208
+ 1. Open the tool and make sure macro is enabled
209
+
210
+ ![Enable macro](/assets/enable-macro.png)
211
+
212
+ 2. Open budgeting file to be summarized
213
+
214
+ 3. Run macro `AgrImport` to start summarize, you can run the macro by selecting `View > Macros > View Macros`
215
+ then choose desired macro and hit `Run` button
216
+
217
+ ![View macro](/assets/view-macro.png)
218
+ ![Run macro](/assets/run-selected-macro.png)
219
+
220
+ 4. Confirm `Yes` to start
221
+
222
+ ![Confirm summarize](/assets/summarize-confirm.png)
223
+
224
+ 5. Wait the app to do its job until it finished, a new workbook will be created as budgeting summary
225
+
226
+ ![Summarize done](/assets/summarize-finish.png)
227
+
228
+ 6. Repeat steps 2 to 5 for all budgeting files
229
+
230
+ 7. Select the result workbook and run `AgrFormat` macro to do formatting
231
+
232
+ ![Formatting result](/assets/formating-message.png)
233
+
234
+ 8. The final step is to do real summarization, run `AgrSummarize` macro and wait until it finished
235
+
236
+ ![Summarize result](/assets/summarize-result.png)
@@ -0,0 +1,153 @@
1
+ /**
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2022-2025 Toha <tohenk@yahoo.com>
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
7
+ * this software and associated documentation files (the "Software"), to deal in
8
+ * the Software without restriction, including without limitation the rights to
9
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10
+ * of the Software, and to permit persons to whom the Software is furnished to do
11
+ * so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ const fs = require('fs');
26
+ const path = require('path');
27
+ const Cmd = require('@ntlab/ntlib/cmd');
28
+ const Sipd = require('../sipd');
29
+
30
+ Cmd.addVar('config', 'c', 'Set configuration file', 'filename');
31
+ Cmd.addVar('mode', '', 'Processing mode, can be download or upload', 'mode');
32
+ Cmd.addVar('url', '', 'Set SIPD url', 'url');
33
+ Cmd.addVar('username', 'u', 'Set username', 'username');
34
+ Cmd.addVar('password', 'p', 'Set password', 'password');
35
+ Cmd.addVar('year', 'y', 'Set year', 'year');
36
+ Cmd.addVar('dir', 'd', 'Set input or output directory', 'filename-or-folder');
37
+ Cmd.addBool('no-download', '', 'Do not download from SIPD instead use previously downloaded files', false);
38
+ Cmd.addBool('help', '', 'Show program usage', false);
39
+
40
+ /**
41
+ * Application configuration.
42
+ *
43
+ * @author Toha <tohenk@yahoo.com>
44
+ */
45
+ class Configuration {
46
+
47
+ /**
48
+ * Constructor.
49
+ *
50
+ * @param {string} rootDir Configuration directory
51
+ */
52
+ constructor(rootDir) {
53
+ // read configuration from command line values
54
+ let filename = Cmd.get('config') ? Cmd.get('config') : path.join(rootDir, 'config.json');
55
+ if (fs.existsSync(filename)) {
56
+ Object.assign(this, this.getConfig(filename));
57
+ }
58
+ for (const a of ['url', 'username', 'password', 'year', 'dir']) {
59
+ const v = Cmd.get(a);
60
+ if (v) {
61
+ this.config[a] = v;
62
+ }
63
+ }
64
+ if (fs.existsSync(filename)) {
65
+ console.log('Configuration loaded from %s', filename);
66
+ }
67
+ if (!this.workdir) {
68
+ this.workdir = rootDir;
69
+ }
70
+ if (Cmd.get('no-download')) {
71
+ this.skipDownload = Cmd.get('no-download');
72
+ }
73
+ if (!this.mode) {
74
+ this.mode = Cmd.get('mode') ? Cmd.get('mode') : Sipd.DOWNLOAD;
75
+ }
76
+
77
+ if (!this.username || !this.password) {
78
+ console.log('Both username or password must be supplied!');
79
+ return;
80
+ }
81
+ if (this.mode === Sipd.UPLOAD && !this.dir) {
82
+ console.log('No data file to process!');
83
+ return;
84
+ }
85
+ if (this.mode) {
86
+ this.initialize();
87
+ }
88
+ }
89
+
90
+ initialize() {
91
+ // load profile
92
+ this.profiles = {};
93
+ let filename = path.join(this.workdir, 'profiles.json');
94
+ if (fs.existsSync(filename)) {
95
+ const profiles = JSON.parse(fs.readFileSync(filename));
96
+ if (profiles.profiles) {
97
+ this.profiles = profiles.profiles;
98
+ }
99
+ if (profiles.active) {
100
+ this.profile = profiles.active;
101
+ }
102
+ }
103
+ this.initialized = true;
104
+ }
105
+
106
+ getConfig(filename) {
107
+ let config = JSON.parse(fs.readFileSync(filename));
108
+ if (config.ref) {
109
+ filename = path.join(path.dirname(filename), config.ref);
110
+ if (fs.existsSync(filename)) {
111
+ config = this.getConfig(filename);
112
+ } else {
113
+ throw new Error(`Non existent configuration reference ${config.ref}!`);
114
+ }
115
+ }
116
+ return config;
117
+ }
118
+
119
+ applyProfile() {
120
+ let profile = this.profile;
121
+ if (null === profile && Cmd.get('profile')) {
122
+ profile = Cmd.get('profile');
123
+ }
124
+ if (profile && this.profiles[profile]) {
125
+ console.log('Using profile %s', profile);
126
+ const keys = ['timeout', 'wait', 'delay', 'opdelay'];
127
+ for (const key in this.profiles[profile]) {
128
+ if (keys.indexOf(key) < 0) {
129
+ continue;
130
+ }
131
+ this[key] = this.profiles[profile][key];
132
+ }
133
+ }
134
+ // clean profile
135
+ if (Cmd.get('clean')) {
136
+ const profiledir = path.join(this.workdir, 'profile');
137
+ if (fs.existsSync(profiledir)) {
138
+ fs.rmSync(profiledir, {recursive: true, force: true});
139
+ }
140
+ }
141
+ return this;
142
+ }
143
+
144
+ checkDir(defaultDir) {
145
+ if (!this.dir) {
146
+ this.dir = path.join(this.workdir, defaultDir);
147
+ } else if (this.dir.slice(-1) != '/' && this.dir.slice(-1) != '\\') {
148
+ this.dir = fs.realpathSync(path.dirname(this.dir));
149
+ }
150
+ }
151
+ }
152
+
153
+ module.exports = Configuration;
package/app/index.js ADDED
@@ -0,0 +1,94 @@
1
+ /**
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2022-2025 Toha <tohenk@yahoo.com>
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
7
+ * this software and associated documentation files (the "Software"), to deal in
8
+ * the Software without restriction, including without limitation the rights to
9
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10
+ * of the Software, and to permit persons to whom the Software is furnished to do
11
+ * so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ const Cmd = require('@ntlab/ntlib/cmd');
26
+ const Configuration = require('./configuration');
27
+ const Sipd = require('../sipd');
28
+
29
+ /**
30
+ * Main application entry point.
31
+ *
32
+ * @author Toha <tohenk@yahoo.com>
33
+ */
34
+ class App {
35
+
36
+ /**
37
+ * Constructor.
38
+ *
39
+ * @param {string} rootDir Application configuration root directory
40
+ */
41
+ constructor(rootDir) {
42
+ this.rootDir = rootDir;
43
+ }
44
+
45
+ initialize() {
46
+ this.config = new Configuration(this.rootDir);
47
+ this.config
48
+ .applyProfile();
49
+ return this.config.initialized;
50
+ }
51
+
52
+ startApp() {
53
+ const sipd = new Sipd(this.config);
54
+ switch (this.config.mode) {
55
+ case Sipd.UPLOAD:
56
+ console.log('Processing agr upload, please wait...');
57
+ break;
58
+ case Sipd.DOWNLOAD:
59
+ console.log('Processing agr download, please wait...');
60
+ this.config.checkDir('agr');
61
+ break;
62
+ case Sipd.REFS:
63
+ console.log('Processing references update, please wait...');
64
+ this.config.checkDir('refs');
65
+ break;
66
+ }
67
+ const works = sipd.getWorks();
68
+ if (works) {
69
+ sipd.works(works, next => {
70
+ setTimeout(() => next(), 500);
71
+ }).then(() => {
72
+ sipd.app.showMessage('Information', 'The process has been completed! :)');
73
+ console.log('Done');
74
+ }).catch(err => {
75
+ if (err) {
76
+ console.log(err);
77
+ } else {
78
+ console.log('Unknown error, aborting!!!');
79
+ }
80
+ });
81
+ } else {
82
+ console.log('Unknown MODE %s!!!', this.config.mode);
83
+ }
84
+ }
85
+
86
+ run() {
87
+ if (this.initialize()) {
88
+ this.startApp();
89
+ return true;
90
+ }
91
+ }
92
+ }
93
+
94
+ module.exports = App;
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,8 @@
1
+ {
2
+ "url":"https://sipd-ri.kemendagri.go.id",
3
+ "mode":"download",
4
+ "provinsi":"CHANGEME",
5
+ "username":"CHANGEME",
6
+ "password":"CHANGEME",
7
+ "year":"2025"
8
+ }
package/config.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "ref":"config/default.json"
3
+ }
package/main.js ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * The MIT License (MIT)
5
+ *
6
+ * Copyright (c) 2022-2025 Toha <tohenk@yahoo.com>
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
9
+ * this software and associated documentation files (the "Software"), to deal in
10
+ * the Software without restriction, including without limitation the rights to
11
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12
+ * of the Software, and to permit persons to whom the Software is furnished to do
13
+ * so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ */
26
+
27
+ const path = require('path');
28
+ const App = require('./app');
29
+ const Cmd = require('@ntlab/ntlib/cmd');
30
+
31
+ if (!Cmd.parse() || (Cmd.get('help') && usage())) {
32
+ process.exit();
33
+ }
34
+
35
+ (function run() {
36
+ new App(__dirname).run();
37
+ })();
38
+
39
+ function usage() {
40
+ console.log('Usage:');
41
+ console.log(' node %s [options]', path.basename(process.argv[1]));
42
+ console.log('');
43
+ console.log('Options:');
44
+ console.log(Cmd.dump());
45
+ console.log('');
46
+ return true;
47
+ }
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@ntlab/sipd-agr",
3
+ "version": "3.0.0",
4
+ "description": "SIPD RI Kemendagri Automation is a web automation using Selenium to help manage data such as budgeting download",
5
+ "main": "main.js",
6
+ "author": "Toha <tohenk@yahoo.com>",
7
+ "license": "MIT",
8
+ "dependencies": {
9
+ "@ntlab/ntlib": "^2.6.2",
10
+ "@ntlab/webrobot": "^1.12.0",
11
+ "@ntlab/work": "^2.3.0",
12
+ "debug": "^4.4.1",
13
+ "exceljs": "^4.4.0",
14
+ "glob": "^11.0.3"
15
+ },
16
+ "bin": {
17
+ "sipd-agr": "main.js"
18
+ }
19
+ }
package/profiles.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "active": "normal",
3
+ "profiles": {
4
+ "fast": {
5
+ "timeout": 5000,
6
+ "wait": 2000,
7
+ "delay": 500,
8
+ "opdelay": 500
9
+ },
10
+ "normal": {
11
+ "timeout": 8000,
12
+ "wait": 2500,
13
+ "delay": 750,
14
+ "opdelay": 600
15
+ },
16
+ "moderate": {
17
+ "timeout": 10000,
18
+ "wait": 3000,
19
+ "delay": 1000,
20
+ "opdelay": 750
21
+ },
22
+ "slow": {
23
+ "timeout": 15000,
24
+ "wait": 5000,
25
+ "delay": 2000,
26
+ "opdelay": 1000
27
+ }
28
+ }
29
+ }