@o3r/configuration 15.3.0-prerelease.9 → 15.4.0-prerelease.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.
@@ -1,28 +1,14 @@
1
- /**
2
- * Fixture file for configuration service
3
- */
4
- class ConfigurationBaseServiceFixture {
5
- constructor() {
6
- /** @inheritDoc */
7
- this.updateConfiguration = jasmine.createSpy('updateConfiguration');
8
- /** @inheritDoc */
9
- this.upsertConfiguration = jasmine.createSpy('upsertConfiguration');
10
- /** @inheritDoc */
11
- this.computeConfiguration = jasmine.createSpy('computeConfiguration');
12
- /** @inheritDoc */
13
- this.getConfigFromBodyTag = jasmine.createSpy('getConfigFromBodyTag');
14
- /** @inheritDoc */
15
- this.extendConfiguration = jasmine.createSpy('extendConfiguration');
16
- /** @inheritDoc */
17
- this.getComponentConfig = jasmine.createSpy('getComponentConfig');
18
- /** @inheritDoc */
19
- this.getConfig = jasmine.createSpy('getConfig');
20
- }
21
- }
22
-
23
- /**
24
- * Generated bundle index. Do not edit.
25
- */
26
-
1
+ var ConfigurationBaseServiceFixture = class {
2
+ constructor() {
3
+ this.updateConfiguration = jasmine.createSpy("updateConfiguration");
4
+ this.upsertConfiguration = jasmine.createSpy("upsertConfiguration");
5
+ this.computeConfiguration = jasmine.createSpy("computeConfiguration");
6
+ this.getConfigFromBodyTag = jasmine.createSpy("getConfigFromBodyTag");
7
+ this.extendConfiguration = jasmine.createSpy("extendConfiguration");
8
+ this.getComponentConfig = jasmine.createSpy("getComponentConfig");
9
+ this.getConfig = jasmine.createSpy("getConfig");
10
+ }
11
+ };
27
12
  export { ConfigurationBaseServiceFixture };
28
- //# sourceMappingURL=o3r-configuration-fixtures-jasmine.mjs.map
13
+
14
+ //# sourceMappingURL=o3r-configuration-fixtures-jasmine.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"o3r-configuration-fixtures-jasmine.mjs","sources":["../../src/fixtures/jasmine/configuration-base-service-fixture-jasmine.ts","../../src/fixtures/jasmine/o3r-configuration-fixtures-jasmine.ts"],"sourcesContent":["import type {\n ConfigurationBaseService,\n} from '@o3r/configuration';\n\n/**\n * Fixture file for configuration service\n */\nexport class ConfigurationBaseServiceFixture implements Readonly<ConfigurationBaseService> {\n /** @inheritDoc */\n public updateConfiguration: jasmine.Spy = jasmine.createSpy('updateConfiguration');\n /** @inheritDoc */\n public upsertConfiguration: jasmine.Spy = jasmine.createSpy('upsertConfiguration');\n /** @inheritDoc */\n public computeConfiguration: jasmine.Spy = jasmine.createSpy('computeConfiguration');\n /** @inheritDoc */\n public getConfigFromBodyTag: jasmine.Spy = jasmine.createSpy('getConfigFromBodyTag');\n /** @inheritDoc */\n public extendConfiguration: jasmine.Spy = jasmine.createSpy('extendConfiguration');\n /** @inheritDoc */\n public getComponentConfig: jasmine.Spy = jasmine.createSpy('getComponentConfig');\n /** @inheritDoc */\n public getConfig: jasmine.Spy = jasmine.createSpy('getConfig');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAIA;;AAEG;MACU,+BAA+B,CAAA;AAA5C,IAAA,WAAA,GAAA;;AAES,QAAA,IAAA,CAAA,mBAAmB,GAAgB,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC;;AAE3E,QAAA,IAAA,CAAA,mBAAmB,GAAgB,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC;;AAE3E,QAAA,IAAA,CAAA,oBAAoB,GAAgB,OAAO,CAAC,SAAS,CAAC,sBAAsB,CAAC;;AAE7E,QAAA,IAAA,CAAA,oBAAoB,GAAgB,OAAO,CAAC,SAAS,CAAC,sBAAsB,CAAC;;AAE7E,QAAA,IAAA,CAAA,mBAAmB,GAAgB,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC;;AAE3E,QAAA,IAAA,CAAA,kBAAkB,GAAgB,OAAO,CAAC,SAAS,CAAC,oBAAoB,CAAC;;AAEzE,QAAA,IAAA,CAAA,SAAS,GAAgB,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC;IAChE;AAAC;;ACtBD;;AAEG;;"}
1
+ {"version":3,"file":"o3r-configuration-fixtures-jasmine.mjs","names":[],"sources":["../../src/fixtures/jasmine/configuration-base-service-fixture-jasmine.ts"],"sourcesContent":["import type {\n ConfigurationBaseService,\n} from '@o3r/configuration';\n\n/**\n * Fixture file for configuration service\n */\nexport class ConfigurationBaseServiceFixture implements Readonly<ConfigurationBaseService> {\n /** @inheritDoc */\n public updateConfiguration: jasmine.Spy = jasmine.createSpy('updateConfiguration');\n /** @inheritDoc */\n public upsertConfiguration: jasmine.Spy = jasmine.createSpy('upsertConfiguration');\n /** @inheritDoc */\n public computeConfiguration: jasmine.Spy = jasmine.createSpy('computeConfiguration');\n /** @inheritDoc */\n public getConfigFromBodyTag: jasmine.Spy = jasmine.createSpy('getConfigFromBodyTag');\n /** @inheritDoc */\n public extendConfiguration: jasmine.Spy = jasmine.createSpy('extendConfiguration');\n /** @inheritDoc */\n public getComponentConfig: jasmine.Spy = jasmine.createSpy('getComponentConfig');\n /** @inheritDoc */\n public getConfig: jasmine.Spy = jasmine.createSpy('getConfig');\n}\n"],"mappings":"AAOA,IAAa,kCAAb,MAA4C;CAA5C,cAAA;EAES,KAAA,sBAAmC,QAAQ,UAAU,qBAAqB;EAE1E,KAAA,sBAAmC,QAAQ,UAAU,qBAAqB;EAE1E,KAAA,uBAAoC,QAAQ,UAAU,sBAAsB;EAE5E,KAAA,uBAAoC,QAAQ,UAAU,sBAAsB;EAE5E,KAAA,sBAAmC,QAAQ,UAAU,qBAAqB;EAE1E,KAAA,qBAAkC,QAAQ,UAAU,oBAAoB;EAExE,KAAA,YAAyB,QAAQ,UAAU,WAAW;CAC/D;AAAC"}
@@ -1,28 +1,14 @@
1
- /**
2
- * Fixture file for configuration service
3
- */
4
- class ConfigurationBaseServiceFixture {
5
- constructor() {
6
- /** @inheritDoc */
7
- this.updateConfiguration = jest.fn();
8
- /** @inheritDoc */
9
- this.upsertConfiguration = jest.fn();
10
- /** @inheritDoc */
11
- this.computeConfiguration = jest.fn();
12
- /** @inheritDoc */
13
- this.getConfigFromBodyTag = jest.fn();
14
- /** @inheritDoc */
15
- this.extendConfiguration = jest.fn();
16
- /** @inheritDoc */
17
- this.getComponentConfig = jest.fn();
18
- /** @inheritDoc */
19
- this.getConfig = jest.fn();
20
- }
21
- }
22
-
23
- /**
24
- * Generated bundle index. Do not edit.
25
- */
26
-
1
+ var ConfigurationBaseServiceFixture = class {
2
+ constructor() {
3
+ this.updateConfiguration = jest.fn();
4
+ this.upsertConfiguration = jest.fn();
5
+ this.computeConfiguration = jest.fn();
6
+ this.getConfigFromBodyTag = jest.fn();
7
+ this.extendConfiguration = jest.fn();
8
+ this.getComponentConfig = jest.fn();
9
+ this.getConfig = jest.fn();
10
+ }
11
+ };
27
12
  export { ConfigurationBaseServiceFixture };
28
- //# sourceMappingURL=o3r-configuration-fixtures-jest.mjs.map
13
+
14
+ //# sourceMappingURL=o3r-configuration-fixtures-jest.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"o3r-configuration-fixtures-jest.mjs","sources":["../../src/fixtures/jest/configuration-base-service-fixture-jest.ts","../../src/fixtures/jest/o3r-configuration-fixtures-jest.ts"],"sourcesContent":["import type {\n ConfigurationBaseService,\n} from '@o3r/configuration';\n\n/**\n * Fixture file for configuration service\n */\nexport class ConfigurationBaseServiceFixture implements Readonly<ConfigurationBaseService> {\n /** @inheritDoc */\n public updateConfiguration: jest.Mock<any, any> = jest.fn();\n /** @inheritDoc */\n public upsertConfiguration: jest.Mock<any, any> = jest.fn();\n /** @inheritDoc */\n public computeConfiguration: jest.Mock<any, any> = jest.fn();\n /** @inheritDoc */\n public getConfigFromBodyTag: jest.Mock<any, any> = jest.fn();\n /** @inheritDoc */\n public extendConfiguration: jest.Mock<any, any> = jest.fn();\n /** @inheritDoc */\n public getComponentConfig: jest.Mock<any, any> = jest.fn();\n /** @inheritDoc */\n public getConfig: jest.Mock<any, any> = jest.fn();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAIA;;AAEG;MACU,+BAA+B,CAAA;AAA5C,IAAA,WAAA,GAAA;;AAES,QAAA,IAAA,CAAA,mBAAmB,GAAwB,IAAI,CAAC,EAAE,EAAE;;AAEpD,QAAA,IAAA,CAAA,mBAAmB,GAAwB,IAAI,CAAC,EAAE,EAAE;;AAEpD,QAAA,IAAA,CAAA,oBAAoB,GAAwB,IAAI,CAAC,EAAE,EAAE;;AAErD,QAAA,IAAA,CAAA,oBAAoB,GAAwB,IAAI,CAAC,EAAE,EAAE;;AAErD,QAAA,IAAA,CAAA,mBAAmB,GAAwB,IAAI,CAAC,EAAE,EAAE;;AAEpD,QAAA,IAAA,CAAA,kBAAkB,GAAwB,IAAI,CAAC,EAAE,EAAE;;AAEnD,QAAA,IAAA,CAAA,SAAS,GAAwB,IAAI,CAAC,EAAE,EAAE;IACnD;AAAC;;ACtBD;;AAEG;;"}
1
+ {"version":3,"file":"o3r-configuration-fixtures-jest.mjs","names":[],"sources":["../../src/fixtures/jest/configuration-base-service-fixture-jest.ts"],"sourcesContent":["import type {\n ConfigurationBaseService,\n} from '@o3r/configuration';\n\n/**\n * Fixture file for configuration service\n */\nexport class ConfigurationBaseServiceFixture implements Readonly<ConfigurationBaseService> {\n /** @inheritDoc */\n public updateConfiguration: jest.Mock<any, any> = jest.fn();\n /** @inheritDoc */\n public upsertConfiguration: jest.Mock<any, any> = jest.fn();\n /** @inheritDoc */\n public computeConfiguration: jest.Mock<any, any> = jest.fn();\n /** @inheritDoc */\n public getConfigFromBodyTag: jest.Mock<any, any> = jest.fn();\n /** @inheritDoc */\n public extendConfiguration: jest.Mock<any, any> = jest.fn();\n /** @inheritDoc */\n public getComponentConfig: jest.Mock<any, any> = jest.fn();\n /** @inheritDoc */\n public getConfig: jest.Mock<any, any> = jest.fn();\n}\n"],"mappings":"AAOA,IAAa,kCAAb,MAA4C;CAA5C,cAAA;EAES,KAAA,sBAA2C,KAAK,GAAE;EAElD,KAAA,sBAA2C,KAAK,GAAE;EAElD,KAAA,uBAA4C,KAAK,GAAE;EAEnD,KAAA,uBAA4C,KAAK,GAAE;EAEnD,KAAA,sBAA2C,KAAK,GAAE;EAElD,KAAA,qBAA0C,KAAK,GAAE;EAEjD,KAAA,YAAiC,KAAK,GAAE;CACjD;AAAC"}
@@ -1,79 +1,100 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, Injectable, NgModule, makeEnvironmentProviders } from '@angular/core';
3
- import { Store } from '@ngrx/store';
4
- import { computeItemIdentifier } from '@o3r/core';
5
- import { setConfigOverride, ConfigurationStoreModule, provideConfigurationStore } from '@o3r/configuration';
6
-
7
- /** ActionUpdateConfigurationBlock */
8
- const RULES_ENGINE_CONFIGURATION_UPDATE_ACTION_TYPE = 'UPDATE_CONFIG';
9
-
10
- /**
11
- * Service to handle async Configuration actions
12
- */
13
- class ConfigurationRulesEngineActionHandler {
14
- constructor() {
15
- this.store = inject(Store);
16
- /** @inheritdoc */
17
- this.supportingActions = [RULES_ENGINE_CONFIGURATION_UPDATE_ACTION_TYPE];
18
- }
19
- /** @inheritdoc */
20
- executeActions(actions) {
21
- const configOverrideMap = actions
22
- .filter((action) => action.library && action.component && action.property && typeof action.value !== 'undefined')
23
- .reduce((acc, ov) => {
24
- const configName = computeItemIdentifier(ov.component, ov.library);
25
- acc[configName] ||= { overrides: {} };
26
- acc[configName].overrides[ov.property] = ov.value;
27
- return acc;
28
- }, {});
29
- const configOverrides = Object.entries(configOverrideMap)
30
- .reduce((acc, [key, value]) => {
31
- acc[key] = value.overrides;
32
- return acc;
33
- }, {});
34
- this.store.dispatch(setConfigOverride({ state: { configOverrides } }));
35
- }
36
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationRulesEngineActionHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
37
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationRulesEngineActionHandler }); }
38
- }
39
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationRulesEngineActionHandler, decorators: [{
40
- type: Injectable
41
- }] });
42
-
43
- /**
44
- * @deprecated Will be removed in v16. Use {@link provideConfigurationRulesEngineAction} instead.
45
- */
46
- class ConfigurationRulesEngineActionModule {
47
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationRulesEngineActionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
48
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationRulesEngineActionModule, imports: [ConfigurationStoreModule] }); }
49
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationRulesEngineActionModule, providers: [
50
- ConfigurationRulesEngineActionHandler
51
- ], imports: [ConfigurationStoreModule] }); }
52
- }
53
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationRulesEngineActionModule, decorators: [{
54
- type: NgModule,
55
- args: [{
56
- imports: [
57
- ConfigurationStoreModule
58
- ],
59
- providers: [
60
- ConfigurationRulesEngineActionHandler
61
- ]
62
- }]
63
- }] });
64
- /**
65
- * Provide configuration rules engine action handler.
66
- */
1
+ import * as i0 from "@angular/core";
2
+ import { Injectable, NgModule, inject, makeEnvironmentProviders } from "@angular/core";
3
+ import { Store } from "@ngrx/store";
4
+ import { computeItemIdentifier } from "@o3r/core";
5
+ import { ConfigurationStoreModule, provideConfigurationStore, setConfigOverride } from "@o3r/configuration";
6
+ const RULES_ENGINE_CONFIGURATION_UPDATE_ACTION_TYPE = "UPDATE_CONFIG";
7
+ var ConfigurationRulesEngineActionHandler = class ConfigurationRulesEngineActionHandler {
8
+ constructor() {
9
+ this.store = inject(Store);
10
+ this.supportingActions = [RULES_ENGINE_CONFIGURATION_UPDATE_ACTION_TYPE];
11
+ }
12
+ executeActions(actions) {
13
+ const configOverrideMap = actions.filter((action) => action.library && action.component && action.property && typeof action.value !== "undefined").reduce((acc, ov) => {
14
+ const configName = computeItemIdentifier(ov.component, ov.library);
15
+ acc[configName] ||= { overrides: {} };
16
+ acc[configName].overrides[ov.property] = ov.value;
17
+ return acc;
18
+ }, {});
19
+ const configOverrides = Object.entries(configOverrideMap).reduce((acc, [key, value]) => {
20
+ acc[key] = value.overrides;
21
+ return acc;
22
+ }, {});
23
+ this.store.dispatch(setConfigOverride({ state: { configOverrides } }));
24
+ }
25
+ static {
26
+ this.ɵfac = i0.ɵɵngDeclareFactory({
27
+ minVersion: "12.0.0",
28
+ version: "22.2.3",
29
+ ngImport: i0,
30
+ type: ConfigurationRulesEngineActionHandler,
31
+ deps: [],
32
+ target: i0.ɵɵFactoryTarget.Injectable
33
+ });
34
+ }
35
+ static {
36
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
37
+ minVersion: "12.0.0",
38
+ version: "22.2.3",
39
+ ngImport: i0,
40
+ type: ConfigurationRulesEngineActionHandler
41
+ });
42
+ }
43
+ };
44
+ i0.ɵɵngDeclareClassMetadata({
45
+ minVersion: "12.0.0",
46
+ version: "22.2.3",
47
+ ngImport: i0,
48
+ type: ConfigurationRulesEngineActionHandler,
49
+ decorators: [{ type: Injectable }]
50
+ });
51
+ var ConfigurationRulesEngineActionModule = class ConfigurationRulesEngineActionModule {
52
+ static {
53
+ this.ɵfac = i0.ɵɵngDeclareFactory({
54
+ minVersion: "12.0.0",
55
+ version: "22.2.3",
56
+ ngImport: i0,
57
+ type: ConfigurationRulesEngineActionModule,
58
+ deps: [],
59
+ target: i0.ɵɵFactoryTarget.NgModule
60
+ });
61
+ }
62
+ static {
63
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
64
+ minVersion: "14.0.0",
65
+ version: "22.2.3",
66
+ ngImport: i0,
67
+ type: ConfigurationRulesEngineActionModule,
68
+ imports: [ConfigurationStoreModule]
69
+ });
70
+ }
71
+ static {
72
+ this.ɵinj = i0.ɵɵngDeclareInjector({
73
+ minVersion: "12.0.0",
74
+ version: "22.2.3",
75
+ ngImport: i0,
76
+ type: ConfigurationRulesEngineActionModule,
77
+ providers: [ConfigurationRulesEngineActionHandler],
78
+ imports: [ConfigurationStoreModule]
79
+ });
80
+ }
81
+ };
82
+ i0.ɵɵngDeclareClassMetadata({
83
+ minVersion: "12.0.0",
84
+ version: "22.2.3",
85
+ ngImport: i0,
86
+ type: ConfigurationRulesEngineActionModule,
87
+ decorators: [{
88
+ type: NgModule,
89
+ args: [{
90
+ imports: [ConfigurationStoreModule],
91
+ providers: [ConfigurationRulesEngineActionHandler]
92
+ }]
93
+ }]
94
+ });
67
95
  function provideConfigurationRulesEngineAction() {
68
- return makeEnvironmentProviders([
69
- provideConfigurationStore(),
70
- ConfigurationRulesEngineActionHandler
71
- ]);
96
+ return makeEnvironmentProviders([provideConfigurationStore(), ConfigurationRulesEngineActionHandler]);
72
97
  }
73
-
74
- /**
75
- * Generated bundle index. Do not edit.
76
- */
77
-
78
98
  export { ConfigurationRulesEngineActionHandler, ConfigurationRulesEngineActionModule, RULES_ENGINE_CONFIGURATION_UPDATE_ACTION_TYPE, provideConfigurationRulesEngineAction };
79
- //# sourceMappingURL=o3r-configuration-rules-engine.mjs.map
99
+
100
+ //# sourceMappingURL=o3r-configuration-rules-engine.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"o3r-configuration-rules-engine.mjs","sources":["../../src/rules-engine/configuration-interfaces.ts","../../src/rules-engine/configuration-handler-action.ts","../../src/rules-engine/configuration-rules-engine-module.ts","../../src/rules-engine/o3r-configuration-rules-engine.ts"],"sourcesContent":["import type {\n RulesEngineAction,\n} from '@o3r/core';\n\n/** ActionUpdateConfigurationBlock */\nexport const RULES_ENGINE_CONFIGURATION_UPDATE_ACTION_TYPE = 'UPDATE_CONFIG';\n\n/**\n * Content of action that updates a Configuration\n */\nexport interface ActionUpdateConfigBlock extends RulesEngineAction {\n actionType: typeof RULES_ENGINE_CONFIGURATION_UPDATE_ACTION_TYPE;\n library: string;\n component: string;\n property: string;\n}\n","import {\n inject,\n Injectable,\n} from '@angular/core';\nimport {\n Store,\n} from '@ngrx/store';\nimport type {\n RulesEngineActionHandler,\n} from '@o3r/core';\nimport {\n computeItemIdentifier,\n} from '@o3r/core';\nimport {\n ActionUpdateConfigBlock,\n RULES_ENGINE_CONFIGURATION_UPDATE_ACTION_TYPE,\n} from './configuration-interfaces';\nimport {\n ConfigurationStore,\n PropertyOverride,\n setConfigOverride,\n} from '@o3r/configuration';\n\n/**\n * Service to handle async Configuration actions\n */\n@Injectable()\nexport class ConfigurationRulesEngineActionHandler implements RulesEngineActionHandler<ActionUpdateConfigBlock> {\n private readonly store = inject<Store<ConfigurationStore>>(Store);\n\n /** @inheritdoc */\n public readonly supportingActions = [RULES_ENGINE_CONFIGURATION_UPDATE_ACTION_TYPE] as const;\n\n /** @inheritdoc */\n public executeActions(actions: ActionUpdateConfigBlock[]): void | Promise<void> {\n const configOverrideMap = actions\n .filter((action) => action.library && action.component && action.property && typeof action.value !== 'undefined')\n .reduce<Record<string, PropertyOverride>>((acc, ov) => {\n const configName = computeItemIdentifier(ov.component, ov.library);\n acc[configName] ||= { overrides: {} };\n acc[configName].overrides[ov.property] = ov.value;\n return acc;\n }, {});\n\n const configOverrides = Object.entries(configOverrideMap)\n .reduce<Record<string, PropertyOverride>>((acc, [key, value]) => {\n acc[key] = value.overrides;\n return acc;\n }, {});\n\n this.store.dispatch(setConfigOverride({ state: { configOverrides } }));\n }\n}\n","import {\n EnvironmentProviders,\n makeEnvironmentProviders,\n NgModule,\n} from '@angular/core';\nimport {\n ConfigurationRulesEngineActionHandler,\n} from './configuration-handler-action';\nimport {\n ConfigurationStoreModule,\n provideConfigurationStore,\n} from '@o3r/configuration';\n\n/**\n * @deprecated Will be removed in v16. Use {@link provideConfigurationRulesEngineAction} instead.\n */\n@NgModule({\n imports: [\n ConfigurationStoreModule\n ],\n providers: [\n ConfigurationRulesEngineActionHandler\n ]\n})\nexport class ConfigurationRulesEngineActionModule {}\n\n/**\n * Provide configuration rules engine action handler.\n */\nexport function provideConfigurationRulesEngineAction(): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideConfigurationStore(),\n ConfigurationRulesEngineActionHandler\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;AAIA;AACO,MAAM,6CAA6C,GAAG;;ACkB7D;;AAEG;MAEU,qCAAqC,CAAA;AADlD,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAA4B,KAAK,CAAC;;AAGjD,QAAA,IAAA,CAAA,iBAAiB,GAAG,CAAC,6CAA6C,CAAU;AAqB7F,IAAA;;AAlBQ,IAAA,cAAc,CAAC,OAAkC,EAAA;QACtD,MAAM,iBAAiB,GAAG;aACvB,MAAM,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,QAAQ,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,WAAW;AAC/G,aAAA,MAAM,CAAmC,CAAC,GAAG,EAAE,EAAE,KAAI;AACpD,YAAA,MAAM,UAAU,GAAG,qBAAqB,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC;YAClE,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;AACrC,YAAA,GAAG,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK;AACjD,YAAA,OAAO,GAAG;QACZ,CAAC,EAA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QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP;AACD,qBAAA;AACD,oBAAA,SAAS,EAAE;wBACT;AACD;AACF,iBAAA;;AAGD;;AAEG;SACa,qCAAqC,GAAA;AACnD,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,yBAAyB,EAAE;QAC3B;AACD,KAAA,CAAC;AACJ;;AClCA;;AAEG;;"}
1
+ {"version":3,"file":"o3r-configuration-rules-engine.mjs","names":[],"sources":["../../src/rules-engine/configuration-interfaces.ts","../../src/rules-engine/configuration-handler-action.ts","../../src/rules-engine/configuration-rules-engine-module.ts"],"sourcesContent":["import type {\n RulesEngineAction,\n} from '@o3r/core';\n\n/** ActionUpdateConfigurationBlock */\nexport const RULES_ENGINE_CONFIGURATION_UPDATE_ACTION_TYPE = 'UPDATE_CONFIG';\n\n/**\n * Content of action that updates a Configuration\n */\nexport interface ActionUpdateConfigBlock extends RulesEngineAction {\n actionType: typeof RULES_ENGINE_CONFIGURATION_UPDATE_ACTION_TYPE;\n library: string;\n component: string;\n property: string;\n}\n","import {\n inject,\n Injectable,\n} from '@angular/core';\nimport {\n Store,\n} from '@ngrx/store';\nimport type {\n RulesEngineActionHandler,\n} from '@o3r/core';\nimport {\n computeItemIdentifier,\n} from '@o3r/core';\nimport {\n ActionUpdateConfigBlock,\n RULES_ENGINE_CONFIGURATION_UPDATE_ACTION_TYPE,\n} from './configuration-interfaces';\nimport {\n ConfigurationStore,\n PropertyOverride,\n setConfigOverride,\n} from '@o3r/configuration';\n\n/**\n * Service to handle async Configuration actions\n */\n@Injectable()\nexport class ConfigurationRulesEngineActionHandler implements RulesEngineActionHandler<ActionUpdateConfigBlock> {\n private readonly store = inject<Store<ConfigurationStore>>(Store);\n\n /** @inheritdoc */\n public readonly supportingActions = [RULES_ENGINE_CONFIGURATION_UPDATE_ACTION_TYPE] as const;\n\n /** @inheritdoc */\n public executeActions(actions: ActionUpdateConfigBlock[]): void | Promise<void> {\n const configOverrideMap = actions\n .filter((action) => action.library && action.component && action.property && typeof action.value !== 'undefined')\n .reduce<Record<string, PropertyOverride>>((acc, ov) => {\n const configName = computeItemIdentifier(ov.component, ov.library);\n acc[configName] ||= { overrides: {} };\n acc[configName].overrides[ov.property] = ov.value;\n return acc;\n }, {});\n\n const configOverrides = Object.entries(configOverrideMap)\n .reduce<Record<string, PropertyOverride>>((acc, [key, value]) => {\n acc[key] = value.overrides;\n return acc;\n }, {});\n\n this.store.dispatch(setConfigOverride({ state: { configOverrides } }));\n }\n}\n","import {\n EnvironmentProviders,\n makeEnvironmentProviders,\n NgModule,\n} from '@angular/core';\nimport {\n ConfigurationRulesEngineActionHandler,\n} from './configuration-handler-action';\nimport {\n ConfigurationStoreModule,\n provideConfigurationStore,\n} from '@o3r/configuration';\n\n/**\n * @deprecated Will be removed in v16. Use {@link provideConfigurationRulesEngineAction} instead.\n */\n@NgModule({\n imports: [\n ConfigurationStoreModule\n ],\n providers: [\n ConfigurationRulesEngineActionHandler\n ]\n})\nexport class ConfigurationRulesEngineActionModule {}\n\n/**\n * Provide configuration rules engine action handler.\n */\nexport function provideConfigurationRulesEngineAction(): EnvironmentProviders {\n return makeEnvironmentProviders([\n provideConfigurationStore(),\n ConfigurationRulesEngineActionHandler\n ]);\n}\n"],"mappings":";;;;;AAKA,MAAa,gDAAgD;ACsB7D,IAAa,wCAAb,MAAa,sCAAqC;CADlD,cAAA;EAEmB,KAAA,QAAQ,OAAkC,KAAK;EAGhD,KAAA,oBAAoB,CAAC,6CAA6C;CAqBnF;CAlBQ,eAAe,SAAkC;EACtD,MAAM,oBAAoB,QACvB,QAAQ,WAAW,OAAO,WAAW,OAAO,aAAa,OAAO,YAAY,OAAO,OAAO,UAAU,WAAW,CAAC,CAChH,QAA0C,KAAK,OAAM;GACpD,MAAM,aAAa,sBAAsB,GAAG,WAAW,GAAG,OAAO;GACjE,IAAI,gBAAgB,EAAE,WAAW,CAAA,EAAE;GACnC,IAAI,WAAW,CAA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