fix(core): update

This commit is contained in:
Philipp Kunz 2022-01-24 06:39:36 +01:00
parent be505ee915
commit f7887a6663
12 changed files with 19435 additions and 3516 deletions

View File

@ -12,6 +12,9 @@ stages:
- release
- metadata
before_script:
- npm install -g @shipzone/npmci
# ====================
# security stage
# ====================
@ -36,6 +39,7 @@ auditProductionDependencies:
- 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

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

@ -9,7 +9,7 @@
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "smartstate",
"shortDescription": "a package that handles state in a good way",
"description": "a package that handles state in a good way",
"npmPackagename": "@pushrocks/smartstate",
"license": "MIT"
}

22860
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,19 +12,21 @@
"build": "(tsbuild --web && tsbundle npm)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsbundle": "^1.0.78",
"@gitzone/tstest": "^1.0.52",
"@gitzone/tsbuild": "^2.1.29",
"@gitzone/tsbundle": "^1.0.89",
"@gitzone/tstest": "^1.0.60",
"@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^14.14.10",
"@types/node": "^17.0.10",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},
"dependencies": {
"@pushrocks/lik": "^4.0.20",
"@pushrocks/smartpromise": "^3.1.3",
"@pushrocks/smartrx": "^2.0.19",
"rxjs": "^6.6.3"
"@pushrocks/isohash": "^1.0.2",
"@pushrocks/lik": "^5.0.1",
"@pushrocks/smartjson": "^4.0.6",
"@pushrocks/smartobject": "^1.0.6",
"@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartrx": "^2.0.20"
},
"files": [
"ts/**/*",

View File

@ -1,5 +1,3 @@
export * from './smartstate.classes.smartstate';
export * from './smartstate.classes.statepart';
export * from './smartstate.classes.statecollection';
export * from './smartstate.classes.stateaction';
export * from './smartstate.classes.stateobservable';

View File

@ -5,7 +5,7 @@ import { StatePart } from './smartstate.classes.statepart';
* Smartstate takes care of providing state
*/
export class Smartstate<StatePartNameType> {
public statePartMap: { [key: string]: StatePart<StatePartNameType, unknown> } = {};
public statePartMap: { [key: string]: StatePart<StatePartNameType, any> } = {};
constructor() {}

View File

@ -1,12 +0,0 @@
import * as plugins from './smartstate.plugins';
import { StatePart } from './smartstate.classes.statepart';
/**
* A StatePartCollection is a collection of StateParts.
* It can be used for expressing interest in a certain set of StateParts.
*/
export class StatePartCollection<StatePartNameType, T> extends StatePart<StatePartNameType, T> {
constructor(nameArg: StatePartNameType) {
super(nameArg);
}
}

View File

@ -1,13 +0,0 @@
import * as plugins from './smartstate.plugins';
/**
* State observable observes a StatePart and notifies everyone interested
*/
export class StateObservable {
/**
* creates an observable from a StateCollection
*/
public static fromStatePartCollection(filterArg?: () => any) {}
constructor() {}
}

View File

@ -30,8 +30,17 @@ export class StatePart<TStatePartName, TStatePayload> {
* notifies of a change on the state
*/
public notifyChange() {
const createStateHash = (stateArg: any) => {
return plugins.isohash.sha256FromString(plugins.smartjson.stringify(stateArg));
};
if (this.stateStore && this.lastStateNotificationPayloadHash && createStateHash(this.stateStore) === createStateHash(this.lastStateNotificationPayloadHash)) {
return;
} else {
this.lastStateNotificationPayloadHash = this.stateStore;
}
this.state.next(this.stateStore);
}
private lastStateNotificationPayloadHash: any;
/**
* selects a state or a substate

View File

@ -1,4 +1,7 @@
import * as isohash from '@pushrocks/isohash';
import * as smartjson from '@pushrocks/smartjson';
import * as smartobject from '@pushrocks/smartobject';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrx from '@pushrocks/smartrx';
export { smartpromise, smartrx };
export { isohash, smartjson, smartobject, smartpromise, smartrx };