queueobj 12.0.17 → 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 +8 -9
- 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
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var queue = require("../app.js")
|
|
2
|
+
|
|
3
|
+
var tst1 = class test1 {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
let t = this, fname = "version_matching.test1.constructor"
|
|
6
|
+
t.log = props.log
|
|
7
|
+
t.id = props.id
|
|
8
|
+
t.version = "2.00"
|
|
9
|
+
|
|
10
|
+
t.process = t.process.bind(t)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
process(callback) {
|
|
14
|
+
let t = this, fname = "version_matching.test1.process"
|
|
15
|
+
t.log({ msg: `This object (${fname}) is id (${t.id}) version (${t.version}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
16
|
+
callback({ success: { msg: `processing ${fname}) is id (${t.id}) version (${t.version})` } })
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var tst2 = class test2 {
|
|
21
|
+
constructor(props) {
|
|
22
|
+
let t = this, fname = "version_matching.test2.constructor"
|
|
23
|
+
t.log = props.log
|
|
24
|
+
t.id = props.id
|
|
25
|
+
t.version = "1.00"
|
|
26
|
+
|
|
27
|
+
t.process = t.process.bind(t)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
process(callback) {
|
|
31
|
+
let t = this, fname = "version_matching.test2.process"
|
|
32
|
+
t.log({ msg: `This object (${fname}) is id (${t.id}) version (${t.version}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
callback({ success: { msg: `processing ${fname}) is id (${t.id}) version (${t.version})` } })
|
|
35
|
+
}, 4000)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var tst3 = class test3 {
|
|
40
|
+
constructor(props) {
|
|
41
|
+
let t = this, fname = "version_matching.test3.constructor"
|
|
42
|
+
t.log = props.log
|
|
43
|
+
t.id = props.id
|
|
44
|
+
t.version = "1.00"
|
|
45
|
+
|
|
46
|
+
t.process = t.process.bind(t)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
process(callback) {
|
|
50
|
+
let t = this, fname = "version_matching.test3.process"
|
|
51
|
+
t.log({ msg: `This object (${fname}) is id (${t.id}) version (${t.version}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
52
|
+
// callback({success: { msg: `processing ${fname}) is id (${t.id}) version (${t.version})` }})
|
|
53
|
+
callback({ error: { msg: `there is some problem thrown here on ${fname}) is id (${t.id}) version (${t.version})` } })
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
var tst4 = class test4 {
|
|
58
|
+
constructor(props) {
|
|
59
|
+
let t = this, fname = "version_matching.test4.constructor"
|
|
60
|
+
t.log = props.log
|
|
61
|
+
t.id = props.id
|
|
62
|
+
t.version = "3.00"
|
|
63
|
+
|
|
64
|
+
t.process = t.process.bind(t)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
process(callback) {
|
|
68
|
+
let t = this, fname = "version_matching.test4.process"
|
|
69
|
+
t.log({ msg: `This object (${fname}) is id (${t.id}) version (${t.version}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
70
|
+
callback({ success: { msg: `processing ${fname}) is id (${t.id}) version (${t.version})` } })
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
var qObj = new queue()
|
|
75
|
+
|
|
76
|
+
qObj.init().process({
|
|
77
|
+
appender: "version",
|
|
78
|
+
exclude_logMsg: ["debug"], /* example ["debug", "info"] */
|
|
79
|
+
include_version: ["1.00", "3.00"],
|
|
80
|
+
process_objects: [tst1, tst2, tst3, tst4]
|
|
81
|
+
}).then((success) => {
|
|
82
|
+
qObj.logMsg({ msg: `test success: {msg: "version_matching objects processed with no errors"}`.success.italic.bold, type: "success" })
|
|
83
|
+
}, (error) => {
|
|
84
|
+
if (typeof error == "string") {
|
|
85
|
+
qObj.logMsg({ msg: `error: ${error}`.error.italic.bold, type: "error" })
|
|
86
|
+
} else {
|
|
87
|
+
let add_s = (error.error_count > 1) ? 's' : ''
|
|
88
|
+
qObj.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" })
|
|
89
|
+
}
|
|
90
|
+
})
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var queue = require("../app.js")
|
|
2
|
+
|
|
3
|
+
var tst1 = class test1 {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
let t = this, fname = "version_non_matching.test1.constructor"
|
|
6
|
+
t.log = props.log
|
|
7
|
+
t.id = props.id
|
|
8
|
+
t.version = "2.00"
|
|
9
|
+
|
|
10
|
+
t.process = t.process.bind(t)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
process(callback) {
|
|
14
|
+
let t = this, fname = "version_non_matching.test1.process"
|
|
15
|
+
t.log({ msg: `This object (${fname}) is id (${t.id}) version (${t.version}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
16
|
+
callback({ success: { msg: `processing ${fname}) is id (${t.id}) version (${t.version})` } })
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var tst2 = class test2 {
|
|
21
|
+
constructor(props) {
|
|
22
|
+
let t = this, fname = "version_non_matching.test2.constructor"
|
|
23
|
+
t.log = props.log
|
|
24
|
+
t.id = props.id
|
|
25
|
+
t.version = "1.00"
|
|
26
|
+
|
|
27
|
+
t.process = t.process.bind(t)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
process(callback) {
|
|
31
|
+
let t = this, fname = "version_non_matching.test2.process"
|
|
32
|
+
t.log({ msg: `This object (${fname}) is id (${t.id}) version (${t.version}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
callback({ success: { msg: `processing ${fname}) is id (${t.id}) version (${t.version})` } })
|
|
35
|
+
}, 4000)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var tst3 = class test3 {
|
|
40
|
+
constructor(props) {
|
|
41
|
+
let t = this, fname = "version_non_matching.test3.constructor"
|
|
42
|
+
t.log = props.log
|
|
43
|
+
t.id = props.id
|
|
44
|
+
t.version = "1.00"
|
|
45
|
+
|
|
46
|
+
t.process = t.process.bind(t)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
process(callback) {
|
|
50
|
+
let t = this, fname = "version_non_matching.test3.process"
|
|
51
|
+
t.log({ msg: `This object (${fname}) is id (${t.id}) version (${t.version}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
52
|
+
// callback({success: { msg: `processing ${fname}) is id (${t.id}) version (${t.version})` }})
|
|
53
|
+
callback({ error: { msg: `there is some problem thrown here on ${fname}) is id (${t.id}) version (${t.version})` } })
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
var tst4 = class test4 {
|
|
58
|
+
constructor(props) {
|
|
59
|
+
let t = this, fname = "version_non_matching.test4.constructor"
|
|
60
|
+
t.log = props.log
|
|
61
|
+
t.id = props.id
|
|
62
|
+
t.version = "3.00"
|
|
63
|
+
|
|
64
|
+
t.process = t.process.bind(t)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
process(callback) {
|
|
68
|
+
let t = this, fname = "version_non_matching.test4.process"
|
|
69
|
+
t.log({ msg: `This object (${fname}) is id (${t.id}) version (${t.version}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
70
|
+
callback({ success: { msg: `processing ${fname}) is id (${t.id}) version (${t.version})` } })
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
var qObj = new queue()
|
|
75
|
+
|
|
76
|
+
qObj.init().process({
|
|
77
|
+
appender: "version",
|
|
78
|
+
exclude_logMsg: ["debug"], /* example ["debug", "info"] */
|
|
79
|
+
exclude_version: ["1.00", "3.00"],
|
|
80
|
+
process_objects: [tst1, tst2, tst3, tst4]
|
|
81
|
+
}).then((success) => {
|
|
82
|
+
qObj.logMsg({ msg: `test success: {msg: "version non matching objects processed with no errors"}`.success.italic.bold, type: "success" })
|
|
83
|
+
}, (error) => {
|
|
84
|
+
if (typeof error == "string") {
|
|
85
|
+
qObj.logMsg({ msg: `error: ${error}`.error.italic.bold, type: "error" })
|
|
86
|
+
} else {
|
|
87
|
+
let add_s = (error.error_count > 1) ? 's' : ''
|
|
88
|
+
qObj.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" })
|
|
89
|
+
}
|
|
90
|
+
})
|
package/test/base.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
var assert = require('assert');
|
|
2
|
-
|
|
3
|
-
describe('base', function () {
|
|
4
|
-
let base, bs
|
|
5
|
-
|
|
6
|
-
beforeEach(function () {
|
|
7
|
-
bs = require('../lib/appenders/base.js')
|
|
8
|
-
base = new bs({getParent: ()=>{}})
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
it('base should pass', function () {
|
|
12
|
-
assert(typeof base != 'undefined')
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it('base.process is a function', function () {
|
|
16
|
-
assert(typeof base.process == 'function')
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
it('base.process_all is a function', function () {
|
|
20
|
-
assert(typeof base.process_all == 'function')
|
|
21
|
-
})
|
|
22
|
-
})
|
package/tests/test_all.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
var colors = require('colors'),
|
|
2
|
-
queue = require("../app.js")
|
|
3
|
-
|
|
4
|
-
class test1 {
|
|
5
|
-
process(callback) {
|
|
6
|
-
callback({ success: { msg: `processing all test1` } })
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
class test2 {
|
|
11
|
-
|
|
12
|
-
process(callback) {
|
|
13
|
-
callback({ success: { msg: `processing all test2` } })
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
class test3 {
|
|
18
|
-
process(callback) {
|
|
19
|
-
// callback({success: { msg: `processing all test3` }})
|
|
20
|
-
callback({ error: { msg: `there is some problem thrown here on test3` } })
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
class test4 {
|
|
25
|
-
process(callback) {
|
|
26
|
-
callback({ success: { msg: `processing all test4` } })
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let qObj = new queue(), props = { appender: 'all', stats: true }
|
|
31
|
-
|
|
32
|
-
qObj.load(props).add(new test1()).add(new test2()).add(new test3()).add(new test4()).process({}).then(res => {
|
|
33
|
-
qObj.logMsg(`success with all processing: (${res})`.bold.italic.green)
|
|
34
|
-
}, err => {
|
|
35
|
-
qObj.logMsg(`error with all processing: (${err})`.red) //show the execution time
|
|
36
|
-
})
|
package/tests/test_bottom_one.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
var colors = require('colors'),
|
|
2
|
-
queue = require("../app.js")
|
|
3
|
-
|
|
4
|
-
class test1 {
|
|
5
|
-
process(callback) {
|
|
6
|
-
callback({success: {msg: `processing test1`}})
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
class test2 {
|
|
11
|
-
process(callback) {
|
|
12
|
-
callback({success: {msg: `processing test2`}})
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
class test3 {
|
|
17
|
-
process(callback) {
|
|
18
|
-
callback({success: {msg: `processing test3`}})
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let qObj = new queue(), props = { appender: 'bottom_one', stats: false}
|
|
23
|
-
|
|
24
|
-
qObj.load(props).add(new test1()).add(new test2(qObj)).add(new test3()).process({}).then(res => {
|
|
25
|
-
qObj.logMsg(`success with all sync processing: (${res})`.bold.italic.green)
|
|
26
|
-
}, err => {
|
|
27
|
-
qObj.logMsg(`errors with all sync processing: (${err})`.red)
|
|
28
|
-
})
|
package/tests/test_func_all.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
var colors = require('colors'),
|
|
2
|
-
queue = require("../app.js");
|
|
3
|
-
|
|
4
|
-
class test1 {
|
|
5
|
-
some_function(callback) {
|
|
6
|
-
callback({success: {msg: `some_function test1`}})
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
class test2 {
|
|
11
|
-
a_func(callback) {
|
|
12
|
-
callback({success: {msg: `a_func test2`}})
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
class test3 {
|
|
17
|
-
constructor(obj, run_func) {
|
|
18
|
-
obj.add(run_func.some_new_func)
|
|
19
|
-
}
|
|
20
|
-
cool(callback) {
|
|
21
|
-
callback({success: {msg: `cool test3`}})
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
class test4 {
|
|
26
|
-
some_new_func(callback) {
|
|
27
|
-
callback({success: {msg: `some_new_func test4`}})
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
let qObj = new queue(), props = { appender: 'func_all' }
|
|
32
|
-
|
|
33
|
-
let tst1 = new test1(),
|
|
34
|
-
tst4 = new test4(),
|
|
35
|
-
tst2 = new test2(),
|
|
36
|
-
tst3 = new test3(qObj, tst4)
|
|
37
|
-
|
|
38
|
-
qObj.load(props).add(tst1.some_function).add(tst2.a_func).add(tst3.cool).process().then(res => {
|
|
39
|
-
qObj.logMsg(`success with func_all processing: (${res})`.bold.italic.green)
|
|
40
|
-
}, err => {
|
|
41
|
-
qObj.logMsg(`errors with func_all processing: (${err})`.red)
|
|
42
|
-
})
|
|
43
|
-
|
package/tests/test_name.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since 2023-01-16
|
|
4
|
-
* test_name.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var colors = require('colors'),
|
|
8
|
-
queue = require("../app.js")
|
|
9
|
-
|
|
10
|
-
class test1 {
|
|
11
|
-
constructor() {
|
|
12
|
-
let t = this
|
|
13
|
-
t.id = 100
|
|
14
|
-
t.name = "new"
|
|
15
|
-
|
|
16
|
-
t.process = t.process.bind(t)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
process(callback) {
|
|
20
|
-
callback({success: {msg: `processing test1 id(${this.id}) name(${this.name})`}})
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
class test2 {
|
|
25
|
-
constructor() {
|
|
26
|
-
let t = this
|
|
27
|
-
t.id = 200
|
|
28
|
-
t.name = "big_data"
|
|
29
|
-
|
|
30
|
-
t.process = t.process.bind(t)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
process(callback) {
|
|
34
|
-
let t = this, msg = `some kinda problem here test2 id(${this.id}) name(${this.name})`
|
|
35
|
-
callback({error: {msg: msg}}) //this will show errors
|
|
36
|
-
// callback({success: {msg: `processing test2 id(${this.id}) name(${this.name})`}}) //this will show no errors
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
ping() {
|
|
40
|
-
qObj.logMsg('hello from test2'.rainbow)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
class test3 {
|
|
45
|
-
constructor() {
|
|
46
|
-
let t = this
|
|
47
|
-
t.id = 300
|
|
48
|
-
t.name = "secondary"
|
|
49
|
-
|
|
50
|
-
t.process = t.process.bind(t)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
process(callback) {
|
|
54
|
-
callback({success: {msg: `processing test3 id(${this.id}) name(${this.name})`}}) //this will show no errors
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
class test4 {
|
|
59
|
-
constructor() {
|
|
60
|
-
let t = this
|
|
61
|
-
t.id = 400
|
|
62
|
-
t.name = "old"
|
|
63
|
-
|
|
64
|
-
t.process = t.process.bind(t)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
process(callback) {
|
|
68
|
-
callback({success: {msg: `processing test4 id(${this.id}) name(${this.name})`}}) //this will show no errors
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
let qObj = new queue(), props = { appender: 'status', stats: true }
|
|
73
|
-
|
|
74
|
-
qObj.load(props).add(new test1()).add(new test2()).add(new test3()).add(new test4())
|
|
75
|
-
|
|
76
|
-
qObj.process({ property: 'name', items: ['big_data'] }).then(res => {
|
|
77
|
-
qObj.logMsg(`success with name processing: (${res})`.bold.italic.green)
|
|
78
|
-
}, err => {
|
|
79
|
-
qObj.logMsg(`errors with name processing: (${err})`.red)
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
// qObj.process({ property: 'status', items: ['error'] }).then(res => {
|
|
83
|
-
// qObj.logMsg(`success with status error processing: (${JSON.stringify(res)})`.bold.italic.green)
|
|
84
|
-
// }, err => {
|
|
85
|
-
// qObj.logMsg(`errors with status error processing: (${JSON.stringify(err)})`.red)
|
|
86
|
-
// })
|
package/tests/test_status.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since 2021-03-22
|
|
4
|
-
* test_status.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var colors = require('colors'),
|
|
8
|
-
queue = require("../app.js")
|
|
9
|
-
|
|
10
|
-
class test1 {
|
|
11
|
-
constructor() {
|
|
12
|
-
let t = this
|
|
13
|
-
t.id = 100
|
|
14
|
-
t.status = "new"
|
|
15
|
-
|
|
16
|
-
t.process = t.process.bind(t)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
process(callback) {
|
|
20
|
-
callback({success: {msg: `processing test1 id(${this.id}) status(${this.status})`}})
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
class test2 {
|
|
25
|
-
constructor() {
|
|
26
|
-
let t = this
|
|
27
|
-
t.id = 200
|
|
28
|
-
t.status = "error"
|
|
29
|
-
|
|
30
|
-
t.process = t.process.bind(t)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
process(callback) {
|
|
34
|
-
let t = this, msg = `some kinda problem here`
|
|
35
|
-
// callback({error: {msg: msg}}) //this will show errors
|
|
36
|
-
callback({success: {msg: `processing test2 id(${this.id}) status(${this.status})`}}) //this will show no errors
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
ping() {
|
|
40
|
-
qObj.logMsg('hello from test2'.rainbow)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
class test3 {
|
|
45
|
-
constructor() {
|
|
46
|
-
let t = this
|
|
47
|
-
t.id = 300
|
|
48
|
-
t.status = "secondary"
|
|
49
|
-
|
|
50
|
-
t.process = t.process.bind(t)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
process(callback) {
|
|
54
|
-
callback({success: {msg: `processing test3 id(${this.id}) status(${this.status})`}}) //this will show no errors
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
class test4 {
|
|
59
|
-
constructor() {
|
|
60
|
-
let t = this
|
|
61
|
-
t.id = 400
|
|
62
|
-
t.status = "new"
|
|
63
|
-
|
|
64
|
-
t.process = t.process.bind(t)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
process(callback) {
|
|
68
|
-
callback({success: {msg: `processing test4 id(${this.id}) status(${this.status})`}}) //this will show no errors
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
let qObj = new queue(), props = { appender: 'status', stats: true }
|
|
73
|
-
|
|
74
|
-
qObj.load(props).add(new test1()).add(new test2()).add(new test3()).add(new test4())
|
|
75
|
-
|
|
76
|
-
qObj.process({ property: 'status', items: ['new'] }).then(res => {
|
|
77
|
-
qObj.logMsg(`success with status processing: (${res})`.bold.italic.green)
|
|
78
|
-
}, err => {
|
|
79
|
-
qObj.logMsg(`errors with status processing: (${err})`.red)
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
// qObj.process({ property: 'status', items: ['error'] }).then(res => {
|
|
83
|
-
// qObj.logMsg(`success with status error processing: (${JSON.stringify(res)})`.bold.italic.green)
|
|
84
|
-
// }, err => {
|
|
85
|
-
// qObj.logMsg(`errors with status error processing: (${JSON.stringify(err)})`.red)
|
|
86
|
-
// })
|
package/tests/test_sync_all.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since 2021-03-22
|
|
4
|
-
* test_sync.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var colors = require('colors'),
|
|
8
|
-
queue = require("../app.js")
|
|
9
|
-
|
|
10
|
-
class test1 {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.id = 100
|
|
13
|
-
this.process = this.process.bind(this)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
process(callback) {
|
|
17
|
-
setTimeout(() => {
|
|
18
|
-
qObj.logMsg(`processing test1`.cyan)
|
|
19
|
-
qObj.logMsg(`some async process`)
|
|
20
|
-
callback({success: {msg: `processing all (${this.id})`}})
|
|
21
|
-
}, 3000)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
class test2 {
|
|
26
|
-
constructor() {
|
|
27
|
-
this.id = 200
|
|
28
|
-
this.process = this.process.bind(this)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
process(callback) {
|
|
32
|
-
let msg = `some kinda problem here in id(${this.id})`
|
|
33
|
-
// callback({error: {msg: msg}}) //this will show errors
|
|
34
|
-
callback({success: {msg: `processing all (${this.id})}`}}) //this will show no errors
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
ping() {
|
|
38
|
-
qObj.logMsg('hello from test2'.rainbow)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
class test3 {
|
|
43
|
-
constructor() {
|
|
44
|
-
this.id = 300
|
|
45
|
-
this.process = this.process.bind(this)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
process(callback) {
|
|
49
|
-
callback({success: {msg: `processing all (${this.id})}`}})
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
class test4 {
|
|
54
|
-
constructor() {
|
|
55
|
-
let t = this
|
|
56
|
-
t.id = 400
|
|
57
|
-
t.custom_function = t.custom_function.bind(this)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
custom_function(callback) {
|
|
61
|
-
let msg = `custom func problem here id(${this.id})`
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
// callback({error: {msg: msg}}) //this will show errors
|
|
64
|
-
callback({success: {msg: `processing all (${this.id})}`}}) //this will show no errors
|
|
65
|
-
}, 3000)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
let tst4 = new test4()
|
|
69
|
-
let qObj = new queue(), props = { appender: 'sync_all' }
|
|
70
|
-
|
|
71
|
-
qObj.load(props).add(new test1()).add(new test2()).add(new test3()).add(tst4.custom_function)
|
|
72
|
-
|
|
73
|
-
qObj.process().then(res => {
|
|
74
|
-
qObj.logMsg(`success with all sync processing: (${res})`.bold.italic.green)
|
|
75
|
-
}, err => {
|
|
76
|
-
qObj.logMsg(`errors with all sync processing: (${err})`.red)
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
|
package/tests/test_top_one.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var colors = require('colors'),
|
|
2
|
-
queue = require("../app.js");
|
|
3
|
-
|
|
4
|
-
class test1 {
|
|
5
|
-
process(callback){
|
|
6
|
-
callback({success: {msg: `processing test1`}})
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
class test2 {
|
|
11
|
-
process(callback){
|
|
12
|
-
callback({success: {msg: `processing test2`}})
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
class test3 {
|
|
17
|
-
process(callback){
|
|
18
|
-
callback({success: {msg: `processing test3`}})
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let qObj = new queue(), props = { appender: 'top_one', stats: true}
|
|
23
|
-
|
|
24
|
-
qObj.load(props).add(new test1()).add(new test2(qObj)).add(new test3()).process({}).then(res => {
|
|
25
|
-
qObj.logMsg(`success with all sync processing: (${res})`.bold.italic.green)
|
|
26
|
-
}, err => {
|
|
27
|
-
qObj.logMsg(`errors with all sync processing: (${err})`.red)
|
|
28
|
-
})
|
|
29
|
-
|
package/tests/test_version.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @author Jim Manton: jrman@risebroadband.net
|
|
3
|
-
* @since 2021-03-22
|
|
4
|
-
* test_status.js
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var colors = require('colors'),
|
|
8
|
-
queue = require("../app.js")
|
|
9
|
-
|
|
10
|
-
class test1 {
|
|
11
|
-
constructor() {
|
|
12
|
-
let t = this
|
|
13
|
-
t.id = 100
|
|
14
|
-
t.version = "dev"
|
|
15
|
-
|
|
16
|
-
t.process = t.process.bind(t)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
process(callback) {
|
|
20
|
-
callback({success: {msg: `processing test1 id(${this.id}) version(${this.version})`}})
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
class test2 {
|
|
25
|
-
constructor() {
|
|
26
|
-
let t = this
|
|
27
|
-
t.id = 200
|
|
28
|
-
t.version = "dev"
|
|
29
|
-
|
|
30
|
-
t.process = t.process.bind(t)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
process(callback) {
|
|
34
|
-
callback({success: {msg: `processing test2 id(${this.id}) version(${this.version})`}})
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
ping() {
|
|
38
|
-
qObj.logMsg('hello from test2'.rainbow)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
class test3 {
|
|
43
|
-
constructor() {
|
|
44
|
-
let t = this
|
|
45
|
-
t.id = 300
|
|
46
|
-
t.version = "test"
|
|
47
|
-
|
|
48
|
-
t.process = t.process.bind(t)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
process(callback) {
|
|
52
|
-
callback({success: {msg: `processing test3 id(${this.id}) version(${this.version})`}})
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
class test4 {
|
|
57
|
-
constructor() {
|
|
58
|
-
let t = this
|
|
59
|
-
t.id = 400
|
|
60
|
-
t.version = "prod"
|
|
61
|
-
|
|
62
|
-
t.process = t.process.bind(t)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
process(callback) {
|
|
66
|
-
callback({success: {msg: `processing test4 id(${this.id}) version(${this.version})`}})
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
class test5 {
|
|
71
|
-
constructor() {
|
|
72
|
-
let t = this
|
|
73
|
-
t.id = 500
|
|
74
|
-
t.version = "v1234"
|
|
75
|
-
|
|
76
|
-
t.process = t.process.bind(t)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
process(callback) {
|
|
80
|
-
callback({success: {msg: `processing test5 id(${this.id}) version(${this.version})`}})
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
let qObj = new queue(), props = { appender: 'version' }
|
|
84
|
-
|
|
85
|
-
qObj.load(props).add(new test1()).add(new test2()).add(new test3()).add(new test4()).add(new test5())
|
|
86
|
-
|
|
87
|
-
qObj.process({ property: 'version', items: ['dev', 'test'] }).then(res => {
|
|
88
|
-
qObj.logMsg(`success with status processing: (${JSON.stringify(res)})`.bold.italic.green)
|
|
89
|
-
}, err => {
|
|
90
|
-
qObj.logMsg(`errors with status processing: (${JSON.stringify(err)})`.red)
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
// qObj.process({ property: 'version', items: ['v1234'] }).then(res => {
|
|
94
|
-
// qObj.logMsg(`4) done with version synchronous processing: (${res})`.bold.italic.green)
|
|
95
|
-
// }, err => {
|
|
96
|
-
// qObj.logMsg(`4) errors with version synchronous processing: (${err})`.red)
|
|
97
|
-
// })
|