w-dwdata-tweqod 1.0.2 → 1.0.4

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.
@@ -77,6 +77,7 @@ import fsCopyFolder from 'wsemi/src/fsCopyFolder.mjs'
77
77
  * @param {String} [opt.fdDwCurrent] 輸入已下載供比對hash用之數據資料夾字串,預設'./_dwCurrent'
78
78
  * @param {String} [opt.fdResult] 輸入已下載數據所連動生成數據資料夾字串,預設'./_result'
79
79
  * @param {String} [opt.fdTaskCpSrc] 輸入任務狀態之來源端資料夾字串,預設'./_taskCpSrc'
80
+ * @param {String} [opt.fdLog] 輸入儲存log資料夾字串,預設'./_logs'
80
81
  * @param {Function} [opt.funDownloadEqs] 輸入自定義下載地震數據函數,回傳資料陣列
81
82
  * @param {Function} [opt.funDownload] 輸入自定義當前下載之hash數據處理函數,回傳資料陣列
82
83
  * @param {Function} [opt.funGetCurrent] 輸入自定義已下載之hash數據處理函數,回傳資料陣列
@@ -191,6 +192,15 @@ let WDwdataTweqod = async(token, opt = {}) => {
191
192
  fsCreateFolder(fdTaskCpSrc)
192
193
  }
193
194
 
195
+ //fdLog
196
+ let fdLog = get(opt, 'fdLog')
197
+ if (!isestr(fdLog)) {
198
+ fdLog = './_logs'
199
+ }
200
+ if (!fsIsFolder(fdLog)) {
201
+ fsCreateFolder(fdLog)
202
+ }
203
+
194
204
  //funDownloadEqs
195
205
  let funDownloadEqs = get(opt, 'funDownloadEqs')
196
206
 
@@ -405,6 +415,7 @@ let WDwdataTweqod = async(token, opt = {}) => {
405
415
  fdDwCurrent,
406
416
  fdResult,
407
417
  fdTaskCpSrc,
418
+ fdLog,
408
419
  funDownload,
409
420
  funGetCurrent,
410
421
  funRemove,
@@ -432,7 +443,7 @@ export default WDwdataTweqod
432
443
  <br class="clear">
433
444
 
434
445
  <footer>
435
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Sun Aug 24 2025 23:40:46 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
446
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Mon Aug 25 2025 14:14:44 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
436
447
  </footer>
437
448
 
438
449
  <script>prettyPrint();</script>
package/docs/global.html CHANGED
@@ -146,7 +146,7 @@
146
146
 
147
147
  <dt class="tag-source">Source:</dt>
148
148
  <dd class="tag-source"><ul class="dummy"><li>
149
- <a href="WDwdataTweqod.mjs.html">WDwdataTweqod.mjs</a>, <a href="WDwdataTweqod.mjs.html#line100">line 100</a>
149
+ <a href="WDwdataTweqod.mjs.html">WDwdataTweqod.mjs</a>, <a href="WDwdataTweqod.mjs.html#line101">line 101</a>
150
150
  </li></ul></dd>
151
151
 
152
152
 
@@ -492,6 +492,40 @@
492
492
 
493
493
 
494
494
 
495
+ <tr>
496
+
497
+ <td class="name"><code>fdLog</code></td>
498
+
499
+
500
+ <td class="type">
501
+
502
+
503
+ <span class="param-type">String</span>
504
+
505
+
506
+
507
+
508
+ </td>
509
+
510
+
511
+ <td class="attributes">
512
+
513
+ &lt;optional><br>
514
+
515
+
516
+
517
+
518
+
519
+ </td>
520
+
521
+
522
+
523
+
524
+ <td class="description last"><p>輸入儲存log資料夾字串,預設'./_logs'</p></td>
525
+ </tr>
526
+
527
+
528
+
495
529
  <tr>
496
530
 
497
531
  <td class="name"><code>funDownloadEqs</code></td>
@@ -766,7 +800,7 @@
766
800
  <br class="clear">
767
801
 
768
802
  <footer>
769
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Sun Aug 24 2025 23:40:46 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
803
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Mon Aug 25 2025 14:14:44 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
770
804
  </footer>
771
805
 
772
806
  <script>prettyPrint();</script>
package/docs/index.html CHANGED
@@ -71,7 +71,7 @@
71
71
  <br class="clear">
72
72
 
73
73
  <footer>
74
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Sun Aug 24 2025 23:40:46 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
74
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Mon Aug 25 2025 14:14:44 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
75
75
  </footer>
76
76
 
77
77
  <script>prettyPrint();</script>
@@ -0,0 +1,99 @@
1
+ // import path from 'path'
2
+ import fs from 'fs'
3
+ import _ from 'lodash-es'
4
+ import w from 'wsemi'
5
+ import WDwdataTweqod from './src/WDwdataTweqod.mjs'
6
+
7
+
8
+ let j = fs.readFileSync('../_data/settings.json', 'utf8')
9
+ let st = JSON.parse(j)
10
+ let token = _.get(st, 'token')
11
+
12
+ //fdDwStorage
13
+ let fdDwStorage = `./_dwStorage`
14
+ w.fsCleanFolder(fdDwStorage)
15
+
16
+ //fdDwAttime
17
+ let fdDwAttime = `./_dwAttime`
18
+ w.fsCleanFolder(fdDwAttime)
19
+
20
+ //fdDwCurrent
21
+ let fdDwCurrent = `./_dwCurrent`
22
+ w.fsCleanFolder(fdDwCurrent)
23
+
24
+ //fdResult
25
+ let fdResult = './_result'
26
+ w.fsCleanFolder(fdResult)
27
+
28
+ //funDownloadEqs
29
+ let funDownloadEqs = async() => {
30
+ let eqs = [
31
+ {
32
+ 'id': '114116',
33
+ 'tag': '',
34
+ 'number': '116',
35
+ 'time': '2025-08-22T14:06:15+08:00',
36
+ 'timeRec': '2025-08-22 14:06:15',
37
+ 'timeTag': '20250822140615',
38
+ 'ml': '5.4',
39
+ 'depth': '15.1',
40
+ 'description': '08/22-14:06臺南市南化區發生規模5.4有感地震,最大震度臺南市楠西、高雄市甲仙、嘉義縣大埔、雲林縣西螺、彰化縣二林4級。',
41
+ 'location': '臺南市政府東北東方 42.0 公里 (位於臺南市南化區)',
42
+ 'intensity': '',
43
+ 'longitude': '120.55',
44
+ 'latitude': '23.16'
45
+ },
46
+ {
47
+ 'id': '114115',
48
+ 'tag': '',
49
+ 'number': '115',
50
+ 'time': '2025-08-21T16:37:47+08:00',
51
+ 'timeRec': '2025-08-21 16:37:47',
52
+ 'timeTag': '20250821163747',
53
+ 'ml': '5.1',
54
+ 'depth': '10.4',
55
+ 'description': '08/21-16:37嘉義縣大埔鄉發生規模5.1有感地震,最大震度嘉義縣大埔、臺南市曾文、高雄市甲仙、嘉義縣太保市4級。',
56
+ 'location': '嘉義縣政府東南方 36.3 公里 (位於嘉義縣大埔鄉)',
57
+ 'intensity': '',
58
+ 'longitude': '120.58',
59
+ 'latitude': '23.26'
60
+ }
61
+ ]
62
+ return eqs
63
+ }
64
+
65
+ let opt = {
66
+ fdDwStorage,
67
+ fdDwAttime,
68
+ fdDwCurrent,
69
+ fdResult,
70
+ funDownloadEqs,
71
+ // funDownload,
72
+ // funGetCurrent,
73
+ // funRemove,
74
+ // funAdd,
75
+ // funModify,
76
+ }
77
+ let ev = await WDwdataTweqod(token, opt)
78
+ .catch((err) => {
79
+ console.log(err)
80
+ })
81
+ ev.on('change', (msg) => {
82
+ delete msg.type
83
+ console.log('change', msg)
84
+ })
85
+ // change { event: 'start', msg: 'running...' }
86
+ // change { event: 'proc-callfun-download', msg: 'start...' }
87
+ // change { event: 'proc-callfun-download', msg: 'done' }
88
+ // change { event: 'proc-callfun-getCurrent', msg: 'start...' }
89
+ // change { event: 'proc-callfun-getCurrent', msg: 'done' }
90
+ // change { event: 'compare', msg: 'start...' }
91
+ // change { event: 'compare', msg: 'done' }
92
+ // change { event: 'proc-add-callfun-add', id: '114101', msg: 'start...' }
93
+ // change { event: 'proc-add-callfun-add', id: '114101', msg: 'done' }
94
+ // change { event: 'proc-add-callfun-add', id: '114102', msg: 'start...' }
95
+ // change { event: 'proc-add-callfun-add', id: '114102', msg: 'done' }
96
+ // ...
97
+
98
+
99
+ //node g.funDownloadEqs.mjs
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "w-dwdata-tweqod",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "main": "dist/w-dwdata-tweqod.umd.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.11.0",
7
7
  "lodash-es": "^4.17.21",
8
- "w-dwdata-builder": "^1.0.3",
9
- "wsemi": "^1.8.18"
8
+ "w-dwdata-builder": "^1.0.5",
9
+ "wsemi": "^1.8.19"
10
10
  },
11
11
  "devDependencies": {
12
12
  "w-package-tools": "^1.1.2"
@@ -30,6 +30,7 @@ import fsCopyFolder from 'wsemi/src/fsCopyFolder.mjs'
30
30
  * @param {String} [opt.fdDwCurrent] 輸入已下載供比對hash用之數據資料夾字串,預設'./_dwCurrent'
31
31
  * @param {String} [opt.fdResult] 輸入已下載數據所連動生成數據資料夾字串,預設'./_result'
32
32
  * @param {String} [opt.fdTaskCpSrc] 輸入任務狀態之來源端資料夾字串,預設'./_taskCpSrc'
33
+ * @param {String} [opt.fdLog] 輸入儲存log資料夾字串,預設'./_logs'
33
34
  * @param {Function} [opt.funDownloadEqs] 輸入自定義下載地震數據函數,回傳資料陣列
34
35
  * @param {Function} [opt.funDownload] 輸入自定義當前下載之hash數據處理函數,回傳資料陣列
35
36
  * @param {Function} [opt.funGetCurrent] 輸入自定義已下載之hash數據處理函數,回傳資料陣列
@@ -144,6 +145,15 @@ let WDwdataTweqod = async(token, opt = {}) => {
144
145
  fsCreateFolder(fdTaskCpSrc)
145
146
  }
146
147
 
148
+ //fdLog
149
+ let fdLog = get(opt, 'fdLog')
150
+ if (!isestr(fdLog)) {
151
+ fdLog = './_logs'
152
+ }
153
+ if (!fsIsFolder(fdLog)) {
154
+ fsCreateFolder(fdLog)
155
+ }
156
+
147
157
  //funDownloadEqs
148
158
  let funDownloadEqs = get(opt, 'funDownloadEqs')
149
159
 
@@ -358,6 +368,7 @@ let WDwdataTweqod = async(token, opt = {}) => {
358
368
  fdDwCurrent,
359
369
  fdResult,
360
370
  fdTaskCpSrc,
371
+ fdLog,
361
372
  funDownload,
362
373
  funGetCurrent,
363
374
  funRemove,