queueobj 12.0.18 → 13.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/.github/workflows/node.js.yml +1 -4
- package/README.md +101 -73
- package/app.js +143 -232
- package/lib/appenders/all.js +1 -1
- package/lib/appenders/base.js +3 -4
- package/lib/appenders/bottom_one.js +1 -1
- package/lib/appenders/func_all.js +1 -1
- package/lib/appenders/sync.js +1 -1
- package/lib/appenders/sync_all.js +1 -1
- package/lib/appenders/top_one.js +1 -1
- package/lib/appenders/version.js +1 -1
- package/package.json +34 -15
- package/test/app.js +15 -51
- package/test/package.js +36 -15
- package/tests/all.js +85 -0
- package/tests/appenders/all.js +17 -0
- package/tests/appenders/base.js +189 -0
- package/tests/appenders/bottom_one.js +17 -0
- package/tests/appenders/func_all.js +17 -0
- package/tests/appenders/name.js +17 -0
- package/tests/appenders/status.js +17 -0
- package/tests/appenders/sync.js +17 -0
- package/tests/appenders/sync_all.js +17 -0
- package/tests/appenders/top_one.js +17 -0
- package/tests/appenders/version.js +17 -0
- package/tests/bottom_one.js +86 -0
- package/tests/files.js +108 -0
- package/tests/func_all.js +94 -0
- package/tests/json_all.js +107 -0
- package/tests/json_bottom_one.js +108 -0
- package/tests/json_func_all.js +109 -0
- package/tests/json_name_matching.js +109 -0
- package/tests/json_name_non_matching.js +109 -0
- package/tests/json_status_matching.js +110 -0
- package/tests/json_status_non_matching.js +110 -0
- package/tests/json_top_one.js +108 -0
- package/tests/json_version_matching.js +110 -0
- package/tests/json_version_non_matching.js +110 -0
- package/tests/name_matching.js +90 -0
- package/tests/name_non_matching.js +90 -0
- package/tests/status_matching.js +90 -0
- package/tests/status_non_matching.js +90 -0
- package/tests/top_one.js +85 -0
- package/tests/version_matching.js +90 -0
- package/tests/version_non_matching.js +90 -0
- package/test/base.js +0 -22
- package/tests/test_all.js +0 -36
- package/tests/test_bottom_one.js +0 -28
- package/tests/test_func_all.js +0 -43
- package/tests/test_name.js +0 -86
- package/tests/test_status.js +0 -86
- package/tests/test_sync_all.js +0 -79
- package/tests/test_top_one.js +0 -29
- package/tests/test_version.js +0 -97
package/lib/appenders/base.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since
|
|
3
|
+
* @since 2023-02-06
|
|
4
4
|
* lib/appenders/base.js
|
|
5
|
-
* jrm debug 8/4 https://www.npmjs.com/package/temporary-stamp
|
|
6
5
|
*/
|
|
7
6
|
|
|
8
7
|
var colors = require('colors')
|
|
@@ -74,7 +73,7 @@ class process_all_obj {
|
|
|
74
73
|
t.parent.results_array.push(obj_props)
|
|
75
74
|
t.continueProcessing()
|
|
76
75
|
} catch (e) {
|
|
77
|
-
t.parent.getParent().logMsg(`pro obj error: (${e.message})`.
|
|
76
|
+
t.parent.getParent().logMsg({msg: `pro obj error: (${e.message})`.error, type: "error"})
|
|
78
77
|
throw e
|
|
79
78
|
}
|
|
80
79
|
})
|
|
@@ -151,7 +150,7 @@ exports = module.exports = class base {
|
|
|
151
150
|
if (t.getParent().getStats()) {
|
|
152
151
|
ret_str += `start (${st}) end(${ed}) milliseconds(${ml})`
|
|
153
152
|
}
|
|
154
|
-
return ret_str
|
|
153
|
+
return ret_str
|
|
155
154
|
}
|
|
156
155
|
|
|
157
156
|
process_all () {
|
package/lib/appenders/sync.js
CHANGED
package/lib/appenders/top_one.js
CHANGED
package/lib/appenders/version.js
CHANGED
package/package.json
CHANGED
|
@@ -2,26 +2,45 @@
|
|
|
2
2
|
"author": {
|
|
3
3
|
"name": "Jim Manton"
|
|
4
4
|
},
|
|
5
|
-
"version": "
|
|
6
|
-
"bundleDependencies":
|
|
5
|
+
"version": "13.0.0",
|
|
6
|
+
"bundleDependencies": [],
|
|
7
7
|
"dependencies": {
|
|
8
|
+
"@types/node": "^18.11.19",
|
|
9
|
+
"base-queue": "^1.0.0",
|
|
8
10
|
"chai": "^4.3.7",
|
|
9
|
-
"colors": "^1.
|
|
11
|
+
"colors": "^1.4.0",
|
|
10
12
|
"diffler": "^2.0.4",
|
|
11
|
-
"
|
|
13
|
+
"fs": "^0.0.1-security",
|
|
14
|
+
"log-queue": "^1.0.0",
|
|
15
|
+
"mocha": "^10.2.0",
|
|
16
|
+
"queuejson": "^9.0.11",
|
|
17
|
+
"valid-path": "^2.1.0"
|
|
12
18
|
},
|
|
13
19
|
"scripts": {
|
|
14
20
|
"start": "node app.ts",
|
|
15
21
|
"test": "mocha",
|
|
16
22
|
"ditched": "ditched -a",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
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"
|
|
25
44
|
},
|
|
26
45
|
"keywords": [
|
|
27
46
|
"queue",
|
|
@@ -33,13 +52,13 @@
|
|
|
33
52
|
"promises",
|
|
34
53
|
"mocha"
|
|
35
54
|
],
|
|
36
|
-
"homepage": "https://github.com/jman717/
|
|
55
|
+
"homepage": "https://github.com/jman717/queueobj",
|
|
37
56
|
"repository": {
|
|
38
57
|
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/jman717/
|
|
58
|
+
"url": "git+https://github.com/jman717/queueobj"
|
|
40
59
|
},
|
|
41
60
|
"deprecated": false,
|
|
42
|
-
"description": "Queue Objects
|
|
61
|
+
"description": "Queue File Objects",
|
|
43
62
|
"email": "jrman@risebroadband.net",
|
|
44
63
|
"license": "MIT",
|
|
45
64
|
"main": "app.js",
|
package/test/app.js
CHANGED
|
@@ -7,71 +7,35 @@ describe('app', function () {
|
|
|
7
7
|
application = require('../app.js')
|
|
8
8
|
assert(app = new application())
|
|
9
9
|
})
|
|
10
|
-
|
|
11
|
-
it('app.process is a function', function () {
|
|
12
|
-
assert(typeof app.process == 'function')
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it('app.getParent is a function', function () {
|
|
16
|
-
assert(typeof app.getParent == 'function')
|
|
17
|
-
})
|
|
18
10
|
|
|
19
|
-
it('app.getObjectToProcess is a function', function () {
|
|
20
|
-
assert(typeof app.getObjectToProcess == 'function')
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
it('app.getObjectById is a function', function () {
|
|
24
|
-
assert(typeof app.getObjectById == 'function')
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('app.getObjs is a function', function () {
|
|
28
|
-
assert(typeof app.getObjs == 'function')
|
|
29
|
-
})
|
|
30
|
-
|
|
31
11
|
it('app.logMsg is a function', function () {
|
|
32
12
|
assert(typeof app.logMsg == 'function')
|
|
33
13
|
})
|
|
14
|
+
|
|
15
|
+
it('app.getFileObject is a function', function () {
|
|
16
|
+
assert(typeof app.getFileObject == 'function')
|
|
17
|
+
})
|
|
34
18
|
})
|
|
35
19
|
|
|
36
20
|
describe('require', function () {
|
|
37
|
-
|
|
38
|
-
it('base', function () {
|
|
39
|
-
assert(require('../lib/appenders/base'))
|
|
40
|
-
})
|
|
41
21
|
|
|
42
|
-
it('colors
|
|
22
|
+
it('colors', function () {
|
|
43
23
|
assert(require('colors'))
|
|
44
24
|
})
|
|
45
25
|
|
|
46
|
-
it('
|
|
47
|
-
assert(require('
|
|
26
|
+
it('base_queue', function () {
|
|
27
|
+
assert(require('base-queue'))
|
|
48
28
|
})
|
|
49
29
|
|
|
50
|
-
it('
|
|
51
|
-
assert(require('
|
|
30
|
+
it('fs', function () {
|
|
31
|
+
assert(require('fs'))
|
|
52
32
|
})
|
|
53
|
-
|
|
54
|
-
it('
|
|
55
|
-
assert(require('
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('bottom_one appender', function () {
|
|
59
|
-
assert(require('../lib/appenders/bottom_one'))
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
it('sync_all appender', function () {
|
|
63
|
-
assert(require('../lib/appenders/sync_all'))
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
it('name appender', function () {
|
|
67
|
-
assert(require('../lib/appenders/name'))
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
it('status appender', function () {
|
|
71
|
-
assert(require('../lib/appenders/status'))
|
|
33
|
+
|
|
34
|
+
it('valid-path', function () {
|
|
35
|
+
assert(require('valid-path'))
|
|
72
36
|
})
|
|
73
|
-
|
|
74
|
-
it('
|
|
75
|
-
assert(require('
|
|
37
|
+
|
|
38
|
+
it('valid-path', function () {
|
|
39
|
+
assert(require('log-queue'))
|
|
76
40
|
})
|
|
77
41
|
})
|
package/test/package.js
CHANGED
|
@@ -6,26 +6,45 @@ const packageMock = {
|
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Jim Manton"
|
|
8
8
|
},
|
|
9
|
-
"version": "
|
|
10
|
-
"bundleDependencies":
|
|
9
|
+
"version": "13.0.0",
|
|
10
|
+
"bundleDependencies": [],
|
|
11
11
|
"dependencies": {
|
|
12
|
+
"@types/node": "^18.11.19",
|
|
13
|
+
"base-queue": "^1.0.0",
|
|
12
14
|
"chai": "^4.3.7",
|
|
13
|
-
"colors": "^1.
|
|
15
|
+
"colors": "^1.4.0",
|
|
14
16
|
"diffler": "^2.0.4",
|
|
15
|
-
"
|
|
17
|
+
"fs": "^0.0.1-security",
|
|
18
|
+
"log-queue": "^1.0.0",
|
|
19
|
+
"mocha": "^10.2.0",
|
|
20
|
+
"queuejson": "^9.0.11",
|
|
21
|
+
"valid-path": "^2.1.0"
|
|
16
22
|
},
|
|
17
23
|
"scripts": {
|
|
18
24
|
"start": "node app.ts",
|
|
19
25
|
"test": "mocha",
|
|
20
26
|
"ditched": "ditched -a",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
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"
|
|
29
48
|
},
|
|
30
49
|
"keywords": [
|
|
31
50
|
"queue",
|
|
@@ -37,13 +56,13 @@ const packageMock = {
|
|
|
37
56
|
"promises",
|
|
38
57
|
"mocha"
|
|
39
58
|
],
|
|
40
|
-
"homepage": "https://github.com/jman717/
|
|
59
|
+
"homepage": "https://github.com/jman717/queueobj",
|
|
41
60
|
"repository": {
|
|
42
61
|
"type": "git",
|
|
43
|
-
"url": "git+https://github.com/jman717/
|
|
62
|
+
"url": "git+https://github.com/jman717/queueobj"
|
|
44
63
|
},
|
|
45
64
|
"deprecated": false,
|
|
46
|
-
"description": "Queue Objects
|
|
65
|
+
"description": "Queue File Objects",
|
|
47
66
|
"email": "jrman@risebroadband.net",
|
|
48
67
|
"license": "MIT",
|
|
49
68
|
"main": "app.js",
|
|
@@ -51,6 +70,8 @@ const packageMock = {
|
|
|
51
70
|
"start": "node app.js"
|
|
52
71
|
}
|
|
53
72
|
|
|
73
|
+
|
|
74
|
+
|
|
54
75
|
describe('package.json', function () {
|
|
55
76
|
it('should pass', function () {
|
|
56
77
|
const difference = jsonHasDifferences(packagejson, packageMock)
|
package/tests/all.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
var queue = require("../app.js")
|
|
2
|
+
|
|
3
|
+
var tst1 = class test1 {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
let t = this, fname = "test_all.test1.constructor"
|
|
6
|
+
t.log = props.log
|
|
7
|
+
t.id = props.id
|
|
8
|
+
|
|
9
|
+
t.process = t.process.bind(t)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
process(callback) {
|
|
13
|
+
let t = this, fname = "test_all.test1.process"
|
|
14
|
+
t.log({ msg: `This object (${fname}) is id (${t.id}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
15
|
+
callback({ success: { msg: `processing all test1` } })
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var tst2 = class test2 {
|
|
20
|
+
constructor(props) {
|
|
21
|
+
let t = this, fname = "test_all.test2.constructor"
|
|
22
|
+
t.log = props.log
|
|
23
|
+
t.id = props.id
|
|
24
|
+
|
|
25
|
+
t.process = t.process.bind(t)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
process(callback) {
|
|
29
|
+
let t = this, fname = "test_all.test2.process"
|
|
30
|
+
t.log({ msg: `This object (${fname}) is id (${t.id}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
31
|
+
setTimeout(() => {
|
|
32
|
+
callback({ success: { msg: `processing all test2` } })
|
|
33
|
+
}, 4000)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var tst3 = class test3 {
|
|
38
|
+
constructor(props) {
|
|
39
|
+
let t = this, fname = "test_all.test3.constructor"
|
|
40
|
+
t.log = props.log
|
|
41
|
+
t.id = props.id
|
|
42
|
+
|
|
43
|
+
t.process = t.process.bind(t)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
process(callback) {
|
|
47
|
+
let t = this, fname = "test_all.test3.process"
|
|
48
|
+
t.log({ msg: `This object (${fname}) is id (${t.id}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
49
|
+
// callback({success: { msg: `processing all test3` }})
|
|
50
|
+
callback({ error: { msg: `there is some problem thrown here on test3` } })
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
var tst4 = class test4 {
|
|
55
|
+
constructor(props) {
|
|
56
|
+
let t = this, fname = "test_all.test4.constructor"
|
|
57
|
+
t.log = props.log
|
|
58
|
+
t.id = props.id
|
|
59
|
+
|
|
60
|
+
t.process = t.process.bind(t)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
process(callback) {
|
|
64
|
+
let t = this, fname = "test_all.test4.process"
|
|
65
|
+
t.log({ msg: `This object (${fname}) is id (${t.id}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
66
|
+
callback({ success: { msg: `processing all test4` } })
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
var qObj = new queue()
|
|
71
|
+
|
|
72
|
+
qObj.init().process({
|
|
73
|
+
appender: "all",
|
|
74
|
+
exclude_logMsg: ["debug"], /* example ["debug", "info"] */
|
|
75
|
+
process_objects: [tst1, tst2, tst3, tst4]
|
|
76
|
+
}).then((success) => {
|
|
77
|
+
qObj.logMsg({ msg: `test success: {msg: "all objects processed with no errors"}`.success.italic.bold, type: "success" })
|
|
78
|
+
}, (error) => {
|
|
79
|
+
if (typeof error == "string") {
|
|
80
|
+
qObj.logMsg({ msg: `error: ${error}`.error.italic.bold, type: "error" })
|
|
81
|
+
} else {
|
|
82
|
+
let add_s = (error.error_count > 1) ? 's' : ''
|
|
83
|
+
qObj.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" })
|
|
84
|
+
}
|
|
85
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
+
* @since 2017-10-01
|
|
4
|
+
* lib/appenders/base.js
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var colors = require('colors')
|
|
8
|
+
|
|
9
|
+
class process_object {
|
|
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_object 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_object = 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_object == null) {
|
|
159
|
+
t.process_object = new process_object({ parent: t })
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
_continue = false
|
|
163
|
+
try {
|
|
164
|
+
switch (t.process_object.getStatus()) {
|
|
165
|
+
case 'process':
|
|
166
|
+
t.process_object.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_object.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
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
}
|