15.1.5 • Published 4 months ago

queueobj v15.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

npm Package License CodeQL Node.js CI

NPM

Queue javascript objects dynamically then process the queue according to the appender. All appenders are handled synchronously.

Included tag appenders:

* 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

npm test

General Setup Test

npm run test_files  
npm run test_all   
npm run test_top_one   
npm run test_bottom_one   
npm run test_func_all   
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_http_all
npm run test_http_top_one
npm run test_http_bottom_one
npm run test_http_func_all
npm run test_http_status_matching
npm run test_http_status_non_matching
npm run test_http_name_matching
npm run test_http_name_non_matching
npm run test_http_version_matching
npm run test_http_version_non_matching
npm run test_json_http_all
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   

Usage

var queue = require("queueobj");

var tst1 = class test1 {
  constructor(props) {
    let t = this, fname = "test_all.test1.constructor"
    t.log = props.log
    t.id = props.id
  }

  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` } })
  }
}

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 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)
  }
}

var tst3 = class test3 {
  constructor(props) {
    let t = this, fname = "test_all.test3.constructor"
    t.log = props.log
    t.id = props.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` } })
  }
}

var tst4 = class test4 {
  constructor(props) {
    let t = this, fname = "test_all.test4.constructor"
    t.log = props.log
    t.id = props.id

  }

  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` } })
  }
}

var qObj = new queue()

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" })
  }
})
15.1.1

4 months ago

15.1.2

4 months ago

15.1.5

4 months ago

15.1.3

4 months ago

15.1.4

4 months ago

15.0.2

1 year ago

15.0.0

1 year ago

15.0.1

1 year ago

15.1.0

1 year ago

10.4.0

1 year ago

14.1.0

1 year ago

14.1.1

1 year ago

14.1.2

1 year ago

14.1.3

1 year ago

14.1.4

1 year ago

14.1.5

1 year ago

12.0.7

1 year ago

12.0.8

1 year ago

12.0.9

1 year ago

12.0.3

1 year ago

12.0.4

1 year ago

12.0.5

1 year ago

12.0.6

1 year ago

12.0.0

1 year ago

12.0.2

1 year ago

12.0.17

1 year ago

12.0.16

1 year ago

12.0.18

1 year ago

12.0.13

1 year ago

12.0.12

1 year ago

12.0.15

1 year ago

12.0.14

1 year ago

12.0.10

1 year ago

11.0.2

1 year ago

11.0.0

1 year ago

11.0.1

1 year ago

10.5.0

1 year ago

10.5.1

1 year ago

10.5.2

1 year ago

10.5.3

1 year ago

10.5.4

1 year ago

10.5.5

1 year ago

14.0.0

1 year ago

14.0.1

1 year ago

13.0.0

1 year ago

14.0.2

1 year ago

14.0.3

1 year ago

14.0.4

1 year ago

14.0.5

1 year ago

14.0.6

1 year ago

14.0.7

1 year ago

0.0.1

1 year ago

9.0.4

1 year ago

9.0.3

1 year ago

10.0.0

1 year ago

10.2.0

1 year ago

9.1.1

1 year ago

9.1.0

1 year ago

10.1.4

1 year ago

10.1.0

1 year ago

10.1.1

1 year ago

10.3.0

1 year ago

10.1.2

1 year ago

10.1.3

1 year ago

7.2.4

2 years ago

8.0.1

2 years ago

8.0.0

2 years ago

8.0.2

2 years ago

9.0.2

2 years ago

9.0.1

2 years ago

9.0.0

2 years ago

7.2.3

2 years ago

7.2.2

3 years ago

7.2.1

3 years ago

7.2.0

3 years ago

5.1.1

3 years ago

5.1.0

3 years ago

5.0.0

3 years ago

6.0.1

3 years ago

6.0.0

3 years ago

6.0.2

3 years ago

7.0.0

3 years ago

7.1.1

3 years ago

7.1.0

3 years ago

4.5.0

3 years ago

4.4.1

3 years ago

4.3.2

3 years ago

4.4.0

3 years ago

4.4.3

3 years ago

4.5.1

3 years ago

4.4.2

3 years ago

4.3.1

3 years ago

4.3.0

3 years ago

4.2.2

3 years ago

4.2.1

3 years ago

4.2.0

3 years ago

4.1.0

3 years ago

4.0.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.0

3 years ago

1.0.0

3 years ago

0.0.2

3 years ago