Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
0e81b8bd94 | |||
138aefc499 | |||
af5fa857cc | |||
f275f7e2f6 | |||
ea1f434cdd | |||
2cc212f210 | |||
2d2788d1ca | |||
de1652bac9 |
@ -3,14 +3,14 @@ image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .npmci_cache/
|
||||
key: "$CI_BUILD_STAGE"
|
||||
- .npmci_cache/
|
||||
key: '$CI_BUILD_STAGE'
|
||||
|
||||
stages:
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- metadata
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- metadata
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
@ -18,21 +18,23 @@ stages:
|
||||
mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
- npmci git mirror
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
snyk:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install -g snyk
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
@ -41,37 +43,40 @@ snyk:
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- priv
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install lts
|
||||
- npmci npm install
|
||||
- npmci command npm run build
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci node install lts
|
||||
- npmci npm publish
|
||||
- npmci node install stable
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# metadata stage
|
||||
@ -81,33 +86,35 @@ codequality:
|
||||
allow_failure: true
|
||||
script:
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
tags:
|
||||
- docker
|
||||
- priv
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
trigger:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci trigger
|
||||
- npmci trigger
|
||||
only:
|
||||
- tags
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-dbase:npmci
|
||||
services:
|
||||
- docker:stable-dind
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci node install lts
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command tsdoc
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
only:
|
||||
@ -115,5 +122,5 @@ pages:
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- public
|
||||
- public
|
||||
allow_failure: true
|
||||
|
349
package-lock.json
generated
349
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/taskbuffer",
|
||||
"version": "2.0.13",
|
||||
"version": "2.1.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -50,19 +50,69 @@
|
||||
}
|
||||
},
|
||||
"@gitzone/tstest": {
|
||||
"version": "1.0.24",
|
||||
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.24.tgz",
|
||||
"integrity": "sha512-HFHLxhXFhhY7nn7H7dxfjy/6WiUGCw35L5Do/ZajCAn/xAWiqnppW1aIp0LOOaWeZ7J5fH7xP88TjsGpwR+MRA==",
|
||||
"version": "1.0.28",
|
||||
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftstest/-/tstest-1.0.28.tgz",
|
||||
"integrity": "sha512-MNXH4hpn/4BRwoCjIxz+fbrpkFw/u8834BFTX4Ug1bU37qBZvwZdyMfHBNRSjDykya3SLjOSqOf1mcMI3gnEvA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@gitzone/tsrun": "^1.2.6",
|
||||
"@gitzone/tsrun": "^1.2.8",
|
||||
"@pushrocks/consolecolor": "^2.0.1",
|
||||
"@pushrocks/smartfile": "^7.0.2",
|
||||
"@pushrocks/smartfile": "^7.0.6",
|
||||
"@pushrocks/smartlog": "^2.0.19",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@pushrocks/smartshell": "^2.0.22",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@pushrocks/smartshell": "^2.0.25",
|
||||
"@types/figures": "^3.0.1",
|
||||
"figures": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartfile": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.6.tgz",
|
||||
"integrity": "sha512-X1kWg1HSQ/MqasRIHPCf6D9CRrcIrpTjW8KLc4GkApJ/W/IVaKsQkJQfdimlg1uc/9v8AYnoRdiGa51yxyghZA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/smarthash": "^2.0.6",
|
||||
"@pushrocks/smartpath": "^4.0.1",
|
||||
"@pushrocks/smartpromise": "^3.0.5",
|
||||
"@pushrocks/smartrequest": "^1.1.27",
|
||||
"@types/fs-extra": "^8.0.0",
|
||||
"fs-extra": "^8.1.0",
|
||||
"glob": "^7.1.4",
|
||||
"js-yaml": "^3.13.1"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartrequest": {
|
||||
"version": "1.1.43",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.43.tgz",
|
||||
"integrity": "sha512-bgzzKN9SxJaYhh+BN3tuLSgdphWsxAOHgNjWWay3o/ib8/c2RwRlmjoxzxXrIhKFEwJjGIo7w04045VgkoWkMQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/smartpromise": "^3.0.5",
|
||||
"@types/form-data": "^2.5.0",
|
||||
"agentkeepalive": "^4.0.2",
|
||||
"form-data": "^2.5.1"
|
||||
}
|
||||
},
|
||||
"@types/fs-extra": {
|
||||
"version": "8.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2ffs-extra/-/fs-extra-8.0.1.tgz",
|
||||
"integrity": "sha512-J00cVDALmi/hJOYsunyT52Hva5TnJeKP5yd1r+mH/ZU0mbYZflR0Z5kw5kITtKTRYMhm1JMClOFYdHnQszEvqw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"fs-extra": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.2.0",
|
||||
"jsonfile": "^4.0.0",
|
||||
"universalify": "^0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@pushrocks/consolecolor": {
|
||||
@ -93,13 +143,13 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/lik": {
|
||||
"version": "3.0.11",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.11.tgz",
|
||||
"integrity": "sha512-SDKRPj9+xBTqozlDPcA7O6BcccM1Tw/sXPVP+OnhNxCubDZ/L2kGNpPpqm43NJUoNxSSo5wdBw4N7MAFYCGdVg==",
|
||||
"version": "3.0.13",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.13.tgz",
|
||||
"integrity": "sha512-YDxYoh2UksEfUxcjSjTwLsW5j852E5FrMG62CUi1I7ZpBxf96b7P1t2pRWsQsNnHRz6FHckW/A1V6XKASB+jZA==",
|
||||
"requires": {
|
||||
"@pushrocks/smartdelay": "^2.0.3",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"@pushrocks/smartrx": "^2.0.3",
|
||||
"@pushrocks/smartdelay": "^2.0.6",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@pushrocks/smartrx": "^2.0.5",
|
||||
"@pushrocks/smarttime": "^3.0.12",
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"minimatch": "^3.0.4",
|
||||
@ -130,11 +180,11 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartdelay": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdelay/-/smartdelay-2.0.3.tgz",
|
||||
"integrity": "sha512-TXKDDqsc7sBTLl+oiYNaF6IdNk1n70i8ur8QfwcUU6tegTnrEkvMWy9h5Zdty/fq1ioCNpKLvuXoA+fgYVwKGQ==",
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdelay/-/smartdelay-2.0.6.tgz",
|
||||
"integrity": "sha512-4wUnzWNhRPODpaaL5GuRaje/C5dg+TMhBxmr57PKc2fqYpy6azWJwonf/s5xpcbJLCPJRbj1x8M5MqgCFq2uvg==",
|
||||
"requires": {
|
||||
"@pushrocks/smartpromise": "^3.0.2"
|
||||
"@pushrocks/smartpromise": "^3.0.6"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartevent": {
|
||||
@ -180,10 +230,33 @@
|
||||
"vinyl-file": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smarthash": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmarthash/-/smarthash-2.1.1.tgz",
|
||||
"integrity": "sha512-zVfqXsi0T+PZQJpXsQf7KJpoCUOv97q7//ccp5o/07Bo77gjLO966fevYO+1y7pbvLZ0nQ4pE536YmLkgwluPQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/smartjson": "^3.0.8",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@types/through2": "^2.0.34",
|
||||
"through2": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartjson": {
|
||||
"version": "3.0.8",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartjson/-/smartjson-3.0.8.tgz",
|
||||
"integrity": "sha512-EjC3611RSZaZmK+nXxXrYDBxdxYWtrxjOrZtQzbYn0yM33KSCH0sLIAG8B2wYZVAOj4A2pC8mVxFSJ1w3iRFHg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/fast-json-stable-stringify": "^2.0.0",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"lodash.clonedeep": "^4.5.0"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartlog": {
|
||||
"version": "2.0.19",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog/-/smartlog-2.0.19.tgz",
|
||||
"integrity": "sha512-I2mDx7WcUlADYWxu5nNP3NSJv95YrCZoG/rarbEqovK7pJQ9a0aINmIcCHkQeL1VSWvxgvhXwHyV/yNEJ4zh3Q==",
|
||||
"version": "2.0.21",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartlog/-/smartlog-2.0.21.tgz",
|
||||
"integrity": "sha512-U+YazzcMrU74crrGV50kYzlOWu//MF5i1wxRMSJonWsiixsWPTPpLsbAVxmIsPcDJyf0u3RixMeelA0WKhhqpg==",
|
||||
"requires": {
|
||||
"@pushrocks/smartlog-interfaces": "^2.0.5"
|
||||
}
|
||||
@ -229,9 +302,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@pushrocks/smartpromise": {
|
||||
"version": "3.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.0.5.tgz",
|
||||
"integrity": "sha512-9kHBWyDFjQ6cV1rseOfge02EH6huh/mrtqxlFoJoxnMaGWf5F8H3UEsskBBUGI6QKE1Bl8evr74AIKWwJ0r/bA=="
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.0.6.tgz",
|
||||
"integrity": "sha512-vlQlBGNVIjfClgnsfgQBU6GIKcskYSFzEcKLt18ngPzPEcjKklXcxaqzLXpnoxR+KBh30QPE8255ncYHXuPPOg=="
|
||||
},
|
||||
"@pushrocks/smartrequest": {
|
||||
"version": "1.1.23",
|
||||
@ -245,21 +318,14 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartrx": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrx/-/smartrx-2.0.3.tgz",
|
||||
"integrity": "sha512-OWxagu+CBdPaq76AIg91hJyrNhDTlEpesj01ooWCeVIaLY3G7yvFkqHsEKNOwPUG1LzCWmjq1l1dHQx9p2vJ9A==",
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrx/-/smartrx-2.0.5.tgz",
|
||||
"integrity": "sha512-BOlIJmnCO8pxqu9f18D9UV5rIsyrmKeK/mWNMiAe/NH2OTeRPNLpgmhZBkXSKNVD8tSsD8aazs4BcACgYOg1FQ==",
|
||||
"requires": {
|
||||
"@pushrocks/lik": "^3.0.2",
|
||||
"@pushrocks/lik": "^3.0.11",
|
||||
"@pushrocks/smartevent": "^2.0.3",
|
||||
"@pushrocks/smartpromise": "^2.0.5",
|
||||
"rxjs": "^6.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartpromise": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-2.0.5.tgz",
|
||||
"integrity": "sha512-9j/chLtIiNkR0MDw7Mpxg9slxAVvAQwUZuiaPYX5KpHdKxQaHLI1VZ8IN0vPhwlfgNO4i4vGXV0wB8BvSDj03g=="
|
||||
}
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"rxjs": "^6.5.3"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartshell": {
|
||||
@ -288,38 +354,72 @@
|
||||
}
|
||||
},
|
||||
"@pushrocks/tapbundle": {
|
||||
"version": "3.0.13",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.0.13.tgz",
|
||||
"integrity": "sha512-23O4UMBafCuD+RnUlXNvtT9DGbL1HMD+xZE1Zcr7Ll7WvgxUgRQQfk9kq6qbLLbjaRe1J2Ijsgh1HuZbBaucLQ==",
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.0.tgz",
|
||||
"integrity": "sha512-xnKIGe7NJqxWBaFeKIEXShDjV2wap1XJqmlp3m1MKqmIF62vRpZnkzpyE1ZAoNwiYQmIsXIpvP/PDv+iPevPfw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/early": "^3.0.3",
|
||||
"@pushrocks/smartdelay": "^2.0.3",
|
||||
"@pushrocks/smartfile": "^7.0.6",
|
||||
"@pushrocks/smartpromise": "^3.0.2",
|
||||
"smartchai": "^2.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartdelay": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartdelay/-/smartdelay-2.0.3.tgz",
|
||||
"integrity": "sha512-TXKDDqsc7sBTLl+oiYNaF6IdNk1n70i8ur8QfwcUU6tegTnrEkvMWy9h5Zdty/fq1ioCNpKLvuXoA+fgYVwKGQ==",
|
||||
"@pushrocks/smartfile": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.6.tgz",
|
||||
"integrity": "sha512-X1kWg1HSQ/MqasRIHPCf6D9CRrcIrpTjW8KLc4GkApJ/W/IVaKsQkJQfdimlg1uc/9v8AYnoRdiGa51yxyghZA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/smartpromise": "^3.0.2"
|
||||
"@pushrocks/smarthash": "^2.0.6",
|
||||
"@pushrocks/smartpath": "^4.0.1",
|
||||
"@pushrocks/smartpromise": "^3.0.5",
|
||||
"@pushrocks/smartrequest": "^1.1.27",
|
||||
"@types/fs-extra": "^8.0.0",
|
||||
"fs-extra": "^8.1.0",
|
||||
"glob": "^7.1.4",
|
||||
"js-yaml": "^3.13.1"
|
||||
}
|
||||
},
|
||||
"@pushrocks/smartpromise": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartpromise/-/smartpromise-3.0.2.tgz",
|
||||
"integrity": "sha512-jmrJMUEmBCWChWK8CIcx4Vw3wv/8OgVNmkaxJrbs+WMaoRUfJtpWWJfrAwwHWt9ZXJbarJ+CwfwfYiiZXymndQ==",
|
||||
"dev": true
|
||||
"@pushrocks/smartrequest": {
|
||||
"version": "1.1.43",
|
||||
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartrequest/-/smartrequest-1.1.43.tgz",
|
||||
"integrity": "sha512-bgzzKN9SxJaYhh+BN3tuLSgdphWsxAOHgNjWWay3o/ib8/c2RwRlmjoxzxXrIhKFEwJjGIo7w04045VgkoWkMQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@pushrocks/smartpromise": "^3.0.5",
|
||||
"@types/form-data": "^2.5.0",
|
||||
"agentkeepalive": "^4.0.2",
|
||||
"form-data": "^2.5.1"
|
||||
}
|
||||
},
|
||||
"@types/fs-extra": {
|
||||
"version": "8.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2ffs-extra/-/fs-extra-8.0.1.tgz",
|
||||
"integrity": "sha512-J00cVDALmi/hJOYsunyT52Hva5TnJeKP5yd1r+mH/ZU0mbYZflR0Z5kw5kITtKTRYMhm1JMClOFYdHnQszEvqw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"fs-extra": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.2.0",
|
||||
"jsonfile": "^4.0.0",
|
||||
"universalify": "^0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@types/chai": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.1.tgz",
|
||||
"integrity": "sha512-LDKlQW/V8bQr5p9aoHye9p7x9faxq0GVeWAkn/Zgyyn848LIAzuR1sHQjGmUBFUpINuGWDG2NTM/ofA2aLMIew==",
|
||||
"version": "4.2.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.5.tgz",
|
||||
"integrity": "sha512-YvbLiIc0DbbhiANrfVObdkLEHJksQZVq0Uvfg550SRAKVYaEJy+V70j65BVe2WNp6E3HtKsUczeijHFCjba3og==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/chai-as-promised": {
|
||||
@ -349,6 +449,12 @@
|
||||
"moment": ">=2.14.0"
|
||||
}
|
||||
},
|
||||
"@types/fast-json-stable-stringify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2ffast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
||||
"integrity": "sha512-mky/O83TXmGY39P1H9YbUpjV6l6voRYlufqfFCvel8l1phuy8HRjdWc1rrPuN53ITBJlbyMSV6z3niOySO5pgQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/figures": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2ffigures/-/figures-3.0.1.tgz",
|
||||
@ -377,9 +483,9 @@
|
||||
}
|
||||
},
|
||||
"@types/luxon": {
|
||||
"version": "1.15.2",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fluxon/-/luxon-1.15.2.tgz",
|
||||
"integrity": "sha512-zHPoyVrLvNaiMRYdhmh88Rn489ZgAgbc6iLxR5Yi0VCNfeNYHcszbhJV2vDHLNrVGy35BPtWBRn4OP2F9BBvFw=="
|
||||
"version": "1.21.0",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fluxon/-/luxon-1.21.0.tgz",
|
||||
"integrity": "sha512-Zhrf65tpjOlVIYrUhX9eu1VzRo8iixQDLFPbfqFxPpG4pBTNNPZ2BFhYE0IAsDfW9GWg+RcrUqiLwrGJH4rq4w=="
|
||||
},
|
||||
"@types/minimatch": {
|
||||
"version": "3.0.3",
|
||||
@ -387,9 +493,18 @@
|
||||
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "12.7.5",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.7.5.tgz",
|
||||
"integrity": "sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w=="
|
||||
"version": "12.12.14",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-12.12.14.tgz",
|
||||
"integrity": "sha512-u/SJDyXwuihpwjXy7hOOghagLEV1KdAST6syfnOk6QZAMzZuWZqXy5aYYZbh8Jdpd4escVFP0MvftHNDb9pruA=="
|
||||
},
|
||||
"@types/through2": {
|
||||
"version": "2.0.34",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fthrough2/-/through2-2.0.34.tgz",
|
||||
"integrity": "sha512-nhRG8+RuG/L+0fAZBQYaRflXKjTrHOKH8MFTChnf+dNVMxA3wHYYrfj0tztK0W51ABXjGfRCDc0vRkecCOrsow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/vinyl": {
|
||||
"version": "2.0.3",
|
||||
@ -401,9 +516,9 @@
|
||||
}
|
||||
},
|
||||
"@types/which": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fwhich/-/which-1.3.1.tgz",
|
||||
"integrity": "sha512-ZrJDWpvg75LTGX4XwuneY9s6bF3OeZcGTpoGh3zDV9ytzcHMFsRrMIaLBRJZQMBoGyKs6unBQfVdrLZiYfb1zQ==",
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://verdaccio.lossless.one/@types%2fwhich/-/which-1.3.2.tgz",
|
||||
"integrity": "sha512-8oDqyLC7eD4HM307boe2QWKyuzdzWBj56xI/imSl2cpL+U3tCMaTAkMJ4ee5JBZ/FsOJlvRGeIShiZDAl1qERA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/yargs": {
|
||||
@ -412,6 +527,17 @@
|
||||
"integrity": "sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw==",
|
||||
"dev": true
|
||||
},
|
||||
"agentkeepalive": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/agentkeepalive/-/agentkeepalive-4.1.0.tgz",
|
||||
"integrity": "sha512-CW/n1wxF8RpEuuiq6Vbn9S8m0VSYDMnZESqaJ6F2cWN9fY8rei2qaxweIaRgq+ek8TqfoFIsUjaGNKGGEHElSg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"debug": "^4.1.0",
|
||||
"depd": "^1.1.2",
|
||||
"humanize-ms": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"ansi-256-colors": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/ansi-256-colors/-/ansi-256-colors-1.1.0.tgz",
|
||||
@ -434,9 +560,9 @@
|
||||
}
|
||||
},
|
||||
"arg": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://verdaccio.lossless.one/arg/-/arg-4.1.1.tgz",
|
||||
"integrity": "sha512-SlmP3fEA88MBv0PypnXZ8ZfJhwmDeIE3SP71j37AiXQBXYosPV0x6uISAaHYSlSVhmHOVkomen0tbGk6Anlebw==",
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://verdaccio.lossless.one/arg/-/arg-4.1.2.tgz",
|
||||
"integrity": "sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg==",
|
||||
"dev": true
|
||||
},
|
||||
"argparse": {
|
||||
@ -624,9 +750,9 @@
|
||||
}
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.20.0",
|
||||
"resolved": "https://verdaccio.lossless.one/commander/-/commander-2.20.0.tgz",
|
||||
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://verdaccio.lossless.one/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true
|
||||
},
|
||||
"concat-map": {
|
||||
@ -661,6 +787,15 @@
|
||||
"which": "^1.2.9"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://verdaccio.lossless.one/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"decamelize": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://verdaccio.lossless.one/decamelize/-/decamelize-1.2.0.tgz",
|
||||
@ -699,6 +834,12 @@
|
||||
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
|
||||
"dev": true
|
||||
},
|
||||
"depd": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://verdaccio.lossless.one/depd/-/depd-1.1.2.tgz",
|
||||
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
|
||||
"dev": true
|
||||
},
|
||||
"diff": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/diff/-/diff-4.0.1.tgz",
|
||||
@ -747,10 +888,16 @@
|
||||
"strip-eof": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"fast-json-stable-stringify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
||||
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
|
||||
"dev": true
|
||||
},
|
||||
"figures": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://verdaccio.lossless.one/figures/-/figures-3.0.0.tgz",
|
||||
"integrity": "sha512-HKri+WoWoUgr83pehn/SIgLOMZ9nAWC6dcGj26RY2R4F50u4+RTUz0RCrUlOV3nKRAICW1UGzyb+kcX2qK1S/g==",
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://verdaccio.lossless.one/figures/-/figures-3.1.0.tgz",
|
||||
"integrity": "sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"escape-string-regexp": "^1.0.5"
|
||||
@ -849,6 +996,15 @@
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
||||
"dev": true
|
||||
},
|
||||
"humanize-ms": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://verdaccio.lossless.one/humanize-ms/-/humanize-ms-1.2.1.tgz",
|
||||
"integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://verdaccio.lossless.one/inflight/-/inflight-1.0.6.tgz",
|
||||
@ -951,6 +1107,12 @@
|
||||
"path-exists": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"lodash.clonedeep": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://verdaccio.lossless.one/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
|
||||
"integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=",
|
||||
"dev": true
|
||||
},
|
||||
"log-symbols": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://verdaccio.lossless.one/log-symbols/-/log-symbols-2.2.0.tgz",
|
||||
@ -961,9 +1123,9 @@
|
||||
}
|
||||
},
|
||||
"luxon": {
|
||||
"version": "1.17.2",
|
||||
"resolved": "https://verdaccio.lossless.one/luxon/-/luxon-1.17.2.tgz",
|
||||
"integrity": "sha512-qELKtIj3HD41N+MvgoxArk8DZGUb4Gpiijs91oi+ZmKJzRlxY6CoyTwNoUwnogCVs4p8HuxVJDik9JbnYgrCng=="
|
||||
"version": "1.21.2",
|
||||
"resolved": "https://verdaccio.lossless.one/luxon/-/luxon-1.21.2.tgz",
|
||||
"integrity": "sha512-yshwnlkA79WfC24/BC9Rd1n0mhorP22Sc7GYn0puRU6wD/douCgNJIzI9qQBuT9m2/bU+n9v1RflVNE4rMPPxQ=="
|
||||
},
|
||||
"make-error": {
|
||||
"version": "1.3.5",
|
||||
@ -1048,6 +1210,12 @@
|
||||
"moment": ">= 2.9.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://verdaccio.lossless.one/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"dev": true
|
||||
},
|
||||
"nice-try": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://verdaccio.lossless.one/nice-try/-/nice-try-1.0.5.tgz",
|
||||
@ -1271,9 +1439,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"resolve": {
|
||||
"version": "1.12.0",
|
||||
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.12.0.tgz",
|
||||
"integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==",
|
||||
"version": "1.13.1",
|
||||
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.13.1.tgz",
|
||||
"integrity": "sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-parse": "^1.0.6"
|
||||
@ -1357,9 +1525,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"source-map-support": {
|
||||
"version": "0.5.13",
|
||||
"resolved": "https://verdaccio.lossless.one/source-map-support/-/source-map-support-0.5.13.tgz",
|
||||
"integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==",
|
||||
"version": "0.5.16",
|
||||
"resolved": "https://verdaccio.lossless.one/source-map-support/-/source-map-support-0.5.16.tgz",
|
||||
"integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"buffer-from": "^1.0.0",
|
||||
@ -1448,10 +1616,19 @@
|
||||
"resolved": "https://verdaccio.lossless.one/symbol-tree/-/symbol-tree-3.2.4.tgz",
|
||||
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="
|
||||
},
|
||||
"through2": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://verdaccio.lossless.one/through2/-/through2-3.0.1.tgz",
|
||||
"integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"readable-stream": "2 || 3"
|
||||
}
|
||||
},
|
||||
"ts-node": {
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://verdaccio.lossless.one/ts-node/-/ts-node-8.3.0.tgz",
|
||||
"integrity": "sha512-dyNS/RqyVTDcmNM4NIBAeDMpsAdaQ+ojdf0GOLqE6nwJOgzEkdRNzJywhDfwnuvB10oa6NLVG1rUJQCpRN7qoQ==",
|
||||
"version": "8.5.2",
|
||||
"resolved": "https://verdaccio.lossless.one/ts-node/-/ts-node-8.5.2.tgz",
|
||||
"integrity": "sha512-W1DK/a6BGoV/D4x/SXXm6TSQx6q3blECUzd5TN+j56YEMX3yPVMpHsICLedUw3DvGF3aTQ8hfdR9AKMaHjIi+A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"arg": "^4.1.0",
|
||||
@ -1467,9 +1644,9 @@
|
||||
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
|
||||
},
|
||||
"tslint": {
|
||||
"version": "5.20.0",
|
||||
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.20.0.tgz",
|
||||
"integrity": "sha512-2vqIvkMHbnx8acMogAERQ/IuINOq6DFqgF8/VDvhEkBqQh/x6SP0Y+OHnKth9/ZcHQSroOZwUQSN18v8KKF0/g==",
|
||||
"version": "5.20.1",
|
||||
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.20.1.tgz",
|
||||
"integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
|
30
package.json
30
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/taskbuffer",
|
||||
"version": "2.0.13",
|
||||
"version": "2.1.0",
|
||||
"private": false,
|
||||
"description": "flexible task management. TypeScript ready!",
|
||||
"main": "dist/index.js",
|
||||
@ -27,29 +27,29 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/taskbuffer#readme",
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^3.0.11",
|
||||
"@pushrocks/smartdelay": "^2.0.3",
|
||||
"@pushrocks/smartlog": "^2.0.19",
|
||||
"@pushrocks/smartpromise": "^3.0.5",
|
||||
"@pushrocks/lik": "^3.0.13",
|
||||
"@pushrocks/smartdelay": "^2.0.6",
|
||||
"@pushrocks/smartlog": "^2.0.21",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@types/cron": "^1.7.1",
|
||||
"cron": "^1.7.2",
|
||||
"rxjs": "^6.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.17",
|
||||
"@gitzone/tstest": "^1.0.24",
|
||||
"@pushrocks/tapbundle": "^3.0.13",
|
||||
"@types/node": "^12.7.5",
|
||||
"tslint": "^5.20.0",
|
||||
"@gitzone/tstest": "^1.0.28",
|
||||
"@pushrocks/tapbundle": "^3.2.0",
|
||||
"@types/node": "^12.12.14",
|
||||
"tslint": "^5.20.1",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
},
|
||||
"files": [
|
||||
"ts/*",
|
||||
"ts_web/*",
|
||||
"dist/*",
|
||||
"dist_web/*",
|
||||
"dist_ts_web/*",
|
||||
"assets/*",
|
||||
"ts/**/*",
|
||||
"ts_web/**/*",
|
||||
"dist/**/*",
|
||||
"dist_web/**/*",
|
||||
"dist_ts_web/**/*",
|
||||
"assets/**/*",
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
|
@ -44,6 +44,11 @@ For further information read the linked docs at the top of this README.
|
||||
|
||||
[](https://push.rocks)
|
||||
|
||||
|
||||
## Contribution
|
||||
|
||||
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
||||
|
||||
For further information read the linked docs at the top of this readme.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
|
||||
import * as taskbuffer from '../ts';
|
||||
import * as taskbuffer from '../ts';
|
||||
|
||||
let preTask: taskbuffer.Task;
|
||||
let afterTask: taskbuffer.Task;
|
||||
@ -12,12 +12,17 @@ tap.test('should create tasks', async () => {
|
||||
name: 'myPreTask',
|
||||
taskFunction: async () => {
|
||||
console.log('pretask executed :)');
|
||||
return 'hi';
|
||||
}
|
||||
});
|
||||
afterTask = new taskbuffer.Task({
|
||||
name: 'myAfterTask',
|
||||
taskFunction: async () => {
|
||||
taskFunction: async x => {
|
||||
if (x === 'hi') {
|
||||
console.log('afterTask: values get passed along alright');
|
||||
}
|
||||
console.log('afterTask executed :)');
|
||||
return x;
|
||||
},
|
||||
preTask,
|
||||
afterTask
|
||||
@ -25,16 +30,22 @@ tap.test('should create tasks', async () => {
|
||||
|
||||
mainTask = new taskbuffer.Task({
|
||||
name: 'mainTask',
|
||||
taskFunction: async () => {
|
||||
console.log('main task executed');
|
||||
taskFunction: async x => {
|
||||
if (x === 'hi') {
|
||||
console.log('mainTask: values get passed along alright');
|
||||
}
|
||||
console.log('afterTask executed :)');
|
||||
return x;
|
||||
},
|
||||
preTask: () => {
|
||||
return preTask;
|
||||
},
|
||||
preTask,
|
||||
afterTask
|
||||
});
|
||||
});
|
||||
|
||||
tap.test('should execute the mainTasj', async () => {
|
||||
tap.test('should execute the mainTask', async () => {
|
||||
await mainTask.trigger();
|
||||
});
|
||||
|
||||
tap.start();
|
||||
tap.start();
|
||||
|
29
test/test.taskrunner.ts
Normal file
29
test/test.taskrunner.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
import * as taskbuffer from '../ts/index';
|
||||
|
||||
let testTaskRunner: taskbuffer.TaskRunner;
|
||||
|
||||
tap.test('should create a valid taskrunner', async () => {
|
||||
testTaskRunner = new taskbuffer.TaskRunner();
|
||||
testTaskRunner.start();
|
||||
});
|
||||
|
||||
tap.test('should execute task when its scheduled', async (tools) => {
|
||||
const done = tools.defer();
|
||||
testTaskRunner.addTask(new taskbuffer.Task({
|
||||
taskFunction: async () => {
|
||||
console.log('hi');
|
||||
}
|
||||
}));
|
||||
|
||||
testTaskRunner.addTask(new taskbuffer.Task({
|
||||
taskFunction: async () => {
|
||||
console.log('there');
|
||||
done.resolve();
|
||||
}
|
||||
}));
|
||||
|
||||
await done.promise;
|
||||
});
|
||||
|
||||
tap.start();
|
@ -3,6 +3,4 @@ export { Taskchain } from './taskbuffer.classes.taskchain';
|
||||
export { Taskparallel } from './taskbuffer.classes.taskparallel';
|
||||
export { TaskManager } from './taskbuffer.classes.taskmanager';
|
||||
export { TaskOnce } from './taskbuffer.classes.taskonce';
|
||||
|
||||
// import for naming only
|
||||
import './taskbuffer.classes.helpers';
|
||||
export { TaskRunner } from './taskbuffer.classes.taskrunner';
|
||||
|
42
ts/taskbuffer.classes.bufferrunner.ts
Normal file
42
ts/taskbuffer.classes.bufferrunner.ts
Normal file
@ -0,0 +1,42 @@
|
||||
import { Task } from './taskbuffer.classes.task';
|
||||
|
||||
export class BufferRunner {
|
||||
public task: Task;
|
||||
// initialze by default
|
||||
public bufferCounter: number = 0;
|
||||
public running: boolean = false;
|
||||
constructor(taskArg: Task) {
|
||||
this.task = taskArg;
|
||||
}
|
||||
|
||||
public trigger(x): Promise<any> {
|
||||
if (!(this.bufferCounter >= this.task.bufferMax)) {
|
||||
this.bufferCounter++;
|
||||
}
|
||||
const returnPromise: Promise<any> = this.task.cycleCounter.getPromiseForCycle(
|
||||
this.bufferCounter + 1
|
||||
);
|
||||
if (!this.running) {
|
||||
this._run(x);
|
||||
}
|
||||
return returnPromise;
|
||||
}
|
||||
|
||||
private _run(x) {
|
||||
const recursiveBufferRunner = x => {
|
||||
if (this.bufferCounter >= 0) {
|
||||
this.running = true;
|
||||
this.task.running = true;
|
||||
Task.runTask(this.task, { x: x }).then(x => {
|
||||
this.bufferCounter--;
|
||||
this.task.cycleCounter.informOfCycle(x);
|
||||
recursiveBufferRunner(x);
|
||||
});
|
||||
} else {
|
||||
this.running = false;
|
||||
this.task.running = false;
|
||||
}
|
||||
};
|
||||
recursiveBufferRunner(x);
|
||||
}
|
||||
}
|
36
ts/taskbuffer.classes.cyclecounter.ts
Normal file
36
ts/taskbuffer.classes.cyclecounter.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import * as plugins from './taskbuffer.plugins';
|
||||
import { Task } from './taskbuffer.classes.task';
|
||||
|
||||
export interface ICycleObject {
|
||||
cycleCounter: number;
|
||||
deferred: plugins.smartpromise.Deferred<any>;
|
||||
}
|
||||
|
||||
export class CycleCounter {
|
||||
public task: Task;
|
||||
public cycleObjectArray: ICycleObject[] = [];
|
||||
constructor(taskArg: Task) {
|
||||
this.task = taskArg;
|
||||
}
|
||||
public getPromiseForCycle(cycleCountArg: number) {
|
||||
const done = plugins.smartpromise.defer();
|
||||
const cycleObject: ICycleObject = {
|
||||
cycleCounter: cycleCountArg,
|
||||
deferred: done
|
||||
};
|
||||
this.cycleObjectArray.push(cycleObject);
|
||||
return done.promise;
|
||||
}
|
||||
public informOfCycle(x) {
|
||||
const newCycleObjectArray: ICycleObject[] = [];
|
||||
this.cycleObjectArray.forEach(cycleObjectArg => {
|
||||
cycleObjectArg.cycleCounter--;
|
||||
if (cycleObjectArg.cycleCounter <= 0) {
|
||||
cycleObjectArg.deferred.resolve(x);
|
||||
} else {
|
||||
newCycleObjectArray.push(cycleObjectArg);
|
||||
}
|
||||
});
|
||||
this.cycleObjectArray = newCycleObjectArray;
|
||||
}
|
||||
}
|
@ -1,166 +1,2 @@
|
||||
import plugins = require('./taskbuffer.plugins');
|
||||
import { Task, ITaskFunction } from './taskbuffer.classes.task';
|
||||
|
||||
export const emptyTaskFunction: ITaskFunction = function(x) {
|
||||
const done = plugins.smartpromise.defer();
|
||||
done.resolve();
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
export const isTask = (taskArg: Task): boolean => {
|
||||
if (taskArg instanceof Task && typeof taskArg.taskFunction === 'function') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export const isTaskTouched = (taskArg: Task, touchedTasksArray: Task[]): boolean => {
|
||||
let result = false;
|
||||
for (const keyArg in touchedTasksArray) {
|
||||
if (taskArg === touchedTasksArray[keyArg]) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
export const runTask = async (taskArg: Task, optionsArg: { x?; touchedTasksArray?: Task[] }) => {
|
||||
const done = plugins.smartpromise.defer();
|
||||
|
||||
// pay respect to execDelay
|
||||
if (taskArg.execDelay) {
|
||||
await plugins.smartdelay.delayFor(taskArg.execDelay);
|
||||
}
|
||||
|
||||
// set running params
|
||||
taskArg.running = true;
|
||||
|
||||
done.promise.then(async () => {
|
||||
taskArg.running = false;
|
||||
});
|
||||
|
||||
// handle options
|
||||
const options = {
|
||||
...{ x: undefined, touchedTasksArray: [] },
|
||||
...optionsArg
|
||||
};
|
||||
const x = options.x;
|
||||
const touchedTasksArray: Task[] = options.touchedTasksArray;
|
||||
|
||||
touchedTasksArray.push(taskArg);
|
||||
|
||||
// run the task cascade
|
||||
const localDeferred = plugins.smartpromise.defer();
|
||||
localDeferred.promise
|
||||
.then(() => {
|
||||
// lets run any preTask
|
||||
if (taskArg.preTask && !isTaskTouched(taskArg.preTask, touchedTasksArray)) {
|
||||
return runTask(taskArg.preTask, { x, touchedTasksArray });
|
||||
} else {
|
||||
const done2 = plugins.smartpromise.defer();
|
||||
done2.resolve(x);
|
||||
return done2.promise;
|
||||
}
|
||||
})
|
||||
.then(async x => {
|
||||
// lets run the main task
|
||||
try {
|
||||
return await taskArg.taskFunction(x);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
})
|
||||
.then(x => {
|
||||
if (taskArg.afterTask && !isTaskTouched(taskArg.afterTask, touchedTasksArray)) {
|
||||
return runTask(taskArg.afterTask, { x: x, touchedTasksArray: touchedTasksArray });
|
||||
} else {
|
||||
const done2 = plugins.smartpromise.defer();
|
||||
done2.resolve(x);
|
||||
return done2.promise;
|
||||
}
|
||||
})
|
||||
.then(x => {
|
||||
done.resolve(x);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
localDeferred.resolve();
|
||||
return await done.promise;
|
||||
};
|
||||
|
||||
export interface cycleObject {
|
||||
cycleCounter: number;
|
||||
deferred: plugins.smartpromise.Deferred<any>;
|
||||
}
|
||||
|
||||
export class CycleCounter {
|
||||
task: Task;
|
||||
cycleObjectArray: cycleObject[] = [];
|
||||
constructor(taskArg: Task) {
|
||||
this.task = taskArg;
|
||||
}
|
||||
getPromiseForCycle(cycleCountArg: number) {
|
||||
const done = plugins.smartpromise.defer();
|
||||
const cycleObject: cycleObject = {
|
||||
cycleCounter: cycleCountArg,
|
||||
deferred: done
|
||||
};
|
||||
this.cycleObjectArray.push(cycleObject);
|
||||
return done.promise;
|
||||
}
|
||||
informOfCycle(x) {
|
||||
const newCycleObjectArray: cycleObject[] = [];
|
||||
this.cycleObjectArray.forEach(cycleObjectArg => {
|
||||
cycleObjectArg.cycleCounter--;
|
||||
if (cycleObjectArg.cycleCounter <= 0) {
|
||||
cycleObjectArg.deferred.resolve(x);
|
||||
} else {
|
||||
newCycleObjectArray.push(cycleObjectArg);
|
||||
}
|
||||
});
|
||||
this.cycleObjectArray = newCycleObjectArray;
|
||||
}
|
||||
}
|
||||
|
||||
export class BufferRunner {
|
||||
task: Task;
|
||||
// initialze by default
|
||||
bufferCounter: number = 0;
|
||||
running: boolean = false;
|
||||
constructor(taskArg: Task) {
|
||||
this.task = taskArg;
|
||||
}
|
||||
|
||||
trigger(x): Promise<any> {
|
||||
if (!(this.bufferCounter >= this.task.bufferMax)) {
|
||||
this.bufferCounter++;
|
||||
}
|
||||
const returnPromise: Promise<any> = this.task.cycleCounter.getPromiseForCycle(
|
||||
this.bufferCounter + 1
|
||||
);
|
||||
if (!this.running) {
|
||||
this._run(x);
|
||||
}
|
||||
return returnPromise;
|
||||
}
|
||||
|
||||
private _run(x) {
|
||||
const recursiveBufferRunner = x => {
|
||||
if (this.bufferCounter >= 0) {
|
||||
this.running = true;
|
||||
this.task.running = true;
|
||||
runTask(this.task, { x: x }).then(x => {
|
||||
this.bufferCounter--;
|
||||
this.task.cycleCounter.informOfCycle(x);
|
||||
recursiveBufferRunner(x);
|
||||
});
|
||||
} else {
|
||||
this.running = false;
|
||||
this.task.running = false;
|
||||
}
|
||||
};
|
||||
recursiveBufferRunner(x);
|
||||
}
|
||||
}
|
||||
|
@ -1,29 +1,147 @@
|
||||
import * as plugins from './taskbuffer.plugins';
|
||||
import * as helpers from './taskbuffer.classes.helpers';
|
||||
import { BufferRunner } from './taskbuffer.classes.bufferrunner';
|
||||
import { CycleCounter } from './taskbuffer.classes.cyclecounter';
|
||||
|
||||
export interface ITaskFunction {
|
||||
(x?: any): PromiseLike<any>;
|
||||
}
|
||||
|
||||
export class Task {
|
||||
// man datory properties
|
||||
name: string;
|
||||
taskFunction: ITaskFunction;
|
||||
buffered: boolean;
|
||||
export type TPreOrAfterTaskFunction = () => Task;
|
||||
|
||||
bufferMax: number;
|
||||
execDelay: number;
|
||||
export class Task {
|
||||
// STATIC
|
||||
public static extractTask(preOrAfterTaskArg: Task | TPreOrAfterTaskFunction): Task {
|
||||
switch (true) {
|
||||
case !preOrAfterTaskArg:
|
||||
return null;
|
||||
case preOrAfterTaskArg instanceof Task:
|
||||
return preOrAfterTaskArg as Task;
|
||||
case typeof preOrAfterTaskArg === 'function':
|
||||
const taskFunction = preOrAfterTaskArg as TPreOrAfterTaskFunction;
|
||||
return taskFunction();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static emptyTaskFunction: ITaskFunction = function(x) {
|
||||
const done = plugins.smartpromise.defer();
|
||||
done.resolve();
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
public static isTask = (taskArg: Task): boolean => {
|
||||
if (taskArg instanceof Task && typeof taskArg.taskFunction === 'function') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
public static isTaskTouched = (
|
||||
taskArg: Task | TPreOrAfterTaskFunction,
|
||||
touchedTasksArray: Task[]
|
||||
): boolean => {
|
||||
const taskToCheck = Task.extractTask(taskArg);
|
||||
let result = false;
|
||||
for (const keyArg in touchedTasksArray) {
|
||||
if (taskToCheck === touchedTasksArray[keyArg]) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
public static runTask = async (
|
||||
taskArg: Task | TPreOrAfterTaskFunction,
|
||||
optionsArg: { x?; touchedTasksArray?: Task[] }
|
||||
) => {
|
||||
const taskToRun = Task.extractTask(taskArg);
|
||||
const done = plugins.smartpromise.defer();
|
||||
|
||||
// pay respect to execDelay
|
||||
if (taskToRun.execDelay) {
|
||||
await plugins.smartdelay.delayFor(taskToRun.execDelay);
|
||||
}
|
||||
|
||||
// set running params
|
||||
taskToRun.running = true;
|
||||
|
||||
done.promise.then(async () => {
|
||||
taskToRun.running = false;
|
||||
});
|
||||
|
||||
// handle options
|
||||
const options = {
|
||||
...{ x: undefined, touchedTasksArray: [] },
|
||||
...optionsArg
|
||||
};
|
||||
const x = options.x;
|
||||
const touchedTasksArray: Task[] = options.touchedTasksArray;
|
||||
|
||||
touchedTasksArray.push(taskToRun);
|
||||
|
||||
// run the task cascade
|
||||
const localDeferred = plugins.smartpromise.defer();
|
||||
localDeferred.promise
|
||||
.then(() => {
|
||||
// lets run any preTask
|
||||
|
||||
if (taskToRun.preTask && !Task.isTaskTouched(taskToRun.preTask, touchedTasksArray)) {
|
||||
return Task.runTask(taskToRun.preTask, { x, touchedTasksArray });
|
||||
} else {
|
||||
const done2 = plugins.smartpromise.defer();
|
||||
done2.resolve(x);
|
||||
return done2.promise;
|
||||
}
|
||||
})
|
||||
.then(async x => {
|
||||
// lets run the main task
|
||||
try {
|
||||
return await taskToRun.taskFunction(x);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
})
|
||||
.then(x => {
|
||||
if (taskToRun.afterTask && !Task.isTaskTouched(taskToRun.afterTask, touchedTasksArray)) {
|
||||
return Task.runTask(taskToRun.afterTask, { x: x, touchedTasksArray: touchedTasksArray });
|
||||
} else {
|
||||
const done2 = plugins.smartpromise.defer();
|
||||
done2.resolve(x);
|
||||
return done2.promise;
|
||||
}
|
||||
})
|
||||
.then(x => {
|
||||
done.resolve(x);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
localDeferred.resolve();
|
||||
return await done.promise;
|
||||
};
|
||||
|
||||
// INSTANCE
|
||||
// man datory properties
|
||||
public name: string;
|
||||
public taskFunction: ITaskFunction;
|
||||
public buffered: boolean;
|
||||
|
||||
public bufferMax: number;
|
||||
public execDelay: number;
|
||||
|
||||
// tasks to run before and after
|
||||
preTask: Task;
|
||||
afterTask: Task;
|
||||
public preTask: Task | TPreOrAfterTaskFunction;
|
||||
public afterTask: Task | TPreOrAfterTaskFunction;
|
||||
|
||||
// initialize by default
|
||||
running: boolean = false;
|
||||
bufferRunner = new helpers.BufferRunner(this);
|
||||
cycleCounter = new helpers.CycleCounter(this);
|
||||
public running: boolean = false;
|
||||
public bufferRunner = new BufferRunner(this);
|
||||
public cycleCounter = new CycleCounter(this);
|
||||
|
||||
idle: boolean = true;
|
||||
public idle: boolean = true;
|
||||
private _state: string = 'ready';
|
||||
|
||||
constructor(optionsArg: {
|
||||
@ -34,11 +152,11 @@ export class Task {
|
||||
/**
|
||||
* any other task to run before
|
||||
*/
|
||||
preTask?: Task;
|
||||
preTask?: Task | TPreOrAfterTaskFunction;
|
||||
/**
|
||||
* any other task to run after
|
||||
*/
|
||||
afterTask?: Task;
|
||||
afterTask?: Task | TPreOrAfterTaskFunction;
|
||||
/**
|
||||
* wether this task should run buffered
|
||||
*/
|
||||
@ -70,7 +188,7 @@ export class Task {
|
||||
/**
|
||||
* trigger the task. Will trigger buffered if this.buffered is true
|
||||
*/
|
||||
trigger(x?): Promise<any> {
|
||||
public trigger(x?): Promise<any> {
|
||||
if (this.buffered) {
|
||||
return this.triggerBuffered(x);
|
||||
} else {
|
||||
@ -81,14 +199,14 @@ export class Task {
|
||||
/**
|
||||
* trigger task unbuffered.
|
||||
*/
|
||||
triggerUnBuffered(x?): Promise<any> {
|
||||
return helpers.runTask(this, { x: x });
|
||||
public triggerUnBuffered(x?): Promise<any> {
|
||||
return Task.runTask(this, { x: x });
|
||||
}
|
||||
|
||||
/**
|
||||
* trigger task buffered.
|
||||
*/
|
||||
triggerBuffered(x?): Promise<any> {
|
||||
public triggerBuffered(x?): Promise<any> {
|
||||
return this.bufferRunner.trigger(x);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ export interface ICronJob {
|
||||
export class TaskManager {
|
||||
public taskMap = new plugins.lik.Objectmap<Task>();
|
||||
private cronJobMap = new plugins.lik.Objectmap<ICronJob>();
|
||||
|
||||
|
||||
constructor() {
|
||||
// nothing here
|
||||
}
|
||||
@ -85,7 +85,7 @@ export class TaskManager {
|
||||
|
||||
/**
|
||||
* deschedules a task by name
|
||||
* @param taskNameArg
|
||||
* @param taskNameArg
|
||||
*/
|
||||
public descheduleTaskByName(taskNameArg: string) {
|
||||
const descheduledCron = this.cronJobMap.findOneAndRemove(itemArg => {
|
||||
|
@ -3,14 +3,14 @@ import * as helpers from './taskbuffer.classes.helpers';
|
||||
import { Task } from './taskbuffer.classes.task';
|
||||
|
||||
export class Taskparallel extends Task {
|
||||
taskArray: Task[];
|
||||
public taskArray: Task[];
|
||||
constructor(optionsArg: { taskArray: Task[] }) {
|
||||
const options = {
|
||||
...optionsArg,
|
||||
...{
|
||||
taskFunction: () => {
|
||||
let done = plugins.smartpromise.defer();
|
||||
let promiseArray: Promise<any>[] = []; // stores promises of all tasks, since they run in parallel
|
||||
const done = plugins.smartpromise.defer();
|
||||
const promiseArray: Promise<any>[] = []; // stores promises of all tasks, since they run in parallel
|
||||
this.taskArray.forEach(function(taskArg) {
|
||||
promiseArray.push(taskArg.trigger());
|
||||
});
|
||||
|
63
ts/taskbuffer.classes.taskrunner.ts
Normal file
63
ts/taskbuffer.classes.taskrunner.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import * as plugins from './taskbuffer.plugins';
|
||||
|
||||
import { Task } from './taskbuffer.classes.task';
|
||||
|
||||
export class TaskRunner {
|
||||
public maxParrallelJobs: number = 1;
|
||||
public status: 'stopped' | 'running' = 'stopped';
|
||||
public runningTasks: plugins.lik.Objectmap<Task> = new plugins.lik.Objectmap<Task>();
|
||||
public qeuedTasks: Task[] = [];
|
||||
|
||||
constructor() {
|
||||
this.runningTasks.eventSubject.subscribe(async eventArg => {
|
||||
this.checkExecution();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* adds a task to the qeue
|
||||
*/
|
||||
public addTask(taskArg: Task) {
|
||||
this.qeuedTasks.push(taskArg);
|
||||
this.checkExecution();
|
||||
}
|
||||
|
||||
/**
|
||||
* set amount of parallel tasks
|
||||
* be careful, you might loose dependability of tasks
|
||||
*/
|
||||
public setMaxParallelJobs(maxParrallelJobsArg: number) {
|
||||
this.maxParrallelJobs = maxParrallelJobsArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* starts the task queue
|
||||
*/
|
||||
public start() {
|
||||
this.status = 'running';
|
||||
}
|
||||
|
||||
/**
|
||||
* checks wether execution is on point
|
||||
*/
|
||||
public async checkExecution() {
|
||||
if (
|
||||
this.runningTasks.getArray().length < this.maxParrallelJobs &&
|
||||
this.status === 'running' &&
|
||||
this.qeuedTasks.length > 0
|
||||
) {
|
||||
const nextJob = this.qeuedTasks.shift();
|
||||
this.runningTasks.add(nextJob);
|
||||
await nextJob.trigger();
|
||||
this.runningTasks.remove(nextJob);
|
||||
this.checkExecution();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* stops the task queue
|
||||
*/
|
||||
public stop() {
|
||||
this.status = 'stopped';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user