queueobj 12.0.3 → 12.0.5

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/README.md CHANGED
@@ -1,12 +1,5 @@
1
- [![npm Package](https://img.shields.io/npm/v/queueobj.svg)](https://www.npmjs.org/package/queueobj)
2
- [![License](https://img.shields.io/npm/l/queueobj.svg)](https://github.com/jman717/queueobj/blob/master/LICENSE)
3
-
4
- [![NPM](https://nodei.co/npm/queueobj.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/queueobj/)
5
-
6
1
  Queue javascript objects dynamically then process the queue according to the appender.
7
2
 
8
- ---------
9
-
10
3
  Included tag appenders:
11
4
 
12
5
  * all - synchronous - process all added objects.
@@ -18,6 +11,11 @@ Included tag appenders:
18
11
  * name - synchronous - queue and process all objects by name.
19
12
  * version - synchronous - queue and process all objects by version.
20
13
 
14
+ Installation
15
+ ---------
16
+
17
+ [![NPM](https://nodei.co/npm/queueobj.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/queueobj/)
18
+
21
19
  Mocha Test
22
20
  ---------
23
21
  ```
@@ -42,7 +40,7 @@ Usage
42
40
  ---------
43
41
  ```js
44
42
 
45
- var colors = require('node-console-colors')
43
+ var colors = require('colors')
46
44
  var queue = require("queueobj");
47
45
 
48
46
  class test1 {
package/app.js CHANGED
@@ -3,20 +3,18 @@
3
3
  * Main processing app
4
4
  */
5
5
 
6
- var colors = require('node-console-colors'),
7
- file_queue = new require('file-obj-queue'),
8
- file_requre_data = [
9
- { props: { id: 100, name: "all", path: "./lib/appenders/all.js", absolute_path: __filename, check: true } },
10
- { props: { id: 101, name: "func_all", path: "./lib/appenders/func_all.js", absolute_path: __filename, check: true } },
11
- { props: { id: 102, name: "top_one", path: "./lib/appenders/top_one.js", absolute_path: __filename, check: true } },
12
- { props: { id: 103, name: "bottom_one", path: "./lib/appenders/bottom_one.js", absolute_path: __filename, check: true } },
13
- { props: { id: 104, name: "sync_all", path: "./lib/appenders/sync_all.js", absolute_path: __filename, check: true } },
14
- { props: { id: 105, name: "status", path: "./lib/appenders/status.js", absolute_path: __filename, check: true } },
15
- { props: { id: 106, name: "name", path: "./lib/appenders/name.js", absolute_path: __filename, check: true } },
16
- { props: { id: 107, name: "version", path: "./lib/appenders/version.js", absolute_path: __filename, check: true } }
17
- ]
6
+ var colors = require('colors'),
7
+ all = require('./lib/appenders/all'),
8
+ func_all = require('./lib/appenders/func_all'),
9
+ top_one = require('./lib/appenders/top_one'),
10
+ bottom_one = require('./lib/appenders/bottom_one'),
11
+ sync_all = require('./lib/appenders/sync_all'),
12
+ status = require('./lib/appenders/status'),
13
+ name = require('./lib/appenders/name'),
14
+ version = require('./lib/appenders/version')
18
15
 
19
16
  class QueueObj {
17
+
20
18
  constructor() {
21
19
  try {
22
20
  var t = this
@@ -28,7 +26,6 @@ class QueueObj {
28
26
  t.bottom_one = null
29
27
  t.array = null
30
28
  t.status = null
31
- t.name = null
32
29
  t.version = null
33
30
  t.stats = false
34
31
  t.sync_all = null
@@ -37,15 +34,14 @@ class QueueObj {
37
34
  t.objs = []
38
35
  t.resolve = null
39
36
  t.reject = null
40
- t.qRequire = new file_queue().init({ input_data: file_requre_data })
41
37
 
42
- t.load = t.load.bind(t)
43
- t.process = t.process.bind(t)
44
- t.getParent = t.getParent.bind(t)
45
- t.getObjectToProcess = t.getObjectToProcess.bind(t)
46
- t.getObjectById = t.getObjectById.bind(t)
47
- t.getObjs = t.getObjs.bind(t)
48
- t.logMsg = t.logMsg.bind(t)
38
+ t.load = t.load.bind(this)
39
+ t.process = t.process.bind(this)
40
+ t.getParent = t.getParent.bind(this)
41
+ t.getObjectToProcess = t.getObjectToProcess.bind(this)
42
+ t.getObjectById = t.getObjectById.bind(this)
43
+ t.getObjs = t.getObjs.bind(this)
44
+ t.logMsg = t.logMsg.bind(this)
49
45
  return t
50
46
  } catch (e) {
51
47
  e.message = "queueObj app.js constructor error: " + e.message
@@ -121,21 +117,44 @@ class QueueObj {
121
117
 
122
118
  load(props) {
123
119
  try {
124
- var t = this, file_obj, obj
120
+ var t = this
125
121
  t.props = props
126
- file_obj = t.qRequire.getFileObject()
127
-
128
122
  t.stats = (typeof props.stats != 'undefined') ? props.stats : false;
129
123
  if (typeof props != `undefined`) {
130
124
  if (typeof props.appender != `undefined` &&
131
125
  typeof props.appender == 'string') {
132
126
  props.getParent = t.getParent
133
- file_obj.map((jsObj, i) => {
134
- if (jsObj.name == props.appender) {
135
- obj = require(jsObj.path)
136
- eval(`t.${jsObj.name} = new obj(props)`)
137
- }
138
- })
127
+ switch (props.appender) {
128
+ case 'all':
129
+ t.all = new all(props)
130
+ break
131
+ case 'top_one':
132
+ t.top_one = new top_one(props)
133
+ break
134
+ case 'bottom_one':
135
+ t.bottom_one = new bottom_one(props)
136
+ break
137
+ case 'func_all':
138
+ t.func_all = new func_all(props)
139
+ break
140
+ case 'array':
141
+ t.array = new array(props)
142
+ break
143
+ case 'status':
144
+ t.status = new status(props)
145
+ break
146
+ case 'version':
147
+ t.version = new version(props)
148
+ break
149
+ case 'sync_all':
150
+ t.sync_all = new sync_all(props)
151
+ break
152
+ case 'name':
153
+ t.name = new name(props)
154
+ break
155
+ default:
156
+ throw new Error(`appender(${props.appender}) not found`)
157
+ }
139
158
  }
140
159
  return t
141
160
  }
@@ -2,9 +2,10 @@
2
2
  * @author Jim Manton: jrman@risebroadband.net
3
3
  * @since 2017-10-01
4
4
  * lib/appenders/base.js
5
+ * jrm debug 8/4 https://www.npmjs.com/package/temporary-stamp
5
6
  */
6
7
 
7
- var colors = require('node-console-colors')
8
+ var colors = require('colors')
8
9
 
9
10
  class process_all_obj {
10
11
  constructor(props) {
@@ -146,10 +147,11 @@ exports = module.exports = class base {
146
147
  let t = this
147
148
  t.dt_end = new Date();
148
149
  let ret_str = '', st = t.dt_start, ed = t.dt_end, ml = t.dt_end - t.dt_start
150
+ // ret_str += JSON.stringify(t.results_array)
149
151
  if (t.getParent().getStats()) {
150
152
  ret_str += `start (${st}) end(${ed}) milliseconds(${ml})`
151
153
  }
152
- return ret_str
154
+ return ret_str //jrm debug
153
155
  }
154
156
 
155
157
  process_all = () => {
package/package.json CHANGED
@@ -2,15 +2,13 @@
2
2
  "author": {
3
3
  "name": "Jim Manton"
4
4
  },
5
- "version": "12.0.3",
6
- "bundleDependencies": [],
5
+ "version": "12.0.5",
6
+ "bundleDependencies": false,
7
7
  "dependencies": {
8
8
  "chai": "^4.3.7",
9
- "diffler": "^2.0.4",
10
- "file-obj-queue": "^1.0.1",
11
- "mocha": "^10.2.0",
12
9
  "node-console-colors": "^1.1.4",
13
- "queuejson": "^8.4.0"
10
+ "diffler": "^2.0.4",
11
+ "mocha": "^10.2.0"
14
12
  },
15
13
  "scripts": {
16
14
  "start": "node app.ts",
package/test/app.js CHANGED
@@ -39,8 +39,8 @@ describe('require', function () {
39
39
  assert(require('../lib/appenders/base'))
40
40
  })
41
41
 
42
- it('node-console-colors', function () {
43
- assert(require('node-console-colors'))
42
+ it('colors app', function () {
43
+ assert(require('colors'))
44
44
  })
45
45
 
46
46
  it('all appender', function () {
package/test/package.js CHANGED
@@ -6,15 +6,13 @@ const packageMock = {
6
6
  "author": {
7
7
  "name": "Jim Manton"
8
8
  },
9
- "version": "12.0.3",
10
- "bundleDependencies": [],
9
+ "version": "12.0.5",
10
+ "bundleDependencies": false,
11
11
  "dependencies": {
12
12
  "chai": "^4.3.7",
13
- "diffler": "^2.0.4",
14
- "file-obj-queue": "^1.0.1",
15
- "mocha": "^10.2.0",
16
13
  "node-console-colors": "^1.1.4",
17
- "queuejson": "^8.4.0"
14
+ "diffler": "^2.0.4",
15
+ "mocha": "^10.2.0"
18
16
  },
19
17
  "scripts": {
20
18
  "start": "node app.ts",
package/tests/test_all.js CHANGED
@@ -1,4 +1,4 @@
1
- var colors = require('node-console-colors'),
1
+ var colors = require('colors'),
2
2
  queue = require("../app.js")
3
3
 
4
4
  class test1 {
@@ -1,4 +1,4 @@
1
- var colors = require('node-console-colors'),
1
+ var colors = require('colors'),
2
2
  queue = require("../app.js")
3
3
 
4
4
  class test1 {
@@ -1,4 +1,4 @@
1
- var colors = require('node-console-colors'),
1
+ var colors = require('colors'),
2
2
  queue = require("../app.js");
3
3
 
4
4
  class test1 {
@@ -4,7 +4,7 @@
4
4
  * test_name.js
5
5
  */
6
6
 
7
- var colors = require('node-console-colors'),
7
+ var colors = require('colors'),
8
8
  queue = require("../app.js")
9
9
 
10
10
  class test1 {
@@ -32,8 +32,8 @@ class test2 {
32
32
 
33
33
  process(callback) {
34
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
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
37
  }
38
38
 
39
39
  ping() {
@@ -69,7 +69,7 @@ class test4 {
69
69
  }
70
70
  }
71
71
 
72
- let qObj = new queue(), props = { appender: 'name', stats: true }
72
+ let qObj = new queue(), props = { appender: 'status', stats: true }
73
73
 
74
74
  qObj.load(props).add(new test1()).add(new test2()).add(new test3()).add(new test4())
75
75
 
@@ -4,7 +4,7 @@
4
4
  * test_status.js
5
5
  */
6
6
 
7
- var colors = require('node-console-colors'),
7
+ var colors = require('colors'),
8
8
  queue = require("../app.js")
9
9
 
10
10
  class test1 {
@@ -4,7 +4,7 @@
4
4
  * test_sync.js
5
5
  */
6
6
 
7
- var colors = require('node-console-colors'),
7
+ var colors = require('colors'),
8
8
  queue = require("../app.js")
9
9
 
10
10
  class test1 {
@@ -1,4 +1,4 @@
1
- var colors = require('node-console-colors'),
1
+ var colors = require('colors'),
2
2
  queue = require("../app.js");
3
3
 
4
4
  class test1 {
@@ -4,7 +4,7 @@
4
4
  * test_status.js
5
5
  */
6
6
 
7
- var colors = require('node-console-colors'),
7
+ var colors = require('colors'),
8
8
  queue = require("../app.js")
9
9
 
10
10
  class test1 {