Comparing version 8.0.0 to 8.1.0
67
app.js
@@ -26,3 +26,2 @@ | ||
t.props.getParent = t.getParent | ||
t.props.log = t.log | ||
@@ -35,11 +34,11 @@ if (typeof t.props != 'undefined' && typeof t.props.debug != 'undefined') { | ||
t.log = t.log.bind(t) | ||
t.init = t.init.bind(t) | ||
t.process = t.process.bind(t) | ||
t.getParent = t.getParent.bind(t) | ||
t.logMsg = t.logMsg.bind(t) | ||
t.log(fname, "debug"); | ||
t.logMsg(fname, {"type": "debug"}); | ||
return t | ||
} catch (e) { | ||
t.log(`${fname}: ${e}`, "error") | ||
t.logMsg(`${fname}: ${e}`, {"type": "error"}) | ||
} | ||
@@ -59,3 +58,3 @@ } | ||
try { | ||
t.log(`${fname} appender(${t.props.appender})`, "debug"); | ||
t.logMsg(`${fname} appender(${t.props.appender})`, {"type": "debug"}); | ||
try { | ||
@@ -150,34 +149,38 @@ try { | ||
} catch (e) { | ||
t.log(`${fname}: ${e}`, "error") | ||
t.logMsg(`${fname}: ${e}`, {"type": "error"}) | ||
} | ||
} | ||
log = (msg, type) => { | ||
logMsg = (msg, props = {}) => { | ||
let t = this | ||
try { | ||
let t = this, tp | ||
switch (type) { | ||
case 'debug': | ||
if (!t.debug) | ||
return | ||
tp = "bg_dark_gray" | ||
break | ||
case 'error': | ||
tp = "fg_red" | ||
break | ||
case 'purple': | ||
tp = "bg_purple" | ||
break | ||
case 'success': | ||
tp = "fg_green" | ||
break | ||
case 'white': | ||
tp = "bg_white" | ||
break | ||
default: | ||
tp = 'bg_dark_gray' | ||
if (typeof props != 'undefined' && typeof props.type != 'undefined') { | ||
switch (props.type) { | ||
case 'debug': | ||
if (!t.debug) | ||
return | ||
tp = "bg_dark_gray" | ||
break | ||
case 'error': | ||
tp = "fg_red" | ||
break | ||
case 'purple': | ||
tp = "bg_purple" | ||
break | ||
case 'success': | ||
tp = "fg_green" | ||
break | ||
case 'white': | ||
tp = "bg_white" | ||
break | ||
default: | ||
tp = 'bg_dark_gray' | ||
} | ||
console.log(cc.set(tp, msg)) | ||
return t | ||
} | ||
console.log(cc.set(tp, msg)) | ||
return t | ||
throw new Error('No props.type included') | ||
} catch (e) { | ||
console.log(`app log: ${e}`) | ||
console.log(`app log: ${e.message} for message (${msg})`) | ||
} | ||
@@ -190,3 +193,2 @@ } | ||
try { | ||
// t.log(`${fname} appender(${JSON.stringify(t.props)})`, "debug"); | ||
switch (t.props.appender) { | ||
@@ -219,6 +221,5 @@ case 'all': | ||
} catch (e) { | ||
t.log(`${fname}: ${e}`, "error") | ||
t.logMsg(`${fname}: ${e}`, {"type": "error"}) | ||
} | ||
} | ||
} |
@@ -15,6 +15,6 @@ /* | ||
t.aname = 'all' | ||
// t.log(`all constructor`, `debug`) | ||
t.parent.logMsg(`all constructor`, {"type": "debug"}) | ||
return t | ||
} catch (e) { | ||
t.log(e, "error") | ||
t.parent.logMsg(e, {"type": "error"}) | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -14,4 +14,2 @@ /* | ||
t.parent = props.getParent() | ||
t.log = t.parent.log | ||
// t.log(fname, "debug"); | ||
t.resolve_array = [] | ||
@@ -27,3 +25,3 @@ t.reject_array = [] | ||
} catch (e) { | ||
t.log(`${fname}: ${e}`, "error") | ||
t.parent.logMsg(`${fname}: ${e}`, { "type": "error" }) | ||
throw e | ||
@@ -38,3 +36,3 @@ } | ||
// t.log(fname, "debug"); | ||
// t.parent.logMsg(fname, {"type": "debug"}) | ||
return new Promise((resolve, reject) => { | ||
@@ -46,3 +44,3 @@ t.resolve_array.push(resolve) | ||
} catch (e) { | ||
t.log(`${fname}: ${e}`, "error") | ||
t.parent.logMsg(`${fname}: ${e}`, { "type": "error" }) | ||
} | ||
@@ -54,3 +52,3 @@ } | ||
try { | ||
// t.log(fname, "debug"); | ||
t.parent.logMsg(fname, {"type": "debug"}) | ||
@@ -62,3 +60,3 @@ coa = t.parent.get_class_obj_array() | ||
} | ||
// throw new Error('class object array has nothing to process') | ||
// throw new Error('class object array has nothing to process') | ||
@@ -71,3 +69,4 @@ coa.map((dat, i) => { | ||
if (typeof dat._getFuncName == 'function') { | ||
t.log(`${fname}: function name(${dat._getFuncName()})`, `debug`) | ||
t.parent.logMsg(`${fname}: function name(${dat._getFuncName()})`, { "type": "debug" }) | ||
t.qObj.add(eval(`dat.${dat._getFuncName()}`)) | ||
@@ -85,3 +84,3 @@ } else { | ||
} catch (e) { | ||
t.log(`${fname}: ${e}`, "error") | ||
t.parent.logMsg(`${fname}: ${e}`, {"type": "error"}) | ||
throw e | ||
@@ -88,0 +87,0 @@ } |
@@ -15,8 +15,8 @@ /* | ||
t.aname = 'bottom_one' | ||
// t.log(`bottom_one constructor`, `debug`) | ||
t.parent.logMsg(`bottom_one constructor`, {"type": "debug"}) | ||
return t | ||
} catch (e) { | ||
t.log(e, "error") | ||
t.parent.logMsg(e.message, {"type": "error"}) | ||
} | ||
} | ||
} |
@@ -15,8 +15,8 @@ /* | ||
t.aname = 'by_status' | ||
// t.log(`by_status constructor`, `debug`) | ||
t.parent.logMsg(`by_status constructor`, {"type": "debug"}) | ||
return t | ||
} catch (e) { | ||
t.log(e, "error") | ||
t.parent.logMsg(e.message, {"type": "error"}) | ||
} | ||
} | ||
} |
@@ -15,8 +15,8 @@ /* | ||
t.aname = 'func_all' | ||
// t.log(`func_all constructor`, `debug`) | ||
// t.parent.logMsg(`func_all constructor`, {"type": "debug"}) | ||
return t | ||
} catch (e) { | ||
t.log(e, "error") | ||
t.parent.logMsg(e.message, {"type": "error"}) | ||
} | ||
} | ||
} |
@@ -15,8 +15,9 @@ /* | ||
t.aname = 'sync_all' | ||
// t.log(`sync_all constructor`, `debug`) | ||
// t.parent.logMsg(`sync_all constructor`, {"type": "debug"}) | ||
return t | ||
} catch (e) { | ||
t.log(e, "error") | ||
t.parent.logMsg(e.message, {"type": "error"}) | ||
} | ||
} | ||
} |
@@ -15,6 +15,7 @@ /* | ||
t.aname = 'top_one' | ||
// t.log(`top_one constructor`, `debug`) | ||
// t.parent.logMsg(`top_one constructor`, {"type": "debug"}) | ||
return t | ||
} catch (e) { | ||
t.log(e, "error") | ||
t.parent.logMsg(e.message, {"type": "error"}) | ||
} | ||
@@ -21,0 +22,0 @@ |
@@ -15,8 +15,9 @@ /* | ||
t.aname = 'version' | ||
// t.log(`version constructor`, `debug`) | ||
// t.parent.logMsg(`version constructor`, {"type": "debug"}) | ||
return t | ||
} catch (e) { | ||
t.log(e, "error") | ||
t.parent.logMsg(e.message, {"type": "error"}) | ||
} | ||
} | ||
} |
@@ -15,6 +15,8 @@ /* | ||
t.aname = 'version' | ||
// t.log(`version constructor`, `debug`) | ||
t.parent.logMsg(`version constructor`, {"type": "debug"}) | ||
return t | ||
} catch (e) { | ||
t.log(e, "error") | ||
t.parent.logMsg(e.message, {"type": "error"}) | ||
} | ||
@@ -21,0 +23,0 @@ |
{ | ||
"name": "queuejson", | ||
"version": "8.0.0", | ||
"version": "8.1.0", | ||
"description": "Process class objects according to json array input data.", | ||
@@ -5,0 +5,0 @@ "main": "app.js", |
@@ -79,4 +79,3 @@ # QueueJson | ||
try { | ||
let qJson = new queue({ | ||
let qJson = new queue({ | ||
class_obj: class_test, | ||
@@ -88,9 +87,11 @@ appender: 'all', | ||
try { | ||
qJson.process({}).then((success: any) => { | ||
qJson.log(`all success: (${JSON.stringify(success)})`, 'success') | ||
qJson.logMsg(`all success: (${JSON.stringify(success)})`, {"type": "success"}) | ||
}, (error: any) => { | ||
qJson.log(`all errors: (${JSON.stringify(error)})`, 'error') | ||
qJson.logMsg(`all errors: (${JSON.stringify(error)})`, {"type": "error"}) | ||
}) | ||
} catch (e) { | ||
console.log(`error running all.ts test`) | ||
qJson.logMsg(`error running readme test`, {"type": "error"}) | ||
} | ||
@@ -97,0 +98,0 @@ |
@@ -7,3 +7,3 @@ const assert = require('assert'), | ||
"name": "queuejson", | ||
"version": "8.0.0", | ||
"version": "8.1.0", | ||
"description": "Process class objects according to json array input data.", | ||
@@ -10,0 +10,0 @@ "main": "app.js", |
@@ -37,18 +37,18 @@ | ||
let qJson = new queue({ | ||
class_obj: class_test_all, | ||
appender: 'all', | ||
stats: true, | ||
debug: true | ||
}).init({ input_data: sample_data_all }) | ||
try { | ||
let qJson = new queue({ | ||
class_obj: class_test_all, | ||
appender: 'all', | ||
stats: true, | ||
debug: true | ||
}).init({ input_data: sample_data_all }) | ||
qJson.process({}).then((success) => { | ||
qJson.log(`all success: (${JSON.stringify(success)})`, 'success') | ||
qJson.logMsg(`all success: (${JSON.stringify(success)})`, { "type": "success" }) | ||
}, (error) => { | ||
qJson.log(`all errors: (${JSON.stringify(error)})`, 'error') | ||
qJson.logMsg(`all errors: (${JSON.stringify(error)})`, { "type": "error" }) | ||
}) | ||
} catch (e) { | ||
console.log(`error running all.ts test`) | ||
qJson.logMsg(`error running all.js test`, { "type": "error" }) | ||
} | ||
@@ -37,18 +37,18 @@ | ||
let qJson = new queue({ | ||
class_obj: class_test_bottom_one, | ||
appender: 'bottom_one', | ||
stats: true, | ||
debug: true | ||
}).init({ input_data: sample_data_bottom_one }) | ||
try { | ||
let qJson = new queue({ | ||
class_obj: class_test_bottom_one, | ||
appender: 'bottom_one', | ||
stats: true, | ||
debug: true | ||
}).init({ input_data: sample_data_bottom_one }) | ||
qJson.process({}).then((success) => { | ||
qJson.log(`all success: (${JSON.stringify(success)})`, 'success') | ||
qJson.logMsg(`all success: (${JSON.stringify(success)})`, { "type": "success" }) | ||
}, (error) => { | ||
qJson.log(`all errors: (${JSON.stringify(error)})`, 'error') | ||
qJson.logMsg(`all errors: (${JSON.stringify(error)})`, { "type": "error" }) | ||
}) | ||
} catch (e) { | ||
console.log(`error running all.ts test`) | ||
qJson.logMsg(`error running bottom_one.js test`, { "type": "error" }) | ||
} | ||
@@ -38,21 +38,20 @@ | ||
] | ||
let qJson = new queue({ | ||
class_obj: class_test_by_matching_status, | ||
appender: 'status', | ||
stats: true, | ||
debug: true | ||
try { | ||
let qJson = new queue({ | ||
class_obj: class_test_by_matching_status, | ||
appender: 'status', | ||
stats: true, | ||
debug: true | ||
}).init({ input_data: sample_data_by_status, matching: ['new', 'print'] }) | ||
}).init({ input_data: sample_data_by_status, matching: ['new', 'print'] }) | ||
try { | ||
qJson.process({}).then((success) => { | ||
qJson.log(`by_status success: (${JSON.stringify(success)})`, 'success') | ||
qJson.logMsg(`by_status success: (${JSON.stringify(success)})`, { "type": "success" }) | ||
}, (error) => { | ||
qJson.log(`by_status errors: (${JSON.stringify(error)})`, 'error') | ||
qJson.logMsg(`by_status errors: (${JSON.stringify(error)})`, { "type": "error" }) | ||
}) | ||
} catch (e) { | ||
console.log(`error running by_status_matching.js test`) | ||
qJson.logMsg(`error running by_status_matching.js test`, { "type": "error" }) | ||
} | ||
@@ -39,18 +39,18 @@ | ||
let qJson = new queue({ | ||
class_obj: class_test_by_non_matching_status, | ||
appender: 'status', | ||
stats: true, | ||
debug: true | ||
}).init({ input_data: sample_data_by_status, non_matching: ['new'] }) | ||
try { | ||
let qJson = new queue({ | ||
class_obj: class_test_by_non_matching_status, | ||
appender: 'status', | ||
stats: true, | ||
debug: true | ||
}).init({ input_data: sample_data_by_status, non_matching: ['new'] }) | ||
qJson.process({}).then((success) => { | ||
qJson.log(`by_status success: (${JSON.stringify(success)})`, 'success') | ||
qJson.logMsg(`by_status success: (${JSON.stringify(success)})`, { "type": "success" }) | ||
}, (error) => { | ||
qJson.log(`by_status errors: (${JSON.stringify(error)})`, 'error') | ||
qJson.logMsg(`by_status errors: (${JSON.stringify(error)})`, { "type": "error" }) | ||
}) | ||
} catch (e) { | ||
console.log(`error running by_status_non_matching.js test`) | ||
qJson.logMsg(`error running by_status_non_matching.js test`, { "type": "error" }) | ||
} | ||
@@ -38,20 +38,20 @@ | ||
try { | ||
let qJson = new queue({ | ||
class_obj: class_test_by_matching_version, | ||
appender: 'version', | ||
stats: true, | ||
debug: false | ||
let qJson = new queue({ | ||
class_obj: class_test_by_matching_version, | ||
appender: 'version', | ||
stats: true, | ||
debug: false | ||
}).init({ input_data: sample_data_version, matching: ['1.01', '4.00'] }) | ||
}).init({ input_data: sample_data_version, matching: ['1.01', '4.00'] }) | ||
try { | ||
qJson.process({}).then((success) => { | ||
qJson.log(`version success: (${JSON.stringify(success)})`, 'success') | ||
qJson.logMsg(`version success: (${JSON.stringify(success)})`, { "type": "success" }) | ||
}, (error) => { | ||
qJson.log(`version errors: (${JSON.stringify(error)})`, 'error') | ||
qJson.logMsg(`version errors: (${JSON.stringify(error)})`, { "type": "error" }) | ||
}) | ||
} catch (e) { | ||
console.log(`error running by_version_matching.js test`) | ||
qJson.logMsg(`error running by_version_matching.js test`, { "type": "error" }) | ||
} | ||
@@ -46,9 +46,9 @@ | ||
qJson.process({}).then((success) => { | ||
qJson.log(`version success: (${JSON.stringify(success)})`, 'success') | ||
qJson.logMsg(`version success: (${JSON.stringify(success)})`, {"type": "success"}) | ||
}, (error) => { | ||
qJson.log(`version errors: (${JSON.stringify(error)})`, 'error') | ||
qJson.logMsg(`version errors: (${JSON.stringify(error)})`, {"type": "error"}) | ||
}) | ||
} catch (e) { | ||
console.log(`error running by_version_non_matching.js test`) | ||
qJson.logMsg(`error running by_version_non_matching.js test`, {"type": "error"}) | ||
} | ||
@@ -42,18 +42,18 @@ | ||
let qJson = new queue({ | ||
class_obj: class_test_func_all, | ||
appender: 'func_all', | ||
stats: false, | ||
debug: true | ||
}).init({ input_data: sample_data_func_all }) | ||
try { | ||
let qJson = new queue({ | ||
class_obj: class_test_func_all, | ||
appender: 'func_all', | ||
stats: false, | ||
debug: true | ||
}).init({ input_data: sample_data_func_all }) | ||
qJson.process({}).then((success) => { | ||
qJson.log(`func_all success: (${JSON.stringify(success)})`, 'success') | ||
qJson.logMsg(`func_all success: (${JSON.stringify(success)})`, {"type": "success"}) | ||
}, (error) => { | ||
qJson.log(`func_all errors: (${JSON.stringify(error)})`, 'error') | ||
qJson.logMsg(`func_all errors: (${JSON.stringify(error)})`, {"type": "error"}) | ||
}) | ||
} catch (e) { | ||
console.log(`error running func_all.ts test`) | ||
qJson.logMsg(`error running func_all.js test`, {"type": "error"}) | ||
} | ||
@@ -23,3 +23,3 @@ | ||
let t = this | ||
setTimeout(()=>{ | ||
setTimeout(() => { | ||
callback({ success: { id: t.id, function_name: 'some_function' } }) | ||
@@ -42,18 +42,18 @@ }, 3000) | ||
let qJson = new queue({ | ||
class_obj: class_test_sync_all, | ||
appender: 'sync_all', | ||
stats: true, | ||
debug: true | ||
}).init({ input_data: sample_data_sync_all }) | ||
try { | ||
let qJson = new queue({ | ||
class_obj: class_test_sync_all, | ||
appender: 'sync_all', | ||
stats: true, | ||
debug: true | ||
}).init({ input_data: sample_data_sync_all }) | ||
qJson.process({}).then((success) => { | ||
qJson.log(`sync_all success: (${JSON.stringify(success)})`, 'success') | ||
qJson.logMsg(`sync_all success: (${JSON.stringify(success)})`, { "type": "success" }) | ||
}, (error) => { | ||
qJson.log(`sync_all errors: (${JSON.stringify(error)})`, 'error') | ||
qJson.logMsg(`sync_all errors: (${JSON.stringify(error)})`, { "type": "error" }) | ||
}) | ||
} catch (e) { | ||
console.log(`error running sync_all.js test`) | ||
qJson.logMsg(`error running sync_all.js test`, { "type": "error" }) | ||
} | ||
@@ -37,18 +37,18 @@ | ||
let qJson = new queue({ | ||
class_obj: class_test_top_one, | ||
appender: 'top_one', | ||
stats: true, | ||
debug: true | ||
}).init({ input_data: sample_data_top_one }) | ||
try { | ||
let qJson = new queue({ | ||
class_obj: class_test_top_one, | ||
appender: 'top_one', | ||
stats: true, | ||
debug: true | ||
}).init({ input_data: sample_data_top_one }) | ||
qJson.process({}).then((success) => { | ||
qJson.log(`all success: (${JSON.stringify(success)})`, 'success') | ||
qJson.logMsg(`all success: (${JSON.stringify(success)})`, { "type": "success" }) | ||
}, (error) => { | ||
qJson.log(`all errors: (${JSON.stringify(error)})`, 'error') | ||
qJson.logMsg(`all errors: (${JSON.stringify(error)})`, { "type": "error" }) | ||
}) | ||
} catch (e) { | ||
console.log(`error running top_one.js test`) | ||
qJson.logMsg(`error running top_one.js test`, { "type": "error" }) | ||
} | ||
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
35925
100
1