Comparing version 12.0.18 to 13.0.0
375
app.js
/* @author Jim Manton: jrman@risebroadband.net | ||
* @since 2021-03-19 | ||
* @since 2023-01-15 | ||
* Main processing app | ||
*/ | ||
var colors = require('colors'), | ||
all = require('./lib/appenders/all'), | ||
func_all = require('./lib/appenders/func_all'), | ||
top_one = require('./lib/appenders/top_one'), | ||
bottom_one = require('./lib/appenders/bottom_one'), | ||
sync_all = require('./lib/appenders/sync_all'), | ||
status = require('./lib/appenders/status'), | ||
name = require('./lib/appenders/name'), | ||
version = require('./lib/appenders/version') | ||
let base_queue = require("base-queue"), | ||
log_queue = require("log-queue"), | ||
fs = require('fs'), | ||
validPath = require('valid-path') | ||
class QueueObj { | ||
const { memoryUsage } = require('process') | ||
constructor() { | ||
try { | ||
var t = this | ||
t.id = 0 | ||
t.appenders_dir = './lib/appenders/' | ||
t.props = {} | ||
t.all = null | ||
t.top_one = null | ||
t.bottom_one = null | ||
t.array = null | ||
t.status = null | ||
t.version = null | ||
t.stats = false | ||
t.sync_all = null | ||
t.name = null | ||
t.func_all = null | ||
t.objs = [] | ||
t.resolve = null | ||
t.reject = null | ||
var log_data = [ | ||
{ props: { id: 100, name: "console_basic", absolute_path: __filename, check: true } } | ||
] | ||
t.load = t.load.bind(this) | ||
t.process = t.process.bind(this) | ||
t.getParent = t.getParent.bind(this) | ||
t.getObjectToProcess = t.getObjectToProcess.bind(this) | ||
t.getObjectById = t.getObjectById.bind(this) | ||
t.getObjs = t.getObjs.bind(this) | ||
t.logMsg = t.logMsg.bind(this) | ||
return t | ||
} catch (e) { | ||
e.message = "queueObj app.js constructor error: " + e.message | ||
throw (e) | ||
var log_object = class log_obj { | ||
constructor(props) { | ||
let t = this | ||
t.id = props.id | ||
t.log = props.log | ||
t.name = props.name | ||
t.path = props.relative_path | ||
t.absolute_path = props.absolute_path | ||
t.status = 'init' | ||
t.errors = false | ||
t.error_msg = 'none' | ||
t.process = t.process.bind(t) | ||
t.do_checks = t.do_checks.bind(t) | ||
if (props.check) { | ||
t.do_checks() | ||
} | ||
} | ||
getStats() { | ||
return this.stats | ||
return t | ||
} | ||
getObjectById(id) { | ||
let t = this, i | ||
for (i = 0; i < t.objs.length; i++) { | ||
if (typeof t.objs[i] != 'undefined' && | ||
typeof t.objs[i].id != 'undefined' && | ||
t.objs[i].id == id) { | ||
return t.objs[i] | ||
} | ||
do_checks() { | ||
let t = this, path_to_check, | ||
last_item = t.absolute_path.split("\\").pop(), | ||
check_file = t.absolute_path.split(last_item)[0], check_path = t.path.split('../') | ||
check_file = check_file.replace(/\\/g, "/"); | ||
path_to_check = validPath(t.path); | ||
if (!path_to_check.valid) { | ||
t.errors = true | ||
t.error_msg = `id = ${t.id} name(${t.name}) Error in ${path_to_check.data.input}: ${path_to_check.error})` | ||
} | ||
return null | ||
} | ||
getObjectByStatus(status) { | ||
let t = this, i | ||
for (i = 0; i < t.objs.length; i++) { | ||
if (typeof t.objs[i] != 'undefined' && | ||
typeof t.objs[i].status != 'undefined' && | ||
t.objs[i].status == status) { | ||
return t.objs[i] | ||
// check_path.map((dat, i) => { | ||
// if (/^[a-zA-Z._]+$/.test(dat)) { | ||
// if (dat != '.' || dat != '..') | ||
// check_file += dat + '/' | ||
// } | ||
// }) | ||
// check_file = check_file.slice(0, -1) | ||
check_file += check_path[1] | ||
check_file += `${t.name}.js` | ||
try { | ||
if (!fs.existsSync(check_file)) { | ||
t.errors = true | ||
t.error_msg = `id = ${t.id} name(${t.name}) file (${check_file} does not exist)` | ||
} | ||
} catch (e) { | ||
e.message = "file_obj do_checks error: " + e.message | ||
throw (e) | ||
} | ||
return null | ||
} | ||
getObjectByVersion(version) { | ||
let t = this, i | ||
for (i = 0; i < t.objs.length; i++) { | ||
if (typeof t.objs[i] != 'undefined' && | ||
typeof t.objs[i].version != 'undefined' && | ||
t.objs[i].version == version) { | ||
return t.objs[i] | ||
} | ||
process(callback) { | ||
let t = this | ||
if (t.errors) | ||
callback({ error: {msg: t.error_msg} }) | ||
else { | ||
callback({ success: {msg: `id = ${t.id} name(${t.name}) success`} }) | ||
} | ||
return null | ||
} | ||
} | ||
count() { | ||
return this.objs.length | ||
} | ||
exports = module.exports = class QueueObj { | ||
constructor() { | ||
var t = this, fname = 'QueueObj.constructor' | ||
try { | ||
t.promise = null | ||
t.resolve = null | ||
t.reject = null | ||
t.promise_2q = null | ||
t.resolve_2q = null | ||
t.reject_2q = null | ||
t.successMsg = '' | ||
t.log_queue = null | ||
get(num) { | ||
if (num < this.objs.length) | ||
return this.objs[num] | ||
return false | ||
} | ||
t.logMsg = t.logMsg.bind(t) | ||
t.init = t.init.bind(t) | ||
t.process = t.process.bind(t) | ||
t.getFileObject = t.getFileObject.bind(t) | ||
getObjectToProcess() { | ||
return this.objs.shift() | ||
} | ||
// t.logMsg(`QueueObj.constructor`.debug) | ||
getBottomObjectToProcess() { | ||
return this.objs.pop() | ||
return t | ||
} catch (e) { | ||
e.message = `QueueObj app.js constructor error: ${e.message}`.error | ||
console.log(e.message) | ||
} | ||
} | ||
getItemToProcess(itm) { | ||
return this.objs[itm] | ||
} | ||
logMsg(msg, props = {}) { | ||
console.log(msg) | ||
} | ||
load(props) { | ||
init() { | ||
var t = this, fname = `QueueObj.init` | ||
try { | ||
var t = this | ||
t.props = props | ||
t.stats = (typeof props.stats != 'undefined') ? props.stats : false; | ||
if (typeof props != `undefined`) { | ||
if (typeof props.appender != `undefined` && | ||
typeof props.appender == 'string') { | ||
props.getParent = t.getParent | ||
switch (props.appender) { | ||
case 'all': | ||
t.all = new all(props) | ||
break | ||
case 'top_one': | ||
t.top_one = new top_one(props) | ||
break | ||
case 'bottom_one': | ||
t.bottom_one = new bottom_one(props) | ||
break | ||
case 'func_all': | ||
t.func_all = new func_all(props) | ||
break | ||
case 'array': | ||
t.array = new array(props) | ||
break | ||
case 'status': | ||
t.status = new status(props) | ||
break | ||
case 'version': | ||
t.version = new version(props) | ||
break | ||
case 'sync_all': | ||
t.sync_all = new sync_all(props) | ||
break | ||
case 'name': | ||
t.name = new name(props) | ||
break | ||
default: | ||
throw new Error(`appender(${props.appender}) not found`) | ||
} | ||
} | ||
return t | ||
} | ||
t.promise = new Promise((resolve, reject) => { | ||
t.resolve = resolve | ||
t.reject = reject | ||
}) | ||
t.promise_2q= new Promise((resolve, reject) => { | ||
t.resolve_2q = resolve | ||
t.reject_2q = reject | ||
}) | ||
return t | ||
} catch (e) { | ||
e.message = "queueObj app.js load error: " + e.message | ||
t.logMsg(e.message) | ||
throw (e) | ||
t.logMsg({ msg: `${fname} error: (${e.message})`.error, type: 'error' }) | ||
// e.message = `QueueObj app.js constructor error: ${e.message}`.error | ||
// console.log(e.message) | ||
} | ||
} | ||
add(obj) { | ||
var t = this | ||
try { | ||
if (t.all != null) { | ||
obj._getProperty = (o) => { | ||
return 'all' | ||
} | ||
} | ||
if (t.top_one != null) { | ||
obj._getProperty = (o) => { | ||
return 'top_one' | ||
} | ||
} | ||
if (t.bottom_one != null) { | ||
t.objs = [] | ||
obj._getProperty = (o) => { | ||
return 'bottom_one' | ||
} | ||
} | ||
if (t.func_all != null) { | ||
obj._getProperty = (o) => { | ||
return 'func_all' | ||
} | ||
} | ||
if (t.sync_all != null) { | ||
obj._getProperty = (o) => { | ||
return 'sync_all' | ||
} | ||
} | ||
if (t.name != null) { | ||
obj._getProperty = (o) => { | ||
return 'name' | ||
} | ||
} | ||
if (typeof obj.status != 'undefined') { | ||
obj._getProperty = (o) => { | ||
return o.status | ||
} | ||
process(props = {}) { | ||
let t = this, fname = `app.process` | ||
} | ||
if (typeof obj.name != 'undefined') { | ||
obj._getProperty = (o) => { | ||
return o.name | ||
} | ||
// if (typeof props.data_to_process_array == 'undefined') | ||
// t.reject('base_queue no props.data_to_process_array') | ||
} | ||
if (typeof obj.version != 'undefined') { | ||
obj._getProperty = (o) => { | ||
return o.version | ||
} | ||
} | ||
if (t.top_one != null) { | ||
if (t.objs.length == 0) { | ||
t.objs.push(obj) | ||
} | ||
return t | ||
} | ||
t.objs.push(obj) | ||
return t | ||
if (typeof props.appender == 'undefined') | ||
t.reject('base_queue no props.appender') | ||
if (typeof props.process_objects == 'undefined') | ||
t.reject(`props.process_objects not defined`) | ||
try { | ||
t.log_queue = new log_queue({ | ||
parent: t, | ||
relative_path: "../base_queue/appenders/log/", | ||
exclude_logMsg: props.exclude_logMsg, | ||
resolve: t.resolve, | ||
reject: t.reject | ||
}).init({ | ||
appender: "console_basic", | ||
process_objects: [log_object], | ||
data_to_process_array: log_data | ||
}) | ||
t.base_queue = new base_queue({ | ||
parent: t, | ||
relative_path: "./appenders/", | ||
logMsg: t.logMsg, | ||
resolve: t.resolve_2q, | ||
reject: t.reject_2q | ||
}).load(props).process() | ||
return t.promise_2q | ||
} catch (e) { | ||
e.message = "queueObj app.js add error: " + e.message | ||
t.logMsg(e.message.red) | ||
throw (e) | ||
console.log(`${fname} error: (${e.message})`) | ||
} | ||
} | ||
getParent() { | ||
return this | ||
getFileObject() { | ||
return this.qJson.get_class_obj_array() | ||
} | ||
getObjs() { | ||
return this.objs | ||
} | ||
process(props = {}) { | ||
logMsg(props = { msg: '', type: '' }) { | ||
let t = this, fname = "QueueObj.logMsg" | ||
try { | ||
var t = this | ||
switch (t.props.appender) { | ||
case 'all': | ||
return t.all.process(props) | ||
case 'top_one': | ||
return t.top_one.process(props) | ||
case 'bottom_one': | ||
return t.bottom_one.process(props) | ||
case 'func_all': | ||
return t.func_all.process(props) | ||
case 'sync': | ||
case 'sync_all': | ||
return t.sync_all.process(props) | ||
case 'name': | ||
return t.name.process(props) | ||
case 'status': | ||
return t.status.process(props) | ||
case 'version': | ||
return t.version.process(props) | ||
default: | ||
throw new Error(`nothing to process`) | ||
if (typeof props.msg == "undefined") | ||
throw new Error(`no msg property in (${JSON.stringify(props)}) `) | ||
if (typeof props.type == "undefined") | ||
throw new Error(`no type property in (${JSON.stringify(props)}) `) | ||
if (t.log_queue != null && typeof t.log_queue.logMsg != 'undefined') { | ||
t.log_queue.logMsg(props) | ||
} else { | ||
throw new Error(`t.log_queue does not exist`) | ||
} | ||
} catch (e) { | ||
e.message = "queueObj app.js load error: " + e.message | ||
t.logMsg(e.message.red) | ||
throw (e) | ||
e.message = `${fname} error: ${e.message})` | ||
t.reject(e.message) | ||
} | ||
} | ||
} | ||
exports = module.exports = function (props) { | ||
return new QueueObj(props) | ||
} |
/* | ||
* @author Jim Manton: jrman@risebroadband.net | ||
* @since 2021-03-22l | ||
* @since 2023-2-5l | ||
* lib/appenders/all.js | ||
@@ -5,0 +5,0 @@ */ |
/* | ||
* @author Jim Manton: jrman@risebroadband.net | ||
* @since 2017-10-01 | ||
* @since 2023-02-06 | ||
* lib/appenders/base.js | ||
* jrm debug 8/4 https://www.npmjs.com/package/temporary-stamp | ||
*/ | ||
@@ -77,3 +76,3 @@ | ||
} catch (e) { | ||
t.parent.getParent().logMsg(`pro obj error: (${e.message})`.red) | ||
t.parent.getParent().logMsg({msg: `pro obj error: (${e.message})`.error, type: "error"}) | ||
throw e | ||
@@ -155,3 +154,3 @@ } | ||
} | ||
return ret_str //jrm debug | ||
return ret_str | ||
} | ||
@@ -158,0 +157,0 @@ |
/* | ||
* @author Jim Manton: jrman@risebroadband.net | ||
* @since 2021-03-22 | ||
* @since 2023-2-5 | ||
* lib/appenders/bottom_one.js | ||
@@ -5,0 +5,0 @@ */ |
/* | ||
* @author Jim Manton: jrman@risebroadband.net | ||
* @since 2021-03-22 | ||
* @since 2023-2-5 | ||
* lib/appenders/func_all.js | ||
@@ -5,0 +5,0 @@ */ |
/* | ||
* @author Jim Manton: jrman@risebroadband.net | ||
* @since 2021-03-22 | ||
* @since 2023-2-5 | ||
* lib/appenders/sync_all.js | ||
@@ -5,0 +5,0 @@ */ |
/* | ||
* @author Jim Manton: jrman@risebroadband.net | ||
* @since 2021-03-22 | ||
* @since 2023-2-5 | ||
* lib/appenders/sync.js | ||
@@ -5,0 +5,0 @@ */ |
/* | ||
* @author Jim Manton: jrman@risebroadband.net | ||
* @since 2021-03-22 | ||
* @since 2023-2-5 | ||
* lib/appenders/top_one.js | ||
@@ -5,0 +5,0 @@ */ |
/* | ||
* @author Jim Manton: jrman@risebroadband.net | ||
* @since 2021-03-22 | ||
* @since 2023-2-5 | ||
* lib/appenders/status.js | ||
@@ -5,0 +5,0 @@ */ |
@@ -5,9 +5,15 @@ { | ||
}, | ||
"version": "12.0.18", | ||
"bundleDependencies": false, | ||
"version": "13.0.0", | ||
"bundleDependencies": [], | ||
"dependencies": { | ||
"@types/node": "^18.11.19", | ||
"base-queue": "^1.0.0", | ||
"chai": "^4.3.7", | ||
"colors": "^1.1.4", | ||
"colors": "^1.4.0", | ||
"diffler": "^2.0.4", | ||
"mocha": "^10.2.0" | ||
"fs": "^0.0.1-security", | ||
"log-queue": "^1.0.0", | ||
"mocha": "^10.2.0", | ||
"queuejson": "^9.0.11", | ||
"valid-path": "^2.1.0" | ||
}, | ||
@@ -18,10 +24,23 @@ "scripts": { | ||
"ditched": "ditched -a", | ||
"test_all": "node ./tests/test_all", | ||
"test_bottom_one": "node ./tests/test_bottom_one", | ||
"test_func_all": "node ./tests/test_func_all", | ||
"test_sync_all": "node ./tests/test_sync_all", | ||
"test_status": "node ./tests/test_status", | ||
"test_name": "node ./tests/test_name", | ||
"test_top_one": "node ./tests/test_top_one", | ||
"test_version": "node ./tests/test_version" | ||
"test_files": "node ./tests/files", | ||
"test_all": "node ./tests/all", | ||
"test_top_one": "node ./tests/top_one", | ||
"test_bottom_one": "node ./tests/bottom_one", | ||
"test_func_all": "node ./tests/func_all", | ||
"test_status_matching": "node ./tests/status_matching", | ||
"test_status_non_matching": "node ./tests/status_non_matching", | ||
"test_name_matching": "node ./tests/name_matching", | ||
"test_name_non_matching": "node ./tests/name_non_matching", | ||
"test_version_matching": "node ./tests/version_matching", | ||
"test_version_non_matching": "node ./tests/version_non_matching", | ||
"test_json_all": "node ./tests/json_all", | ||
"test_json_top_one": "node ./tests/json_top_one", | ||
"test_json_bottom_one": "node ./tests/json_bottom_one", | ||
"test_json_func_all": "node ./tests/json_func_all", | ||
"test_json_status_matching": "node ./tests/json_status_matching", | ||
"test_json_status_non_matching": "node ./tests/json_status_non_matching", | ||
"test_json_version_matching": "node ./tests/json_version_matching", | ||
"test_json_version_non_matching": "node ./tests/json_version_non_matching", | ||
"test_json_name_matching": "node ./tests/json_name_matching", | ||
"test_json_name_non_matching": "node ./tests/json_name_non_matching" | ||
}, | ||
@@ -38,9 +57,9 @@ "keywords": [ | ||
], | ||
"homepage": "https://github.com/jman717/QueueObj", | ||
"homepage": "https://github.com/jman717/queueobj", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/jman717/QueueObj.git" | ||
"url": "git+https://github.com/jman717/queueobj" | ||
}, | ||
"deprecated": false, | ||
"description": "Queue Objects For Processing", | ||
"description": "Queue File Objects", | ||
"email": "jrman@risebroadband.net", | ||
@@ -47,0 +66,0 @@ "license": "MIT", |
164
README.md
@@ -8,15 +8,23 @@ [![npm Package](https://img.shields.io/npm/v/queueobj.svg)](https://www.npmjs.org/package/queueobj) | ||
Queue javascript objects dynamically then process the queue according to the appender. | ||
Queue javascript objects dynamically then process the queue according to the appender. All appenders are handled synchronously. | ||
Included tag appenders: | ||
* all - synchronous - process all added objects. | ||
* func_all - synchronous - process custom functions to added objects. | ||
* top_one - synchronous - process only the object in the 0(zero) position of the process array. | ||
* bottom_one - synchronous - process only the object in the last position of the process array. | ||
* sync_all - synchronous - All appenders are synchronous now. Sync_all is no different than all. | ||
* status - synchronous - queue and process all objects by status. | ||
* name - synchronous - queue and process all objects by name. | ||
* version - synchronous - queue and process all objects by version. | ||
* files - See if inputed files exists. | ||
* all - process all added objects. | ||
* top_one - process only the object in the 0(zero) position of the process array. | ||
* bottom_one - process only the object in the last position of the process array. | ||
* func_all - process custom function names in created objects. Custom processing names can be used in any appender, this is just one example. | ||
* status - queue and process all objects by status. | ||
* name - queue and process all objects by name. | ||
* version - queue and process all objects by version. | ||
* json_all - process a class object per json input array variables. | ||
* json_top_one - process a class object per the first json input array variable. | ||
* json_bottom_one - process a class object per the last json input array variable. | ||
* json_func_all - process custom function names in created objects. Custom processing names can be used in any json appender, this is just one example. | ||
* json_status - queue and process all objects by status. | ||
* json_name - queue and process all objects by name. | ||
* json_version - queue and process all objects by version. | ||
Mocha Test | ||
@@ -31,2 +39,3 @@ --------- | ||
``` | ||
npm run test_files | ||
npm run test_all | ||
@@ -36,6 +45,18 @@ npm run test_top_one | ||
npm run test_func_all | ||
npm run test_sync_all | ||
npm run test_status | ||
npm run test_version | ||
npm run test_name | ||
npm run test_status_matching | ||
npm run test_status_non_matching | ||
npm run test_name_matching | ||
npm run test_name_non_matching | ||
npm run test_version_matching | ||
npm run test_version_non_matching | ||
npm run test_json_all | ||
npm run test_json_top_one | ||
npm run test_json_bottom_one | ||
npm run test_json_func_all | ||
npm run test_json_status_matching | ||
npm run test_json_status_non_matching | ||
npm run test_json_version_matching | ||
npm run test_json_version_non_matching | ||
npm run test_json_name_matching | ||
npm run test_json_name_non_matching | ||
@@ -48,72 +69,79 @@ ``` | ||
var colors = require('colors') | ||
var queue = require("queueobj"); | ||
class test1 { | ||
constructor() { | ||
this.id = 100 | ||
this.process = this.process.bind(this) | ||
} | ||
var tst1 = class test1 { | ||
constructor(props) { | ||
let t = this, fname = "test_all.test1.constructor" | ||
t.log = props.log | ||
t.id = props.id | ||
} | ||
process(callback) { | ||
setTimeout(() => { | ||
console.log(`processing test1`.cyan) | ||
console.log(`some async process`) | ||
callback({success: {msg: `processing all (${this.id})`}}) | ||
}, 3000) | ||
} | ||
process(callback) { | ||
let t = this, fname = "test_all.test1.process" | ||
t.log({ msg: `This object (${fname}) is id (${t.id}). Do stuff here`.bgBrightGreen, type: "info" }) | ||
callback({ success: { msg: `processing all test1` } }) | ||
} | ||
} | ||
class test2 { | ||
constructor() { | ||
this.id = 200 | ||
this.process = this.process.bind(this) | ||
} | ||
var tst2 = class test2 { | ||
constructor(props) { | ||
let t = this, fname = "test_all.test2.constructor" | ||
t.log = props.log | ||
t.id = props.id | ||
} | ||
process(callback) { | ||
let msg = `some kinda problem here in id(${this.id})` | ||
// callback({error: {msg: msg}}) //this will show errors | ||
callback({success: {msg: `processing all (${this.id})}`}}) //this will show no errors | ||
} | ||
ping() { | ||
console.log('hello from test2'.rainbow) | ||
} | ||
process(callback) { | ||
let t = this, fname = "test_all.test2.process" | ||
t.log({ msg: `This object (${fname}) is id (${t.id}). Do stuff here`.bgBrightGreen, type: "info" }) | ||
setTimeout(() => { | ||
callback({ success: { msg: `processing all test2` } }) | ||
}, 4000) | ||
} | ||
} | ||
class test3 { | ||
constructor() { | ||
this.id = 300 | ||
this.process = this.process.bind(this) | ||
} | ||
var tst3 = class test3 { | ||
constructor(props) { | ||
let t = this, fname = "test_all.test3.constructor" | ||
t.log = props.log | ||
t.id = props.id | ||
} | ||
process(callback) { | ||
callback({success: {msg: `processing all (${this.id})}`}}) | ||
} | ||
process(callback) { | ||
let t = this, fname = "test_all.test3.process" | ||
t.log({ msg: `This object (${fname}) is id (${t.id}). Do stuff here`.bgBrightGreen, type: "info" }) | ||
// callback({success: { msg: `processing all test3` }}) | ||
callback({ error: { msg: `there is some problem thrown here on test3` } }) | ||
} | ||
} | ||
class test4 { | ||
constructor() { | ||
let t = this | ||
t.id = 400 | ||
t.custom_function = t.custom_function.bind(this) | ||
} | ||
var tst4 = class test4 { | ||
constructor(props) { | ||
let t = this, fname = "test_all.test4.constructor" | ||
t.log = props.log | ||
t.id = props.id | ||
custom_function(callback) { | ||
let msg = `custom func problem here id(${this.id})` | ||
setTimeout(() => { | ||
// callback({error: {msg: msg}}) //this will show errors | ||
callback({success: {msg: `processing all (${this.id})}`}}) //this will show no errors | ||
}, 3000) | ||
} | ||
} | ||
process(callback) { | ||
let t = this, fname = "test_all.test4.process" | ||
t.log({ msg: `This object (${fname}) is id (${t.id}). Do stuff here`.bgBrightGreen, type: "info" }) | ||
callback({ success: { msg: `processing all test4` } }) | ||
} | ||
} | ||
let tst4 = new test4() | ||
let qObj = new queue(), props = { appender: 'name' } | ||
qObj.load(props).add(new test1()).add(new test2()).add(new test3()).add(tst4.custom_function) | ||
var qObj = new queue() | ||
qObj.process().then(res => { | ||
console.log(`success with all sync processing: (${JSON.stringify(res)})`.green) | ||
}, err => { | ||
console.log(`errors with all sync processing: (${JSON.stringify(err)})`.red) | ||
qObj.init().process({ | ||
appender: "all", | ||
exclude_logMsg: ["debug"], /* example ["debug", "info"] */ | ||
process_objects: [tst1, tst2, tst3, tst4] | ||
}).then((success) => { | ||
qObj.logMsg({ msg: `test success: {msg: "all objects processed with no errors"}`.success.italic.bold, type: "success" }) | ||
}, (error) => { | ||
if (typeof error == "string") { | ||
qObj.logMsg({ msg: `error: ${error}`.error.italic.bold, type: "error" }) | ||
} else { | ||
let add_s = (error.error_count > 1) ? 's' : '' | ||
qObj.logMsg({ msg: `${error.error_count} error${add_s} detected`.error.italic.bold, type: "error" }) | ||
} | ||
}) | ||
@@ -120,0 +148,0 @@ |
@@ -10,69 +10,33 @@ var assert = require('assert'); | ||
}) | ||
it('app.process is a function', function () { | ||
assert(typeof app.process == 'function') | ||
}) | ||
it('app.getParent is a function', function () { | ||
assert(typeof app.getParent == 'function') | ||
it('app.logMsg is a function', function () { | ||
assert(typeof app.logMsg == 'function') | ||
}) | ||
it('app.getObjectToProcess is a function', function () { | ||
assert(typeof app.getObjectToProcess == 'function') | ||
}) | ||
it('app.getObjectById is a function', function () { | ||
assert(typeof app.getObjectById == 'function') | ||
it('app.getFileObject is a function', function () { | ||
assert(typeof app.getFileObject == 'function') | ||
}) | ||
it('app.getObjs is a function', function () { | ||
assert(typeof app.getObjs == 'function') | ||
}) | ||
it('app.logMsg is a function', function () { | ||
assert(typeof app.logMsg == 'function') | ||
}) | ||
}) | ||
describe('require', function () { | ||
it('base', function () { | ||
assert(require('../lib/appenders/base')) | ||
}) | ||
it('colors app', function () { | ||
it('colors', function () { | ||
assert(require('colors')) | ||
}) | ||
it('all appender', function () { | ||
assert(require('../lib/appenders/all')) | ||
it('base_queue', function () { | ||
assert(require('base-queue')) | ||
}) | ||
it('func_all appender', function () { | ||
assert(require('../lib/appenders/func_all')) | ||
it('fs', function () { | ||
assert(require('fs')) | ||
}) | ||
it('top_one appender', function () { | ||
assert(require('../lib/appenders/top_one')) | ||
it('valid-path', function () { | ||
assert(require('valid-path')) | ||
}) | ||
it('bottom_one appender', function () { | ||
assert(require('../lib/appenders/bottom_one')) | ||
it('valid-path', function () { | ||
assert(require('log-queue')) | ||
}) | ||
it('sync_all appender', function () { | ||
assert(require('../lib/appenders/sync_all')) | ||
}) | ||
it('name appender', function () { | ||
assert(require('../lib/appenders/name')) | ||
}) | ||
it('status appender', function () { | ||
assert(require('../lib/appenders/status')) | ||
}) | ||
it('version appender', function () { | ||
assert(require('../lib/appenders/version')) | ||
}) | ||
}) |
@@ -9,9 +9,15 @@ const assert = require('assert'), | ||
}, | ||
"version": "12.0.18", | ||
"bundleDependencies": false, | ||
"version": "13.0.0", | ||
"bundleDependencies": [], | ||
"dependencies": { | ||
"@types/node": "^18.11.19", | ||
"base-queue": "^1.0.0", | ||
"chai": "^4.3.7", | ||
"colors": "^1.1.4", | ||
"colors": "^1.4.0", | ||
"diffler": "^2.0.4", | ||
"mocha": "^10.2.0" | ||
"fs": "^0.0.1-security", | ||
"log-queue": "^1.0.0", | ||
"mocha": "^10.2.0", | ||
"queuejson": "^9.0.11", | ||
"valid-path": "^2.1.0" | ||
}, | ||
@@ -22,10 +28,23 @@ "scripts": { | ||
"ditched": "ditched -a", | ||
"test_all": "node ./tests/test_all", | ||
"test_bottom_one": "node ./tests/test_bottom_one", | ||
"test_func_all": "node ./tests/test_func_all", | ||
"test_sync_all": "node ./tests/test_sync_all", | ||
"test_status": "node ./tests/test_status", | ||
"test_name": "node ./tests/test_name", | ||
"test_top_one": "node ./tests/test_top_one", | ||
"test_version": "node ./tests/test_version" | ||
"test_files": "node ./tests/files", | ||
"test_all": "node ./tests/all", | ||
"test_top_one": "node ./tests/top_one", | ||
"test_bottom_one": "node ./tests/bottom_one", | ||
"test_func_all": "node ./tests/func_all", | ||
"test_status_matching": "node ./tests/status_matching", | ||
"test_status_non_matching": "node ./tests/status_non_matching", | ||
"test_name_matching": "node ./tests/name_matching", | ||
"test_name_non_matching": "node ./tests/name_non_matching", | ||
"test_version_matching": "node ./tests/version_matching", | ||
"test_version_non_matching": "node ./tests/version_non_matching", | ||
"test_json_all": "node ./tests/json_all", | ||
"test_json_top_one": "node ./tests/json_top_one", | ||
"test_json_bottom_one": "node ./tests/json_bottom_one", | ||
"test_json_func_all": "node ./tests/json_func_all", | ||
"test_json_status_matching": "node ./tests/json_status_matching", | ||
"test_json_status_non_matching": "node ./tests/json_status_non_matching", | ||
"test_json_version_matching": "node ./tests/json_version_matching", | ||
"test_json_version_non_matching": "node ./tests/json_version_non_matching", | ||
"test_json_name_matching": "node ./tests/json_name_matching", | ||
"test_json_name_non_matching": "node ./tests/json_name_non_matching" | ||
}, | ||
@@ -42,9 +61,9 @@ "keywords": [ | ||
], | ||
"homepage": "https://github.com/jman717/QueueObj", | ||
"homepage": "https://github.com/jman717/queueobj", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/jman717/QueueObj.git" | ||
"url": "git+https://github.com/jman717/queueobj" | ||
}, | ||
"deprecated": false, | ||
"description": "Queue Objects For Processing", | ||
"description": "Queue File Objects", | ||
"email": "jrman@risebroadband.net", | ||
@@ -57,2 +76,4 @@ "license": "MIT", | ||
describe('package.json', function () { | ||
@@ -59,0 +80,0 @@ it('should pass', function () { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113271
49
2663
147
10
13
1
+ Added@types/node@^18.11.19
+ Addedbase-queue@^1.0.0
+ Addedfs@^0.0.1-security
+ Addedlog-queue@^1.0.0
+ Addedqueuejson@^9.0.11
+ Addedvalid-path@^2.1.0
+ Added@cspotcode/source-map-support@0.8.1(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.9(transitive)
+ Added@tsconfig/node10@1.0.11(transitive)
+ Added@tsconfig/node12@1.0.11(transitive)
+ Added@tsconfig/node14@1.0.3(transitive)
+ Added@tsconfig/node16@1.0.4(transitive)
+ Added@types/node@18.19.67(transitive)
+ Addedacorn@8.14.0(transitive)
+ Addedacorn-walk@8.3.4(transitive)
+ Addedarg@4.1.3(transitive)
+ Addedbase-queue@1.0.7(transitive)
+ Addedcreate-require@1.1.1(transitive)
+ Addeddiff@4.0.2(transitive)
+ Addedfs@0.0.1-security(transitive)
+ Addedlog-queue@1.0.02.1.0(transitive)
+ Addedmake-error@1.3.6(transitive)
+ Addednode-console-colors@1.1.5(transitive)
+ Addedqueuejson@9.0.14(transitive)
+ Addedqueueobj@12.0.18(transitive)
+ Addedts-node@10.9.2(transitive)
+ Addedtypescript@5.7.2(transitive)
+ Addedundici-types@5.26.5(transitive)
+ Addedv8-compile-cache-lib@3.0.1(transitive)
+ Addedvalid-path@2.1.0(transitive)
+ Addedyn@3.1.1(transitive)
Updatedcolors@^1.4.0