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
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
var file_queue = require("../app.js"),
|
|
2
|
-
fs = require('fs'),
|
|
3
|
-
validPath = require('valid-path')
|
|
4
|
-
|
|
5
|
-
var file_data = [
|
|
6
|
-
{ props: { id: 100, name: "all", version: "1.00", absolute_path: __filename, check: true } },
|
|
7
|
-
{ props: { id: 101, name: "func_all", version: "2.00", absolute_path: __filename, check: true } },
|
|
8
|
-
{ props: { id: 102, name: "top_one", version: "1.00", absolute_path: __filename, check: true } },
|
|
9
|
-
{ props: { id: 103, name: "bottom_one", version: "3.00", absolute_path: __filename, check: true } },
|
|
10
|
-
{ props: { id: 104, name: "sync_all", version: "4.00", absolute_path: __filename, check: true } },
|
|
11
|
-
{ props: { id: 105, name: "status", version: "5.00", absolute_path: __filename, check: true } },
|
|
12
|
-
{ props: { id: 106, name: "name", version: "2.00", absolute_path: __filename, check: true } },
|
|
13
|
-
{ props: { id: 107, name: "version", version: "3.00", absolute_path: __filename, check: true } }
|
|
14
|
-
]
|
|
15
|
-
|
|
16
|
-
var file_object = class file_obj {
|
|
17
|
-
constructor(props) {
|
|
18
|
-
let t = this, fname = "file_obj.constructor"
|
|
19
|
-
try {
|
|
20
|
-
t.id = props.id
|
|
21
|
-
t.log = props.log
|
|
22
|
-
t.name = props.name
|
|
23
|
-
t.version = props.version
|
|
24
|
-
t.path = props.relative_path
|
|
25
|
-
t.absolute_path = props.absolute_path
|
|
26
|
-
t.errors = false
|
|
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
|
-
// }
|
|
33
|
-
t.base_queue_process_function = t.a_cool_function
|
|
34
|
-
|
|
35
|
-
t.do_checks = t.do_checks.bind(t)
|
|
36
|
-
t.a_cool_function = t.a_cool_function.bind(t)
|
|
37
|
-
t.base_queue_process_function = t.base_queue_process_function.bind(t)
|
|
38
|
-
|
|
39
|
-
if (props.check) {
|
|
40
|
-
t.do_checks()
|
|
41
|
-
}
|
|
42
|
-
} catch (e) {
|
|
43
|
-
e.message = `${fname} error: ${e.message}`
|
|
44
|
-
throw e
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return t
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
do_checks() {
|
|
51
|
-
let t = this, path_to_check,
|
|
52
|
-
last_item = t.absolute_path.split("\\").pop(),
|
|
53
|
-
check_file = t.absolute_path.split(last_item)[0], check_path = t.path.split('/')
|
|
54
|
-
|
|
55
|
-
check_file = check_file.replace(/\\/g, "/");
|
|
56
|
-
path_to_check = validPath(t.path);
|
|
57
|
-
|
|
58
|
-
if (!path_to_check.valid) {
|
|
59
|
-
t.errors = true
|
|
60
|
-
t.error_msg = `id = ${t.id} name(${t.name}) Error in ${path_to_check.data.input}: ${path_to_check.error})`
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
check_path.map((dat, i) => {
|
|
64
|
-
if (/^[a-zA-Z._]+$/.test(dat)) {
|
|
65
|
-
if (dat != '.')
|
|
66
|
-
check_file += dat + '/'
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
check_file = check_file.slice(0, -1)
|
|
70
|
-
try {
|
|
71
|
-
if (!fs.existsSync(check_file)) {
|
|
72
|
-
t.errors = true
|
|
73
|
-
t.error_msg = `id = ${t.id} name(${t.name}) file (${check_file} does not exist)`
|
|
74
|
-
}
|
|
75
|
-
} catch (e) {
|
|
76
|
-
e.message = "file_obj do_checks error: " + e.message
|
|
77
|
-
throw (e)
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
a_cool_function(callback) {
|
|
82
|
-
let t = this
|
|
83
|
-
t.log({ msg: `processing object id ${t.id} name(${t.name}) version(${t.version}). Do a bunch of stuff here.`.silly, type: "silly" })
|
|
84
|
-
if (t.errors)
|
|
85
|
-
callback({ error: { msg: t.error_msg } })
|
|
86
|
-
else
|
|
87
|
-
callback({ success: { msg: `id = ${t.id} name(${t.name}) version(${t.version})`}})
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
var qRequire = new file_queue()
|
|
92
|
-
|
|
93
|
-
qRequire.init().process({
|
|
94
|
-
appender: "json_version",
|
|
95
|
-
exclude_logMsg: ["debug", "silly", "info"], /* default [] */
|
|
96
|
-
process_objects: [file_object],
|
|
97
|
-
include_version: ["2.00", "4.00"],
|
|
98
|
-
data_to_process_array: file_data
|
|
99
|
-
}).then((success) => {
|
|
100
|
-
qRequire.logMsg({ msg: `test success: json_version objects processed with no errors`.success.italic.bold, type: "success" })
|
|
101
|
-
}, (error) => {
|
|
102
|
-
if (typeof error == "string") {
|
|
103
|
-
qRequire.logMsg({ msg: `error: ${error}`.error.italic.bold, type: "error" })
|
|
104
|
-
|
|
105
|
-
} else {
|
|
106
|
-
let add_s = (error.error_count > 1) ? 's' : ''
|
|
107
|
-
qRequire.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" })
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
|
package/tests/name_matching.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
var queue = require("../app.js")
|
|
2
|
-
|
|
3
|
-
var tst1 = class test1 {
|
|
4
|
-
constructor(props) {
|
|
5
|
-
let t = this, fname = "name_matching.test1.constructor"
|
|
6
|
-
t.log = props.log
|
|
7
|
-
t.id = props.id
|
|
8
|
-
t.name = "test 1"
|
|
9
|
-
|
|
10
|
-
t.process = t.process.bind(t)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
process(callback) {
|
|
14
|
-
let t = this, fname = "name_matching.test1.process"
|
|
15
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) name (${t.name}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
16
|
-
callback({ success: { msg: `processing all ${t.name}` } })
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var tst2 = class test2 {
|
|
21
|
-
constructor(props) {
|
|
22
|
-
let t = this, fname = "name_matching.test2.constructor"
|
|
23
|
-
t.log = props.log
|
|
24
|
-
t.id = props.id
|
|
25
|
-
t.name = "test 2"
|
|
26
|
-
|
|
27
|
-
t.process = t.process.bind(t)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
process(callback) {
|
|
31
|
-
let t = this, fname = "name_matching.test2.process"
|
|
32
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) name (${t.name}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
33
|
-
setTimeout(() => {
|
|
34
|
-
callback({ success: { msg: `processing all ${t.name}` } })
|
|
35
|
-
}, 4000)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
var tst3 = class test3 {
|
|
40
|
-
constructor(props) {
|
|
41
|
-
let t = this, fname = "name_matching.test3.constructor"
|
|
42
|
-
t.log = props.log
|
|
43
|
-
t.id = props.id
|
|
44
|
-
t.name = "test 3"
|
|
45
|
-
|
|
46
|
-
t.process = t.process.bind(t)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
process(callback) {
|
|
50
|
-
let t = this, fname = "name_matching.test3.process"
|
|
51
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) name (${t.name}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
52
|
-
// callback({success: { msg: `processing all ${t.name}` }})
|
|
53
|
-
callback({ error: { msg: `there is some problem thrown here on ${t.name}` } })
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
var tst4 = class test4 {
|
|
58
|
-
constructor(props) {
|
|
59
|
-
let t = this, fname = "name_matching.test4.constructor"
|
|
60
|
-
t.log = props.log
|
|
61
|
-
t.id = props.id
|
|
62
|
-
t.name = "test 4"
|
|
63
|
-
|
|
64
|
-
t.process = t.process.bind(t)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
process(callback) {
|
|
68
|
-
let t = this, fname = "name_matching.test4.process"
|
|
69
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) name (${t.name}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
70
|
-
callback({ success: { msg: `processing all ${t.name}` } })
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var qObj = new queue()
|
|
75
|
-
|
|
76
|
-
qObj.init().process({
|
|
77
|
-
appender: "name",
|
|
78
|
-
exclude_logMsg: ["debug"], /* example ["debug", "info"] */
|
|
79
|
-
include_names: ["test 2", "test 4"],
|
|
80
|
-
process_objects: [tst1, tst2, tst3, tst4]
|
|
81
|
-
}).then((success) => {
|
|
82
|
-
qObj.logMsg({ msg: `test success: {msg: "name 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
|
-
})
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
var queue = require("../app.js")
|
|
2
|
-
|
|
3
|
-
var tst1 = class test1 {
|
|
4
|
-
constructor(props) {
|
|
5
|
-
let t = this, fname = "name_non_matching.test1.constructor"
|
|
6
|
-
t.log = props.log
|
|
7
|
-
t.id = props.id
|
|
8
|
-
t.name = "test 1"
|
|
9
|
-
|
|
10
|
-
t.process = t.process.bind(t)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
process(callback) {
|
|
14
|
-
let t = this, fname = "name_non_matching.test1.process"
|
|
15
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) name (${t.name}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
16
|
-
callback({ success: { msg: `processing all ${t.name}` } })
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var tst2 = class test2 {
|
|
21
|
-
constructor(props) {
|
|
22
|
-
let t = this, fname = "name_non_matching.test2.constructor"
|
|
23
|
-
t.log = props.log
|
|
24
|
-
t.id = props.id
|
|
25
|
-
t.name = "test 2"
|
|
26
|
-
|
|
27
|
-
t.process = t.process.bind(t)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
process(callback) {
|
|
31
|
-
let t = this, fname = "name_non_matching.test2.process"
|
|
32
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) name (${t.name}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
33
|
-
setTimeout(() => {
|
|
34
|
-
callback({ success: { msg: `processing all ${t.name}` } })
|
|
35
|
-
}, 4000)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
var tst3 = class test3 {
|
|
40
|
-
constructor(props) {
|
|
41
|
-
let t = this, fname = "name_non_matching.test3.constructor"
|
|
42
|
-
t.log = props.log
|
|
43
|
-
t.id = props.id
|
|
44
|
-
t.name = "test 3"
|
|
45
|
-
|
|
46
|
-
t.process = t.process.bind(t)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
process(callback) {
|
|
50
|
-
let t = this, fname = "name_non_matching.test3.process"
|
|
51
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) name (${t.name}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
52
|
-
// callback({success: { msg: `processing all ${t.name}` }})
|
|
53
|
-
callback({ error: { msg: `there is some problem thrown here on ${t.name}` } })
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
var tst4 = class test4 {
|
|
58
|
-
constructor(props) {
|
|
59
|
-
let t = this, fname = "name_non_matching.test4.constructor"
|
|
60
|
-
t.log = props.log
|
|
61
|
-
t.id = props.id
|
|
62
|
-
t.name = "test 4"
|
|
63
|
-
|
|
64
|
-
t.process = t.process.bind(t)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
process(callback) {
|
|
68
|
-
let t = this, fname = "name_non_matching.test4.process"
|
|
69
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) name (${t.name}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
70
|
-
callback({ success: { msg: `processing all ${t.name}` } })
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var qObj = new queue()
|
|
75
|
-
|
|
76
|
-
qObj.init().process({
|
|
77
|
-
appender: "name",
|
|
78
|
-
exclude_logMsg: ["debug"], /* example ["debug", "info"] */
|
|
79
|
-
exclude_names: ["test 2", "test 4"],
|
|
80
|
-
process_objects: [tst1, tst2, tst3, tst4]
|
|
81
|
-
}).then((success) => {
|
|
82
|
-
qObj.logMsg({ msg: `test success: {msg: "name 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/tests/status_matching.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
var queue = require("../app.js")
|
|
2
|
-
|
|
3
|
-
var tst1 = class test1 {
|
|
4
|
-
constructor(props) {
|
|
5
|
-
let t = this, fname = "status.test1.constructor"
|
|
6
|
-
t.log = props.log
|
|
7
|
-
t.id = props.id
|
|
8
|
-
t.status = "init"
|
|
9
|
-
|
|
10
|
-
t.process = t.process.bind(t)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
process(callback) {
|
|
14
|
-
let t = this, fname = "status.test1.process"
|
|
15
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) status (${t.status}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
16
|
-
callback({ success: { msg: `processing all test1` } })
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var tst2 = class test2 {
|
|
21
|
-
constructor(props) {
|
|
22
|
-
let t = this, fname = "status.test2.constructor"
|
|
23
|
-
t.log = props.log
|
|
24
|
-
t.id = props.id
|
|
25
|
-
t.status = "step 1"
|
|
26
|
-
|
|
27
|
-
t.process = t.process.bind(t)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
process(callback) {
|
|
31
|
-
let t = this, fname = "status.test2.process"
|
|
32
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) status (${t.status}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
33
|
-
setTimeout(() => {
|
|
34
|
-
callback({ success: { msg: `processing all test2` } })
|
|
35
|
-
}, 4000)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
var tst3 = class test3 {
|
|
40
|
-
constructor(props) {
|
|
41
|
-
let t = this, fname = "status.test3.constructor"
|
|
42
|
-
t.log = props.log
|
|
43
|
-
t.id = props.id
|
|
44
|
-
t.status = "remove"
|
|
45
|
-
|
|
46
|
-
t.process = t.process.bind(t)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
process(callback) {
|
|
50
|
-
let t = this, fname = "status.test3.process"
|
|
51
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) status (${t.status}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
52
|
-
// callback({success: { msg: `processing all test3` }})
|
|
53
|
-
callback({ error: { msg: `there is some problem thrown here on test3` } })
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
var tst4 = class test4 {
|
|
58
|
-
constructor(props) {
|
|
59
|
-
let t = this, fname = "status.test4.constructor"
|
|
60
|
-
t.log = props.log
|
|
61
|
-
t.id = props.id
|
|
62
|
-
t.status = "delete"
|
|
63
|
-
|
|
64
|
-
t.process = t.process.bind(t)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
process(callback) {
|
|
68
|
-
let t = this, fname = "status.test4.process"
|
|
69
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) status (${t.status}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
70
|
-
callback({ success: { msg: `processing all test4` } })
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var qObj = new queue()
|
|
75
|
-
|
|
76
|
-
qObj.init().process({
|
|
77
|
-
appender: "status",
|
|
78
|
-
exclude_logMsg: ["debug"], /* example ["debug", "info"] */
|
|
79
|
-
include_status: ["init", "delete"],
|
|
80
|
-
process_objects: [tst1, tst2, tst3, tst4]
|
|
81
|
-
}).then((success) => {
|
|
82
|
-
qObj.logMsg({ msg: `test success: {msg: "status 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
|
-
})
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
var queue = require("../app.js")
|
|
2
|
-
|
|
3
|
-
var tst1 = class test1 {
|
|
4
|
-
constructor(props) {
|
|
5
|
-
let t = this, fname = "status.test1.constructor"
|
|
6
|
-
t.log = props.log
|
|
7
|
-
t.id = props.id
|
|
8
|
-
t.status = "init"
|
|
9
|
-
|
|
10
|
-
t.process = t.process.bind(t)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
process(callback) {
|
|
14
|
-
let t = this, fname = "status.test1.process"
|
|
15
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) status (${t.status}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
16
|
-
callback({ success: { msg: `processing all test1` } })
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var tst2 = class test2 {
|
|
21
|
-
constructor(props) {
|
|
22
|
-
let t = this, fname = "status.test2.constructor"
|
|
23
|
-
t.log = props.log
|
|
24
|
-
t.id = props.id
|
|
25
|
-
t.status = "step 1"
|
|
26
|
-
|
|
27
|
-
t.process = t.process.bind(t)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
process(callback) {
|
|
31
|
-
let t = this, fname = "status.test2.process"
|
|
32
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) status (${t.status}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
33
|
-
setTimeout(() => {
|
|
34
|
-
callback({ success: { msg: `processing all test2` } })
|
|
35
|
-
}, 4000)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
var tst3 = class test3 {
|
|
40
|
-
constructor(props) {
|
|
41
|
-
let t = this, fname = "status.test3.constructor"
|
|
42
|
-
t.log = props.log
|
|
43
|
-
t.id = props.id
|
|
44
|
-
t.status = "remove"
|
|
45
|
-
|
|
46
|
-
t.process = t.process.bind(t)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
process(callback) {
|
|
50
|
-
let t = this, fname = "status.test3.process"
|
|
51
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) status (${t.status}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
52
|
-
// callback({success: { msg: `processing all test3` }})
|
|
53
|
-
callback({ error: { msg: `there is some problem thrown here on test3` } })
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
var tst4 = class test4 {
|
|
58
|
-
constructor(props) {
|
|
59
|
-
let t = this, fname = "status.test4.constructor"
|
|
60
|
-
t.log = props.log
|
|
61
|
-
t.id = props.id
|
|
62
|
-
t.status = "delete"
|
|
63
|
-
|
|
64
|
-
t.process = t.process.bind(t)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
process(callback) {
|
|
68
|
-
let t = this, fname = "status.test4.process"
|
|
69
|
-
t.log({ msg: `This object (${fname}) is id (${t.id}) status (${t.status}). Do stuff here`.bgBrightGreen, type: "info" })
|
|
70
|
-
callback({ success: { msg: `processing all test4` } })
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var qObj = new queue()
|
|
75
|
-
|
|
76
|
-
qObj.init().process({
|
|
77
|
-
appender: "status",
|
|
78
|
-
exclude_logMsg: ["debug"], /* example ["debug", "info"] */
|
|
79
|
-
exclude_status: ["init", "delete"],
|
|
80
|
-
process_objects: [tst1, tst2, tst3, tst4]
|
|
81
|
-
}).then((success) => {
|
|
82
|
-
qObj.logMsg({ msg: `test success: {msg: "status 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/tests/top_one.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
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: "top_one",
|
|
74
|
-
exclude_logMsg: ["debug"], /* example ["debug", "info"] */
|
|
75
|
-
process_objects: [tst1, tst2, tst3, tst4]
|
|
76
|
-
}).then((success) => {
|
|
77
|
-
qObj.logMsg({ msg: `test success: {msg: "top_one object 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
|
-
})
|
|
@@ -1,90 +0,0 @@
|
|
|
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
|
-
})
|