queueobj 12.0.2 → 12.0.4
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 +1 -1
- package/app.js +52 -30
- package/lib/appenders/base.js +1 -1
- package/package.json +3 -3
- package/test/app.js +12 -11
- package/test/package.js +3 -4
- package/tests/test_all.js +1 -1
- package/tests/test_bottom_one.js +1 -1
- package/tests/test_func_all.js +1 -1
- package/tests/test_name.js +1 -1
- package/tests/test_status.js +1 -1
- package/tests/test_sync_all.js +1 -1
- package/tests/test_top_one.js +1 -1
- package/tests/test_version.js +1 -1
package/README.md
CHANGED
package/app.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/* @author Jim Manton: jrman@risebroadband.
|
|
1
|
+
/* @author Jim Manton: jrman@risebroadband.netfile_queue
|
|
2
2
|
* @since 2021-03-19
|
|
3
3
|
* Main processing app
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
var colors = require('colors'),
|
|
6
|
+
var colors = require('node-console-colors'),
|
|
7
7
|
file_queue = new require('file-obj-queue'),
|
|
8
8
|
file_requre_data = [
|
|
9
9
|
{ props: { id: 100, name: "all", path: "./lib/appenders/all.js", absolute_path: __filename, check: true } },
|
|
@@ -37,7 +37,8 @@ class QueueObj {
|
|
|
37
37
|
t.objs = []
|
|
38
38
|
t.resolve = null
|
|
39
39
|
t.reject = null
|
|
40
|
-
t.qRequire = new file_queue().init({ input_data: file_requre_data })
|
|
40
|
+
t.qRequire = new file_queue().init({ input_data: file_requre_data }) //jrm debug 1/29
|
|
41
|
+
console.log(`jrm debug 1/29 obj(${typeof t.qRequire})`)
|
|
41
42
|
|
|
42
43
|
t.load = t.load.bind(t)
|
|
43
44
|
t.process = t.process.bind(t)
|
|
@@ -220,38 +221,59 @@ class QueueObj {
|
|
|
220
221
|
return this.objs
|
|
221
222
|
}
|
|
222
223
|
|
|
223
|
-
process(props = {}) {
|
|
224
|
+
process(props = {}) { //jrm debug 1/29
|
|
225
|
+
let t = this, fname = `app process`, file_obj, jsObj, i
|
|
226
|
+
let pro = { 'dat_array': [''] }
|
|
224
227
|
try {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
return t.
|
|
231
|
-
|
|
232
|
-
return t.bottom_one.process(props)
|
|
233
|
-
case 'func_all':
|
|
234
|
-
return t.func_all.process(props)
|
|
235
|
-
case 'sync':
|
|
236
|
-
case 'sync_all':
|
|
237
|
-
return t.sync_all.process(props)
|
|
238
|
-
case 'name':
|
|
239
|
-
return t.name.process(props)
|
|
240
|
-
case 'status':
|
|
241
|
-
return t.status.process(props)
|
|
242
|
-
case 'version':
|
|
243
|
-
return t.version.process(props)
|
|
244
|
-
default:
|
|
245
|
-
throw new Error(`nothing to process`)
|
|
228
|
+
file_obj = t.qRequire.getFileObject()
|
|
229
|
+
for (i = 0; i < file_obj.length; i++) {
|
|
230
|
+
jsObj = file_obj[i]
|
|
231
|
+
if (jsObj.name == t.props.appender) {
|
|
232
|
+
pro.dat_array.push(`${jsObj.name}`)
|
|
233
|
+
return eval(`t.${jsObj.name}.process(props)`)
|
|
234
|
+
}
|
|
246
235
|
}
|
|
236
|
+
throw new Error('no appender found to process')
|
|
247
237
|
} catch (e) {
|
|
248
|
-
e.message
|
|
249
|
-
|
|
238
|
+
t.logMsg(`${fname}: ${e.message}`, { "type": "error" })
|
|
239
|
+
// e.message = "queueObj app.js load error: " + e.message
|
|
240
|
+
// t.logMsg(e.message.red)
|
|
250
241
|
throw (e)
|
|
251
|
-
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
// try {
|
|
247
|
+
// var t = this
|
|
248
|
+
// switch (t.props.appender) {
|
|
249
|
+
// case 'all':
|
|
250
|
+
// return t.all.process(props)
|
|
251
|
+
// case 'top_one':
|
|
252
|
+
// return t.top_one.process(props)
|
|
253
|
+
// case 'bottom_one':
|
|
254
|
+
// return t.bottom_one.process(props)
|
|
255
|
+
// case 'func_all':
|
|
256
|
+
// return t.func_all.process(props)
|
|
257
|
+
// case 'sync':
|
|
258
|
+
// case 'sync_all':
|
|
259
|
+
// return t.sync_all.process(props)
|
|
260
|
+
// case 'name':
|
|
261
|
+
// return t.name.process(props)
|
|
262
|
+
// case 'status':
|
|
263
|
+
// return t.status.process(props)
|
|
264
|
+
// case 'version':
|
|
265
|
+
// return t.version.process(props)
|
|
266
|
+
// default:
|
|
267
|
+
// throw new Error(`nothing to process`)
|
|
268
|
+
// }
|
|
269
|
+
// } catch (e) {
|
|
270
|
+
// e.message = "queueObj app.js load error: " + e.message
|
|
271
|
+
// t.logMsg(e.message.red)
|
|
272
|
+
// throw (e)
|
|
273
|
+
// }
|
|
252
274
|
}
|
|
253
275
|
}
|
|
254
276
|
|
|
255
|
-
exports = module.exports = function (
|
|
256
|
-
return new QueueObj(
|
|
277
|
+
exports = module.exports = function () {
|
|
278
|
+
return new QueueObj()
|
|
257
279
|
}
|
package/lib/appenders/base.js
CHANGED
package/package.json
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
"author": {
|
|
3
3
|
"name": "Jim Manton"
|
|
4
4
|
},
|
|
5
|
-
"version": "12.0.
|
|
5
|
+
"version": "12.0.4",
|
|
6
6
|
"bundleDependencies": [],
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"chai": "^4.3.7",
|
|
9
9
|
"diffler": "^2.0.4",
|
|
10
|
-
"file-obj-queue": "^1.0.
|
|
10
|
+
"file-obj-queue": "^1.0.18",
|
|
11
11
|
"mocha": "^10.2.0",
|
|
12
12
|
"node-console-colors": "^1.1.4",
|
|
13
|
-
"queuejson": "^
|
|
13
|
+
"queuejson": "^9.0.4"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"start": "node app.ts",
|
package/test/app.js
CHANGED
|
@@ -1,46 +1,47 @@
|
|
|
1
|
-
var assert = require('assert')
|
|
1
|
+
var assert = require('assert')
|
|
2
2
|
|
|
3
3
|
describe('app', function () {
|
|
4
|
-
let app, application
|
|
4
|
+
let app, application, file_queue
|
|
5
5
|
|
|
6
6
|
it('app.constructor should pass', function () {
|
|
7
|
-
application = require('../app.js')
|
|
7
|
+
application = require('../app.js'),
|
|
8
|
+
file_queue = new require('file-obj-queue')
|
|
8
9
|
assert(app = new application())
|
|
9
10
|
})
|
|
10
11
|
|
|
11
12
|
it('app.process is a function', function () {
|
|
12
13
|
assert(typeof app.process == 'function')
|
|
13
14
|
})
|
|
14
|
-
|
|
15
|
+
|
|
15
16
|
it('app.getParent is a function', function () {
|
|
16
17
|
assert(typeof app.getParent == 'function')
|
|
17
18
|
})
|
|
18
|
-
|
|
19
|
+
|
|
19
20
|
it('app.getObjectToProcess is a function', function () {
|
|
20
21
|
assert(typeof app.getObjectToProcess == 'function')
|
|
21
22
|
})
|
|
22
|
-
|
|
23
|
+
|
|
23
24
|
it('app.getObjectById is a function', function () {
|
|
24
25
|
assert(typeof app.getObjectById == 'function')
|
|
25
26
|
})
|
|
26
|
-
|
|
27
|
+
|
|
27
28
|
it('app.getObjs is a function', function () {
|
|
28
29
|
assert(typeof app.getObjs == 'function')
|
|
29
30
|
})
|
|
30
|
-
|
|
31
|
+
|
|
31
32
|
it('app.logMsg is a function', function () {
|
|
32
33
|
assert(typeof app.logMsg == 'function')
|
|
33
34
|
})
|
|
34
35
|
})
|
|
35
36
|
|
|
36
37
|
describe('require', function () {
|
|
37
|
-
|
|
38
|
+
|
|
38
39
|
it('base', function () {
|
|
39
40
|
assert(require('../lib/appenders/base'))
|
|
40
41
|
})
|
|
41
42
|
|
|
42
|
-
it('colors
|
|
43
|
-
assert(require('colors'))
|
|
43
|
+
it('node-console-colors', function () {
|
|
44
|
+
assert(require('node-console-colors'))
|
|
44
45
|
})
|
|
45
46
|
|
|
46
47
|
it('all appender', function () {
|
package/test/package.js
CHANGED
|
@@ -6,15 +6,14 @@ const packageMock = {
|
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Jim Manton"
|
|
8
8
|
},
|
|
9
|
-
"version": "12.0.
|
|
9
|
+
"version": "12.0.4",
|
|
10
10
|
"bundleDependencies": [],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chai": "^4.3.7",
|
|
13
13
|
"diffler": "^2.0.4",
|
|
14
|
-
"file-obj-queue": "^1.0.
|
|
14
|
+
"file-obj-queue": "^1.0.24",
|
|
15
15
|
"mocha": "^10.2.0",
|
|
16
|
-
"node-console-colors": "^1.1.4"
|
|
17
|
-
"queuejson": "^8.4.0"
|
|
16
|
+
"node-console-colors": "^1.1.4"
|
|
18
17
|
},
|
|
19
18
|
"scripts": {
|
|
20
19
|
"start": "node app.ts",
|
package/tests/test_all.js
CHANGED
package/tests/test_bottom_one.js
CHANGED
package/tests/test_func_all.js
CHANGED
package/tests/test_name.js
CHANGED
package/tests/test_status.js
CHANGED
package/tests/test_sync_all.js
CHANGED
package/tests/test_top_one.js
CHANGED