@o3r/core 14.0.0-next.8 → 14.0.0-next.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/core",
3
- "version": "14.0.0-next.8",
3
+ "version": "14.0.0-next.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,7 +38,7 @@
38
38
  "@ngrx/entity": "^20.0.0",
39
39
  "@ngrx/store": "^20.0.0",
40
40
  "@nx/angular": "~21.6.0",
41
- "@o3r/telemetry": "~14.0.0-next.8",
41
+ "@o3r/telemetry": "~14.0.0-next.9",
42
42
  "@schematics/angular": "^20.0.0",
43
43
  "chokidar": "^4.0.3",
44
44
  "globby": "^11.1.0",
@@ -76,7 +76,7 @@
76
76
  }
77
77
  },
78
78
  "dependencies": {
79
- "@o3r/schematics": "~14.0.0-next.8",
79
+ "@o3r/schematics": "~14.0.0-next.9",
80
80
  "tslib": "^2.6.2",
81
81
  "uuid": "^11.0.5"
82
82
  },
@@ -88,11 +88,11 @@
88
88
  "@ngrx/store": "~20.1.0",
89
89
  "@ngrx/store-devtools": "~20.1.0",
90
90
  "@nx/eslint-plugin": "~21.6.0",
91
- "@o3r/store-sync": "~14.0.0-next.8",
91
+ "@o3r/store-sync": "~14.0.0-next.9",
92
92
  "@stylistic/eslint-plugin": "~5.6.0",
93
93
  "@types/jest": "~30.0.0",
94
- "@typescript-eslint/eslint-plugin": "~8.47.0",
95
- "@typescript-eslint/parser": "~8.47.0",
94
+ "@typescript-eslint/eslint-plugin": "~8.51.0",
95
+ "@typescript-eslint/parser": "~8.51.0",
96
96
  "angular-eslint": "~20.6.0",
97
97
  "cpy-cli": "^6.0.0",
98
98
  "eslint": "~9.39.0",
@@ -100,7 +100,7 @@
100
100
  "eslint-import-resolver-typescript": "~4.4.0",
101
101
  "eslint-plugin-import": "~2.32.0",
102
102
  "eslint-plugin-import-newlines": "~1.4.0",
103
- "eslint-plugin-jest": "~29.1.0",
103
+ "eslint-plugin-jest": "~29.11.0",
104
104
  "eslint-plugin-jsdoc": "~61.5.0",
105
105
  "eslint-plugin-prefer-arrow": "~1.2.3",
106
106
  "eslint-plugin-unicorn": "~62.0.0",
@@ -114,7 +114,7 @@
114
114
  "jsonc-eslint-parser": "~2.4.0",
115
115
  "nx": "~21.6.0",
116
116
  "ts-jest": "~29.4.0",
117
- "typescript-eslint": "~8.47.0",
117
+ "typescript-eslint": "~8.51.0",
118
118
  "zone.js": "~0.15.0"
119
119
  },
120
120
  "engines": {
@@ -1,4 +1,4 @@
1
- import { InjectionToken, ModuleWithProviders, NgModule } from '@angular/core';
1
+ import { InjectionToken, ModuleWithProviders, NgModule, Optional } from '@angular/core';
2
2
  import { Action, ActionReducer, StoreModule } from '@ngrx/store';
3
3
  <%if (isAsync) {%>
4
4
  import { EffectsModule } from '@ngrx/effects';
@@ -6,24 +6,35 @@ import { <%= storeName %>Effect } from './<%= fileName %>.effect';<%}%>
6
6
  import { <%= cStoreName %>Reducer } from './<%= fileName %>.reducer';
7
7
  import { <%= scuStoreName %>_STORE_NAME, <%= storeName %>State } from './<%= fileName %>.state';
8
8
 
9
+ /** Action Reducer map for <%= storeName %> store */
10
+ type <%= storeName %>ActionReducer<T extends <%= storeName %>State=<%= storeName %>State, V extends Action=Action> = ActionReducer<T, V>;
11
+
12
+ /** Internal Token of the <%= storeName %> reducer */
13
+ const INTERNAL_<%= scuStoreName %>_REDUCER_TOKEN = new InjectionToken<<%= storeName %>ActionReducer>('Internal <%= storeName %> Reducer');
14
+
9
15
  /** Token of the <%= storeName %> reducer */
10
- export const <%= scuStoreName %>_REDUCER_TOKEN = new InjectionToken<ActionReducer<<%= storeName %>State, Action>>('Feature <%= storeName %> Reducer');
16
+ export const <%= scuStoreName %>_REDUCER_TOKEN = new InjectionToken<<%= storeName %>ActionReducer>('Feature <%= storeName %> Reducer');
11
17
 
12
- /** Provide default reducer for <%= storeName %> store */
13
- export function getDefault<%= storeName %>Reducer() {
14
- return <%= cStoreName %>Reducer;
18
+ /**
19
+ * Retrieve default reducer for <%= storeName %> store
20
+ * @param customReducer
21
+ */
22
+ export function get<%= storeName %>Reducer(customReducer: <%= storeName %>ActionReducer = <%= cStoreName %>Reducer): <%= storeName %>ActionReducer {
23
+ return customReducer;
15
24
  }
16
25
 
17
26
  @NgModule({
18
27
  imports: [
19
- StoreModule.forFeature(<%= scuStoreName %>_STORE_NAME, <%= scuStoreName %>_REDUCER_TOKEN)<%if (isAsync) {%>, EffectsModule.forFeature([<%= storeName %>Effect])<%}%>
28
+ StoreModule.forFeature(<%= scuStoreName %>_STORE_NAME, INTERNAL_<%= scuStoreName %>_REDUCER_TOKEN)<%if (isAsync) {%>, EffectsModule.forFeature([<%= storeName %>Effect])<%}%>
20
29
  ],
21
- providers: [
22
- { provide: <%= scuStoreName %>_REDUCER_TOKEN, useFactory: getDefault<%= storeName %>Reducer }
23
- ]
30
+ providers: [{
31
+ provide: INTERNAL_<%= scuStoreName %>_REDUCER_TOKEN,
32
+ useFactory: get<%= storeName %>Reducer,
33
+ deps: [[new Optional(), <%= scuStoreName %>_REDUCER_TOKEN]]
34
+ }]
24
35
  })
25
36
  export class <%= storeName %>StoreModule {
26
- public static forRoot<T extends <%= storeName %>State>(reducerFactory: () => ActionReducer<T, Action>): ModuleWithProviders<<%= storeName %>StoreModule> {
37
+ public static forRoot<T extends <%= storeName %>State>(reducerFactory: () => <%= storeName %>ActionReducer<T>): ModuleWithProviders<<%= storeName %>StoreModule> {
27
38
  return {
28
39
  ngModule: <%= storeName %>StoreModule,
29
40
  providers: [