@verisoft/store 18.6.0 → 18.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +43 -0
- package/README.md +52 -3
- package/jest.config.ts +22 -0
- package/ng-package.json +7 -0
- package/package.json +13 -28
- package/project.json +36 -0
- package/{index.d.ts → src/index.ts} +12 -10
- package/src/lib/binding-state/binding.actions.ts +76 -0
- package/src/lib/binding-state/binding.effects.ts +472 -0
- package/src/lib/detail-state/detail.actions.ts +89 -0
- package/src/lib/detail-state/detail.effects.ts +283 -0
- package/src/lib/detail-state/detail.models.ts +42 -0
- package/src/lib/detail-state/detail.reducer.ts +147 -0
- package/src/lib/table-state/actions.ts +93 -0
- package/src/lib/table-state/effects.ts +99 -0
- package/src/lib/table-state/models.ts +20 -0
- package/src/lib/table-state/reducers.ts +126 -0
- package/src/test-setup.ts +8 -0
- package/tsconfig.json +29 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +16 -0
- package/esm2022/index.mjs +0 -11
- package/esm2022/lib/binding-state/binding.actions.mjs +0 -35
- package/esm2022/lib/binding-state/binding.effects.mjs +0 -124
- package/esm2022/lib/detail-state/detail.actions.mjs +0 -47
- package/esm2022/lib/detail-state/detail.effects.mjs +0 -116
- package/esm2022/lib/detail-state/detail.models.mjs +0 -12
- package/esm2022/lib/detail-state/detail.reducer.mjs +0 -87
- package/esm2022/lib/table-state/actions.mjs +0 -50
- package/esm2022/lib/table-state/effects.mjs +0 -49
- package/esm2022/lib/table-state/models.mjs +0 -12
- package/esm2022/lib/table-state/reducers.mjs +0 -80
- package/esm2022/verisoft-store.mjs +0 -5
- package/fesm2022/verisoft-store.mjs +0 -602
- package/fesm2022/verisoft-store.mjs.map +0 -1
- package/lib/binding-state/binding.actions.d.ts +0 -43
- package/lib/binding-state/binding.effects.d.ts +0 -45
- package/lib/detail-state/detail.actions.d.ts +0 -52
- package/lib/detail-state/detail.effects.d.ts +0 -52
- package/lib/detail-state/detail.models.d.ts +0 -27
- package/lib/detail-state/detail.reducer.d.ts +0 -4
- package/lib/table-state/actions.d.ts +0 -48
- package/lib/table-state/effects.d.ts +0 -25
- package/lib/table-state/models.d.ts +0 -9
- package/lib/table-state/reducers.d.ts +0 -3
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["../../../.eslintrc.base.json"],
|
|
3
|
+
"ignorePatterns": ["!**/*"],
|
|
4
|
+
"overrides": [
|
|
5
|
+
{
|
|
6
|
+
"files": ["*.ts"],
|
|
7
|
+
"extends": [
|
|
8
|
+
"plugin:@nx/angular",
|
|
9
|
+
"plugin:@angular-eslint/template/process-inline-templates"
|
|
10
|
+
],
|
|
11
|
+
"rules": {
|
|
12
|
+
"@angular-eslint/directive-selector": [
|
|
13
|
+
"error",
|
|
14
|
+
{
|
|
15
|
+
"type": "attribute",
|
|
16
|
+
"prefix": "lib",
|
|
17
|
+
"style": "camelCase"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"@angular-eslint/component-selector": [
|
|
21
|
+
"error",
|
|
22
|
+
{
|
|
23
|
+
"type": "element",
|
|
24
|
+
"prefix": "lib",
|
|
25
|
+
"style": "kebab-case"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"files": ["*.html"],
|
|
32
|
+
"extends": ["plugin:@nx/angular-template"],
|
|
33
|
+
"rules": {}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"files": ["*.json"],
|
|
37
|
+
"parser": "jsonc-eslint-parser",
|
|
38
|
+
"rules": {
|
|
39
|
+
"@nx/dependency-checks": "error"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
package/README.md
CHANGED
|
@@ -1,7 +1,56 @@
|
|
|
1
1
|
# store
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `store` library provides state management utilities and shared store logic for the Verisoft Frontend workspace.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Centralized state management for applications and libraries
|
|
8
|
+
- Shared selectors, actions, and reducers
|
|
9
|
+
- Utilities for working with NgRx or other state management solutions
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
This package is intended for internal use within the monorepo. To use it in another library or app, add it as a dependency in your `project.json`:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"store": "*"
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Import the required modules, services, or utilities from `store`:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { StoreModule } from '@verisoft/store';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Development
|
|
30
|
+
|
|
31
|
+
### Building
|
|
32
|
+
|
|
33
|
+
Run the following command to build the library:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
nx build store
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Running Unit Tests
|
|
40
|
+
|
|
41
|
+
To execute the unit tests for this library:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
nx test store
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Contributing
|
|
48
|
+
|
|
49
|
+
1. Fork the repository and create your branch from `master`.
|
|
50
|
+
2. Make your changes and add tests if needed.
|
|
51
|
+
3. Run `nx test store` to ensure all tests pass.
|
|
52
|
+
4. Submit a pull request.
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
This project is licensed under the MIT License.
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
export default {
|
|
3
|
+
displayName: 'store',
|
|
4
|
+
preset: '../../../jest.preset.js',
|
|
5
|
+
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
|
|
6
|
+
coverageDirectory: '../../../coverage/src/libs/store',
|
|
7
|
+
transform: {
|
|
8
|
+
'^.+\\.(ts|mjs|js|html)$': [
|
|
9
|
+
'jest-preset-angular',
|
|
10
|
+
{
|
|
11
|
+
tsconfig: '<rootDir>/tsconfig.spec.json',
|
|
12
|
+
stringifyContentPathRegex: '\\.(html|svg)$',
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
|
|
17
|
+
snapshotSerializers: [
|
|
18
|
+
'jest-preset-angular/build/serializers/no-ng-attributes',
|
|
19
|
+
'jest-preset-angular/build/serializers/ng-snapshot',
|
|
20
|
+
'jest-preset-angular/build/serializers/html-comment',
|
|
21
|
+
],
|
|
22
|
+
};
|
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,28 +1,13 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@verisoft/store",
|
|
3
|
-
"version": "18.
|
|
4
|
-
"peerDependencies": {
|
|
5
|
-
"@ngrx/store": "^18.0.2",
|
|
6
|
-
"@verisoft/core": "18.
|
|
7
|
-
"@ngrx/effects": "18.0.2",
|
|
8
|
-
"rxjs": "~7.8.0",
|
|
9
|
-
"@angular/router": "18.2.8"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"sideEffects": false,
|
|
15
|
-
"module": "fesm2022/verisoft-store.mjs",
|
|
16
|
-
"typings": "index.d.ts",
|
|
17
|
-
"exports": {
|
|
18
|
-
"./package.json": {
|
|
19
|
-
"default": "./package.json"
|
|
20
|
-
},
|
|
21
|
-
".": {
|
|
22
|
-
"types": "./index.d.ts",
|
|
23
|
-
"esm2022": "./esm2022/verisoft-store.mjs",
|
|
24
|
-
"esm": "./esm2022/verisoft-store.mjs",
|
|
25
|
-
"default": "./fesm2022/verisoft-store.mjs"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@verisoft/store",
|
|
3
|
+
"version": "18.7.0",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@ngrx/store": "^18.0.2",
|
|
6
|
+
"@verisoft/core": "18.7.0",
|
|
7
|
+
"@ngrx/effects": "18.0.2",
|
|
8
|
+
"rxjs": "~7.8.0",
|
|
9
|
+
"@angular/router": "18.2.8"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {},
|
|
12
|
+
"sideEffects": false
|
|
13
|
+
}
|
package/project.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "store",
|
|
3
|
+
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "src/libs/store/src",
|
|
5
|
+
"prefix": "lib",
|
|
6
|
+
"projectType": "library",
|
|
7
|
+
"tags": [],
|
|
8
|
+
"targets": {
|
|
9
|
+
"build": {
|
|
10
|
+
"executor": "@nx/angular:package",
|
|
11
|
+
"outputs": ["{workspaceRoot}/dist/{projectRoot}"],
|
|
12
|
+
"options": {
|
|
13
|
+
"project": "src/libs/store/ng-package.json"
|
|
14
|
+
},
|
|
15
|
+
"configurations": {
|
|
16
|
+
"production": {
|
|
17
|
+
"tsConfig": "src/libs/store/tsconfig.lib.prod.json"
|
|
18
|
+
},
|
|
19
|
+
"development": {
|
|
20
|
+
"tsConfig": "src/libs/store/tsconfig.lib.json"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"defaultConfiguration": "production"
|
|
24
|
+
},
|
|
25
|
+
"test": {
|
|
26
|
+
"executor": "@nx/jest:jest",
|
|
27
|
+
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
|
28
|
+
"options": {
|
|
29
|
+
"jestConfig": "src/libs/store/jest.config.ts"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"lint": {
|
|
33
|
+
"executor": "@nx/eslint:lint"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export * from './lib/detail-state/detail.actions';
|
|
2
|
-
export * from './lib/detail-state/detail.reducer';
|
|
3
|
-
export * from './lib/detail-state/detail.effects';
|
|
4
|
-
export * from './lib/detail-state/detail.models';
|
|
5
|
-
|
|
6
|
-
export * from './lib/table-state/
|
|
7
|
-
export * from './lib/table-state/
|
|
8
|
-
export * from './lib/table-state/
|
|
9
|
-
export * from './lib/
|
|
10
|
-
|
|
1
|
+
export * from './lib/detail-state/detail.actions';
|
|
2
|
+
export * from './lib/detail-state/detail.reducer';
|
|
3
|
+
export * from './lib/detail-state/detail.effects';
|
|
4
|
+
export * from './lib/detail-state/detail.models';
|
|
5
|
+
|
|
6
|
+
export * from './lib/table-state/actions';
|
|
7
|
+
export * from './lib/table-state/reducers';
|
|
8
|
+
export * from './lib/table-state/effects';
|
|
9
|
+
export * from './lib/table-state/models';
|
|
10
|
+
|
|
11
|
+
export * from './lib/binding-state/binding.actions';
|
|
12
|
+
export * from './lib/binding-state/binding.effects';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { createAction, props } from '@ngrx/store';
|
|
2
|
+
|
|
3
|
+
export function createAddBindingAction<TCreate>(bindingsRepository: string) {
|
|
4
|
+
return createAction(
|
|
5
|
+
`[${bindingsRepository}/API] Add bindings`,
|
|
6
|
+
props<{ binding: TCreate }>()
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function createAddBindingsAction<TCreate>(bindingsRepository: string) {
|
|
11
|
+
return createAction(
|
|
12
|
+
`[${bindingsRepository}/API] Add bindings`,
|
|
13
|
+
props<{ bindings: TCreate[] }>()
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function createAddBindingsFailureAction(bindingsRepository: string) {
|
|
18
|
+
return createAction(
|
|
19
|
+
`[${bindingsRepository}/API] Add bindings failure`,
|
|
20
|
+
props<{ error: any }>()
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function createAddBindingsSuccessAction(bindingsRepository: string) {
|
|
25
|
+
return createAction(
|
|
26
|
+
`[${bindingsRepository}/API] Add bindings success`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function createEditBindingAction<TEdit>(bindingsRepository: string) {
|
|
31
|
+
return createAction(
|
|
32
|
+
`[${bindingsRepository}/API] Edit binding`,
|
|
33
|
+
props<{ binding: TEdit }>()
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function createEditBindingFailureAction(bindingsRepository: string) {
|
|
38
|
+
return createAction(
|
|
39
|
+
`[${bindingsRepository}/API] Edit binding failure`,
|
|
40
|
+
props<{ error: any }>()
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function createEditBindingSuccessAction(bindingsRepository: string) {
|
|
45
|
+
return createAction(
|
|
46
|
+
`[${bindingsRepository}/API] Edit binding success`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function createDeleteBindingAction(bindingsRepository: string) {
|
|
51
|
+
return createAction(
|
|
52
|
+
`[${bindingsRepository}/API] Delete binding`,
|
|
53
|
+
props<{ id: number | string }>()
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function createDeleteBindingsAction(bindingsRepository: string) {
|
|
58
|
+
return createAction(
|
|
59
|
+
`[${bindingsRepository}/API] Delete bindings`,
|
|
60
|
+
props<{ bindingIds: number[] }>()
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function createDeleteBindingsFailureAction(bindingsRepository: string) {
|
|
65
|
+
return createAction(
|
|
66
|
+
`[${bindingsRepository}/API] Delete bindings failure`,
|
|
67
|
+
props<{ error: any }>()
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function createDeleteBindingsSuccessAction(bindingsRepository: string) {
|
|
72
|
+
return createAction(
|
|
73
|
+
`[${bindingsRepository}/API] Delete bindings success`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|