fix(core): update

This commit is contained in:
Philipp Kunz 2022-08-07 11:19:43 +02:00
parent 875c06f86c
commit fcd50a780a
10 changed files with 55 additions and 61 deletions

4
.gitignore vendored
View File

@ -15,8 +15,6 @@ node_modules/
# builds
dist/
dist_web/
dist_serve/
dist_ts_web/
dist_*/
# custom

View File

@ -12,29 +12,35 @@ stages:
- release
- metadata
before_script:
- npm install -g @shipzone/npmci
# ====================
# security stage
# ====================
mirror:
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci git mirror
- 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:
- lossless
- docker
- notpriv
allow_failure: true
snyk:
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command snyk test
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags:
- lossless
- docker
- notpriv
allow_failure: true
# ====================
# test stage
@ -49,9 +55,7 @@ testStable:
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
testBuild:
stage: test
@ -62,9 +66,7 @@ testBuild:
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
release:
stage: release
@ -84,11 +86,12 @@ release:
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci command npm install -g typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
@ -108,11 +111,10 @@ trigger:
pages:
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci node install stable
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
- npmci command npm run buildDocs
tags:
- lossless
- docker

24
.vscode/launch.json vendored
View File

@ -2,28 +2,10 @@
"version": "0.2.0",
"configurations": [
{
"name": "current file",
"type": "node",
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
"type": "node-terminal"
}
]
}

View File

@ -15,7 +15,7 @@
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm"]
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}

View File

@ -5,7 +5,7 @@
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "smartrule",
"shortDescription": "a smart rule library for handling decision trees.",
"description": "a smart rule library for handling decision trees.",
"npmPackagename": "@pushrocks/smartrule",
"license": "MIT",
"projectDomain": "push.rocks"

View File

@ -3,15 +3,16 @@
"version": "2.0.0",
"private": false,
"description": "a smart rule library for handling decision trees.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
"author": "Lossless GmbH",
"license": "MIT",
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild --web)",
"format": "(gitzone format)"
"format": "(gitzone format)",
"buildDocs": "tsdoc"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.65",
@ -23,11 +24,15 @@
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_web/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
}
}

View File

@ -8,13 +8,20 @@ a smart rule library for handling decision trees.
* [docs (typedoc)](https://pushrocks.gitlab.io/smartrule/)
## Status for master
[![pipeline status](https://gitlab.com/pushrocks/smartrule/badges/master/pipeline.svg)](https://gitlab.com/pushrocks/smartrule/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartrule/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartrule/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartrule.svg)](https://www.npmjs.com/package/@pushrocks/smartrule)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartrule/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartrule)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartrule/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartrule/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartrule)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartrule)](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/)
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/smartrule)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartrule)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartrule)](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

View File

@ -12,12 +12,12 @@ tap.test('first test', async () => {
testSmartruleInstance = new smartrule.SmartRule<ITestMessage>();
testSmartruleInstance.createRule(
2,
async messageArg => {
async (messageArg) => {
if (messageArg.body.startsWith('hello')) {
return 'apply-stop';
}
},
async messageArg => {
async (messageArg) => {
console.log(`rule triggered for message with body ${messageArg.body}`);
}
);
@ -26,7 +26,7 @@ tap.test('first test', async () => {
tap.test('make a decision based on an object', async () => {
testSmartruleInstance.makeDecision({
id: '123456',
body: 'hello, there. This is a cool message!'
body: 'hello, there. This is a cool message!',
});
});

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartrule',
version: '2.0.0',
version: '2.0.1',
description: 'a smart rule library for handling decision trees.'
}

View File

@ -20,7 +20,7 @@ export class SmartRule<T> {
// gets the next batch with the same priority
const getNextParallelBatch = (priorityStart: number) => {
return this.rules.filter(rule => {
return this.rules.filter((rule) => {
return rule.priority === priorityStart;
});
};