@opengeoweb/store 20.0.1-nightly-20261015 → 20.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/dist/index.esm.js CHANGED
@@ -5,7 +5,7 @@ export { LayerType } from '@opengeoweb/webmap';
5
5
  import { dateUtils, PROJECTION, defaultDelay, useDebounce } from '@opengeoweb/shared';
6
6
  import { secondsPerPxFromCanvasWidth, defaultTimeSpan, defaultSecondsPerPx, defaultAnimationDelayAtStart, defaultTimeStep, MAX_ANIMATION_STEPS, AnimationLengthMode, defaultExactSelections, withDraggedRange, roundWithTimeStep, isValidAnimationLength, isWithinAnimationStepLimit, settingRange, isAnchoredMode, resolveAnimationRange, defaultOffsetSelections, getAnimationLengthFromRange, withModeSelections, getSpeedDelay } from '@opengeoweb/time-slider';
7
7
  import { produce } from 'immer';
8
- import { getLastEmptyFeatureIndex, getGeoJson, moveFeature, createInterSections, defaultLayers, fetchStacCatalogRoot, stacCatalogCollectionToLayerProps, fetchStacCatalogCollections, emptyGeoJSON, defaultIntersectionStyleProperties, addSelectionTypeToGeoJSON, getFeatureCollection } from '@opengeoweb/webmap-react';
8
+ import { getLastEmptyFeatureIndex, getGeoJson, moveFeature, createInterSections, defaultLayers, fetchStacCatalogRoot, defaultEdrStyles, normalizeEDRLabel, fetchEDRJson, stacCatalogCollectionToLayerProps, fetchStacCatalogCollections, emptyGeoJSON, defaultIntersectionStyleProperties, addSelectionTypeToGeoJSON, getFeatureCollection } from '@opengeoweb/webmap-react';
9
9
  export { defaultLayers } from '@opengeoweb/webmap-react';
10
10
  import { v4 } from 'uuid';
11
11
  import React, { useEffect, useRef, useCallback } from 'react';
@@ -1321,6 +1321,9 @@ var trimTrailingSlashes = function trimTrailingSlashes(url) {
1321
1321
  var getSTACServiceRootUrl = function getSTACServiceRootUrl(serviceUrl) {
1322
1322
  return trimTrailingSlashes(serviceUrl).replace(/\/collections\/[^/]+$/, '');
1323
1323
  };
1324
+ var getEDRServiceRootUrl = function getEDRServiceRootUrl(serviceUrl) {
1325
+ return trimTrailingSlashes(serviceUrl).replace(/\/collections\/[^/]+$/, '');
1326
+ };
1324
1327
  var getTrailingSlashVariant = function getTrailingSlashVariant(url) {
1325
1328
  return url.endsWith('/') ? url.slice(0, -1) : "".concat(url, "/");
1326
1329
  };
@@ -1584,6 +1587,7 @@ var utils$1 = /*#__PURE__*/Object.freeze({
1584
1587
  filterCurrentValueFromDimensions: filterCurrentValueFromDimensions,
1585
1588
  filterNonTimeDimensions: filterNonTimeDimensions,
1586
1589
  generateFeatureId: generateFeatureId,
1590
+ getEDRServiceRootUrl: getEDRServiceRootUrl,
1587
1591
  getFeatureSelectionKey: getFeatureSelectionKey,
1588
1592
  getSTACServiceRootUrl: getSTACServiceRootUrl,
1589
1593
  getSelectedFeatureIndexByIds: getSelectedFeatureIndexByIds,
@@ -3206,6 +3210,7 @@ var slice$6 = createSlice({
3206
3210
  draft.byId[mapId].baseLayers = [];
3207
3211
  draft.byId[mapId].mapLayers = [];
3208
3212
  draft.byId[mapId].overLayers = [];
3213
+ draft.byId[mapId].featureLayers = [];
3209
3214
  draft.byId[mapId].isAutoUpdating = false;
3210
3215
  draft.byId[mapId].isAnimating = false;
3211
3216
  draft.byId[mapId].isTimeSliderVisible = true;
@@ -5215,6 +5220,15 @@ var useSyncgroupTimeState = function useSyncgroupTimeState(panelId) {
5215
5220
  var layerStore = function layerStore(store) {
5216
5221
  return store === null || store === void 0 ? void 0 : store.layers;
5217
5222
  };
5223
+ var getCollectionServiceRootUrl = function getCollectionServiceRootUrl(layerType, serviceUrl) {
5224
+ if (layerType === LayerType.edrFeatureLayer) {
5225
+ return getEDRServiceRootUrl(serviceUrl);
5226
+ }
5227
+ if (layerType === LayerType.stacGeoTIFFLayer) {
5228
+ return getSTACServiceRootUrl(serviceUrl);
5229
+ }
5230
+ return undefined;
5231
+ };
5218
5232
  /**
5219
5233
  * Gets a layer from the layers part of the store by its Id
5220
5234
  *
@@ -5487,7 +5501,8 @@ var getLayerService = createSelector(getLayerById, function (layer) {
5487
5501
  var getLayerServiceName = createSelector(function (store) {
5488
5502
  return store;
5489
5503
  }, getLayerById, getLayerService, function (store, layer, service) {
5490
- var layerService = getServiceByUrl(store, service) || ((layer === null || layer === void 0 ? void 0 : layer.layerType) === LayerType.stacGeoTIFFLayer ? getServiceByUrl(store, getSTACServiceRootUrl(service)) || getServiceByUrl(store, getTrailingSlashVariant(getSTACServiceRootUrl(service))) : undefined);
5504
+ var serviceRootUrl = getCollectionServiceRootUrl(layer === null || layer === void 0 ? void 0 : layer.layerType, service);
5505
+ var layerService = getServiceByUrl(store, service) || (serviceRootUrl ? getServiceByUrl(store, serviceRootUrl) || getServiceByUrl(store, getTrailingSlashVariant(serviceRootUrl)) : undefined);
5491
5506
  return layerService !== null && layerService !== void 0 && layerService.name ? layerService === null || layerService === void 0 ? void 0 : layerService.name : '';
5492
5507
  }, selectorMemoizationOptions);
5493
5508
  /**
@@ -5745,8 +5760,9 @@ var getIsLayerMissing = createSelector(function (store) {
5745
5760
  if (type === LayerType.featureLayer || type === LayerType.stacGeoTIFFLayer) {
5746
5761
  return false;
5747
5762
  }
5748
- var layer = getLayerFromService(store, service, name);
5749
- return !layer || status === LayerStatus.error;
5763
+ var serviceRootUrl = getCollectionServiceRootUrl(type, service);
5764
+ var serviceLayer = getLayerFromService(store, service, name) || (serviceRootUrl ? getLayerFromService(store, serviceRootUrl, name) || getLayerFromService(store, getTrailingSlashVariant(serviceRootUrl), name) : undefined);
5765
+ return !serviceLayer || status === LayerStatus.error;
5750
5766
  }, selectorMemoizationOptions);
5751
5767
  var getIsLayerSelectable = createSelector(getLayerById, function (layer) {
5752
5768
  return Boolean(layer === null || layer === void 0 ? void 0 : layer.isSelectable);
@@ -9957,21 +9973,59 @@ var fetchSTACLayers = /*#__PURE__*/function () {
9957
9973
  return _ref.apply(this, arguments);
9958
9974
  };
9959
9975
  }();
9976
+ var fetchEDRLayers = /*#__PURE__*/function () {
9977
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(serviceUrl) {
9978
+ var _data$collections;
9979
+ var baseUrl, data;
9980
+ return _regenerator().w(function (_context2) {
9981
+ while (1) switch (_context2.n) {
9982
+ case 0:
9983
+ baseUrl = serviceUrl.endsWith('/') ? serviceUrl.slice(0, -1) : serviceUrl;
9984
+ _context2.n = 1;
9985
+ return fetchEDRJson("".concat(baseUrl, "/collections"));
9986
+ case 1:
9987
+ data = _context2.v;
9988
+ return _context2.a(2, ((_data$collections = data.collections) !== null && _data$collections !== void 0 ? _data$collections : []).flatMap(function (collection) {
9989
+ var _collection$parameter;
9990
+ return Object.entries((_collection$parameter = collection.parameter_names) !== null && _collection$parameter !== void 0 ? _collection$parameter : {}).map(function (_ref3) {
9991
+ var _parameter$label, _ref5, _collection$path, _collection$title, _parameter$observedPr, _parameter$label2;
9992
+ var _ref4 = _slicedToArray(_ref3, 2),
9993
+ parameterId = _ref4[0],
9994
+ parameter = _ref4[1];
9995
+ return {
9996
+ name: parameterId,
9997
+ title: (_parameter$label = parameter.label) !== null && _parameter$label !== void 0 ? _parameter$label : parameterId,
9998
+ leaf: true,
9999
+ path: [].concat(_toConsumableArray((_ref5 = (_collection$path = collection.path) !== null && _collection$path !== void 0 ? _collection$path : collection.groups) !== null && _ref5 !== void 0 ? _ref5 : collection.group ? [collection.group] : []), [(_collection$title = collection.title) !== null && _collection$title !== void 0 ? _collection$title : collection.id]),
10000
+ keywords: (_parameter$observedPr = parameter.observedProperty) !== null && _parameter$observedPr !== void 0 && _parameter$observedPr.label ? [normalizeEDRLabel(parameter.observedProperty.label, (_parameter$label2 = parameter.label) !== null && _parameter$label2 !== void 0 ? _parameter$label2 : parameterId)] : [],
10001
+ edrCollectionId: collection.id,
10002
+ edrParameter: parameter,
10003
+ styles: defaultEdrStyles
10004
+ };
10005
+ });
10006
+ }));
10007
+ }
10008
+ }, _callee2);
10009
+ }));
10010
+ return function fetchEDRLayers(_x2) {
10011
+ return _ref2.apply(this, arguments);
10012
+ };
10013
+ }();
9960
10014
  var dispatchServiceLayers = function dispatchServiceLayers(service, layers, listenerApi) {
9961
10015
  listenerApi.dispatch(serviceActions.serviceSetLayers(_objectSpread2(_objectSpread2({}, service), {}, {
9962
10016
  layers: layers
9963
10017
  })));
9964
10018
  };
9965
10019
  var fetchSTACService = /*#__PURE__*/function () {
9966
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(service, listenerApi) {
10020
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(service, listenerApi) {
9967
10021
  var _yield$Promise$all, _yield$Promise$all2, root, layers;
9968
- return _regenerator().w(function (_context2) {
9969
- while (1) switch (_context2.n) {
10022
+ return _regenerator().w(function (_context3) {
10023
+ while (1) switch (_context3.n) {
9970
10024
  case 0:
9971
- _context2.n = 1;
10025
+ _context3.n = 1;
9972
10026
  return Promise.all([fetchStacCatalogRoot(service.serviceUrl), fetchSTACLayers(service.serviceUrl)]);
9973
10027
  case 1:
9974
- _yield$Promise$all = _context2.v;
10028
+ _yield$Promise$all = _context3.v;
9975
10029
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
9976
10030
  root = _yield$Promise$all2[0];
9977
10031
  layers = _yield$Promise$all2[1];
@@ -9981,117 +10035,139 @@ var fetchSTACService = /*#__PURE__*/function () {
9981
10035
  type: 'STAC'
9982
10036
  }), layers, listenerApi);
9983
10037
  case 2:
9984
- return _context2.a(2);
10038
+ return _context3.a(2);
9985
10039
  }
9986
- }, _callee2);
10040
+ }, _callee3);
9987
10041
  }));
9988
- return function fetchSTACService(_x2, _x3) {
9989
- return _ref2.apply(this, arguments);
10042
+ return function fetchSTACService(_x3, _x4) {
10043
+ return _ref6.apply(this, arguments);
9990
10044
  };
9991
10045
  }();
9992
10046
  var fetchService = /*#__PURE__*/function () {
9993
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(service, listenerApi) {
9994
- var layers, _t;
9995
- return _regenerator().w(function (_context3) {
9996
- while (1) switch (_context3.p = _context3.n) {
10047
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(service, listenerApi) {
10048
+ var layers, _layers, _t, _t2;
10049
+ return _regenerator().w(function (_context4) {
10050
+ while (1) switch (_context4.p = _context4.n) {
9997
10051
  case 0:
9998
- if (!(service.type === 'STAC')) {
9999
- _context3.n = 2;
10052
+ if (!(service.type === 'EDR')) {
10053
+ _context4.n = 5;
10000
10054
  break;
10001
10055
  }
10002
- _context3.n = 1;
10003
- return fetchSTACService(service, listenerApi);
10004
- case 1:
10005
- return _context3.a(2);
10056
+ _context4.p = 1;
10057
+ _context4.n = 2;
10058
+ return fetchEDRLayers(service.serviceUrl);
10006
10059
  case 2:
10007
- _context3.p = 2;
10008
- _context3.n = 3;
10009
- return queryWMSLayers(service.serviceUrl);
10010
- case 3:
10011
- layers = _context3.v;
10060
+ layers = _context4.v;
10012
10061
  dispatchServiceLayers(service, layers, listenerApi);
10013
- _context3.n = 5;
10062
+ _context4.n = 4;
10014
10063
  break;
10015
- case 4:
10016
- _context3.p = 4;
10017
- _t = _context3.v;
10064
+ case 3:
10065
+ _context4.p = 3;
10066
+ _t = _context4.v;
10018
10067
  if (_t instanceof Error) {
10019
10068
  console.warn(_t.message);
10020
10069
  }
10070
+ dispatchServiceLayers(service, [], listenerApi);
10071
+ case 4:
10072
+ return _context4.a(2);
10021
10073
  case 5:
10022
- return _context3.a(2);
10074
+ if (!(service.type === 'STAC')) {
10075
+ _context4.n = 7;
10076
+ break;
10077
+ }
10078
+ _context4.n = 6;
10079
+ return fetchSTACService(service, listenerApi);
10080
+ case 6:
10081
+ return _context4.a(2);
10082
+ case 7:
10083
+ _context4.p = 7;
10084
+ _context4.n = 8;
10085
+ return queryWMSLayers(service.serviceUrl);
10086
+ case 8:
10087
+ _layers = _context4.v;
10088
+ dispatchServiceLayers(service, _layers, listenerApi);
10089
+ _context4.n = 10;
10090
+ break;
10091
+ case 9:
10092
+ _context4.p = 9;
10093
+ _t2 = _context4.v;
10094
+ if (_t2 instanceof Error) {
10095
+ console.warn(_t2.message);
10096
+ }
10097
+ case 10:
10098
+ return _context4.a(2);
10023
10099
  }
10024
- }, _callee3, null, [[2, 4]]);
10100
+ }, _callee4, null, [[7, 9], [1, 3]]);
10025
10101
  }));
10026
- return function fetchService(_x4, _x5) {
10027
- return _ref3.apply(this, arguments);
10102
+ return function fetchService(_x5, _x6) {
10103
+ return _ref7.apply(this, arguments);
10028
10104
  };
10029
10105
  }();
10030
10106
  var fetchInitialServices = /*#__PURE__*/function () {
10031
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(payload, listenerApi) {
10032
- var _t2;
10033
- return _regenerator().w(function (_context5) {
10034
- while (1) switch (_context5.p = _context5.n) {
10107
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(payload, listenerApi) {
10108
+ var _t3;
10109
+ return _regenerator().w(function (_context6) {
10110
+ while (1) switch (_context6.p = _context6.n) {
10035
10111
  case 0:
10036
10112
  if (payload !== null && payload !== void 0 && payload.services) {
10037
- _context5.n = 1;
10113
+ _context6.n = 1;
10038
10114
  break;
10039
10115
  }
10040
- return _context5.a(2);
10116
+ return _context6.a(2);
10041
10117
  case 1:
10042
- _context5.p = 1;
10043
- _context5.n = 2;
10118
+ _context6.p = 1;
10119
+ _context6.n = 2;
10044
10120
  return Promise.all(payload.services.map(/*#__PURE__*/function () {
10045
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(_ref5) {
10121
+ var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref9) {
10046
10122
  var url, service;
10047
- return _regenerator().w(function (_context4) {
10048
- while (1) switch (_context4.n) {
10123
+ return _regenerator().w(function (_context5) {
10124
+ while (1) switch (_context5.n) {
10049
10125
  case 0:
10050
- url = _ref5.url, service = _objectWithoutProperties(_ref5, _excluded);
10051
- return _context4.a(2, fetchService(_objectSpread2(_objectSpread2({}, service), {}, {
10126
+ url = _ref9.url, service = _objectWithoutProperties(_ref9, _excluded);
10127
+ return _context5.a(2, fetchService(_objectSpread2(_objectSpread2({}, service), {}, {
10052
10128
  serviceUrl: url
10053
10129
  }), listenerApi));
10054
10130
  }
10055
- }, _callee4);
10131
+ }, _callee5);
10056
10132
  }));
10057
- return function (_x8) {
10058
- return _ref6.apply(this, arguments);
10133
+ return function (_x9) {
10134
+ return _ref0.apply(this, arguments);
10059
10135
  };
10060
10136
  }()));
10061
10137
  case 2:
10062
- _context5.n = 4;
10138
+ _context6.n = 4;
10063
10139
  break;
10064
10140
  case 3:
10065
- _context5.p = 3;
10066
- _t2 = _context5.v;
10067
- console.warn(_t2);
10141
+ _context6.p = 3;
10142
+ _t3 = _context6.v;
10143
+ console.warn(_t3);
10068
10144
  case 4:
10069
- return _context5.a(2);
10145
+ return _context6.a(2);
10070
10146
  }
10071
- }, _callee5, null, [[1, 3]]);
10147
+ }, _callee6, null, [[1, 3]]);
10072
10148
  }));
10073
- return function fetchInitialServices(_x6, _x7) {
10074
- return _ref4.apply(this, arguments);
10149
+ return function fetchInitialServices(_x7, _x8) {
10150
+ return _ref8.apply(this, arguments);
10075
10151
  };
10076
10152
  }();
10077
10153
  serviceListener.startListening({
10078
10154
  actionCreator: serviceActions.fetchInitialServices,
10079
10155
  effect: function () {
10080
- var _effect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(_ref7, listenerApi) {
10156
+ var _effect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(_ref1, listenerApi) {
10081
10157
  var payload;
10082
- return _regenerator().w(function (_context6) {
10083
- while (1) switch (_context6.n) {
10158
+ return _regenerator().w(function (_context7) {
10159
+ while (1) switch (_context7.n) {
10084
10160
  case 0:
10085
- payload = _ref7.payload;
10161
+ payload = _ref1.payload;
10086
10162
  listenerApi.cancelActiveListeners();
10087
- _context6.n = 1;
10163
+ _context7.n = 1;
10088
10164
  return fetchInitialServices(payload, listenerApi);
10089
10165
  case 1:
10090
- return _context6.a(2);
10166
+ return _context7.a(2);
10091
10167
  }
10092
- }, _callee6);
10168
+ }, _callee7);
10093
10169
  }));
10094
- function effect(_x9, _x0) {
10170
+ function effect(_x0, _x1) {
10095
10171
  return _effect.apply(this, arguments);
10096
10172
  }
10097
10173
  return effect;
@@ -4,6 +4,7 @@ import type { Dimension, ReduxLayer } from '../types';
4
4
  import type { LayerState } from './types';
5
5
  export declare const trimTrailingSlashes: (url: string) => string;
6
6
  export declare const getSTACServiceRootUrl: (serviceUrl: string) => string;
7
+ export declare const getEDRServiceRootUrl: (serviceUrl: string) => string;
7
8
  export declare const getTrailingSlashVariant: (url: string) => string;
8
9
  /**
9
10
  * Generates a unique id for a geoJSON feature. Feature ids need to be stable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/store",
3
- "version": "20.0.1-nightly-20261015",
3
+ "version": "20.1.0",
4
4
  "description": "GeoWeb Store library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,15 +20,15 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@opengeoweb/shared": "20.0.1-nightly-20261015",
23
+ "@opengeoweb/shared": "20.1.0",
24
24
  "react-redux": "^9.2.0",
25
25
  "@reduxjs/toolkit": "^2.6.1",
26
- "@opengeoweb/webmap-react": "20.0.1-nightly-20261015",
27
- "@opengeoweb/webmap": "20.0.1-nightly-20261015",
26
+ "@opengeoweb/webmap-react": "20.1.0",
27
+ "@opengeoweb/webmap": "20.1.0",
28
28
  "immer": "^10.0.3",
29
29
  "lodash": "^4.18.1",
30
- "@opengeoweb/metronome": "20.0.1-nightly-20261015",
31
- "@opengeoweb/time-slider": "20.0.1-nightly-20261015",
30
+ "@opengeoweb/metronome": "20.1.0",
31
+ "@opengeoweb/time-slider": "20.1.0",
32
32
  "ol": "^10.4.0",
33
33
  "@turf/turf": "^7.2.0",
34
34
  "@types/geojson": "^7946.0.14",