fix(core): update
This commit is contained in:
parent
801e2ad266
commit
86b2842ed2
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
name: Default (not tags)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags-ignore:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||||
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
|
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install pnpm and npmci
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
|
||||||
|
- name: Run npm prepare
|
||||||
|
run: npmci npm prepare
|
||||||
|
|
||||||
|
- name: Audit production dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --prod
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Audit development dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --dev
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: security
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Test stable
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm test
|
||||||
|
|
||||||
|
- name: Test build
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm build
|
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
name: Default (tags)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||||
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
|
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Audit production dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --prod
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Audit development dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --dev
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: security
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Test stable
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm test
|
||||||
|
|
||||||
|
- name: Test build
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm build
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: test
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm publish
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
needs: test
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @shipzone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Code quality
|
||||||
|
run: |
|
||||||
|
npmci command npm install -g typescript
|
||||||
|
npmci npm install
|
||||||
|
|
||||||
|
- name: Trigger
|
||||||
|
run: npmci trigger
|
||||||
|
|
||||||
|
- name: Build docs and upload artifacts
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
pnpm install -g @gitzone/tsdoc
|
||||||
|
npmci command tsdoc
|
||||||
|
continue-on-error: true
|
141
.gitlab-ci.yml
141
.gitlab-ci.yml
@ -1,141 +0,0 @@
|
|||||||
# gitzone ci_default
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .npmci_cache/
|
|
||||||
key: '$CI_BUILD_STAGE'
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- security
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- metadata
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- npm install -g @shipzone/npmci
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# security stage
|
|
||||||
# ====================
|
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
auditProductionDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --production --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=prod --production
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
auditDevDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=dev
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# test stage
|
|
||||||
# ====================
|
|
||||||
|
|
||||||
testStable:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
testBuild:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command npm run build
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# metadata stage
|
|
||||||
# ====================
|
|
||||||
codequality:
|
|
||||||
stage: metadata
|
|
||||||
allow_failure: true
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
script:
|
|
||||||
- npmci command npm install -g tslint typescript
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
pages:
|
|
||||||
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:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
allow_failure: true
|
|
@ -8,10 +8,10 @@
|
|||||||
"projectType": "npm",
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "pushrocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "taskbuffer",
|
"gitrepo": "taskbuffer",
|
||||||
"shortDescription": "flexible task management. TypeScript ready!",
|
"description": "flexible task management. TypeScript ready!",
|
||||||
"npmPackagename": "@pushrocks/taskbuffer",
|
"npmPackagename": "@push.rocks/taskbuffer",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
package.json
21
package.json
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/taskbuffer",
|
"name": "@push.rocks/taskbuffer",
|
||||||
"version": "3.0.10",
|
"version": "3.0.10",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "flexible task management. TypeScript ready!",
|
"description": "flexible task management. TypeScript ready!",
|
||||||
@ -8,7 +8,8 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --web)",
|
||||||
"build": "(tsbuild --web && tsbundle npm)"
|
"build": "(tsbuild --web && tsbundle npm)",
|
||||||
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -28,20 +29,20 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/taskbuffer#readme",
|
"homepage": "https://gitlab.com/pushrocks/taskbuffer#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/isounique": "^1.0.5",
|
"@push.rocks/isounique": "^1.0.5",
|
||||||
"@pushrocks/lik": "^6.0.0",
|
"@push.rocks/lik": "^6.0.0",
|
||||||
"@pushrocks/smartdelay": "^2.0.13",
|
"@push.rocks/smartdelay": "^3.0.5",
|
||||||
"@pushrocks/smartlog": "^3.0.1",
|
"@push.rocks/smartlog": "^3.0.1",
|
||||||
"@pushrocks/smartpromise": "^3.1.7",
|
"@push.rocks/smartpromise": "^4.0.3",
|
||||||
"@pushrocks/smartrx": "^3.0.0",
|
"@push.rocks/smartrx": "^3.0.0",
|
||||||
"@pushrocks/smarttime": "^4.0.1"
|
"@push.rocks/smarttime": "^4.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.63",
|
"@gitzone/tsbuild": "^2.1.63",
|
||||||
"@gitzone/tsbundle": "^2.0.6",
|
"@gitzone/tsbundle": "^2.0.6",
|
||||||
"@gitzone/tsrun": "^1.2.39",
|
"@gitzone/tsrun": "^1.2.39",
|
||||||
"@gitzone/tstest": "^1.0.72",
|
"@gitzone/tstest": "^1.0.72",
|
||||||
"@pushrocks/tapbundle": "^5.0.4",
|
"@push.rocks/tapbundle": "^5.0.4",
|
||||||
"@types/node": "^18.11.18"
|
"@types/node": "^18.11.18"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
1618
pnpm-lock.yaml
generated
1618
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
30
readme.md
30
readme.md
@ -1,27 +1,26 @@
|
|||||||
# @pushrocks/taskbuffer
|
# @push.rocks/taskbuffer
|
||||||
flexible task management. TypeScript ready!
|
flexible task management. TypeScript ready!
|
||||||
|
|
||||||
## Availabililty and Links
|
## Availabililty and Links
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/taskbuffer)
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/taskbuffer)
|
||||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/taskbuffer)
|
* [gitlab.com (source)](https://gitlab.com/push.rocks/taskbuffer)
|
||||||
* [github.com (source mirror)](https://github.com/pushrocks/taskbuffer)
|
* [github.com (source mirror)](https://github.com/push.rocks/taskbuffer)
|
||||||
* [docs (typedoc)](https://pushrocks.gitlab.io/taskbuffer/)
|
* [docs (typedoc)](https://push.rocks.gitlab.io/taskbuffer/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
|
|
||||||
Status Category | Status Badge
|
Status Category | Status Badge
|
||||||
-- | --
|
-- | --
|
||||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/taskbuffer/badges/master/pipeline.svg)](https://lossless.cloud)
|
GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/taskbuffer/badges/master/pipeline.svg)](https://lossless.cloud)
|
||||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/taskbuffer/badges/master/coverage.svg)](https://lossless.cloud)
|
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/taskbuffer/badges/master/coverage.svg)](https://lossless.cloud)
|
||||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/taskbuffer)](https://lossless.cloud)
|
npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/taskbuffer)](https://lossless.cloud)
|
||||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/taskbuffer)](https://lossless.cloud)
|
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/taskbuffer)](https://lossless.cloud)
|
||||||
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
||||||
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
||||||
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/taskbuffer)](https://lossless.cloud)
|
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/taskbuffer)](https://lossless.cloud)
|
||||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/taskbuffer)](https://lossless.cloud)
|
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/taskbuffer)](https://lossless.cloud)
|
||||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/taskbuffer)](https://lossless.cloud)
|
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/taskbuffer)](https://lossless.cloud)
|
||||||
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@ -57,7 +56,6 @@ We are always happy for code contributions. If you are not the code contributing
|
|||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
## Legal
|
||||||
|
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||||
|
|
||||||
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
import * as taskbuffer from '../ts/index.js';
|
import * as taskbuffer from '../ts/index.js';
|
||||||
|
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
|
|
||||||
// setup some testData to work with
|
// setup some testData to work with
|
||||||
let testTask: taskbuffer.Task;
|
let testTask: taskbuffer.Task;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
import * as taskbuffer from '../ts/index.js';
|
import * as taskbuffer from '../ts/index.js';
|
||||||
|
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
|
|
||||||
let task1Executed = false;
|
let task1Executed = false;
|
||||||
const task1 = new taskbuffer.Task({
|
const task1 = new taskbuffer.Task({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
|
|
||||||
import * as taskbuffer from '../ts/index.js';
|
import * as taskbuffer from '../ts/index.js';
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
import * as taskbuffer from '../ts/index.js';
|
import * as taskbuffer from '../ts/index.js';
|
||||||
|
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
|
|
||||||
let myTaskManager: taskbuffer.TaskManager;
|
let myTaskManager: taskbuffer.TaskManager;
|
||||||
let taskRunCounter = 0;
|
let taskRunCounter = 0;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
import * as taskbuffer from '../ts/index.js';
|
import * as taskbuffer from '../ts/index.js';
|
||||||
|
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
|
|
||||||
const flowTask1 = new taskbuffer.Task({
|
const flowTask1 = new taskbuffer.Task({
|
||||||
taskFunction: (x: number) => {
|
taskFunction: (x: number) => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
import * as taskbuffer from '../ts/index.js';
|
import * as taskbuffer from '../ts/index.js';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { tap, expect } from '@pushrocks/tapbundle';
|
import { tap, expect } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
import * as taskbuffer from '../ts/index.js';
|
import * as taskbuffer from '../ts/index.js';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { tap, expect } from '@pushrocks/tapbundle';
|
import { tap, expect } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
import * as taskbuffer from '../ts/index.js';
|
import * as taskbuffer from '../ts/index.js';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { tap, expect } from '@pushrocks/tapbundle';
|
import { tap, expect } from '@push.rocks/tapbundle';
|
||||||
|
|
||||||
import * as taskbuffer from '../ts/index.js';
|
import * as taskbuffer from '../ts/index.js';
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* autocreated commitinfo by @pushrocks/commitinfo
|
* autocreated commitinfo by @pushrocks/commitinfo
|
||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@pushrocks/taskbuffer',
|
name: '@push.rocks/taskbuffer',
|
||||||
version: '3.0.10',
|
version: '3.0.11',
|
||||||
description: 'flexible task management. TypeScript ready!'
|
description: 'flexible task management. TypeScript ready!'
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export { Task } from './taskbuffer.classes.task.js';
|
export { Task } from './taskbuffer.classes.task.js';
|
||||||
export type { ITaskFunction } from './taskbuffer.classes.task.js'
|
export type { ITaskFunction } from './taskbuffer.classes.task.js';
|
||||||
export { Taskchain } from './taskbuffer.classes.taskchain.js';
|
export { Taskchain } from './taskbuffer.classes.taskchain.js';
|
||||||
export { Taskparallel } from './taskbuffer.classes.taskparallel.js';
|
export { Taskparallel } from './taskbuffer.classes.taskparallel.js';
|
||||||
export { TaskManager } from './taskbuffer.classes.taskmanager.js';
|
export { TaskManager } from './taskbuffer.classes.taskmanager.js';
|
||||||
@ -7,6 +7,4 @@ export { TaskOnce } from './taskbuffer.classes.taskonce.js';
|
|||||||
export { TaskRunner } from './taskbuffer.classes.taskrunner.js';
|
export { TaskRunner } from './taskbuffer.classes.taskrunner.js';
|
||||||
export { TaskDebounced } from './taskbuffer.classes.taskdebounced.js';
|
export { TaskDebounced } from './taskbuffer.classes.taskdebounced.js';
|
||||||
import * as distributedCoordination from './taskbuffer.classes.distributedcoordinator.js';
|
import * as distributedCoordination from './taskbuffer.classes.distributedcoordinator.js';
|
||||||
export {
|
export { distributedCoordination };
|
||||||
distributedCoordination
|
|
||||||
}
|
|
||||||
|
@ -22,6 +22,9 @@ export interface IDistributedTaskRequestResult {
|
|||||||
* this needs to correlate to the decisionInfoBasis
|
* this needs to correlate to the decisionInfoBasis
|
||||||
*/
|
*/
|
||||||
submitterRandomId: string;
|
submitterRandomId: string;
|
||||||
|
/**
|
||||||
|
* can be used while debugging
|
||||||
|
*/
|
||||||
considered: boolean;
|
considered: boolean;
|
||||||
rank: string;
|
rank: string;
|
||||||
reason: string;
|
reason: string;
|
||||||
@ -29,6 +32,10 @@ export interface IDistributedTaskRequestResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export abstract class AbstractDistributedCoordinator {
|
export abstract class AbstractDistributedCoordinator {
|
||||||
public abstract fireDistributedTaskRequest(infoBasisArg: IDistributedTaskRequest): Promise<IDistributedTaskRequestResult>
|
public abstract fireDistributedTaskRequest(
|
||||||
public abstract updateDistributedTaskRequest(infoBasisArg: IDistributedTaskRequest): Promise<void>
|
infoBasisArg: IDistributedTaskRequest
|
||||||
|
): Promise<IDistributedTaskRequestResult>;
|
||||||
|
public abstract updateDistributedTaskRequest(
|
||||||
|
infoBasisArg: IDistributedTaskRequest
|
||||||
|
): Promise<void>;
|
||||||
}
|
}
|
@ -9,7 +9,7 @@ export interface ICronJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ITaskManagerConstructorOptions {
|
export interface ITaskManagerConstructorOptions {
|
||||||
distributedCoordinator?: AbstractDistributedCoordinator
|
distributedCoordinator?: AbstractDistributedCoordinator;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TaskManager {
|
export class TaskManager {
|
||||||
@ -18,7 +18,7 @@ export class TaskManager {
|
|||||||
private cronJobManager = new plugins.smarttime.CronManager();
|
private cronJobManager = new plugins.smarttime.CronManager();
|
||||||
|
|
||||||
public options: ITaskManagerConstructorOptions = {
|
public options: ITaskManagerConstructorOptions = {
|
||||||
distributedCoordinator: null
|
distributedCoordinator: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(optionosArg: ITaskManagerConstructorOptions = {}) {
|
constructor(optionosArg: ITaskManagerConstructorOptions = {}) {
|
||||||
@ -78,36 +78,40 @@ export class TaskManager {
|
|||||||
*/
|
*/
|
||||||
public scheduleTaskByName(taskNameArg: string, cronStringArg: string) {
|
public scheduleTaskByName(taskNameArg: string, cronStringArg: string) {
|
||||||
const taskToSchedule = this.getTaskByName(taskNameArg);
|
const taskToSchedule = this.getTaskByName(taskNameArg);
|
||||||
const cronJob = this.cronJobManager.addCronjob(cronStringArg, async (triggerTimeArg: number) => {
|
const cronJob = this.cronJobManager.addCronjob(
|
||||||
console.log(`taskbuffer schedule triggered task >>${taskToSchedule.name}<<`);
|
cronStringArg,
|
||||||
console.log(
|
async (triggerTimeArg: number) => {
|
||||||
`task >>${taskToSchedule.name}<< is ${
|
console.log(`taskbuffer schedule triggered task >>${taskToSchedule.name}<<`);
|
||||||
taskToSchedule.buffered
|
console.log(
|
||||||
? `buffered with max ${taskToSchedule.bufferMax} buffered calls`
|
`task >>${taskToSchedule.name}<< is ${
|
||||||
: `unbuffered`
|
taskToSchedule.buffered
|
||||||
}`
|
? `buffered with max ${taskToSchedule.bufferMax} buffered calls`
|
||||||
);
|
: `unbuffered`
|
||||||
if (this.options.distributedCoordinator) {
|
}`
|
||||||
console.log(`Found a distrubuted coordinator, performing distributed consultation.`);
|
);
|
||||||
const announcementResult = await this.options.distributedCoordinator.fireDistributedTaskRequest({
|
if (this.options.distributedCoordinator) {
|
||||||
submitterRandomId: this.randomId,
|
console.log(`Found a distrubuted coordinator, performing distributed consultation.`);
|
||||||
status: 'requesting',
|
const announcementResult =
|
||||||
taskExecutionParallel: 1,
|
await this.options.distributedCoordinator.fireDistributedTaskRequest({
|
||||||
taskExecutionTime: triggerTimeArg,
|
submitterRandomId: this.randomId,
|
||||||
taskExecutionTimeout: taskToSchedule.timeout,
|
status: 'requesting',
|
||||||
taskName: taskToSchedule.name,
|
taskExecutionParallel: 1,
|
||||||
taskVersion: taskToSchedule.version,
|
taskExecutionTime: triggerTimeArg,
|
||||||
});
|
taskExecutionTimeout: taskToSchedule.timeout,
|
||||||
|
taskName: taskToSchedule.name,
|
||||||
|
taskVersion: taskToSchedule.version,
|
||||||
|
});
|
||||||
|
|
||||||
if (!announcementResult.shouldTrigger) {
|
if (!announcementResult.shouldTrigger) {
|
||||||
console.log('distributed coordinator result: NOT EXECUTING')
|
console.log('distributed coordinator result: NOT EXECUTING');
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
console.log('distributed coordinator result: CHOSEN AND EXECUTING')
|
console.log('distributed coordinator result: CHOSEN AND EXECUTING');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
await taskToSchedule.trigger();
|
||||||
}
|
}
|
||||||
await taskToSchedule.trigger();
|
);
|
||||||
});
|
|
||||||
taskToSchedule.cronJob = cronJob;
|
taskToSchedule.cronJob = cronJob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import * as isounique from '@pushrocks/isounique';
|
import * as isounique from '@push.rocks/isounique';
|
||||||
import * as lik from '@pushrocks/lik';
|
import * as lik from '@push.rocks/lik';
|
||||||
import * as smartlog from '@pushrocks/smartlog';
|
import * as smartlog from '@push.rocks/smartlog';
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
import * as smartrx from '@pushrocks/smartrx';
|
import * as smartrx from '@push.rocks/smartrx';
|
||||||
import * as smarttime from '@pushrocks/smarttime';
|
import * as smarttime from '@push.rocks/smarttime';
|
||||||
|
|
||||||
export { isounique, lik, smartlog, smartpromise, smartdelay, smartrx, smarttime };
|
export { isounique, lik, smartlog, smartpromise, smartdelay, smartrx, smarttime };
|
||||||
|
Loading…
Reference in New Issue
Block a user