@o3r/configuration 15.3.0-prerelease.9 → 15.3.0-rc.1
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/fesm2022/o3r-configuration-fixtures-jasmine.mjs +13 -27
- package/fesm2022/o3r-configuration-fixtures-jasmine.mjs.map +1 -1
- package/fesm2022/o3r-configuration-fixtures-jest.mjs +13 -27
- package/fesm2022/o3r-configuration-fixtures-jest.mjs.map +1 -1
- package/fesm2022/o3r-configuration-rules-engine.mjs +97 -76
- package/fesm2022/o3r-configuration-rules-engine.mjs.map +1 -1
- package/fesm2022/o3r-configuration.mjs +716 -780
- package/fesm2022/o3r-configuration.mjs.map +1 -1
- package/package.json +5 -5
- package/schematics/configuration-to-component/schema.json +0 -3
- package/schematics/ng-add/schema.json +0 -3
- package/types/o3r-configuration-fixtures-jasmine.d.ts +17 -20
- package/types/o3r-configuration-fixtures-jasmine.d.ts.map +1 -1
- package/types/o3r-configuration-fixtures-jest.d.ts +17 -20
- package/types/o3r-configuration-fixtures-jest.d.ts.map +1 -1
- package/types/o3r-configuration-rules-engine.d.ts +24 -30
- package/types/o3r-configuration-rules-engine.d.ts.map +1 -1
- package/types/o3r-configuration.d.ts +370 -401
- package/types/o3r-configuration.d.ts.map +1 -1
|
@@ -1,831 +1,767 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import * as i0 from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import * as i1 from
|
|
7
|
-
import {
|
|
8
|
-
import { createEntityAdapter } from
|
|
9
|
-
import { takeUntilDestroyed,
|
|
10
|
-
import { LoggerService } from
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Get the component and library's names based on the configuration name
|
|
14
|
-
* @param configurationName Name of the component as found in the store
|
|
15
|
-
* @returns Object containing library and component name.
|
|
16
|
-
*/
|
|
1
|
+
import { computeItemIdentifier, deepFill, filterMessageContent, otterComponentInfoPropertyName, sendOtterMessage } from "@o3r/core";
|
|
2
|
+
import { distinctUntilChanged, filter, map, shareReplay, switchMap, take } from "rxjs/operators";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import { ApplicationRef, DestroyRef, Injectable, InjectionToken, NgModule, inject, makeEnvironmentProviders } from "@angular/core";
|
|
5
|
+
import { BehaviorSubject, combineLatest, firstValueFrom, fromEvent, of, shareReplay as shareReplay$1 } from "rxjs";
|
|
6
|
+
import * as i1 from "@ngrx/store";
|
|
7
|
+
import { Store, StoreModule, createAction, createFeatureSelector, createReducer, createSelector, on, props, provideState, select } from "@ngrx/store";
|
|
8
|
+
import { createEntityAdapter } from "@ngrx/entity";
|
|
9
|
+
import { takeUntilDestroyed, toObservable, toSignal } from "@angular/core/rxjs-interop";
|
|
10
|
+
import { LoggerService } from "@o3r/logger";
|
|
17
11
|
function parseConfigurationName(configurationName) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
}
|
|
12
|
+
const parsedConfigurationName = configurationName.match(/^([^#]*)#(.*)$/i);
|
|
13
|
+
if (parsedConfigurationName) return {
|
|
14
|
+
library: parsedConfigurationName.length > 2 ? parsedConfigurationName[1] : void 0,
|
|
15
|
+
componentName: parsedConfigurationName.length > 2 ? parsedConfigurationName[2] : parsedConfigurationName[0]
|
|
16
|
+
};
|
|
25
17
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Operator to get the configuration from store for a given component and merge it with the global config
|
|
28
|
-
* @param defaultValue Default value of the configuration
|
|
29
|
-
*/
|
|
30
18
|
function getConfiguration(defaultValue) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
return (source) => source.pipe(map((configOverride) => {
|
|
20
|
+
return deepFill(defaultValue, configOverride);
|
|
21
|
+
}), distinctUntilChanged((prev, current) => JSON.stringify(prev) === JSON.stringify(current)), shareReplay({
|
|
22
|
+
refCount: true,
|
|
23
|
+
bufferSize: 1
|
|
24
|
+
}));
|
|
34
25
|
}
|
|
35
|
-
|
|
36
|
-
/** Actions */
|
|
37
|
-
const ACTION_SET = '[ConfigOverride] set';
|
|
38
|
-
/**
|
|
39
|
-
* Clear all overrides and fill the store with the payload
|
|
40
|
-
*/
|
|
41
|
-
const setConfigOverride = createAction(ACTION_SET, props());
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* ConfigOverride Store initial value
|
|
45
|
-
*/
|
|
26
|
+
const setConfigOverride = createAction("[ConfigOverride] set", props());
|
|
46
27
|
const configOverrideInitialState = { configOverrides: {} };
|
|
47
|
-
|
|
48
|
-
* List of basic actions for ConfigOverride Store
|
|
49
|
-
*/
|
|
50
|
-
const configOverrideReducerFeatures = [
|
|
51
|
-
on(setConfigOverride, (_state, payload) => ({ ...payload.state }))
|
|
52
|
-
];
|
|
53
|
-
/**
|
|
54
|
-
* ConfigOverride Store reducer
|
|
55
|
-
*/
|
|
28
|
+
const configOverrideReducerFeatures = [on(setConfigOverride, (_state, payload) => ({ ...payload.state }))];
|
|
56
29
|
const configOverrideReducer = createReducer(configOverrideInitialState, ...configOverrideReducerFeatures);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
* Name of the ConfigOverride Store
|
|
60
|
-
*/
|
|
61
|
-
const CONFIG_OVERRIDE_STORE_NAME = 'configOverride';
|
|
62
|
-
|
|
63
|
-
/** Token of the ConfigOverride reducer */
|
|
64
|
-
const CONFIG_OVERRIDE_REDUCER_TOKEN = new InjectionToken('Feature ConfigOverride Reducer');
|
|
65
|
-
/** Provide default reducer for ConfigOverride store */
|
|
30
|
+
const CONFIG_OVERRIDE_STORE_NAME = "configOverride";
|
|
31
|
+
const CONFIG_OVERRIDE_REDUCER_TOKEN = new InjectionToken("Feature ConfigOverride Reducer");
|
|
66
32
|
function getDefaultConfigOverrideReducer() {
|
|
67
|
-
|
|
33
|
+
return configOverrideReducer;
|
|
68
34
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
35
|
+
var ConfigOverrideStoreModule = class ConfigOverrideStoreModule {
|
|
36
|
+
static forRoot(reducerFactory) {
|
|
37
|
+
return {
|
|
38
|
+
ngModule: ConfigOverrideStoreModule,
|
|
39
|
+
providers: [{
|
|
40
|
+
provide: CONFIG_OVERRIDE_REDUCER_TOKEN,
|
|
41
|
+
useFactory: reducerFactory
|
|
42
|
+
}]
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
static {
|
|
46
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
47
|
+
minVersion: "12.0.0",
|
|
48
|
+
version: "22.2.3",
|
|
49
|
+
ngImport: i0,
|
|
50
|
+
type: ConfigOverrideStoreModule,
|
|
51
|
+
deps: [],
|
|
52
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
static {
|
|
56
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
57
|
+
minVersion: "14.0.0",
|
|
58
|
+
version: "22.2.3",
|
|
59
|
+
ngImport: i0,
|
|
60
|
+
type: ConfigOverrideStoreModule,
|
|
61
|
+
imports: [i1.StoreFeatureModule]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
static {
|
|
65
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
66
|
+
minVersion: "12.0.0",
|
|
67
|
+
version: "22.2.3",
|
|
68
|
+
ngImport: i0,
|
|
69
|
+
type: ConfigOverrideStoreModule,
|
|
70
|
+
providers: [{
|
|
71
|
+
provide: CONFIG_OVERRIDE_REDUCER_TOKEN,
|
|
72
|
+
useFactory: getDefaultConfigOverrideReducer
|
|
73
|
+
}],
|
|
74
|
+
imports: [StoreModule.forFeature(CONFIG_OVERRIDE_STORE_NAME, CONFIG_OVERRIDE_REDUCER_TOKEN)]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
79
|
+
minVersion: "12.0.0",
|
|
80
|
+
version: "22.2.3",
|
|
81
|
+
ngImport: i0,
|
|
82
|
+
type: ConfigOverrideStoreModule,
|
|
83
|
+
decorators: [{
|
|
84
|
+
type: NgModule,
|
|
85
|
+
args: [{
|
|
86
|
+
imports: [StoreModule.forFeature(CONFIG_OVERRIDE_STORE_NAME, CONFIG_OVERRIDE_REDUCER_TOKEN)],
|
|
87
|
+
providers: [{
|
|
88
|
+
provide: CONFIG_OVERRIDE_REDUCER_TOKEN,
|
|
89
|
+
useFactory: getDefaultConfigOverrideReducer
|
|
90
|
+
}]
|
|
91
|
+
}]
|
|
92
|
+
}]
|
|
93
|
+
});
|
|
102
94
|
function provideConfigOverrideStore(reducerFactory) {
|
|
103
|
-
|
|
104
|
-
provideState(CONFIG_OVERRIDE_STORE_NAME, reducerFactory ? reducerFactory() : configOverrideReducer)
|
|
105
|
-
]);
|
|
95
|
+
return makeEnvironmentProviders([provideState(CONFIG_OVERRIDE_STORE_NAME, reducerFactory ? reducerFactory() : configOverrideReducer)]);
|
|
106
96
|
}
|
|
107
|
-
|
|
108
|
-
/** Select ConfigOverride State */
|
|
109
97
|
const selectConfigOverrideState = createFeatureSelector(CONFIG_OVERRIDE_STORE_NAME);
|
|
110
|
-
/** Select the array of ConfigOverride */
|
|
111
98
|
const selectConfigOverride = createSelector(selectConfigOverrideState, (state) => state?.configOverrides || {});
|
|
112
|
-
/**
|
|
113
|
-
* Get the override for given component identifier
|
|
114
|
-
* @param componentId
|
|
115
|
-
*/
|
|
116
99
|
const selectComponentOverrideConfig = (componentId) => createSelector(selectConfigOverride, (configOverrides) => configOverrides[componentId] || {});
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Deserializer
|
|
120
|
-
* @param rawObject
|
|
121
|
-
*/
|
|
122
100
|
const configOverrideStorageDeserializer = (rawObject) => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
return rawObject;
|
|
127
|
-
};
|
|
128
|
-
const configOverrideStorageSync = {
|
|
129
|
-
deserialize: configOverrideStorageDeserializer
|
|
101
|
+
if (!rawObject) return configOverrideInitialState;
|
|
102
|
+
return rawObject;
|
|
130
103
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
const ACTION_UPSERT_CONFIGURATION_ENTITY = '[Configuration] set configuration entity';
|
|
139
|
-
/**
|
|
140
|
-
* Upsert one configuration entity
|
|
141
|
-
*/
|
|
142
|
-
const upsertConfigurationEntity = createAction(ACTION_UPSERT_CONFIGURATION_ENTITY, props());
|
|
143
|
-
/**
|
|
144
|
-
* Update one configuration entity
|
|
145
|
-
*/
|
|
104
|
+
const configOverrideStorageSync = { deserialize: configOverrideStorageDeserializer };
|
|
105
|
+
const ACTION_CLEAR_ENTITIES = "[Configuration] clear entities";
|
|
106
|
+
const ACTION_UPDATE_ENTITIES = "[Configuration] update entities";
|
|
107
|
+
const ACTION_UPSERT_ENTITIES = "[Configuration] upsert entities";
|
|
108
|
+
const ACTION_SET_ENTITIES = "[Configuration] set entities";
|
|
109
|
+
const ACTION_UPDATE_CONFIGURATION_ENTITY = "[Configuration] update configuration entity";
|
|
110
|
+
const upsertConfigurationEntity = createAction("[Configuration] set configuration entity", props());
|
|
146
111
|
const updateConfigurationEntity = createAction(ACTION_UPDATE_CONFIGURATION_ENTITY, props());
|
|
147
|
-
/**
|
|
148
|
-
* Clear all configuration and fill the store with the payload
|
|
149
|
-
*/
|
|
150
112
|
const setConfigurationEntities = createAction(ACTION_SET_ENTITIES, props());
|
|
151
|
-
/**
|
|
152
|
-
* Update configuration with known IDs, ignore the new ones
|
|
153
|
-
*/
|
|
154
113
|
const updateConfigurationEntities = createAction(ACTION_UPDATE_ENTITIES, props());
|
|
155
|
-
/**
|
|
156
|
-
* Update configuration with known IDs, insert the new ones
|
|
157
|
-
*/
|
|
158
114
|
const upsertConfigurationEntities = createAction(ACTION_UPSERT_ENTITIES, props());
|
|
159
|
-
/**
|
|
160
|
-
* Clear only the entities, keeps the other attributes in the state
|
|
161
|
-
*/
|
|
162
115
|
const clearConfigurationEntities = createAction(ACTION_CLEAR_ENTITIES);
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* compute the configuration into SetEntitiesPayload
|
|
166
|
-
* @param customConfigObject array of configurations
|
|
167
|
-
*/
|
|
168
116
|
function computeConfiguration(customConfigObject) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
117
|
+
return { entities: customConfigObject.reduce((acc, conf) => {
|
|
118
|
+
const id = computeItemIdentifier(conf.name, conf.library);
|
|
119
|
+
acc[id] = {
|
|
120
|
+
...conf.config,
|
|
121
|
+
id
|
|
122
|
+
};
|
|
123
|
+
return acc;
|
|
124
|
+
}, {}) };
|
|
175
125
|
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Configuration Store adapter
|
|
179
|
-
*/
|
|
180
|
-
const configurationAdapter = createEntityAdapter({
|
|
181
|
-
selectId: (model) => model.id
|
|
182
|
-
});
|
|
183
|
-
/**
|
|
184
|
-
* Configuration Store initial value
|
|
185
|
-
*/
|
|
126
|
+
const configurationAdapter = createEntityAdapter({ selectId: (model) => model.id });
|
|
186
127
|
const configurationInitialState = configurationAdapter.getInitialState({});
|
|
187
|
-
/**
|
|
188
|
-
* List of basic actions for Configuration Store
|
|
189
|
-
*/
|
|
190
128
|
const configurationReducerFeatures = [
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
129
|
+
on(setConfigurationEntities, (state, payload) => configurationAdapter.addMany(Object.keys(payload).map((id) => ({
|
|
130
|
+
...payload[id],
|
|
131
|
+
id
|
|
132
|
+
})), configurationAdapter.removeAll(state))),
|
|
133
|
+
on(updateConfigurationEntities, (state, payload) => configurationAdapter.updateMany(Object.keys(payload.entities).map((id) => ({
|
|
134
|
+
id,
|
|
135
|
+
changes: payload.entities[id]
|
|
136
|
+
})), state)),
|
|
137
|
+
on(upsertConfigurationEntities, (state, payload) => configurationAdapter.upsertMany(Object.keys(payload.entities).map((id) => ({
|
|
138
|
+
...payload.entities[id],
|
|
139
|
+
id
|
|
140
|
+
})), state)),
|
|
141
|
+
on(clearConfigurationEntities, (state) => configurationAdapter.removeAll(state)),
|
|
142
|
+
on(updateConfigurationEntity, (state, payload) => configurationAdapter.updateOne({
|
|
143
|
+
id: payload.id,
|
|
144
|
+
changes: payload.configuration
|
|
145
|
+
}, state)),
|
|
146
|
+
on(upsertConfigurationEntity, (state, payload) => configurationAdapter.upsertOne({
|
|
147
|
+
id: payload.id,
|
|
148
|
+
...payload.configuration
|
|
149
|
+
}, state))
|
|
197
150
|
];
|
|
198
|
-
/**
|
|
199
|
-
* Configuration Store reducer
|
|
200
|
-
*/
|
|
201
151
|
const configurationReducer = createReducer(configurationInitialState, ...configurationReducerFeatures);
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
*/
|
|
206
|
-
const CONFIGURATION_STORE_NAME = 'configuration';
|
|
207
|
-
/**
|
|
208
|
-
* ID of the global configuration
|
|
209
|
-
*/
|
|
210
|
-
const globalConfigurationId = 'global';
|
|
211
|
-
|
|
212
|
-
/** Token of the Configuration reducer */
|
|
213
|
-
const CONFIGURATION_REDUCER_TOKEN = new InjectionToken('Feature Configuration Reducer');
|
|
214
|
-
/** Provide default reducer for Configuration store */
|
|
152
|
+
const CONFIGURATION_STORE_NAME = "configuration";
|
|
153
|
+
const globalConfigurationId = "global";
|
|
154
|
+
const CONFIGURATION_REDUCER_TOKEN = new InjectionToken("Feature Configuration Reducer");
|
|
215
155
|
function getDefaultConfigurationReducer() {
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* @deprecated Will be removed in v16. Use {@link provideConfigurationStore} instead.
|
|
220
|
-
*/
|
|
221
|
-
class ConfigurationStoreModule {
|
|
222
|
-
static forRoot(reducerFactory) {
|
|
223
|
-
return {
|
|
224
|
-
ngModule: ConfigurationStoreModule,
|
|
225
|
-
providers: [
|
|
226
|
-
{ provide: CONFIGURATION_REDUCER_TOKEN, useFactory: reducerFactory }
|
|
227
|
-
]
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationStoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
231
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationStoreModule, imports: [i1.StoreFeatureModule] }); }
|
|
232
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationStoreModule, providers: [
|
|
233
|
-
{ provide: CONFIGURATION_REDUCER_TOKEN, useFactory: getDefaultConfigurationReducer }
|
|
234
|
-
], imports: [StoreModule.forFeature(CONFIGURATION_STORE_NAME, CONFIGURATION_REDUCER_TOKEN)] }); }
|
|
156
|
+
return configurationReducer;
|
|
235
157
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
158
|
+
var ConfigurationStoreModule = class ConfigurationStoreModule {
|
|
159
|
+
static forRoot(reducerFactory) {
|
|
160
|
+
return {
|
|
161
|
+
ngModule: ConfigurationStoreModule,
|
|
162
|
+
providers: [{
|
|
163
|
+
provide: CONFIGURATION_REDUCER_TOKEN,
|
|
164
|
+
useFactory: reducerFactory
|
|
165
|
+
}]
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
static {
|
|
169
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
170
|
+
minVersion: "12.0.0",
|
|
171
|
+
version: "22.2.3",
|
|
172
|
+
ngImport: i0,
|
|
173
|
+
type: ConfigurationStoreModule,
|
|
174
|
+
deps: [],
|
|
175
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
static {
|
|
179
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
180
|
+
minVersion: "14.0.0",
|
|
181
|
+
version: "22.2.3",
|
|
182
|
+
ngImport: i0,
|
|
183
|
+
type: ConfigurationStoreModule,
|
|
184
|
+
imports: [i1.StoreFeatureModule]
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
static {
|
|
188
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
189
|
+
minVersion: "12.0.0",
|
|
190
|
+
version: "22.2.3",
|
|
191
|
+
ngImport: i0,
|
|
192
|
+
type: ConfigurationStoreModule,
|
|
193
|
+
providers: [{
|
|
194
|
+
provide: CONFIGURATION_REDUCER_TOKEN,
|
|
195
|
+
useFactory: getDefaultConfigurationReducer
|
|
196
|
+
}],
|
|
197
|
+
imports: [StoreModule.forFeature(CONFIGURATION_STORE_NAME, CONFIGURATION_REDUCER_TOKEN)]
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
202
|
+
minVersion: "12.0.0",
|
|
203
|
+
version: "22.2.3",
|
|
204
|
+
ngImport: i0,
|
|
205
|
+
type: ConfigurationStoreModule,
|
|
206
|
+
decorators: [{
|
|
207
|
+
type: NgModule,
|
|
208
|
+
args: [{
|
|
209
|
+
imports: [StoreModule.forFeature(CONFIGURATION_STORE_NAME, CONFIGURATION_REDUCER_TOKEN)],
|
|
210
|
+
providers: [{
|
|
211
|
+
provide: CONFIGURATION_REDUCER_TOKEN,
|
|
212
|
+
useFactory: getDefaultConfigurationReducer
|
|
213
|
+
}]
|
|
214
|
+
}]
|
|
215
|
+
}]
|
|
216
|
+
});
|
|
251
217
|
function provideConfigurationStore(reducerFactory) {
|
|
252
|
-
|
|
253
|
-
provideState(CONFIGURATION_STORE_NAME, reducerFactory ? reducerFactory() : configurationReducer)
|
|
254
|
-
]);
|
|
218
|
+
return makeEnvironmentProviders([provideState(CONFIGURATION_STORE_NAME, reducerFactory ? reducerFactory() : configurationReducer)]);
|
|
255
219
|
}
|
|
256
|
-
|
|
257
220
|
const { selectIds, selectEntities, selectAll, selectTotal } = configurationAdapter.getSelectors();
|
|
258
|
-
/**
|
|
259
|
-
* Select Configuration State
|
|
260
|
-
* Note: the usage of createSelector is to avoid warning printing because of potentially undefined feature store
|
|
261
|
-
*/
|
|
262
221
|
const selectConfigurationState = createSelector((state) => state[CONFIGURATION_STORE_NAME], (state) => state);
|
|
263
|
-
/** Select the array of Configuration ids */
|
|
264
222
|
const selectConfigurationIds = createSelector(selectConfigurationState, (state) => state ? selectIds(state) : []);
|
|
265
|
-
/** Select the array of Configuration */
|
|
266
223
|
const selectAllConfiguration = createSelector(selectConfigurationState, (state) => state ? selectAll(state) : []);
|
|
267
|
-
/** Select the dictionary of Configuration entities */
|
|
268
224
|
const selectConfigurationEntities = createSelector(selectConfigurationState, (state) => state ? selectEntities(state) : {});
|
|
269
|
-
/** Select the total Configuration count */
|
|
270
225
|
const selectConfigurationTotal = createSelector(selectConfigurationState, (state) => state ? selectTotal(state) : 0);
|
|
271
|
-
|
|
272
|
-
* Select the configuration for component with id
|
|
273
|
-
* @param props property of the selector
|
|
274
|
-
* @param props.id id of the component
|
|
275
|
-
*/
|
|
276
|
-
const selectConfigurationForComponent = (props) => createSelector(selectConfigurationEntities, (entities) => (entities?.[props.id] || {}));
|
|
277
|
-
/**
|
|
278
|
-
* Select the global configuration
|
|
279
|
-
*/
|
|
226
|
+
const selectConfigurationForComponent = (props) => createSelector(selectConfigurationEntities, (entities) => entities?.[props.id] || {});
|
|
280
227
|
const selectGlobalConfiguration = createSelector(selectConfigurationForComponent({ id: globalConfigurationId }), (config) => config);
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
return configurationInitialState;
|
|
286
|
-
}
|
|
287
|
-
return configurationAdapter.getInitialState(rawObject);
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
|
|
228
|
+
const configurationStorageSync = { deserialize: (rawObject) => {
|
|
229
|
+
if (!rawObject || !rawObject.ids) return configurationInitialState;
|
|
230
|
+
return configurationAdapter.getInitialState(rawObject);
|
|
231
|
+
} };
|
|
291
232
|
const OTTER_CONFIGURATION_DEVTOOLS_DEFAULT_OPTIONS = {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
233
|
+
defaultLibraryName: "@o3r/components",
|
|
234
|
+
defaultJsonFilename: "partial-static-config.json",
|
|
235
|
+
isActivatedOnBootstrap: false,
|
|
236
|
+
isActivatedOnBootstrapWhenCMSContext: true
|
|
296
237
|
};
|
|
297
|
-
const OTTER_CONFIGURATION_DEVTOOLS_OPTIONS = new InjectionToken(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* Copy the whole configuration to the clipboard
|
|
476
|
-
*/
|
|
477
|
-
async copyConfigurationToClipboard() {
|
|
478
|
-
const configs = await firstValueFrom(this.configurationDevtools.configurationEntities$);
|
|
479
|
-
this.copyElementToClipboard(JSON.stringify(configs));
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Replace N configurations in one shot
|
|
483
|
-
* @param configurations array of configurations to update
|
|
484
|
-
*/
|
|
485
|
-
updateConfigurations(configurations) {
|
|
486
|
-
this.configurationDevtools.loadConfiguration(configurations);
|
|
487
|
-
}
|
|
488
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationDevtoolsConsoleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
489
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationDevtoolsConsoleService, providedIn: 'root' }); }
|
|
490
|
-
}
|
|
491
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationDevtoolsConsoleService, decorators: [{
|
|
492
|
-
type: Injectable,
|
|
493
|
-
args: [{
|
|
494
|
-
providedIn: 'root'
|
|
495
|
-
}]
|
|
496
|
-
}], ctorParameters: () => [] });
|
|
497
|
-
|
|
498
|
-
/**
|
|
499
|
-
* Determine if the given message is a Configuration message
|
|
500
|
-
* @param message message to check
|
|
501
|
-
*/
|
|
238
|
+
const OTTER_CONFIGURATION_DEVTOOLS_OPTIONS = new InjectionToken("Otter Configuration Devtools options");
|
|
239
|
+
var OtterConfigurationDevtools = class OtterConfigurationDevtools {
|
|
240
|
+
constructor() {
|
|
241
|
+
this.store = inject(Store);
|
|
242
|
+
this.appRef = inject(ApplicationRef);
|
|
243
|
+
this.options = inject(OTTER_CONFIGURATION_DEVTOOLS_OPTIONS, { optional: true }) ?? OTTER_CONFIGURATION_DEVTOOLS_DEFAULT_OPTIONS;
|
|
244
|
+
const options = this.options;
|
|
245
|
+
this.options = {
|
|
246
|
+
...OTTER_CONFIGURATION_DEVTOOLS_DEFAULT_OPTIONS,
|
|
247
|
+
...options
|
|
248
|
+
};
|
|
249
|
+
this.configurationEntities$ = this.store.pipe(select(selectConfigurationEntities), map((entities) => Object.values(entities).filter((entity) => !!entity).map((entity) => {
|
|
250
|
+
const { id, ...config } = entity;
|
|
251
|
+
const { library = this.options.defaultLibraryName, componentName: name = id } = parseConfigurationName(id) || {};
|
|
252
|
+
return {
|
|
253
|
+
name,
|
|
254
|
+
config,
|
|
255
|
+
library
|
|
256
|
+
};
|
|
257
|
+
})), shareReplay(1));
|
|
258
|
+
}
|
|
259
|
+
getComponentConfigName(selector, isFallbackName = false) {
|
|
260
|
+
if (!isFallbackName) return typeof selector === "string" ? selector : computeItemIdentifier(selector.componentName, selector.library || this.options.defaultLibraryName);
|
|
261
|
+
return typeof selector === "string" ? computeItemIdentifier(selector, this.options.defaultLibraryName || "global") : computeItemIdentifier(selector.componentName, this.options.defaultLibraryName || "global");
|
|
262
|
+
}
|
|
263
|
+
getComponentsWithConfiguration() {
|
|
264
|
+
return firstValueFrom(this.store.pipe(select(selectConfigurationIds), map((ids) => ids.map((configName) => parseConfigurationName(configName.toString())).filter((parsedName) => !!parsedName).map((parsedName) => parsedName.componentName + (parsedName.library ? " from " + parsedName.library : "")))));
|
|
265
|
+
}
|
|
266
|
+
setDynamicConfig(selector, configProperty, configValue) {
|
|
267
|
+
this.store.dispatch(upsertConfigurationEntity({
|
|
268
|
+
id: this.getComponentConfigName(selector),
|
|
269
|
+
configuration: { [configProperty]: configValue }
|
|
270
|
+
}));
|
|
271
|
+
this.appRef.tick();
|
|
272
|
+
}
|
|
273
|
+
getCurrentConfigurationFor(selector) {
|
|
274
|
+
return firstValueFrom(this.store.pipe(select(selectConfigurationEntities), map((entities) => entities[this.getComponentConfigName(selector)] || entities[this.getComponentConfigName(selector, true)]), filter((entity) => !!entity), map((entity) => {
|
|
275
|
+
const { id, ...configuration } = entity;
|
|
276
|
+
return configuration;
|
|
277
|
+
})));
|
|
278
|
+
}
|
|
279
|
+
getConfiguration() {
|
|
280
|
+
return firstValueFrom(this.configurationEntities$);
|
|
281
|
+
}
|
|
282
|
+
loadConfiguration(configurations) {
|
|
283
|
+
this.store.dispatch(upsertConfigurationEntities(computeConfiguration(typeof configurations === "string" ? JSON.parse(configurations) : configurations)));
|
|
284
|
+
this.appRef.tick();
|
|
285
|
+
}
|
|
286
|
+
static {
|
|
287
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
288
|
+
minVersion: "12.0.0",
|
|
289
|
+
version: "22.2.3",
|
|
290
|
+
ngImport: i0,
|
|
291
|
+
type: OtterConfigurationDevtools,
|
|
292
|
+
deps: [],
|
|
293
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
static {
|
|
297
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
298
|
+
minVersion: "12.0.0",
|
|
299
|
+
version: "22.2.3",
|
|
300
|
+
ngImport: i0,
|
|
301
|
+
type: OtterConfigurationDevtools,
|
|
302
|
+
providedIn: "root"
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
307
|
+
minVersion: "12.0.0",
|
|
308
|
+
version: "22.2.3",
|
|
309
|
+
ngImport: i0,
|
|
310
|
+
type: OtterConfigurationDevtools,
|
|
311
|
+
decorators: [{
|
|
312
|
+
type: Injectable,
|
|
313
|
+
args: [{ providedIn: "root" }]
|
|
314
|
+
}],
|
|
315
|
+
ctorParameters: () => []
|
|
316
|
+
});
|
|
317
|
+
var ConfigurationDevtoolsConsoleService = class ConfigurationDevtoolsConsoleService {
|
|
318
|
+
static {
|
|
319
|
+
this.windowModuleName = "configuration";
|
|
320
|
+
}
|
|
321
|
+
constructor() {
|
|
322
|
+
this.configurationDevtools = inject(OtterConfigurationDevtools);
|
|
323
|
+
this.options = inject(OTTER_CONFIGURATION_DEVTOOLS_OPTIONS, { optional: true }) ?? OTTER_CONFIGURATION_DEVTOOLS_DEFAULT_OPTIONS;
|
|
324
|
+
const options = this.options;
|
|
325
|
+
this.options = {
|
|
326
|
+
...OTTER_CONFIGURATION_DEVTOOLS_DEFAULT_OPTIONS,
|
|
327
|
+
...options
|
|
328
|
+
};
|
|
329
|
+
if (this.options.isActivatedOnBootstrap || this.options.isActivatedOnBootstrapWhenCMSContext && document.body.dataset.cmscontext === "true") this.activate();
|
|
330
|
+
}
|
|
331
|
+
downloadJSON(content, fileName = this.options.defaultJsonFilename) {
|
|
332
|
+
const a = document.createElement("a");
|
|
333
|
+
const file = new Blob([content], { type: "text/plain" });
|
|
334
|
+
a.href = URL.createObjectURL(file);
|
|
335
|
+
a.download = fileName;
|
|
336
|
+
a.click();
|
|
337
|
+
}
|
|
338
|
+
copyElementToClipboard(content) {
|
|
339
|
+
const input = document.createElement("textarea");
|
|
340
|
+
input.value = content;
|
|
341
|
+
document.body.append(input);
|
|
342
|
+
input.select();
|
|
343
|
+
document.execCommand("copy");
|
|
344
|
+
input.remove();
|
|
345
|
+
}
|
|
346
|
+
setDynamicConfig(selector, configProperty, configValue) {
|
|
347
|
+
this.configurationDevtools.setDynamicConfig(selector, configProperty, configValue);
|
|
348
|
+
}
|
|
349
|
+
activate() {
|
|
350
|
+
const windowWithDevtools = window;
|
|
351
|
+
windowWithDevtools._OTTER_DEVTOOLS_ ||= {};
|
|
352
|
+
windowWithDevtools._OTTER_DEVTOOLS_[ConfigurationDevtoolsConsoleService.windowModuleName] = this;
|
|
353
|
+
console.info(`Otter Configuration Devtools is now accessible via the _OTTER_DEVTOOLS_.${ConfigurationDevtoolsConsoleService.windowModuleName} variable`);
|
|
354
|
+
}
|
|
355
|
+
async displayComponentsWithConfiguration() {
|
|
356
|
+
const selectors = await this.configurationDevtools.getComponentsWithConfiguration();
|
|
357
|
+
console.log(selectors);
|
|
358
|
+
}
|
|
359
|
+
async displayCurrentConfigurationFor(selector) {
|
|
360
|
+
const configuration = await this.configurationDevtools.getCurrentConfigurationFor(selector);
|
|
361
|
+
console.log(configuration);
|
|
362
|
+
}
|
|
363
|
+
async saveConfiguration(fileName = this.options.defaultJsonFilename) {
|
|
364
|
+
const configs = await firstValueFrom(this.configurationDevtools.configurationEntities$);
|
|
365
|
+
this.downloadJSON(JSON.stringify(configs), fileName);
|
|
366
|
+
}
|
|
367
|
+
async displayConfiguration() {
|
|
368
|
+
const configs = await this.configurationDevtools.getConfiguration();
|
|
369
|
+
console.log(configs);
|
|
370
|
+
}
|
|
371
|
+
async displayConfigurationBookmark() {
|
|
372
|
+
const content = await this.configurationDevtools.getConfiguration();
|
|
373
|
+
console.log("BOOKMARK");
|
|
374
|
+
console.log(`javascript:window._OTTER_DEVTOOLS_.updateConfigurations('${JSON.stringify(content).replace(/'/g, "\\'")}')`);
|
|
375
|
+
}
|
|
376
|
+
async copyConfigurationToClipboard() {
|
|
377
|
+
const configs = await firstValueFrom(this.configurationDevtools.configurationEntities$);
|
|
378
|
+
this.copyElementToClipboard(JSON.stringify(configs));
|
|
379
|
+
}
|
|
380
|
+
updateConfigurations(configurations) {
|
|
381
|
+
this.configurationDevtools.loadConfiguration(configurations);
|
|
382
|
+
}
|
|
383
|
+
static {
|
|
384
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
385
|
+
minVersion: "12.0.0",
|
|
386
|
+
version: "22.2.3",
|
|
387
|
+
ngImport: i0,
|
|
388
|
+
type: ConfigurationDevtoolsConsoleService,
|
|
389
|
+
deps: [],
|
|
390
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
static {
|
|
394
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
395
|
+
minVersion: "12.0.0",
|
|
396
|
+
version: "22.2.3",
|
|
397
|
+
ngImport: i0,
|
|
398
|
+
type: ConfigurationDevtoolsConsoleService,
|
|
399
|
+
providedIn: "root"
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
404
|
+
minVersion: "12.0.0",
|
|
405
|
+
version: "22.2.3",
|
|
406
|
+
ngImport: i0,
|
|
407
|
+
type: ConfigurationDevtoolsConsoleService,
|
|
408
|
+
decorators: [{
|
|
409
|
+
type: Injectable,
|
|
410
|
+
args: [{ providedIn: "root" }]
|
|
411
|
+
}],
|
|
412
|
+
ctorParameters: () => []
|
|
413
|
+
});
|
|
502
414
|
const isConfigurationMessage = (message) => {
|
|
503
|
-
|
|
504
|
-
|| message.dataType === 'updateConfig'
|
|
505
|
-
|| message.dataType === 'requestMessages'
|
|
506
|
-
|| message.dataType === 'connect');
|
|
415
|
+
return message && (message.dataType === "configurations" || message.dataType === "updateConfig" || message.dataType === "requestMessages" || message.dataType === "connect");
|
|
507
416
|
};
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
417
|
+
var ConfigurationDevtoolsMessageService = class ConfigurationDevtoolsMessageService {
|
|
418
|
+
constructor() {
|
|
419
|
+
this.store = inject(Store);
|
|
420
|
+
this.logger = inject(LoggerService);
|
|
421
|
+
this.configurationDevtools = inject(OtterConfigurationDevtools);
|
|
422
|
+
this.options = inject(OTTER_CONFIGURATION_DEVTOOLS_OPTIONS, { optional: true });
|
|
423
|
+
this.sendMessage = sendOtterMessage;
|
|
424
|
+
this.destroyRef = inject(DestroyRef);
|
|
425
|
+
const options = this.options;
|
|
426
|
+
this.options = {
|
|
427
|
+
...OTTER_CONFIGURATION_DEVTOOLS_DEFAULT_OPTIONS,
|
|
428
|
+
...options
|
|
429
|
+
};
|
|
430
|
+
if (this.options.isActivatedOnBootstrap) this.activate();
|
|
431
|
+
}
|
|
432
|
+
async sendCurrentConfigurationState() {
|
|
433
|
+
const configurations = await firstValueFrom(this.store.pipe(select(selectConfigurationEntities)));
|
|
434
|
+
this.sendMessage("configurations", { configurations });
|
|
435
|
+
}
|
|
436
|
+
handleReEmitRequest(only) {
|
|
437
|
+
if (!only || only.includes("configurations")) return this.sendCurrentConfigurationState();
|
|
438
|
+
}
|
|
439
|
+
async handleEvents(message) {
|
|
440
|
+
this.logger.debug("Message handling by the configuration service", message);
|
|
441
|
+
switch (message.dataType) {
|
|
442
|
+
case "connect":
|
|
443
|
+
await this.connectPlugin();
|
|
444
|
+
break;
|
|
445
|
+
case "requestMessages":
|
|
446
|
+
await this.handleReEmitRequest(message.only);
|
|
447
|
+
break;
|
|
448
|
+
case "updateConfig":
|
|
449
|
+
this.configurationDevtools.loadConfiguration([{
|
|
450
|
+
name: message.id,
|
|
451
|
+
config: message.configValue
|
|
452
|
+
}]);
|
|
453
|
+
break;
|
|
454
|
+
default: this.logger.warn("Message ignored by the configuration service", message);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
connectPlugin() {
|
|
458
|
+
this.logger.debug("Otter DevTools is plugged to configuration service of the application");
|
|
459
|
+
return this.sendCurrentConfigurationState();
|
|
460
|
+
}
|
|
461
|
+
activate() {
|
|
462
|
+
fromEvent(window, "message").pipe(takeUntilDestroyed(this.destroyRef), filterMessageContent(isConfigurationMessage)).subscribe((e) => this.handleEvents(e));
|
|
463
|
+
this.store.pipe(select(selectConfigurationEntities), takeUntilDestroyed(this.destroyRef)).subscribe((configurations) => this.sendMessage("configurations", { configurations }));
|
|
464
|
+
}
|
|
465
|
+
static {
|
|
466
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
467
|
+
minVersion: "12.0.0",
|
|
468
|
+
version: "22.2.3",
|
|
469
|
+
ngImport: i0,
|
|
470
|
+
type: ConfigurationDevtoolsMessageService,
|
|
471
|
+
deps: [],
|
|
472
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
static {
|
|
476
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
477
|
+
minVersion: "12.0.0",
|
|
478
|
+
version: "22.2.3",
|
|
479
|
+
ngImport: i0,
|
|
480
|
+
type: ConfigurationDevtoolsMessageService,
|
|
481
|
+
providedIn: "root"
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
486
|
+
minVersion: "12.0.0",
|
|
487
|
+
version: "22.2.3",
|
|
488
|
+
ngImport: i0,
|
|
489
|
+
type: ConfigurationDevtoolsMessageService,
|
|
490
|
+
decorators: [{
|
|
491
|
+
type: Injectable,
|
|
492
|
+
args: [{ providedIn: "root" }]
|
|
493
|
+
}],
|
|
494
|
+
ctorParameters: () => []
|
|
495
|
+
});
|
|
496
|
+
var ConfigurationDevtoolsModule = class ConfigurationDevtoolsModule {
|
|
497
|
+
static instrument(options) {
|
|
498
|
+
return {
|
|
499
|
+
ngModule: ConfigurationDevtoolsModule,
|
|
500
|
+
providers: [
|
|
501
|
+
{
|
|
502
|
+
provide: OTTER_CONFIGURATION_DEVTOOLS_OPTIONS,
|
|
503
|
+
useValue: {
|
|
504
|
+
...OTTER_CONFIGURATION_DEVTOOLS_DEFAULT_OPTIONS,
|
|
505
|
+
...options
|
|
506
|
+
},
|
|
507
|
+
multi: false
|
|
508
|
+
},
|
|
509
|
+
ConfigurationDevtoolsMessageService,
|
|
510
|
+
ConfigurationDevtoolsConsoleService,
|
|
511
|
+
OtterConfigurationDevtools
|
|
512
|
+
]
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
static {
|
|
516
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
517
|
+
minVersion: "12.0.0",
|
|
518
|
+
version: "22.2.3",
|
|
519
|
+
ngImport: i0,
|
|
520
|
+
type: ConfigurationDevtoolsModule,
|
|
521
|
+
deps: [],
|
|
522
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
static {
|
|
526
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
527
|
+
minVersion: "14.0.0",
|
|
528
|
+
version: "22.2.3",
|
|
529
|
+
ngImport: i0,
|
|
530
|
+
type: ConfigurationDevtoolsModule,
|
|
531
|
+
imports: [StoreModule, ConfigurationStoreModule]
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
static {
|
|
535
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
536
|
+
minVersion: "12.0.0",
|
|
537
|
+
version: "22.2.3",
|
|
538
|
+
ngImport: i0,
|
|
539
|
+
type: ConfigurationDevtoolsModule,
|
|
540
|
+
providers: [
|
|
541
|
+
{
|
|
542
|
+
provide: OTTER_CONFIGURATION_DEVTOOLS_OPTIONS,
|
|
543
|
+
useValue: OTTER_CONFIGURATION_DEVTOOLS_DEFAULT_OPTIONS
|
|
544
|
+
},
|
|
545
|
+
ConfigurationDevtoolsMessageService,
|
|
546
|
+
ConfigurationDevtoolsConsoleService,
|
|
547
|
+
OtterConfigurationDevtools
|
|
548
|
+
],
|
|
549
|
+
imports: [StoreModule, ConfigurationStoreModule]
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
554
|
+
minVersion: "12.0.0",
|
|
555
|
+
version: "22.2.3",
|
|
556
|
+
ngImport: i0,
|
|
557
|
+
type: ConfigurationDevtoolsModule,
|
|
558
|
+
decorators: [{
|
|
559
|
+
type: NgModule,
|
|
560
|
+
args: [{
|
|
561
|
+
imports: [StoreModule, ConfigurationStoreModule],
|
|
562
|
+
providers: [
|
|
563
|
+
{
|
|
564
|
+
provide: OTTER_CONFIGURATION_DEVTOOLS_OPTIONS,
|
|
565
|
+
useValue: OTTER_CONFIGURATION_DEVTOOLS_DEFAULT_OPTIONS
|
|
566
|
+
},
|
|
567
|
+
ConfigurationDevtoolsMessageService,
|
|
568
|
+
ConfigurationDevtoolsConsoleService,
|
|
569
|
+
OtterConfigurationDevtools
|
|
570
|
+
]
|
|
571
|
+
}]
|
|
572
|
+
}]
|
|
573
|
+
});
|
|
634
574
|
function provideConfigurationDevtools(options) {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationBaseServiceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
649
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationBaseServiceModule, imports: [ConfigurationStoreModule] }); }
|
|
650
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: ConfigurationBaseServiceModule, imports: [ConfigurationStoreModule] }); }
|
|
575
|
+
return makeEnvironmentProviders([
|
|
576
|
+
provideConfigurationStore(),
|
|
577
|
+
{
|
|
578
|
+
provide: OTTER_CONFIGURATION_DEVTOOLS_OPTIONS,
|
|
579
|
+
useValue: {
|
|
580
|
+
...OTTER_CONFIGURATION_DEVTOOLS_DEFAULT_OPTIONS,
|
|
581
|
+
...options
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
ConfigurationDevtoolsMessageService,
|
|
585
|
+
ConfigurationDevtoolsConsoleService,
|
|
586
|
+
OtterConfigurationDevtools
|
|
587
|
+
]);
|
|
651
588
|
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
589
|
+
var ConfigurationBaseServiceModule = class ConfigurationBaseServiceModule {
|
|
590
|
+
static {
|
|
591
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
592
|
+
minVersion: "12.0.0",
|
|
593
|
+
version: "22.2.3",
|
|
594
|
+
ngImport: i0,
|
|
595
|
+
type: ConfigurationBaseServiceModule,
|
|
596
|
+
deps: [],
|
|
597
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
static {
|
|
601
|
+
this.ɵmod = i0.ɵɵngDeclareNgModule({
|
|
602
|
+
minVersion: "14.0.0",
|
|
603
|
+
version: "22.2.3",
|
|
604
|
+
ngImport: i0,
|
|
605
|
+
type: ConfigurationBaseServiceModule,
|
|
606
|
+
imports: [ConfigurationStoreModule]
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
static {
|
|
610
|
+
this.ɵinj = i0.ɵɵngDeclareInjector({
|
|
611
|
+
minVersion: "12.0.0",
|
|
612
|
+
version: "22.2.3",
|
|
613
|
+
ngImport: i0,
|
|
614
|
+
type: ConfigurationBaseServiceModule,
|
|
615
|
+
imports: [ConfigurationStoreModule]
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
620
|
+
minVersion: "12.0.0",
|
|
621
|
+
version: "22.2.3",
|
|
622
|
+
ngImport: i0,
|
|
623
|
+
type: ConfigurationBaseServiceModule,
|
|
624
|
+
decorators: [{
|
|
625
|
+
type: NgModule,
|
|
626
|
+
args: [{ imports: [ConfigurationStoreModule] }]
|
|
627
|
+
}]
|
|
628
|
+
});
|
|
659
629
|
const jsonStringifyDiff = (obj1, obj2) => JSON.stringify(obj1) === JSON.stringify(obj2);
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
type: Injectable,
|
|
744
|
-
args: [{
|
|
745
|
-
providedIn: ConfigurationBaseServiceModule
|
|
746
|
-
}]
|
|
747
|
-
}] });
|
|
748
|
-
|
|
630
|
+
var ConfigurationBaseService = class ConfigurationBaseService {
|
|
631
|
+
constructor() {
|
|
632
|
+
this.store = inject(Store);
|
|
633
|
+
this.extendedConfiguration = {};
|
|
634
|
+
}
|
|
635
|
+
upsertConfiguration(configuration, configurationId = globalConfigurationId) {
|
|
636
|
+
this.store.dispatch(upsertConfigurationEntity({
|
|
637
|
+
id: configurationId,
|
|
638
|
+
configuration
|
|
639
|
+
}));
|
|
640
|
+
}
|
|
641
|
+
updateConfiguration(configuration, configurationId = globalConfigurationId) {
|
|
642
|
+
this.store.dispatch(updateConfigurationEntity({
|
|
643
|
+
id: configurationId,
|
|
644
|
+
configuration
|
|
645
|
+
}));
|
|
646
|
+
}
|
|
647
|
+
getConfigFromBodyTag(configTagName = "staticconfig") {
|
|
648
|
+
const bootstrapConfigString = document.body.dataset[configTagName];
|
|
649
|
+
const customConfigObject = bootstrapConfigString ? JSON.parse(bootstrapConfigString) : [];
|
|
650
|
+
if (customConfigObject.length > 0) this.computeConfiguration(customConfigObject);
|
|
651
|
+
}
|
|
652
|
+
computeConfiguration(customConfigObject) {
|
|
653
|
+
this.store.dispatch(upsertConfigurationEntities(computeConfiguration(customConfigObject)));
|
|
654
|
+
}
|
|
655
|
+
extendConfiguration(extension, configurationId = globalConfigurationId, forceUpdate = false) {
|
|
656
|
+
if (this.extendedConfiguration[configurationId] && !forceUpdate) return;
|
|
657
|
+
this.extendedConfiguration[configurationId] = true;
|
|
658
|
+
this.store.pipe(select(selectConfigurationEntities), take(1), map((storedConfigs) => configurationId in storedConfigs ? deepFill(extension, storedConfigs[configurationId]) : extension)).subscribe((extendedConfig) => this.upsertConfiguration(extendedConfig, configurationId));
|
|
659
|
+
}
|
|
660
|
+
getComponentConfig(id, defaultValue) {
|
|
661
|
+
return (source) => {
|
|
662
|
+
const componentConfigurationFromStore$ = this.getConfig(id);
|
|
663
|
+
return source.pipe(switchMap((overrideConfig) => componentConfigurationFromStore$.pipe(map((componentConfigurationFromStore) => {
|
|
664
|
+
const config = componentConfigurationFromStore ? deepFill(defaultValue, componentConfigurationFromStore) : defaultValue;
|
|
665
|
+
return overrideConfig ? deepFill(config, overrideConfig) : config;
|
|
666
|
+
}))));
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
getConfig(id) {
|
|
670
|
+
const globalConfig$ = this.store.pipe(select(selectGlobalConfiguration));
|
|
671
|
+
const componentConfig$ = id === "global" ? of({}) : this.store.pipe(select(selectConfigurationForComponent({ id })));
|
|
672
|
+
const overrideConfig$ = this.store.pipe(select(selectComponentOverrideConfig(id)));
|
|
673
|
+
return combineLatest([
|
|
674
|
+
globalConfig$,
|
|
675
|
+
componentConfig$,
|
|
676
|
+
overrideConfig$
|
|
677
|
+
]).pipe(map(([globalConfig, componentConfig, overrideConfig]) => ({
|
|
678
|
+
...globalConfig,
|
|
679
|
+
...componentConfig,
|
|
680
|
+
...overrideConfig
|
|
681
|
+
})), distinctUntilChanged(jsonStringifyDiff));
|
|
682
|
+
}
|
|
683
|
+
static {
|
|
684
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
685
|
+
minVersion: "12.0.0",
|
|
686
|
+
version: "22.2.3",
|
|
687
|
+
ngImport: i0,
|
|
688
|
+
type: ConfigurationBaseService,
|
|
689
|
+
deps: [],
|
|
690
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
static {
|
|
694
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
695
|
+
minVersion: "12.0.0",
|
|
696
|
+
version: "22.2.3",
|
|
697
|
+
ngImport: i0,
|
|
698
|
+
type: ConfigurationBaseService,
|
|
699
|
+
providedIn: ConfigurationBaseServiceModule
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
704
|
+
minVersion: "12.0.0",
|
|
705
|
+
version: "22.2.3",
|
|
706
|
+
ngImport: i0,
|
|
707
|
+
type: ConfigurationBaseService,
|
|
708
|
+
decorators: [{
|
|
709
|
+
type: Injectable,
|
|
710
|
+
args: [{ providedIn: ConfigurationBaseServiceModule }]
|
|
711
|
+
}]
|
|
712
|
+
});
|
|
749
713
|
const decorator = (target, key) => {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
enumerable: true,
|
|
763
|
-
configurable: true
|
|
764
|
-
});
|
|
765
|
-
}
|
|
714
|
+
const privateField = `_${key}`;
|
|
715
|
+
if (delete target[key]) Object.defineProperty(target, key, {
|
|
716
|
+
get: function() {
|
|
717
|
+
return this[privateField];
|
|
718
|
+
},
|
|
719
|
+
set: function(value) {
|
|
720
|
+
this[privateField] = value;
|
|
721
|
+
if (this[otterComponentInfoPropertyName]) this[otterComponentInfoPropertyName].configId = this[privateField].configId;
|
|
722
|
+
},
|
|
723
|
+
enumerable: true,
|
|
724
|
+
configurable: true
|
|
725
|
+
});
|
|
766
726
|
};
|
|
767
|
-
/**
|
|
768
|
-
* Decorator to identify the component's configuration
|
|
769
|
-
*/
|
|
770
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention -- decorator should be PascalCase
|
|
771
727
|
function O3rConfig() {
|
|
772
|
-
|
|
728
|
+
return decorator;
|
|
773
729
|
}
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
this.subscriber.complete();
|
|
800
|
-
this.closed = true;
|
|
801
|
-
}
|
|
802
|
-
/**
|
|
803
|
-
* @inheritdoc
|
|
804
|
-
*/
|
|
805
|
-
asObservable() {
|
|
806
|
-
return this.observable;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
/**
|
|
811
|
-
* Get a configuration signal
|
|
812
|
-
* @param configInput
|
|
813
|
-
* @param configId
|
|
814
|
-
* @param defaultConfig
|
|
815
|
-
*/
|
|
730
|
+
var ConfigurationObserver = class {
|
|
731
|
+
constructor(configId, defaultConfig, configurationService) {
|
|
732
|
+
this.configId = configId;
|
|
733
|
+
this.subscriber = new BehaviorSubject({});
|
|
734
|
+
if (configurationService) configurationService.extendConfiguration(defaultConfig, configId);
|
|
735
|
+
this.observable = this.subscriber.pipe(configurationService ? configurationService.getComponentConfig(configId, defaultConfig) : getConfiguration(defaultConfig), shareReplay({
|
|
736
|
+
refCount: true,
|
|
737
|
+
bufferSize: 1
|
|
738
|
+
}));
|
|
739
|
+
}
|
|
740
|
+
next(value) {
|
|
741
|
+
this.subscriber.next(value || {});
|
|
742
|
+
}
|
|
743
|
+
error(err) {
|
|
744
|
+
this.subscriber.error(err);
|
|
745
|
+
this.closed = true;
|
|
746
|
+
}
|
|
747
|
+
complete() {
|
|
748
|
+
this.subscriber.complete();
|
|
749
|
+
this.closed = true;
|
|
750
|
+
}
|
|
751
|
+
asObservable() {
|
|
752
|
+
return this.observable;
|
|
753
|
+
}
|
|
754
|
+
};
|
|
816
755
|
function configSignal(configInput, configId, defaultConfig) {
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
756
|
+
const configurationService = inject(ConfigurationBaseService, { optional: true });
|
|
757
|
+
if (configurationService) configurationService.extendConfiguration(defaultConfig, configId);
|
|
758
|
+
const signal = toSignal(toObservable(configInput).pipe(configurationService ? configurationService.getComponentConfig(configId, defaultConfig) : getConfiguration(defaultConfig), shareReplay$1({
|
|
759
|
+
bufferSize: 1,
|
|
760
|
+
refCount: true
|
|
761
|
+
})), { initialValue: defaultConfig });
|
|
762
|
+
signal.configId = configId;
|
|
763
|
+
return signal;
|
|
824
764
|
}
|
|
825
|
-
|
|
826
|
-
/**
|
|
827
|
-
* Generated bundle index. Do not edit.
|
|
828
|
-
*/
|
|
829
|
-
|
|
830
765
|
export { CONFIGURATION_REDUCER_TOKEN, CONFIGURATION_STORE_NAME, CONFIG_OVERRIDE_REDUCER_TOKEN, CONFIG_OVERRIDE_STORE_NAME, ConfigOverrideStoreModule, ConfigurationBaseService, ConfigurationBaseServiceModule, ConfigurationDevtoolsConsoleService, ConfigurationDevtoolsMessageService, ConfigurationDevtoolsModule, ConfigurationObserver, ConfigurationStoreModule, O3rConfig, OTTER_CONFIGURATION_DEVTOOLS_DEFAULT_OPTIONS, OTTER_CONFIGURATION_DEVTOOLS_OPTIONS, OtterConfigurationDevtools, clearConfigurationEntities, computeConfiguration, configOverrideInitialState, configOverrideReducer, configOverrideReducerFeatures, configOverrideStorageDeserializer, configOverrideStorageSync, configSignal, configurationAdapter, configurationInitialState, configurationReducer, configurationReducerFeatures, configurationStorageSync, getConfiguration, getDefaultConfigOverrideReducer, getDefaultConfigurationReducer, globalConfigurationId, isConfigurationMessage, parseConfigurationName, provideConfigOverrideStore, provideConfigurationDevtools, provideConfigurationStore, selectAllConfiguration, selectComponentOverrideConfig, selectConfigOverride, selectConfigOverrideState, selectConfigurationEntities, selectConfigurationForComponent, selectConfigurationIds, selectConfigurationState, selectConfigurationTotal, selectGlobalConfiguration, setConfigOverride, setConfigurationEntities, updateConfigurationEntities, updateConfigurationEntity, upsertConfigurationEntities, upsertConfigurationEntity };
|
|
831
|
-
|
|
766
|
+
|
|
767
|
+
//# sourceMappingURL=o3r-configuration.mjs.map
|