base-queue 1.0.7 → 3.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.
@@ -78,3 +78,4 @@ jobs:
78
78
 
79
79
  - run: npm run build --if-present
80
80
  - run: npm run test_base
81
+ - run: npm run json_base
package/README.md CHANGED
@@ -19,5 +19,13 @@ General Setup Test
19
19
  ```
20
20
  npm run test_base
21
21
  npm run json_base
22
+ npm run http_base
23
+ npm run http_json_base
24
+ npm run json_version_matching
25
+ npm run json_version_non_matching
26
+ npm run json_name_matching
27
+ npm run json_name_non_matching
28
+ npm run json_status_matching
29
+ npm run json_status_non_matching
22
30
 
23
31
  ```
@@ -36,7 +36,7 @@ exports = module.exports = class common_code {
36
36
  if (typeof obj_a != "undefined" &&
37
37
  typeof eval(`obj_a.${t.by_what}`) != "undefined" &&
38
38
  is.indexOf(eval(`obj_a.${t.by_what}`)) > -1) {
39
- t.parent.main_process_objects.push(new obj(dat.props))
39
+ t.parent.main_process_objects.push(new obj(dat.props))
40
40
  }
41
41
  }
42
42
  if (typeof xis != "undefined") {
@@ -19,7 +19,7 @@ exports = module.exports = class json_name extends base {
19
19
  log: t.parent.logMsg,
20
20
  include_func: t.get_include_names,
21
21
  exclude_func: t.get_exclude_names,
22
- by_what: t.aname
22
+ by_what: "name"
23
23
  })
24
24
 
25
25
  if (typeof props.data_to_process_array == 'undefined')
@@ -57,13 +57,7 @@ exports = module.exports = class json_name extends base {
57
57
  dat.props.log = t.parent.logMsg
58
58
  dat.props.relative_path = t.relative_path
59
59
  obj = t.get_objects_to_process()[0]
60
- is = t.get_include_names()
61
- obj_a = new obj(dat.props)
62
- if (typeof obj_a != "undefined" &&
63
- typeof obj_a.name != "undefined" &&
64
- is.indexOf(obj_a.name) > -1) {
65
- t.main_process_objects.push(new obj(dat.props))
66
- }
60
+ t.common_code.init({ obj: obj, dat: dat })
67
61
  })
68
62
  } catch (e) {
69
63
  e.message = `${fname} error: ${e.message}`
@@ -4,7 +4,8 @@
4
4
  * json_status.js
5
5
  */
6
6
 
7
- var base = require('./base.js')
7
+ var base = require('./base.js'),
8
+ common_code = require('./common_code.js')
8
9
 
9
10
  exports = module.exports = class json_status extends base {
10
11
  constructor(props) {
@@ -18,7 +19,7 @@ exports = module.exports = class json_status extends base {
18
19
  log: t.parent.logMsg,
19
20
  include_func: t.get_include_status,
20
21
  exclude_func: t.get_exclude_status,
21
- by_what: t.aname
22
+ by_what: "status"
22
23
  })
23
24
 
24
25
  if (typeof props.data_to_process_array == 'undefined')
@@ -42,7 +43,8 @@ exports = module.exports = class json_status extends base {
42
43
 
43
44
  init(props = {}) {
44
45
  var t = this, fname = `json_status.init`, obj, is, obj_a
45
- try {``
46
+ try {
47
+ ``
46
48
  t.parent.logMsg({ msg: `${fname}`.debug, type: "debug" })
47
49
 
48
50
  if (typeof t.get_objects_to_process()[0] == "undefined")
@@ -54,17 +56,11 @@ exports = module.exports = class json_status extends base {
54
56
  dat.props.log = t.parent.logMsg
55
57
  dat.props.relative_path = t.relative_path
56
58
  obj = t.get_objects_to_process()[0]
57
- is = t.get_include_status()
58
- obj_a = new obj(dat.props)
59
- if (typeof obj_a != "undefined" &&
60
- typeof obj_a.status != "undefined" &&
61
- is.indexOf(obj_a.status) > -1) {
62
- t.main_process_objects.push(new obj(dat.props))
63
- }
59
+ t.common_code.init({ obj: obj, dat: dat })
64
60
  })
65
61
  } catch (e) {
66
62
  e.message = `${fname} error: ${e.message}`
67
- t.parent.logMsg({msg: e.message.error, type: "error"})
63
+ t.parent.logMsg({ msg: e.message.error, type: "error" })
68
64
  throw e
69
65
  }
70
66
 
@@ -80,7 +76,7 @@ exports = module.exports = class json_status extends base {
80
76
  process(props = {}) {
81
77
  var t = this, fname = `json_status.process`
82
78
  try {
83
- t.parent.logMsg({msg: `${fname} length(${t.main_process_objects.length})`.debug, type: "debug"})
79
+ t.parent.logMsg({ msg: `${fname} length(${t.main_process_objects.length})`.debug, type: "debug" })
84
80
 
85
81
  super.process(props)
86
82
  return t
@@ -4,7 +4,8 @@
4
4
  * json_version.js
5
5
  */
6
6
 
7
- var base = require('./base.js')
7
+ var base = require('./base.js'),
8
+ common_code = require('./common_code.js')
8
9
 
9
10
  exports = module.exports = class json_version extends base {
10
11
  constructor(props) {
@@ -18,9 +19,9 @@ exports = module.exports = class json_version extends base {
18
19
  log: t.parent.logMsg,
19
20
  include_func: t.get_include_version,
20
21
  exclude_func: t.get_exclude_version,
21
- by_what: t.aname
22
+ by_what: "version"
22
23
  })
23
-
24
+
24
25
  if (typeof props.data_to_process_array == 'undefined')
25
26
  throw new Error(`props.data_to_process_array not defined`)
26
27
 
@@ -42,7 +43,8 @@ exports = module.exports = class json_version extends base {
42
43
 
43
44
  init(props = {}) {
44
45
  var t = this, fname = `json_version.init`, obj, is, obj_a
45
- try {``
46
+ try {
47
+ ``
46
48
  t.parent.logMsg({ msg: `${fname}`.debug, type: "debug" })
47
49
 
48
50
  if (typeof t.get_objects_to_process()[0] == "undefined")
@@ -54,17 +56,11 @@ exports = module.exports = class json_version extends base {
54
56
  dat.props.log = t.parent.logMsg
55
57
  dat.props.relative_path = t.relative_path
56
58
  obj = t.get_objects_to_process()[0]
57
- is = t.get_include_version()
58
- obj_a = new obj(dat.props)
59
- if (typeof obj_a != "undefined" &&
60
- typeof obj_a.version != "undefined" &&
61
- is.indexOf(obj_a.version) > -1) {
62
- t.main_process_objects.push(new obj(dat.props))
63
- }
59
+ t.common_code.init({ obj: obj, dat: dat })
64
60
  })
65
61
  } catch (e) {
66
62
  e.message = `${fname} error: ${e.message}`
67
- t.parent.logMsg({msg: e.message.error, type: "error"})
63
+ t.parent.logMsg({ msg: e.message.error, type: "error" })
68
64
  throw e
69
65
  }
70
66
 
@@ -80,7 +76,7 @@ exports = module.exports = class json_version extends base {
80
76
  process(props = {}) {
81
77
  var t = this, fname = `json_version.process`
82
78
  try {
83
- t.parent.logMsg({msg: `${fname} length(${t.main_process_objects.length})`.debug, type: "debug"})
79
+ t.parent.logMsg({ msg: `${fname} length(${t.main_process_objects.length})`.debug, type: "debug" })
84
80
 
85
81
  super.process(props)
86
82
  return t
package/package.json CHANGED
@@ -2,14 +2,14 @@
2
2
  "author": {
3
3
  "name": "Jim Manton"
4
4
  },
5
- "version": "1.0.7",
5
+ "version": "3.0.0",
6
6
  "bundleDependencies": [],
7
7
  "dependencies": {
8
8
  "chai": "^4.3.7",
9
9
  "colors": "^1.4.0",
10
10
  "diffler": "^2.0.4",
11
11
  "fs": "^0.0.1-security",
12
- "log-queue": "^2.1.0",
12
+ "log-queue": "^3.0.0",
13
13
  "mocha": "^10.2.0",
14
14
  "valid-path": "^2.1.0"
15
15
  },
@@ -18,7 +18,15 @@
18
18
  "test": "mocha",
19
19
  "ditched": "ditched -a",
20
20
  "test_base": "node ./tests/base",
21
- "json_base": "node ./tests/json"
21
+ "json_base": "node ./tests/json",
22
+ "http_base": "node ./tests/http_base",
23
+ "http_json_base": "node ./tests/http_json",
24
+ "json_version_matching": "node ./tests/json_version",
25
+ "json_version_non_matching": "node ./tests/json_version_non_matching",
26
+ "json_name_matching": "node ./tests/json_name",
27
+ "json_name_non_matching": "node ./tests/json_name_non_matching",
28
+ "json_status_matching": "node ./tests/json_status",
29
+ "json_status_non_matching": "node ./tests/json_status_non_matching"
22
30
  },
23
31
  "keywords": [
24
32
  "queue",
package/test/package.js CHANGED
@@ -6,14 +6,14 @@ const packageMock = {
6
6
  "author": {
7
7
  "name": "Jim Manton"
8
8
  },
9
- "version": "1.0.7",
9
+ "version": "3.0.0",
10
10
  "bundleDependencies": [],
11
11
  "dependencies": {
12
12
  "chai": "^4.3.7",
13
13
  "colors": "^1.4.0",
14
14
  "diffler": "^2.0.4",
15
15
  "fs": "^0.0.1-security",
16
- "log-queue": "^2.1.0",
16
+ "log-queue": "^3.0.0",
17
17
  "mocha": "^10.2.0",
18
18
  "valid-path": "^2.1.0"
19
19
  },
@@ -22,7 +22,15 @@ const packageMock = {
22
22
  "test": "mocha",
23
23
  "ditched": "ditched -a",
24
24
  "test_base": "node ./tests/base",
25
- "json_base": "node ./tests/json"
25
+ "json_base": "node ./tests/json",
26
+ "http_base": "node ./tests/http_base",
27
+ "http_json_base": "node ./tests/http_json",
28
+ "json_version_matching": "node ./tests/json_version",
29
+ "json_version_non_matching": "node ./tests/json_version_non_matching",
30
+ "json_name_matching": "node ./tests/json_name",
31
+ "json_name_non_matching": "node ./tests/json_name_non_matching",
32
+ "json_status_matching": "node ./tests/json_status",
33
+ "json_status_non_matching": "node ./tests/json_status_non_matching"
26
34
  },
27
35
  "keywords": [
28
36
  "queue",
@@ -48,6 +56,7 @@ const packageMock = {
48
56
  "start": "node app.js"
49
57
  }
50
58
 
59
+
51
60
  describe('package.json', function () {
52
61
  it('should pass', function () {
53
62
  const difference = jsonHasDifferences(packagejson, packageMock)
@@ -0,0 +1,101 @@
1
+
2
+ var tst1 = class test1 {
3
+ constructor(props) {
4
+ let t = this, fname = "test_all.test1.constructor"
5
+ t.log = props.log
6
+ t.id = props.id
7
+
8
+ t.process = t.process.bind(t)
9
+ }
10
+
11
+ process(callback) {
12
+ let t = this, fname = "test_all.test1.process"
13
+ t.log({ msg: `This object (${fname}) is id (${t.id}). Do stuff here`.bgBrightGreen, type: "info" })
14
+ callback({ success: { msg: `processing all test1` } })
15
+ }
16
+ }
17
+
18
+ var tst2 = class test2 {
19
+ constructor(props) {
20
+ let t = this, fname = "test_all.test2.constructor"
21
+ t.log = props.log
22
+ t.id = props.id
23
+
24
+ t.process = t.process.bind(t)
25
+ }
26
+
27
+ process(callback) {
28
+ let t = this, fname = "test_all.test2.process"
29
+ t.log({ msg: `This object (${fname}) is id (${t.id}). Do stuff here`.bgBrightGreen, type: "info" })
30
+ setTimeout(() => {
31
+ callback({ success: { msg: `processing all test2` } })
32
+ }, 4000)
33
+ }
34
+ }
35
+
36
+ var tst3 = class test3 {
37
+ constructor(props) {
38
+ let t = this, fname = "test_all.test3.constructor"
39
+ t.log = props.log
40
+ t.id = props.id
41
+
42
+ t.process = t.process.bind(t)
43
+ }
44
+
45
+ process(callback) {
46
+ let t = this, fname = "test_all.test3.process"
47
+ t.log({ msg: `This object (${fname}) is id (${t.id}). Do stuff here`.bgBrightGreen, type: "info" })
48
+ // callback({success: { msg: `processing all test3` }})
49
+ callback({ error: { msg: `there is some problem thrown here on test3` } })
50
+ }
51
+ }
52
+
53
+ var tst4 = class test4 {
54
+ constructor(props) {
55
+ let t = this, fname = "test_all.test4.constructor"
56
+ t.log = props.log
57
+ t.id = props.id
58
+
59
+ t.process = t.process.bind(t)
60
+ }
61
+
62
+ process(callback) {
63
+ let t = this, fname = "test_all.test4.process"
64
+ t.log({ msg: `This object (${fname}) is id (${t.id}). Do stuff here`.bgBrightGreen, type: "info" })
65
+ callback({ success: { msg: `processing all test4` } })
66
+ }
67
+ }
68
+
69
+ var lq = require("log-queue"),
70
+ log = new lq({
71
+ exclude_logMsg: ["debug"], /* example ["debug", "info"] */
72
+ }).init({appender: "http", hostname: "127.0.0.1", port: 3001}),
73
+ a_resolve, a_reject,
74
+ promise = new Promise((resolve, reject) => {
75
+ a_resolve = resolve
76
+ a_reject = reject
77
+ }),
78
+ bb = require("../app.js"),
79
+ base_queue = new bb({
80
+ parent: null,
81
+ relative_path: "./appenders/",
82
+ logMsg: log.logMsg,
83
+ resolve: a_resolve,
84
+ reject: a_reject
85
+ }).load({
86
+ appender: "all",
87
+ process_objects: [tst1, tst2, tst3, tst4]
88
+ }).process()
89
+
90
+ promise.then((success) => {
91
+ log.logMsg({ msg: `All object processed successfully`.success.italic.bold, type: "success" })
92
+ }, (error) => {
93
+ if (typeof error == "string") {
94
+ log.logMsg({ msg: `error: ${error}`.error.italic.bold, type: "error" })
95
+ } else {
96
+ let add_s = (error.error_count > 1) ? 's' : ''
97
+ log.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" })
98
+ }
99
+ })
100
+
101
+ log.server()
@@ -0,0 +1,121 @@
1
+ var file_data = [
2
+ { props: { id: 100, name: "all", absolute_path: __filename, check: false } },
3
+ { props: { id: 101, name: "func_all", absolute_path: __filename, check: false } },
4
+ { props: { id: 102, name: "top_one", absolute_path: __filename, check: false } },
5
+ { props: { id: 103, name: "bottom_one", absolute_path: __filename, check: false } },
6
+ { props: { id: 104, name: "sync_all", absolute_path: __filename, check: false } },
7
+ { props: { id: 105, name: "status", absolute_path: __filename, check: false } },
8
+ { props: { id: 106, name: "name", absolute_path: __filename, check: false } },
9
+ { props: { id: 107, name: "version", absolute_path: __filename, check: false } }
10
+ ]
11
+
12
+ var file_object = class file_obj {
13
+ constructor(props) {
14
+ let t = this, fname = "file_obj.constructor"
15
+ try {
16
+ t.id = props.id
17
+ t.log = props.log
18
+ t.name = props.name
19
+ t.path = props.relative_path
20
+ t.absolute_path = props.absolute_path
21
+ t.status = 'init'
22
+ t.errors = false
23
+ t.error_msg = 'none'
24
+
25
+ // if (t.id == 104) {
26
+ // t.errors = true
27
+ // t.error_msg = `some sort of error here`
28
+ // }
29
+
30
+ t.process = t.process.bind(t)
31
+ t.do_checks = t.do_checks.bind(t)
32
+
33
+ if (props.check) {
34
+ t.do_checks()
35
+ }
36
+ } catch (e) {
37
+ e.message = `${fname} error: ${e.message}`
38
+ throw e
39
+ }
40
+
41
+ return t
42
+ }
43
+
44
+ do_checks() {
45
+ let t = this, path_to_check,
46
+ last_item = t.absolute_path.split("\\").pop(),
47
+ check_file = t.absolute_path.split(last_item)[0], check_path = t.path.split('/')
48
+
49
+ check_file = check_file.replace(/\\/g, "/");
50
+ path_to_check = validPath(t.path);
51
+
52
+ if (!path_to_check.valid) {
53
+ t.errors = true
54
+ t.error_msg = `id = ${t.id} name(${t.name}) Error in ${path_to_check.data.input}: ${path_to_check.error})`
55
+ }
56
+
57
+ check_path.map((dat, i) => {
58
+ if (/^[a-zA-Z._]+$/.test(dat)) {
59
+ if (dat != '.')
60
+ check_file += dat + '/'
61
+ }
62
+ })
63
+ check_file = check_file.slice(0, -1)
64
+ try {
65
+ if (!fs.existsSync(check_file)) {
66
+ t.errors = true
67
+ t.error_msg = `id = ${t.id} name(${t.name}) file (${check_file} does not exist)`
68
+ }
69
+ } catch (e) {
70
+ e.message = "file_obj do_checks error: " + e.message
71
+ throw (e)
72
+ }
73
+ }
74
+
75
+ process(callback) {
76
+ let t = this
77
+ t.log({ msg: `processing object id ${t.id}. Do a bunch of stuff here.`.silly, type: "silly" })
78
+ if (t.errors)
79
+ callback({ error: { msg: t.error_msg } })
80
+ else
81
+ callback({ success: { msg: `id = ${t.id} name(${t.name})` } })
82
+ }
83
+ }
84
+
85
+ var lq = require("log-queue"),
86
+ log = new lq({
87
+ exclude_logMsg: ["debug"], /* example ["debug", "info"] */
88
+ parent: null
89
+ }).init({appender: "http", hostname: "127.0.0.1", port: 3000}),
90
+ a_resolve, a_reject,
91
+ promise = new Promise((resolve, reject) => {
92
+ a_resolve = resolve
93
+ a_reject = reject
94
+ }),
95
+ bb = require("../app.js"),
96
+ base_queue = new bb({
97
+ parent: null,
98
+ relative_path: "./appenders/",
99
+ logMsg: log.logMsg,
100
+ resolve: a_resolve,
101
+ reject: a_reject
102
+ }).load({
103
+ appender: "json_all",
104
+ exclude_logMsg: ["debug", "silly", "info"], /* default [] */
105
+ process_objects: [file_object],
106
+ data_to_process_array: file_data
107
+ }).process()
108
+
109
+ promise.then((success) => {
110
+ log.logMsg({ msg: `Json all object processed successfully`.success.italic.bold, type: "success" })
111
+ }, (error) => {
112
+ if (typeof error == "string") {
113
+ log.logMsg({ msg: `error: ${error}`.error.italic.bold, type: "error" })
114
+ } else {
115
+ let add_s = (error.error_count > 1) ? 's' : ''
116
+ log.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" })
117
+ }
118
+ })
119
+
120
+ log.server()
121
+
@@ -0,0 +1,85 @@
1
+
2
+ var file_data = [
3
+ { props: { id: 100, name: "all", status: "new", absolute_path: __filename, check: true } },
4
+ { props: { id: 101, name: "func_all", status: "done", absolute_path: __filename, check: true } },
5
+ { props: { id: 102, name: "top_one", status: "new", absolute_path: __filename, check: true } },
6
+ { props: { id: 103, name: "bottom_one", status: "new", absolute_path: __filename, check: true } },
7
+ { props: { id: 104, name: "sync_all", status: "done", absolute_path: __filename, check: true } },
8
+ { props: { id: 105, name: "status", status: "delete", absolute_path: __filename, check: true } },
9
+ { props: { id: 106, name: "name", status: "test", absolute_path: __filename, check: true } },
10
+ { props: { id: 107, name: "version", status: "new", absolute_path: __filename, check: true } }
11
+ ]
12
+
13
+ var file_object = class file_obj {
14
+ constructor(props) {
15
+ let t = this, fname = "file_obj.constructor"
16
+ try {
17
+ t.id = props.id
18
+ t.log = props.log
19
+ t.name = props.name
20
+ t.status = props.status
21
+ t.path = props.relative_path
22
+ t.absolute_path = props.absolute_path
23
+ t.errors = false
24
+ t.error_msg = 'none'
25
+
26
+ // if (t.id == 104) {
27
+ // t.errors = true
28
+ // t.error_msg = `some sort of error here`
29
+ // }
30
+
31
+ t.process = t.process.bind(t)
32
+ } catch (e) {
33
+ e.message = `${fname} error: ${e.message}`
34
+ throw e
35
+ }
36
+
37
+ return t
38
+ }
39
+
40
+ process(callback) {
41
+ let t = this
42
+ t.log({ msg: `processing object id ${t.id}. Do a bunch of stuff here.`.silly, type: "silly" })
43
+ if (t.errors)
44
+ callback({ error: { msg: t.error_msg } })
45
+ else
46
+ callback({ success: { msg: `id = ${t.id} name(${t.name}) status(${t.status})` } })
47
+ }
48
+ }
49
+
50
+ var lq = require("log-queue"),
51
+ log = new lq({
52
+ exclude_logMsg: ["debug"], /* example ["debug", "info"] */
53
+ }).init({appender: "console"}),
54
+ a_resolve, a_reject,
55
+ promise = new Promise((resolve, reject) => {
56
+ a_resolve = resolve
57
+ a_reject = reject
58
+ }),
59
+ bb = require("../app.js"),
60
+ base_queue = new bb({
61
+ parent: null,
62
+ relative_path: "./appenders/",
63
+ logMsg: log.logMsg,
64
+ resolve: a_resolve,
65
+ reject: a_reject
66
+ }).load({
67
+ appender: "json_name",
68
+ exclude_logMsg: [], /* default [] */
69
+ process_objects: [file_object],
70
+ include_names: ["all", "bottom_one", "func_all"],
71
+ data_to_process_array: file_data
72
+ }).process()
73
+
74
+ promise.then((success) => {
75
+ log.logMsg({ msg: `Json all object processed successfully`.success.italic.bold, type: "success" })
76
+ }, (error) => {
77
+ if (typeof error == "string") {
78
+ log.logMsg({ msg: `error: ${error}`.error.italic.bold, type: "error" })
79
+ } else {
80
+ let add_s = (error.error_count > 1) ? 's' : ''
81
+ log.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" })
82
+ }
83
+ })
84
+
85
+
@@ -0,0 +1,85 @@
1
+
2
+ var file_data = [
3
+ { props: { id: 100, name: "all", status: "new", absolute_path: __filename, check: true } },
4
+ { props: { id: 101, name: "func_all", status: "done", absolute_path: __filename, check: true } },
5
+ { props: { id: 102, name: "top_one", status: "new", absolute_path: __filename, check: true } },
6
+ { props: { id: 103, name: "bottom_one", status: "new", absolute_path: __filename, check: true } },
7
+ { props: { id: 104, name: "sync_all", status: "done", absolute_path: __filename, check: true } },
8
+ { props: { id: 105, name: "status", status: "delete", absolute_path: __filename, check: true } },
9
+ { props: { id: 106, name: "name", status: "test", absolute_path: __filename, check: true } },
10
+ { props: { id: 107, name: "version", status: "new", absolute_path: __filename, check: true } }
11
+ ]
12
+
13
+ var file_object = class file_obj {
14
+ constructor(props) {
15
+ let t = this, fname = "file_obj.constructor"
16
+ try {
17
+ t.id = props.id
18
+ t.log = props.log
19
+ t.name = props.name
20
+ t.status = props.status
21
+ t.path = props.relative_path
22
+ t.absolute_path = props.absolute_path
23
+ t.errors = false
24
+ t.error_msg = 'none'
25
+
26
+ // if (t.id == 104) {
27
+ // t.errors = true
28
+ // t.error_msg = `some sort of error here`
29
+ // }
30
+
31
+ t.process = t.process.bind(t)
32
+ } catch (e) {
33
+ e.message = `${fname} error: ${e.message}`
34
+ throw e
35
+ }
36
+
37
+ return t
38
+ }
39
+
40
+ process(callback) {
41
+ let t = this
42
+ t.log({ msg: `processing object id ${t.id}. Do a bunch of stuff here.`.silly, type: "silly" })
43
+ if (t.errors)
44
+ callback({ error: { msg: t.error_msg } })
45
+ else
46
+ callback({ success: { msg: `id = ${t.id} name(${t.name}) status(${t.status})` } })
47
+ }
48
+ }
49
+
50
+ var lq = require("log-queue"),
51
+ log = new lq({
52
+ exclude_logMsg: ["debug"], /* example ["debug", "info"] */
53
+ }).init({appender: "console"}),
54
+ a_resolve, a_reject,
55
+ promise = new Promise((resolve, reject) => {
56
+ a_resolve = resolve
57
+ a_reject = reject
58
+ }),
59
+ bb = require("../app.js"),
60
+ base_queue = new bb({
61
+ parent: null,
62
+ relative_path: "./appenders/",
63
+ logMsg: log.logMsg,
64
+ resolve: a_resolve,
65
+ reject: a_reject
66
+ }).load({
67
+ appender: "json_name",
68
+ exclude_logMsg: [], /* default [] */
69
+ process_objects: [file_object],
70
+ exclude_names: ["all", "bottom_one", "func_all"],
71
+ data_to_process_array: file_data
72
+ }).process()
73
+
74
+ promise.then((success) => {
75
+ log.logMsg({ msg: `Json all object processed successfully`.success.italic.bold, type: "success" })
76
+ }, (error) => {
77
+ if (typeof error == "string") {
78
+ log.logMsg({ msg: `error: ${error}`.error.italic.bold, type: "error" })
79
+ } else {
80
+ let add_s = (error.error_count > 1) ? 's' : ''
81
+ log.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" })
82
+ }
83
+ })
84
+
85
+
@@ -0,0 +1,85 @@
1
+
2
+ var file_data = [
3
+ { props: { id: 100, name: "all", status: "new", absolute_path: __filename, check: true } },
4
+ { props: { id: 101, name: "func_all", status: "done", absolute_path: __filename, check: true } },
5
+ { props: { id: 102, name: "top_one", status: "new", absolute_path: __filename, check: true } },
6
+ { props: { id: 103, name: "bottom_one", status: "new", absolute_path: __filename, check: true } },
7
+ { props: { id: 104, name: "sync_all", status: "done", absolute_path: __filename, check: true } },
8
+ { props: { id: 105, name: "status", status: "delete", absolute_path: __filename, check: true } },
9
+ { props: { id: 106, name: "name", status: "test", absolute_path: __filename, check: true } },
10
+ { props: { id: 107, name: "version", status: "new", absolute_path: __filename, check: true } }
11
+ ]
12
+
13
+ var file_object = class file_obj {
14
+ constructor(props) {
15
+ let t = this, fname = "file_obj.constructor"
16
+ try {
17
+ t.id = props.id
18
+ t.log = props.log
19
+ t.name = props.name
20
+ t.status = props.status
21
+ t.path = props.relative_path
22
+ t.absolute_path = props.absolute_path
23
+ t.errors = false
24
+ t.error_msg = 'none'
25
+
26
+ // if (t.id == 104) {
27
+ // t.errors = true
28
+ // t.error_msg = `some sort of error here`
29
+ // }
30
+
31
+ t.process = t.process.bind(t)
32
+ } catch (e) {
33
+ e.message = `${fname} error: ${e.message}`
34
+ throw e
35
+ }
36
+
37
+ return t
38
+ }
39
+
40
+ process(callback) {
41
+ let t = this
42
+ t.log({ msg: `processing object id ${t.id}. Do a bunch of stuff here.`.silly, type: "silly" })
43
+ if (t.errors)
44
+ callback({ error: { msg: t.error_msg } })
45
+ else
46
+ callback({ success: { msg: `id = ${t.id} name(${t.name}) status(${t.status})` } })
47
+ }
48
+ }
49
+
50
+ var lq = require("log-queue"),
51
+ log = new lq({
52
+ exclude_logMsg: ["debug"], /* example ["debug", "info"] */
53
+ }).init({appender: "console"}),
54
+ a_resolve, a_reject,
55
+ promise = new Promise((resolve, reject) => {
56
+ a_resolve = resolve
57
+ a_reject = reject
58
+ }),
59
+ bb = require("../app.js"),
60
+ base_queue = new bb({
61
+ parent: null,
62
+ relative_path: "./appenders/",
63
+ logMsg: log.logMsg,
64
+ resolve: a_resolve,
65
+ reject: a_reject
66
+ }).load({
67
+ appender: "json_status",
68
+ exclude_logMsg: [], /* default [] */
69
+ process_objects: [file_object],
70
+ include_status: ["done", "delete"],
71
+ data_to_process_array: file_data
72
+ }).process()
73
+
74
+ promise.then((success) => {
75
+ log.logMsg({ msg: `Json all object processed successfully`.success.italic.bold, type: "success" })
76
+ }, (error) => {
77
+ if (typeof error == "string") {
78
+ log.logMsg({ msg: `error: ${error}`.error.italic.bold, type: "error" })
79
+ } else {
80
+ let add_s = (error.error_count > 1) ? 's' : ''
81
+ log.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" })
82
+ }
83
+ })
84
+
85
+
@@ -0,0 +1,85 @@
1
+
2
+ var file_data = [
3
+ { props: { id: 100, name: "all", status: "new", absolute_path: __filename, check: true } },
4
+ { props: { id: 101, name: "func_all", status: "done", absolute_path: __filename, check: true } },
5
+ { props: { id: 102, name: "top_one", status: "new", absolute_path: __filename, check: true } },
6
+ { props: { id: 103, name: "bottom_one", status: "new", absolute_path: __filename, check: true } },
7
+ { props: { id: 104, name: "sync_all", status: "done", absolute_path: __filename, check: true } },
8
+ { props: { id: 105, name: "status", status: "delete", absolute_path: __filename, check: true } },
9
+ { props: { id: 106, name: "name", status: "test", absolute_path: __filename, check: true } },
10
+ { props: { id: 107, name: "version", status: "new", absolute_path: __filename, check: true } }
11
+ ]
12
+
13
+ var file_object = class file_obj {
14
+ constructor(props) {
15
+ let t = this, fname = "file_obj.constructor"
16
+ try {
17
+ t.id = props.id
18
+ t.log = props.log
19
+ t.name = props.name
20
+ t.status = props.status
21
+ t.path = props.relative_path
22
+ t.absolute_path = props.absolute_path
23
+ t.errors = false
24
+ t.error_msg = 'none'
25
+
26
+ // if (t.id == 104) {
27
+ // t.errors = true
28
+ // t.error_msg = `some sort of error here`
29
+ // }
30
+
31
+ t.process = t.process.bind(t)
32
+ } catch (e) {
33
+ e.message = `${fname} error: ${e.message}`
34
+ throw e
35
+ }
36
+
37
+ return t
38
+ }
39
+
40
+ process(callback) {
41
+ let t = this
42
+ t.log({ msg: `processing object id ${t.id}. Do a bunch of stuff here.`.silly, type: "silly" })
43
+ if (t.errors)
44
+ callback({ error: { msg: t.error_msg } })
45
+ else
46
+ callback({ success: { msg: `id = ${t.id} name(${t.name}) status(${t.status})` } })
47
+ }
48
+ }
49
+
50
+ var lq = require("log-queue"),
51
+ log = new lq({
52
+ exclude_logMsg: ["debug"], /* example ["debug", "info"] */
53
+ }).init({appender: "console"}),
54
+ a_resolve, a_reject,
55
+ promise = new Promise((resolve, reject) => {
56
+ a_resolve = resolve
57
+ a_reject = reject
58
+ }),
59
+ bb = require("../app.js"),
60
+ base_queue = new bb({
61
+ parent: null,
62
+ relative_path: "./appenders/",
63
+ logMsg: log.logMsg,
64
+ resolve: a_resolve,
65
+ reject: a_reject
66
+ }).load({
67
+ appender: "json_status",
68
+ exclude_logMsg: [], /* default [] */
69
+ process_objects: [file_object],
70
+ exclude_status: ["done", "delete"],
71
+ data_to_process_array: file_data
72
+ }).process()
73
+
74
+ promise.then((success) => {
75
+ log.logMsg({ msg: `Json all object processed successfully`.success.italic.bold, type: "success" })
76
+ }, (error) => {
77
+ if (typeof error == "string") {
78
+ log.logMsg({ msg: `error: ${error}`.error.italic.bold, type: "error" })
79
+ } else {
80
+ let add_s = (error.error_count > 1) ? 's' : ''
81
+ log.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" })
82
+ }
83
+ })
84
+
85
+
@@ -0,0 +1,85 @@
1
+
2
+ var file_data = [
3
+ { props: { id: 100, name: "all", version: "1.00", absolute_path: __filename, check: true } },
4
+ { props: { id: 101, name: "func_all", version: "2.00", absolute_path: __filename, check: true } },
5
+ { props: { id: 102, name: "top_one", version: "1.00", absolute_path: __filename, check: true } },
6
+ { props: { id: 103, name: "bottom_one", version: "3.00", absolute_path: __filename, check: true } },
7
+ { props: { id: 104, name: "sync_all", version: "4.00", absolute_path: __filename, check: true } },
8
+ { props: { id: 105, name: "status", version: "5.00", absolute_path: __filename, check: true } },
9
+ { props: { id: 106, name: "name", version: "2.00", absolute_path: __filename, check: true } },
10
+ { props: { id: 107, name: "version", version: "3.00", absolute_path: __filename, check: true } }
11
+ ]
12
+
13
+ var file_object = class file_obj {
14
+ constructor(props) {
15
+ let t = this, fname = "file_obj.constructor"
16
+ try {
17
+ t.id = props.id
18
+ t.log = props.log
19
+ t.name = props.name
20
+ t.version = props.version
21
+ t.path = props.relative_path
22
+ t.absolute_path = props.absolute_path
23
+ t.errors = false
24
+ t.error_msg = 'none'
25
+
26
+ // if (t.id == 104) {
27
+ // t.errors = true
28
+ // t.error_msg = `some sort of error here`
29
+ // }
30
+
31
+ t.process = t.process.bind(t)
32
+ } catch (e) {
33
+ e.message = `${fname} error: ${e.message}`
34
+ throw e
35
+ }
36
+
37
+ return t
38
+ }
39
+
40
+ process(callback) {
41
+ let t = this
42
+ t.log({ msg: `processing object id ${t.id}. Do a bunch of stuff here.`.silly, type: "silly" })
43
+ if (t.errors)
44
+ callback({ error: { msg: t.error_msg } })
45
+ else
46
+ callback({ success: { msg: `id = ${t.id} name(${t.name}) version(${t.version})` } })
47
+ }
48
+ }
49
+
50
+ var lq = require("log-queue"),
51
+ log = new lq({
52
+ exclude_logMsg: ["debug"], /* example ["debug", "info"] */
53
+ }).init({appender: "console"}),
54
+ a_resolve, a_reject,
55
+ promise = new Promise((resolve, reject) => {
56
+ a_resolve = resolve
57
+ a_reject = reject
58
+ }),
59
+ bb = require("../app.js"),
60
+ base_queue = new bb({
61
+ parent: null,
62
+ relative_path: "./appenders/",
63
+ logMsg: log.logMsg,
64
+ resolve: a_resolve,
65
+ reject: a_reject
66
+ }).load({
67
+ appender: "json_version",
68
+ exclude_logMsg: [], /* default [] */
69
+ process_objects: [file_object],
70
+ include_version: ["2.00", "5.00"],
71
+ data_to_process_array: file_data
72
+ }).process()
73
+
74
+ promise.then((success) => {
75
+ log.logMsg({ msg: `Json all object processed successfully`.success.italic.bold, type: "success" })
76
+ }, (error) => {
77
+ if (typeof error == "string") {
78
+ log.logMsg({ msg: `error: ${error}`.error.italic.bold, type: "error" })
79
+ } else {
80
+ let add_s = (error.error_count > 1) ? 's' : ''
81
+ log.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" })
82
+ }
83
+ })
84
+
85
+
@@ -0,0 +1,85 @@
1
+
2
+ var file_data = [
3
+ { props: { id: 100, name: "all", version: "1.00", absolute_path: __filename, check: true } },
4
+ { props: { id: 101, name: "func_all", version: "2.00", absolute_path: __filename, check: true } },
5
+ { props: { id: 102, name: "top_one", version: "1.00", absolute_path: __filename, check: true } },
6
+ { props: { id: 103, name: "bottom_one", version: "3.00", absolute_path: __filename, check: true } },
7
+ { props: { id: 104, name: "sync_all", version: "4.00", absolute_path: __filename, check: true } },
8
+ { props: { id: 105, name: "status", version: "5.00", absolute_path: __filename, check: true } },
9
+ { props: { id: 106, name: "name", version: "2.00", absolute_path: __filename, check: true } },
10
+ { props: { id: 107, name: "version", version: "3.00", absolute_path: __filename, check: true } }
11
+ ]
12
+
13
+ var file_object = class file_obj {
14
+ constructor(props) {
15
+ let t = this, fname = "file_obj.constructor"
16
+ try {
17
+ t.id = props.id
18
+ t.log = props.log
19
+ t.name = props.name
20
+ t.version = props.version
21
+ t.path = props.relative_path
22
+ t.absolute_path = props.absolute_path
23
+ t.errors = false
24
+ t.error_msg = 'none'
25
+
26
+ // if (t.id == 104) {
27
+ // t.errors = true
28
+ // t.error_msg = `some sort of error here`
29
+ // }
30
+
31
+ t.process = t.process.bind(t)
32
+ } catch (e) {
33
+ e.message = `${fname} error: ${e.message}`
34
+ throw e
35
+ }
36
+
37
+ return t
38
+ }
39
+
40
+ process(callback) {
41
+ let t = this
42
+ t.log({ msg: `processing object id ${t.id}. Do a bunch of stuff here.`.silly, type: "silly" })
43
+ if (t.errors)
44
+ callback({ error: { msg: t.error_msg } })
45
+ else
46
+ callback({ success: { msg: `id = ${t.id} name(${t.name}) version(${t.version})` } })
47
+ }
48
+ }
49
+
50
+ var lq = require("log-queue"),
51
+ log = new lq({
52
+ exclude_logMsg: ["debug"], /* example ["debug", "info"] */
53
+ }).init({appender: "console"}),
54
+ a_resolve, a_reject,
55
+ promise = new Promise((resolve, reject) => {
56
+ a_resolve = resolve
57
+ a_reject = reject
58
+ }),
59
+ bb = require("../app.js"),
60
+ base_queue = new bb({
61
+ parent: null,
62
+ relative_path: "./appenders/",
63
+ logMsg: log.logMsg,
64
+ resolve: a_resolve,
65
+ reject: a_reject
66
+ }).load({
67
+ appender: "json_version",
68
+ exclude_logMsg: [], /* default [] */
69
+ process_objects: [file_object],
70
+ exclude_version: ["2.00", "5.00"],
71
+ data_to_process_array: file_data
72
+ }).process()
73
+
74
+ promise.then((success) => {
75
+ log.logMsg({ msg: `Json all object processed successfully`.success.italic.bold, type: "success" })
76
+ }, (error) => {
77
+ if (typeof error == "string") {
78
+ log.logMsg({ msg: `error: ${error}`.error.italic.bold, type: "error" })
79
+ } else {
80
+ let add_s = (error.error_count > 1) ? 's' : ''
81
+ log.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" })
82
+ }
83
+ })
84
+
85
+