file-obj-queue 3.0.0 → 3.0.1
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/.github/workflows/{github-actions.yml → github-actions-demo.yml} +1 -1
- package/.github/workflows/node.js.yml +0 -1
- package/LICENSE +1 -1
- package/README.md +7 -132
- package/app.js +40 -155
- package/base_queue/app.js +146 -0
- package/base_queue/appenders/base.js +77 -0
- package/base_queue/appenders/json_all.js +70 -0
- package/package.json +7 -28
- package/test/app.js +1 -5
- package/test/package.js +7 -28
- package/tests/appenders/all.js +1 -1
- package/tests/appenders/base.js +1 -1
- package/tests/appenders/bottom_one.js +1 -1
- package/tests/appenders/func_all.js +1 -1
- package/tests/appenders/sync.js +1 -1
- package/tests/appenders/sync_all.js +1 -1
- package/tests/appenders/top_one.js +1 -1
- package/tests/appenders/version.js +1 -1
- package/tests/files.js +32 -50
- package/lib/appenders/all.js +0 -17
- package/lib/appenders/base.js +0 -189
- package/lib/appenders/bottom_one.js +0 -17
- package/lib/appenders/func_all.js +0 -17
- package/lib/appenders/name.js +0 -17
- package/lib/appenders/status.js +0 -17
- package/lib/appenders/sync.js +0 -17
- package/lib/appenders/sync_all.js +0 -17
- package/lib/appenders/top_one.js +0 -17
- package/lib/appenders/version.js +0 -17
- package/tests/all.js +0 -85
- package/tests/bottom_one.js +0 -86
- package/tests/func_all.js +0 -94
- package/tests/json_all.js +0 -107
- package/tests/json_bottom_one.js +0 -108
- package/tests/json_func_all.js +0 -109
- package/tests/json_name_matching.js +0 -109
- package/tests/json_name_non_matching.js +0 -109
- package/tests/json_status_matching.js +0 -110
- package/tests/json_status_non_matching.js +0 -110
- package/tests/json_top_one.js +0 -108
- package/tests/json_version_matching.js +0 -110
- package/tests/json_version_non_matching.js +0 -110
- package/tests/name_matching.js +0 -90
- package/tests/name_non_matching.js +0 -90
- package/tests/status_matching.js +0 -90
- package/tests/status_non_matching.js +0 -90
- package/tests/top_one.js +0 -85
- package/tests/version_matching.js +0 -90
- package/tests/version_non_matching.js +0 -90
package/package.json
CHANGED
|
@@ -2,45 +2,24 @@
|
|
|
2
2
|
"author": {
|
|
3
3
|
"name": "Jim Manton"
|
|
4
4
|
},
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.1",
|
|
6
6
|
"bundleDependencies": [],
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@types/node": "^18.
|
|
9
|
-
"
|
|
10
|
-
"chai": "^4.3.7",
|
|
8
|
+
"@types/node": "^18.19.127",
|
|
9
|
+
"chai": "^4.5.0",
|
|
11
10
|
"colors": "^1.4.0",
|
|
12
11
|
"diffler": "^2.0.4",
|
|
13
12
|
"fs": "^0.0.1-security",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
13
|
+
"mocha": "^10.8.2",
|
|
14
|
+
"queuejson": "^10.0.0",
|
|
15
|
+
"typescript": "^4.9.5",
|
|
17
16
|
"valid-path": "^2.1.0"
|
|
18
17
|
},
|
|
19
18
|
"scripts": {
|
|
20
19
|
"start": "node app.ts",
|
|
21
20
|
"test": "mocha",
|
|
22
21
|
"ditched": "ditched -a",
|
|
23
|
-
"test_files": "node ./tests/files"
|
|
24
|
-
"test_all": "node ./tests/all",
|
|
25
|
-
"test_top_one": "node ./tests/top_one",
|
|
26
|
-
"test_bottom_one": "node ./tests/bottom_one",
|
|
27
|
-
"test_func_all": "node ./tests/func_all",
|
|
28
|
-
"test_status_matching": "node ./tests/status_matching",
|
|
29
|
-
"test_status_non_matching": "node ./tests/status_non_matching",
|
|
30
|
-
"test_name_matching": "node ./tests/name_matching",
|
|
31
|
-
"test_name_non_matching": "node ./tests/name_non_matching",
|
|
32
|
-
"test_version_matching": "node ./tests/version_matching",
|
|
33
|
-
"test_version_non_matching": "node ./tests/version_non_matching",
|
|
34
|
-
"test_json_all": "node ./tests/json_all",
|
|
35
|
-
"test_json_top_one": "node ./tests/json_top_one",
|
|
36
|
-
"test_json_bottom_one": "node ./tests/json_bottom_one",
|
|
37
|
-
"test_json_func_all": "node ./tests/json_func_all",
|
|
38
|
-
"test_json_status_matching": "node ./tests/json_status_matching",
|
|
39
|
-
"test_json_status_non_matching": "node ./tests/json_status_non_matching",
|
|
40
|
-
"test_json_version_matching": "node ./tests/json_version_matching",
|
|
41
|
-
"test_json_version_non_matching": "node ./tests/json_version_non_matching",
|
|
42
|
-
"test_json_name_matching": "node ./tests/json_name_matching",
|
|
43
|
-
"test_json_name_non_matching": "node ./tests/json_name_non_matching"
|
|
22
|
+
"test_files": "node ./tests/files"
|
|
44
23
|
},
|
|
45
24
|
"keywords": [
|
|
46
25
|
"queue",
|
package/test/app.js
CHANGED
|
@@ -24,7 +24,7 @@ describe('require', function () {
|
|
|
24
24
|
})
|
|
25
25
|
|
|
26
26
|
it('base_queue', function () {
|
|
27
|
-
assert(require('
|
|
27
|
+
assert(require('../base_queue/app'))
|
|
28
28
|
})
|
|
29
29
|
|
|
30
30
|
it('fs', function () {
|
|
@@ -34,8 +34,4 @@ describe('require', function () {
|
|
|
34
34
|
it('valid-path', function () {
|
|
35
35
|
assert(require('valid-path'))
|
|
36
36
|
})
|
|
37
|
-
|
|
38
|
-
it('valid-path', function () {
|
|
39
|
-
assert(require('log-queue'))
|
|
40
|
-
})
|
|
41
37
|
})
|
package/test/package.js
CHANGED
|
@@ -6,45 +6,24 @@ const packageMock = {
|
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Jim Manton"
|
|
8
8
|
},
|
|
9
|
-
"version": "3.0.
|
|
9
|
+
"version": "3.0.1",
|
|
10
10
|
"bundleDependencies": [],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@types/node": "^18.
|
|
13
|
-
"
|
|
14
|
-
"chai": "^4.3.7",
|
|
12
|
+
"@types/node": "^18.19.127",
|
|
13
|
+
"chai": "^4.5.0",
|
|
15
14
|
"colors": "^1.4.0",
|
|
16
15
|
"diffler": "^2.0.4",
|
|
17
16
|
"fs": "^0.0.1-security",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
17
|
+
"mocha": "^10.8.2",
|
|
18
|
+
"queuejson": "^10.0.0",
|
|
19
|
+
"typescript": "^4.9.5",
|
|
21
20
|
"valid-path": "^2.1.0"
|
|
22
21
|
},
|
|
23
22
|
"scripts": {
|
|
24
23
|
"start": "node app.ts",
|
|
25
24
|
"test": "mocha",
|
|
26
25
|
"ditched": "ditched -a",
|
|
27
|
-
"test_files": "node ./tests/files"
|
|
28
|
-
"test_all": "node ./tests/all",
|
|
29
|
-
"test_top_one": "node ./tests/top_one",
|
|
30
|
-
"test_bottom_one": "node ./tests/bottom_one",
|
|
31
|
-
"test_func_all": "node ./tests/func_all",
|
|
32
|
-
"test_status_matching": "node ./tests/status_matching",
|
|
33
|
-
"test_status_non_matching": "node ./tests/status_non_matching",
|
|
34
|
-
"test_name_matching": "node ./tests/name_matching",
|
|
35
|
-
"test_name_non_matching": "node ./tests/name_non_matching",
|
|
36
|
-
"test_version_matching": "node ./tests/version_matching",
|
|
37
|
-
"test_version_non_matching": "node ./tests/version_non_matching",
|
|
38
|
-
"test_json_all": "node ./tests/json_all",
|
|
39
|
-
"test_json_top_one": "node ./tests/json_top_one",
|
|
40
|
-
"test_json_bottom_one": "node ./tests/json_bottom_one",
|
|
41
|
-
"test_json_func_all": "node ./tests/json_func_all",
|
|
42
|
-
"test_json_status_matching": "node ./tests/json_status_matching",
|
|
43
|
-
"test_json_status_non_matching": "node ./tests/json_status_non_matching",
|
|
44
|
-
"test_json_version_matching": "node ./tests/json_version_matching",
|
|
45
|
-
"test_json_version_non_matching": "node ./tests/json_version_non_matching",
|
|
46
|
-
"test_json_name_matching": "node ./tests/json_name_matching",
|
|
47
|
-
"test_json_name_non_matching": "node ./tests/json_name_non_matching"
|
|
26
|
+
"test_files": "node ./tests/files"
|
|
48
27
|
},
|
|
49
28
|
"keywords": [
|
|
50
29
|
"queue",
|
package/tests/appenders/all.js
CHANGED
package/tests/appenders/base.js
CHANGED
|
@@ -73,7 +73,7 @@ class process_object {
|
|
|
73
73
|
t.parent.results_array.push(obj_props)
|
|
74
74
|
t.continueProcessing()
|
|
75
75
|
} catch (e) {
|
|
76
|
-
t.parent.getParent().logMsg(
|
|
76
|
+
t.parent.getParent().logMsg(`pro obj error: (${e.message})`.red)
|
|
77
77
|
throw e
|
|
78
78
|
}
|
|
79
79
|
})
|
package/tests/appenders/sync.js
CHANGED
package/tests/files.js
CHANGED
|
@@ -1,45 +1,37 @@
|
|
|
1
|
-
var
|
|
1
|
+
var colors = require('colors'),
|
|
2
|
+
file_queue = require("../app.js"),
|
|
2
3
|
fs = require('fs'),
|
|
3
4
|
validPath = require('valid-path')
|
|
4
5
|
|
|
5
6
|
var file_data = [
|
|
6
|
-
{ props: { id: 100, name: "all.js", absolute_path: __filename, check: true } },
|
|
7
|
-
{ props: { id: 101, name: "func_all.js", absolute_path: __filename, check: true } },
|
|
8
|
-
{ props: { id: 102, name: "top_one.js", absolute_path: __filename, check: true } },
|
|
9
|
-
{ props: { id: 103, name: "bottom_one.js", absolute_path: __filename, check: true } },
|
|
10
|
-
{ props: { id: 104, name: "sync_all.js", absolute_path: __filename, check: true } },
|
|
11
|
-
{ props: { id: 105, name: "status.js", absolute_path: __filename, check: true } },
|
|
12
|
-
{ props: { id: 106, name: "name.js", absolute_path: __filename, check: true } },
|
|
13
|
-
{ props: { id: 107, name: "version.js", absolute_path: __filename, check: true } }
|
|
7
|
+
{ props: { id: 100, name: "all", path: "./appenders/all.js", absolute_path: __filename, check: true } },
|
|
8
|
+
{ props: { id: 101, name: "func_all", path: "./appenders/func_all.js", absolute_path: __filename, check: true } },
|
|
9
|
+
{ props: { id: 102, name: "top_one", path: "./appenders/top_one.js", absolute_path: __filename, check: true } },
|
|
10
|
+
{ props: { id: 103, name: "bottom_one", path: "./appenders/bottom_one.js", absolute_path: __filename, check: true } },
|
|
11
|
+
{ props: { id: 104, name: "sync_all", path: "./appenders/sync_all.js", absolute_path: __filename, check: true } },
|
|
12
|
+
{ props: { id: 105, name: "status", path: "./appenders/status.js", absolute_path: __filename, check: true } },
|
|
13
|
+
{ props: { id: 106, name: "name", path: "./appenders/name.js", absolute_path: __filename, check: true } },
|
|
14
|
+
{ props: { id: 107, name: "version", path: "./appenders/version.js", absolute_path: __filename, check: true } }
|
|
14
15
|
]
|
|
15
16
|
|
|
17
|
+
|
|
16
18
|
var file_object = class file_obj {
|
|
17
19
|
constructor(props) {
|
|
18
|
-
let t = this
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
t.error_msg = 'none'
|
|
28
|
-
|
|
29
|
-
// if (t.id == 104) {
|
|
30
|
-
// t.errors = true
|
|
31
|
-
// t.error_msg = `some sort of error here`
|
|
32
|
-
// }
|
|
20
|
+
let t = this
|
|
21
|
+
t.id = props.id
|
|
22
|
+
t.log = props.log
|
|
23
|
+
t.name = props.name
|
|
24
|
+
t.path = props.path
|
|
25
|
+
t.absolute_path = props.absolute_path
|
|
26
|
+
t.status = 'init'
|
|
27
|
+
t.errors = false
|
|
28
|
+
t.error_msg = 'none'
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
t.process = t.process.bind(t)
|
|
31
|
+
t.do_checks = t.do_checks.bind(t)
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
} catch (e) {
|
|
41
|
-
e.message = `${fname} error: ${e.message}`
|
|
42
|
-
throw e
|
|
33
|
+
if (props.check) {
|
|
34
|
+
t.do_checks()
|
|
43
35
|
}
|
|
44
36
|
|
|
45
37
|
return t
|
|
@@ -48,7 +40,6 @@ var file_object = class file_obj {
|
|
|
48
40
|
do_checks() {
|
|
49
41
|
let t = this, path_to_check,
|
|
50
42
|
last_item = t.absolute_path.split("\\").pop(),
|
|
51
|
-
fname = `file_obj.do_checks`,
|
|
52
43
|
check_file = t.absolute_path.split(last_item)[0], check_path = t.path.split('/')
|
|
53
44
|
|
|
54
45
|
check_file = check_file.replace(/\\/g, "/");
|
|
@@ -65,12 +56,11 @@ var file_object = class file_obj {
|
|
|
65
56
|
check_file += dat + '/'
|
|
66
57
|
}
|
|
67
58
|
})
|
|
68
|
-
check_file
|
|
59
|
+
check_file = check_file.slice(0, -1)
|
|
69
60
|
try {
|
|
70
61
|
if (!fs.existsSync(check_file)) {
|
|
71
62
|
t.errors = true
|
|
72
63
|
t.error_msg = `id = ${t.id} name(${t.name}) file (${check_file} does not exist)`
|
|
73
|
-
t.log({ msg: t.error_msg.error, type: "error" })
|
|
74
64
|
}
|
|
75
65
|
} catch (e) {
|
|
76
66
|
e.message = "file_obj do_checks error: " + e.message
|
|
@@ -80,7 +70,6 @@ var file_object = class file_obj {
|
|
|
80
70
|
|
|
81
71
|
process(callback) {
|
|
82
72
|
let t = this
|
|
83
|
-
t.log({ msg: `processing object id ${t.id}. Do a bunch of stuff here.`.silly, type: "silly" })
|
|
84
73
|
if (t.errors)
|
|
85
74
|
callback({ error: { msg: t.error_msg } })
|
|
86
75
|
else
|
|
@@ -90,19 +79,12 @@ var file_object = class file_obj {
|
|
|
90
79
|
|
|
91
80
|
var qRequire = new file_queue()
|
|
92
81
|
|
|
93
|
-
qRequire.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
qRequire.logMsg({
|
|
100
|
-
}, (error) => {
|
|
101
|
-
if (typeof error == "string") {
|
|
102
|
-
qRequire.logMsg({msg: `error: ${error}`.error.italic.bold, type: "error"})
|
|
103
|
-
} else {
|
|
104
|
-
let add_s = (error.error_count > 1) ? 's' : ''
|
|
105
|
-
qRequire.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" })
|
|
106
|
-
}
|
|
82
|
+
qRequire.process({ appender: "json_all",
|
|
83
|
+
process_objects: [file_object],
|
|
84
|
+
data_to_process_array: file_data }).then((success)=>{
|
|
85
|
+
qRequire.logMsg(`test success: all file objects processed with no errors`.success)
|
|
86
|
+
},(error)=>{
|
|
87
|
+
let add_s = (error.error_count > 1) ? 's' : ''
|
|
88
|
+
qRequire.logMsg(`${error.error_count} error${add_s} detected`.error)
|
|
107
89
|
})
|
|
108
90
|
|
package/lib/appenders/all.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since 2023-2-5l
|
|
4
|
-
* lib/appenders/all.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var base = require('./base.js')
|
|
8
|
-
|
|
9
|
-
exports = module.exports = class all extends base{
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props)
|
|
12
|
-
var t = this
|
|
13
|
-
t.aname = 'all'
|
|
14
|
-
t.pro_types = ['items']
|
|
15
|
-
return t
|
|
16
|
-
}
|
|
17
|
-
}
|
package/lib/appenders/base.js
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since 2023-02-06
|
|
4
|
-
* lib/appenders/base.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var colors = require('colors')
|
|
8
|
-
|
|
9
|
-
class process_all_obj {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
let t = this
|
|
12
|
-
t.parent = props.parent
|
|
13
|
-
t.objs = t.parent.getParent().getObjs()
|
|
14
|
-
t.status = 'process'
|
|
15
|
-
t.process_objs_item = 0
|
|
16
|
-
t.process_props_item = 0
|
|
17
|
-
t.await_item = 0
|
|
18
|
-
t.any_errors = false
|
|
19
|
-
|
|
20
|
-
t.continueProcessing = t.continueProcessing.bind(t)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
process () {
|
|
24
|
-
let t = this
|
|
25
|
-
try {
|
|
26
|
-
if (t.process_objs_item >= t.objs.length) {
|
|
27
|
-
if (t.any_errors)
|
|
28
|
-
t.setStatus('finish with errors')
|
|
29
|
-
else
|
|
30
|
-
t.setStatus('finish')
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
let obj, pro, itm
|
|
35
|
-
try {
|
|
36
|
-
obj = t.parent.getParent().getItemToProcess(t.process_objs_item)
|
|
37
|
-
} catch (e) {
|
|
38
|
-
e.message = `base error: (${e.message})`
|
|
39
|
-
throw e
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
pro = (typeof obj == 'function') ? obj : obj.process;
|
|
43
|
-
} catch (e) {
|
|
44
|
-
t.parent.getParent()(`pro error: (${e.message})`.red)
|
|
45
|
-
throw e
|
|
46
|
-
}
|
|
47
|
-
if (typeof t.parent.pro_props != 'undefined' &&
|
|
48
|
-
typeof t.parent.pro_props.property != 'undefined' &&
|
|
49
|
-
typeof t.parent.pro_props.items != 'undefined' &&
|
|
50
|
-
typeof obj._getProperty == 'function') {
|
|
51
|
-
let skip = true
|
|
52
|
-
for (let q = 0; q < t.parent.pro_props.items.length; q++) {
|
|
53
|
-
itm = t.parent.pro_props.items[q]
|
|
54
|
-
if (itm == obj._getProperty(obj)) {
|
|
55
|
-
skip = false
|
|
56
|
-
break
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (skip) {
|
|
60
|
-
t.continueProcessing()
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
t.setStatus('wait')
|
|
65
|
-
pro((obj_props) => {
|
|
66
|
-
try {
|
|
67
|
-
if (typeof obj_props != 'undefined' && typeof obj_props.error != 'undefined') {
|
|
68
|
-
t.any_errors = true
|
|
69
|
-
t.parent.getParent().logMsg(obj_props)
|
|
70
|
-
} else {
|
|
71
|
-
t.parent.getParent().logMsg(obj_props)
|
|
72
|
-
}
|
|
73
|
-
t.parent.results_array.push(obj_props)
|
|
74
|
-
t.continueProcessing()
|
|
75
|
-
} catch (e) {
|
|
76
|
-
t.parent.getParent().logMsg({msg: `pro obj error: (${e.message})`.error, type: "error"})
|
|
77
|
-
throw e
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
} catch (e) {
|
|
81
|
-
e.message = `error: ${e.message} `
|
|
82
|
-
throw e
|
|
83
|
-
}
|
|
84
|
-
} catch (e) {
|
|
85
|
-
e.message = `process_all_obj error: ${e.message} `
|
|
86
|
-
throw e
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
continueProcessing () {
|
|
91
|
-
let t = this
|
|
92
|
-
t.process_objs_item++
|
|
93
|
-
t.setStatus('process')
|
|
94
|
-
t.parent.process_all()
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
getStatus () {
|
|
98
|
-
return this.status
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
setStatus (v) {
|
|
102
|
-
this.status = v
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
exports = module.exports = class base {
|
|
107
|
-
constructor(props) {
|
|
108
|
-
let t = this
|
|
109
|
-
t.await_array = []
|
|
110
|
-
t.resolve_array = []
|
|
111
|
-
t.reject_array = []
|
|
112
|
-
t.results_array = []
|
|
113
|
-
t.getParent = props.getParent
|
|
114
|
-
t.dt_start = null
|
|
115
|
-
t.dt_end = null
|
|
116
|
-
t.process_all_obj = null
|
|
117
|
-
t.pro_props = []
|
|
118
|
-
|
|
119
|
-
t.process = t.process.bind(this)
|
|
120
|
-
t.process_all = t.process_all.bind(this)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// await(props) {
|
|
124
|
-
// let t = this
|
|
125
|
-
// t.await_array.push(props)
|
|
126
|
-
// return new Promise((resolve, reject) => {
|
|
127
|
-
// t.resolve_array.push(resolve)
|
|
128
|
-
// t.reject_array.push(reject)
|
|
129
|
-
// });
|
|
130
|
-
// }
|
|
131
|
-
|
|
132
|
-
process(props) {
|
|
133
|
-
let t = this
|
|
134
|
-
t.dt_start = new Date(); // start measuring time
|
|
135
|
-
|
|
136
|
-
t.pro_props = props
|
|
137
|
-
|
|
138
|
-
return new Promise((resolve, reject) => {
|
|
139
|
-
t.resolve_array.push(resolve)
|
|
140
|
-
t.reject_array.push(reject)
|
|
141
|
-
t.process_all()
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
getStats() {
|
|
146
|
-
let t = this
|
|
147
|
-
t.dt_end = new Date();
|
|
148
|
-
let ret_str = '', st = t.dt_start, ed = t.dt_end, ml = t.dt_end - t.dt_start
|
|
149
|
-
// ret_str += JSON.stringify(t.results_array)
|
|
150
|
-
if (t.getParent().getStats()) {
|
|
151
|
-
ret_str += `start (${st}) end(${ed}) milliseconds(${ml})`
|
|
152
|
-
}
|
|
153
|
-
return ret_str
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
process_all () {
|
|
157
|
-
let t = this, _continue
|
|
158
|
-
if (t.process_all_obj == null) {
|
|
159
|
-
t.process_all_obj = new process_all_obj({ parent: t })
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
_continue = false
|
|
163
|
-
try {
|
|
164
|
-
switch (t.process_all_obj.getStatus()) {
|
|
165
|
-
case 'process':
|
|
166
|
-
t.process_all_obj.process()
|
|
167
|
-
_continue = true
|
|
168
|
-
break
|
|
169
|
-
case 'finish with errors':
|
|
170
|
-
t.reject_array[t.reject_array.length - 1](t.getStats())
|
|
171
|
-
break
|
|
172
|
-
case 'finish':
|
|
173
|
-
t.resolve_array[t.resolve_array.length - 1](t.getStats())
|
|
174
|
-
break
|
|
175
|
-
case 'wait':
|
|
176
|
-
return
|
|
177
|
-
default:
|
|
178
|
-
throw new Error(`status(${t.process_all_obj.getStatus()}) does not exist`)
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (_continue)
|
|
182
|
-
t.process_all()
|
|
183
|
-
} catch (e) {
|
|
184
|
-
e.message = `process_all error: ${e.message} `
|
|
185
|
-
throw e
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since 2023-2-5
|
|
4
|
-
* lib/appenders/bottom_one.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var base = require('./base.js')
|
|
8
|
-
|
|
9
|
-
exports = module.exports = class bottom_one extends base{
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props)
|
|
12
|
-
var t = this
|
|
13
|
-
t.aname = 'bottom_one'
|
|
14
|
-
t.pro_types = ['items']
|
|
15
|
-
return t
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since 2023-2-5
|
|
4
|
-
* lib/appenders/func_all.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var base = require('./base.js')
|
|
8
|
-
|
|
9
|
-
exports = module.exports = class func_all extends base {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props)
|
|
12
|
-
var t = this
|
|
13
|
-
t.aname = 'func_all'
|
|
14
|
-
t.pro_types = ['items']
|
|
15
|
-
return t
|
|
16
|
-
}
|
|
17
|
-
}
|
package/lib/appenders/name.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since 2023-01-16
|
|
4
|
-
* lib/appenders/name.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var base = require('./base.js')
|
|
8
|
-
|
|
9
|
-
exports = module.exports = class name extends base {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props)
|
|
12
|
-
var t = this
|
|
13
|
-
t.aname = 'name'
|
|
14
|
-
t.pro_types = ['name']
|
|
15
|
-
return t
|
|
16
|
-
}
|
|
17
|
-
}
|
package/lib/appenders/status.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since 2023-01-16
|
|
4
|
-
* lib/appenders/status.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var base = require('./base.js')
|
|
8
|
-
|
|
9
|
-
exports = module.exports = class status extends base {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props)
|
|
12
|
-
var t = this
|
|
13
|
-
t.aname = 'status'
|
|
14
|
-
t.pro_types = ['status']
|
|
15
|
-
return t
|
|
16
|
-
}
|
|
17
|
-
}
|
package/lib/appenders/sync.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since 2023-2-5
|
|
4
|
-
* lib/appenders/sync.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var base = require('./base.js')
|
|
8
|
-
|
|
9
|
-
exports = module.exports = class sync extends base {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props)
|
|
12
|
-
var t = this
|
|
13
|
-
t.aname = 'sync'
|
|
14
|
-
t.pro_types = ['items', 'byIds']
|
|
15
|
-
return t
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since 2023-2-5
|
|
4
|
-
* lib/appenders/sync_all.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var base = require('./base.js')
|
|
8
|
-
|
|
9
|
-
exports = module.exports = class sync_all extends base {
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props)
|
|
12
|
-
var t = this
|
|
13
|
-
t.aname = 'sync_all'
|
|
14
|
-
t.pro_types = ['items']
|
|
15
|
-
return t
|
|
16
|
-
}
|
|
17
|
-
}
|
package/lib/appenders/top_one.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since 2023-2-5
|
|
4
|
-
* lib/appenders/top_one.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var base = require('./base.js')
|
|
8
|
-
|
|
9
|
-
exports = module.exports = class top_one extends base{
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props)
|
|
12
|
-
var t = this
|
|
13
|
-
t.aname = 'top_one'
|
|
14
|
-
t.pro_types = ['items']
|
|
15
|
-
return t
|
|
16
|
-
}
|
|
17
|
-
}
|