@opengeoweb/store 11.0.0 → 11.1.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/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSlice, createSelector, createAction, createListenerMiddleware, isAnyOf, createEntityAdapter, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
1
|
+
import { createSlice, createSelector, createAction, createListenerMiddleware, isAnyOf, createEntityAdapter, combineReducers, configureStore, compose, EnhancerArray } from '@reduxjs/toolkit';
|
|
2
2
|
import { isEqual, isEmpty, compact } from 'lodash';
|
|
3
3
|
import { dateUtils, PROJECTION, defaultDelay } from '@opengeoweb/shared';
|
|
4
4
|
import { webmapUtils, parseISO8601IntervalToDateInterval, LayerType, getWMJSMapById, webmapTestSettings, WMLayer, getWMSRequests, handleDateUtilsISOString, isProjectionSupported, queryWMSLayers } from '@opengeoweb/webmap';
|
|
@@ -7981,6 +7981,41 @@ metronomeListener.startListening({
|
|
|
7981
7981
|
}()
|
|
7982
7982
|
});
|
|
7983
7983
|
|
|
7984
|
+
/* *
|
|
7985
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7986
|
+
* you may not use this file except in compliance with the License.
|
|
7987
|
+
* You may obtain a copy of the License at
|
|
7988
|
+
*
|
|
7989
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7990
|
+
*
|
|
7991
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7992
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7993
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7994
|
+
* See the License for the specific language governing permissions and
|
|
7995
|
+
* limitations under the License.
|
|
7996
|
+
*
|
|
7997
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7998
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
7999
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
8000
|
+
* */
|
|
8001
|
+
var unifyReducerMaps = function unifyReducerMaps(reducerMaps) {
|
|
8002
|
+
var unifiedReducerMaps = {};
|
|
8003
|
+
for (var _iterator = _createForOfIteratorHelperLoose(reducerMaps), _step; !(_step = _iterator()).done;) {
|
|
8004
|
+
var reducersMap = _step.value;
|
|
8005
|
+
for (var _i = 0, _Object$entries = Object.entries(reducersMap); _i < _Object$entries.length; _i++) {
|
|
8006
|
+
var _Object$entries$_i = _Object$entries[_i],
|
|
8007
|
+
key = _Object$entries$_i[0],
|
|
8008
|
+
reducer = _Object$entries$_i[1];
|
|
8009
|
+
if (key in unifiedReducerMaps && unifiedReducerMaps[key] !== reducer) {
|
|
8010
|
+
throw new Error("Reducer key " + key + " is already defined with a different reducer");
|
|
8011
|
+
} else {
|
|
8012
|
+
unifiedReducerMaps[key] = reducer;
|
|
8013
|
+
}
|
|
8014
|
+
}
|
|
8015
|
+
}
|
|
8016
|
+
return unifiedReducerMaps;
|
|
8017
|
+
};
|
|
8018
|
+
|
|
7984
8019
|
/* *
|
|
7985
8020
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7986
8021
|
* you may not use this file except in compliance with the License.
|
|
@@ -8428,5 +8463,61 @@ var createMockStore = function createMockStore(mockState) {
|
|
|
8428
8463
|
}
|
|
8429
8464
|
});
|
|
8430
8465
|
};
|
|
8466
|
+
var getDefaultEnhancers = function getDefaultEnhancers() {
|
|
8467
|
+
return new EnhancerArray();
|
|
8468
|
+
};
|
|
8469
|
+
/**
|
|
8470
|
+
* This creates an OpenGeoWeb redux store for redux connected components
|
|
8471
|
+
*
|
|
8472
|
+
* @param preloadedState Initial state for your application
|
|
8473
|
+
* @param extraReducers Additional reducers, you can pass your own reducers. See apps/geoweb/src/app/store.ts for how it is used in GeoWeb.
|
|
8474
|
+
* @param extraMiddleWares Additional middlewares
|
|
8475
|
+
* @param extraEnhancer Custom enhancers
|
|
8476
|
+
* @param enableDevTools Set to true to enable redux devtools.
|
|
8477
|
+
* @returns A redux store you can use with the core components
|
|
8478
|
+
*/
|
|
8479
|
+
var configureOpenGeoWebStore = function configureOpenGeoWebStore(preloadedState, extraReducers, extraMiddleWares, extraEnhancers, enableDevTools) {
|
|
8480
|
+
if (preloadedState === void 0) {
|
|
8481
|
+
preloadedState = {};
|
|
8482
|
+
}
|
|
8483
|
+
if (extraReducers === void 0) {
|
|
8484
|
+
extraReducers = {};
|
|
8485
|
+
}
|
|
8486
|
+
if (extraMiddleWares === void 0) {
|
|
8487
|
+
extraMiddleWares = [];
|
|
8488
|
+
}
|
|
8489
|
+
if (extraEnhancers === void 0) {
|
|
8490
|
+
extraEnhancers = getDefaultEnhancers();
|
|
8491
|
+
}
|
|
8492
|
+
if (enableDevTools === void 0) {
|
|
8493
|
+
enableDevTools = false;
|
|
8494
|
+
}
|
|
8495
|
+
var allReducers = unifyReducerMaps([storeReducerMap, extraReducers]);
|
|
8496
|
+
var openGeoWebReducers = combineReducers(allReducers);
|
|
8497
|
+
// Combine middlewares
|
|
8498
|
+
var middlewares = [mapListener.middleware, serviceListener.middleware, layersListener.middleware, genericListener.middleware].concat(extraMiddleWares);
|
|
8499
|
+
// Ensure we do not add middlewares twice
|
|
8500
|
+
var uniqueMiddlewares = Array.from(new Set(middlewares.map(function (obj) {
|
|
8501
|
+
return obj;
|
|
8502
|
+
})));
|
|
8503
|
+
return configureStore({
|
|
8504
|
+
reducer: openGeoWebReducers,
|
|
8505
|
+
preloadedState: preloadedState,
|
|
8506
|
+
enhancers: function enhancers(defaultEnhancers) {
|
|
8507
|
+
return [compose.apply(void 0, [].concat(defaultEnhancers, extraEnhancers))];
|
|
8508
|
+
},
|
|
8509
|
+
devTools: enableDevTools,
|
|
8510
|
+
middleware: function middleware(getDefaultMiddleware) {
|
|
8511
|
+
return [].concat(getDefaultMiddleware({
|
|
8512
|
+
serializableCheck: {
|
|
8513
|
+
warnAfter: 128
|
|
8514
|
+
},
|
|
8515
|
+
immutableCheck: {
|
|
8516
|
+
warnAfter: 128
|
|
8517
|
+
}
|
|
8518
|
+
})).concat(uniqueMiddlewares);
|
|
8519
|
+
}
|
|
8520
|
+
});
|
|
8521
|
+
};
|
|
8431
8522
|
|
|
8432
|
-
export { IS_LEGEND_OPEN_BY_DEFAULT, createMockStore, drawingToolActions, drawingToolListener, drawingToolReducer, selectors as drawingToolSelectors, filterLayers$1 as filterLayers, genericActions, genericListener, selectors$3 as genericSelectors, types as genericTypes, getSingularDrawtoolDrawLayerId, getUserAddedServices, initialState$2 as initialState, layerActions, layerReducer, selectors$6 as layerSelectors, types$3 as layerTypes, utils$1 as layerUtils, layersListener, constants as linkComponentTypesConstants, loadingIndicatorActions, constants$1 as loadingIndicatorConstants, loadingIndicatorReducer, selectors$2 as loadingIndicatorSelectors, mapActions, enums as mapEnums, mapListener, mapReducer, selectors$1 as mapSelectors, types$4 as mapTypes, mapUtils, metronomeListener, routerActions, routerListener, routerReducer, utils as routerUtils, selectorMemoizationOptions, serviceActions, serviceListener, serviceReducer, selectors$7 as serviceSelectors, types$5 as serviceTypes, setUserAddedServices, storeMiddlewares, storeReducerMap, storeTestSettings, storeTestUtils, utils$3 as storeUtils, constants$2 as syncConstants, syncGroupsActions, syncGroupsListener, syncGroupsReducer, selector as syncGroupsSelector, selectors$4 as syncGroupsSelectors, types$1 as syncGroupsTypes, types$1 as types, uiActions, uiReducer, selectors$5 as uiSelectors, types$2 as uiTypes, useSetupDialog, useUpdateSharedData };
|
|
8523
|
+
export { IS_LEGEND_OPEN_BY_DEFAULT, configureOpenGeoWebStore, createMockStore, drawingToolActions, drawingToolListener, drawingToolReducer, selectors as drawingToolSelectors, filterLayers$1 as filterLayers, genericActions, genericListener, selectors$3 as genericSelectors, types as genericTypes, getSingularDrawtoolDrawLayerId, getUserAddedServices, initialState$2 as initialState, layerActions, layerReducer, selectors$6 as layerSelectors, types$3 as layerTypes, utils$1 as layerUtils, layersListener, constants as linkComponentTypesConstants, loadingIndicatorActions, constants$1 as loadingIndicatorConstants, loadingIndicatorReducer, selectors$2 as loadingIndicatorSelectors, mapActions, enums as mapEnums, mapListener, mapReducer, selectors$1 as mapSelectors, types$4 as mapTypes, mapUtils, metronomeListener, routerActions, routerListener, routerReducer, utils as routerUtils, selectorMemoizationOptions, serviceActions, serviceListener, serviceReducer, selectors$7 as serviceSelectors, types$5 as serviceTypes, setUserAddedServices, storeMiddlewares, storeReducerMap, storeTestSettings, storeTestUtils, utils$3 as storeUtils, constants$2 as syncConstants, syncGroupsActions, syncGroupsListener, syncGroupsReducer, selector as syncGroupsSelector, selectors$4 as syncGroupsSelectors, types$1 as syncGroupsTypes, types$1 as types, uiActions, uiReducer, selectors$5 as uiSelectors, types$2 as uiTypes, unifyReducerMaps, useSetupDialog, useUpdateSharedData };
|
package/package.json
CHANGED
package/src/store/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { routerListener } from './router/listener';
|
|
|
8
8
|
export { drawingToolListener } from './drawingTool/listener';
|
|
9
9
|
export { layersListener } from './map/layer/listeners';
|
|
10
10
|
export { metronomeListener } from './map/map/metronomeListener';
|
|
11
|
+
export { unifyReducerMaps, type ReducerMap } from './unifyReducerMaps';
|
|
11
12
|
export * from './router';
|
|
12
13
|
export * from './drawingTool';
|
|
13
14
|
export * from './types';
|
package/src/store/store.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { DevToolsEnhancerOptions, EnhancerArray, ListenerMiddleware, StoreEnhancer } from '@reduxjs/toolkit';
|
|
1
2
|
import { ToolkitStore } from '@reduxjs/toolkit/dist/configureStore';
|
|
3
|
+
import { ExtractDispatchExtensions } from '@reduxjs/toolkit/dist/tsHelpers';
|
|
2
4
|
import { WebMapStateModuleState } from './map';
|
|
3
5
|
import { SynchronizationGroupModuleState } from './generic/syncGroups/types';
|
|
4
6
|
import { LoadingIndicatorModuleState } from './generic/loadingIndicator/types';
|
|
5
7
|
import { UIModuleState } from './ui/types';
|
|
6
8
|
import { DrawtoolModuleStore } from './drawingTool/reducer';
|
|
9
|
+
import { ReducerMap } from './unifyReducerMaps';
|
|
7
10
|
export declare const storeReducerMap: {
|
|
8
11
|
webmap: import("redux").Reducer<import("./map/types").WebMapState>;
|
|
9
12
|
services: import("redux").Reducer<import("./map/types").ServiceState>;
|
|
@@ -14,5 +17,20 @@ export declare const storeReducerMap: {
|
|
|
14
17
|
drawingtools: import("redux").Reducer<import("./drawingTool/reducer").DrawingToolState>;
|
|
15
18
|
router: import("redux").Reducer<{}>;
|
|
16
19
|
};
|
|
17
|
-
export declare const storeMiddlewares: (
|
|
20
|
+
export declare const storeMiddlewares: (ListenerMiddleware<import("./types").CoreAppStore, import("@reduxjs/toolkit").ThunkDispatch<import("./types").CoreAppStore, unknown, import("redux").AnyAction>, unknown> | ListenerMiddleware<import("./router/types").RouterModuleStore, import("@reduxjs/toolkit").ThunkDispatch<import("./router/types").RouterModuleStore, unknown, import("redux").AnyAction>, unknown>)[];
|
|
18
21
|
export declare const createMockStore: (mockState?: WebMapStateModuleState | SynchronizationGroupModuleState | LoadingIndicatorModuleState | UIModuleState | DrawtoolModuleStore) => ToolkitStore;
|
|
22
|
+
/**
|
|
23
|
+
* This creates an OpenGeoWeb redux store for redux connected components
|
|
24
|
+
*
|
|
25
|
+
* @param preloadedState Initial state for your application
|
|
26
|
+
* @param extraReducers Additional reducers, you can pass your own reducers. See apps/geoweb/src/app/store.ts for how it is used in GeoWeb.
|
|
27
|
+
* @param extraMiddleWares Additional middlewares
|
|
28
|
+
* @param extraEnhancer Custom enhancers
|
|
29
|
+
* @param enableDevTools Set to true to enable redux devtools.
|
|
30
|
+
* @returns A redux store you can use with the core components
|
|
31
|
+
*/
|
|
32
|
+
export declare const configureOpenGeoWebStore: (preloadedState?: object, extraReducers?: ReducerMap, extraMiddleWares?: ListenerMiddleware[], extraEnhancers?: EnhancerArray<[
|
|
33
|
+
StoreEnhancer<{
|
|
34
|
+
dispatch: ExtractDispatchExtensions<unknown>;
|
|
35
|
+
}>
|
|
36
|
+
]>, enableDevTools?: boolean | DevToolsEnhancerOptions) => ToolkitStore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|