@opengeoweb/layer-select 19.3.0 → 19.5.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 +71 -34
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2511,8 +2511,12 @@ var DetectableServiceType;
|
|
|
2511
2511
|
DetectableServiceType["STAC"] = "STAC";
|
|
2512
2512
|
DetectableServiceType["WMS"] = "WMS";
|
|
2513
2513
|
})(DetectableServiceType || (DetectableServiceType = {}));
|
|
2514
|
+
var stripStacCollectionsAndTrailingSlashes = function stripStacCollectionsAndTrailingSlashes(serviceUrl) {
|
|
2515
|
+
return (serviceUrl != null ? serviceUrl : '').replace(/\/collections.*$/i, '').replace(/\/+$/, '');
|
|
2516
|
+
};
|
|
2514
2517
|
var normalizeStacServiceUrl = function normalizeStacServiceUrl(serviceUrl) {
|
|
2515
|
-
|
|
2518
|
+
var normalizedUrl = stripStacCollectionsAndTrailingSlashes(serviceUrl);
|
|
2519
|
+
return normalizedUrl ? normalizedUrl + "/" : '';
|
|
2516
2520
|
};
|
|
2517
2521
|
var validateServiceName = function validateServiceName(t, value, services, ownServiceName) {
|
|
2518
2522
|
if (ownServiceName === void 0) {
|
|
@@ -2543,9 +2547,10 @@ var validateServiceUrl = function validateServiceUrl(t, value, services) {
|
|
|
2543
2547
|
return t('validations-service-valid-url');
|
|
2544
2548
|
}
|
|
2545
2549
|
// check url existing
|
|
2550
|
+
var normalizedServiceUrl = stripStacCollectionsAndTrailingSlashes(serviceUrl);
|
|
2546
2551
|
var foundUrl = Object.keys(services).find(function (serviceId) {
|
|
2547
2552
|
var _services$serviceId2;
|
|
2548
|
-
return ((_services$serviceId2 = services[serviceId]) == null ? void 0 : _services$serviceId2.serviceUrl) ===
|
|
2553
|
+
return stripStacCollectionsAndTrailingSlashes((_services$serviceId2 = services[serviceId]) == null ? void 0 : _services$serviceId2.serviceUrl) === normalizedServiceUrl;
|
|
2549
2554
|
});
|
|
2550
2555
|
if (foundUrl) {
|
|
2551
2556
|
return t('validations-service-existing');
|
|
@@ -2592,63 +2597,95 @@ var loadWMSService = /*#__PURE__*/function () {
|
|
|
2592
2597
|
};
|
|
2593
2598
|
}();
|
|
2594
2599
|
var detectServiceType = /*#__PURE__*/function () {
|
|
2595
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2596
|
-
var
|
|
2597
|
-
return _regenerator().w(function (
|
|
2598
|
-
while (1) switch (
|
|
2600
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(url) {
|
|
2601
|
+
var trimmedUrl, isStacServiceUrl, _t2;
|
|
2602
|
+
return _regenerator().w(function (_context3) {
|
|
2603
|
+
while (1) switch (_context3.n) {
|
|
2599
2604
|
case 0:
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2605
|
+
trimmedUrl = url.trim();
|
|
2606
|
+
isStacServiceUrl = /*#__PURE__*/function () {
|
|
2607
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(candidateUrl) {
|
|
2608
|
+
var root, hasStacRootShape;
|
|
2609
|
+
return _regenerator().w(function (_context2) {
|
|
2610
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
2611
|
+
case 0:
|
|
2612
|
+
_context2.p = 0;
|
|
2613
|
+
_context2.n = 1;
|
|
2614
|
+
return fetchStacCatalogRoot(candidateUrl);
|
|
2615
|
+
case 1:
|
|
2616
|
+
root = _context2.v;
|
|
2617
|
+
hasStacRootShape = root.stac_version || root.type === 'Catalog' || Array.isArray(root.conformsTo);
|
|
2618
|
+
if (!hasStacRootShape) {
|
|
2619
|
+
_context2.n = 2;
|
|
2620
|
+
break;
|
|
2621
|
+
}
|
|
2622
|
+
return _context2.a(2, true);
|
|
2623
|
+
case 2:
|
|
2624
|
+
return _context2.a(2, Boolean(root.type === 'Collection' && root.stac_version && Array.isArray(root.links)));
|
|
2625
|
+
case 3:
|
|
2626
|
+
_context2.p = 3;
|
|
2627
|
+
_context2.v;
|
|
2628
|
+
return _context2.a(2, false);
|
|
2629
|
+
}
|
|
2630
|
+
}, _callee2, null, [[0, 3]]);
|
|
2631
|
+
}));
|
|
2632
|
+
return function isStacServiceUrl(_x4) {
|
|
2633
|
+
return _ref3.apply(this, arguments);
|
|
2634
|
+
};
|
|
2635
|
+
}();
|
|
2636
|
+
_context3.n = 1;
|
|
2637
|
+
return isStacServiceUrl(trimmedUrl);
|
|
2603
2638
|
case 1:
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
if (!hasStacRootShape) {
|
|
2607
|
-
_context2.n = 2;
|
|
2639
|
+
if (!_context3.v) {
|
|
2640
|
+
_context3.n = 2;
|
|
2608
2641
|
break;
|
|
2609
2642
|
}
|
|
2610
|
-
return
|
|
2643
|
+
return _context3.a(2, DetectableServiceType.STAC);
|
|
2611
2644
|
case 2:
|
|
2612
|
-
|
|
2613
|
-
|
|
2645
|
+
_t2 = !trimmedUrl.endsWith('/');
|
|
2646
|
+
if (!_t2) {
|
|
2647
|
+
_context3.n = 4;
|
|
2614
2648
|
break;
|
|
2615
2649
|
}
|
|
2616
|
-
|
|
2650
|
+
_context3.n = 3;
|
|
2651
|
+
return isStacServiceUrl(trimmedUrl + "/");
|
|
2617
2652
|
case 3:
|
|
2618
|
-
|
|
2619
|
-
break;
|
|
2653
|
+
_t2 = _context3.v;
|
|
2620
2654
|
case 4:
|
|
2621
|
-
|
|
2622
|
-
|
|
2655
|
+
if (!_t2) {
|
|
2656
|
+
_context3.n = 5;
|
|
2657
|
+
break;
|
|
2658
|
+
}
|
|
2659
|
+
return _context3.a(2, DetectableServiceType.STAC);
|
|
2623
2660
|
case 5:
|
|
2624
|
-
return
|
|
2661
|
+
return _context3.a(2, DetectableServiceType.WMS);
|
|
2625
2662
|
}
|
|
2626
|
-
},
|
|
2663
|
+
}, _callee3);
|
|
2627
2664
|
}));
|
|
2628
2665
|
return function detectServiceType(_x3) {
|
|
2629
2666
|
return _ref2.apply(this, arguments);
|
|
2630
2667
|
};
|
|
2631
2668
|
}();
|
|
2632
2669
|
var loadSTACService = /*#__PURE__*/function () {
|
|
2633
|
-
var
|
|
2634
|
-
var
|
|
2670
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(serviceUrl) {
|
|
2671
|
+
var _ref5, _root$title, _root$description;
|
|
2635
2672
|
var _yield$Promise$all, root, collections, serviceId, layers;
|
|
2636
|
-
return _regenerator().w(function (
|
|
2637
|
-
while (1) switch (
|
|
2673
|
+
return _regenerator().w(function (_context4) {
|
|
2674
|
+
while (1) switch (_context4.n) {
|
|
2638
2675
|
case 0:
|
|
2639
|
-
|
|
2676
|
+
_context4.n = 1;
|
|
2640
2677
|
return Promise.all([fetchStacCatalogRoot(serviceUrl), fetchStacCatalogCollections(serviceUrl)]);
|
|
2641
2678
|
case 1:
|
|
2642
|
-
_yield$Promise$all =
|
|
2679
|
+
_yield$Promise$all = _context4.v;
|
|
2643
2680
|
root = _yield$Promise$all[0];
|
|
2644
2681
|
collections = _yield$Promise$all[1];
|
|
2645
2682
|
serviceId = serviceUrl.replace(/\/+$/, '').replace(/[^a-zA-Z0-9]/g, '_');
|
|
2646
2683
|
layers = collections.map(stacCatalogCollectionToLayerProps);
|
|
2647
|
-
return
|
|
2684
|
+
return _context4.a(2, {
|
|
2648
2685
|
// Use URL-based ids so different STAC endpoints with identical root.id
|
|
2649
2686
|
// values (e.g. "stac-fastapi") can coexist in the service store.
|
|
2650
2687
|
id: serviceId,
|
|
2651
|
-
name: (
|
|
2688
|
+
name: (_ref5 = (_root$title = root.title) != null ? _root$title : root.id) != null ? _ref5 : serviceId,
|
|
2652
2689
|
serviceUrl: serviceUrl,
|
|
2653
2690
|
"abstract": (_root$description = root.description) != null ? _root$description : '',
|
|
2654
2691
|
layers: layers,
|
|
@@ -2656,10 +2693,10 @@ var loadSTACService = /*#__PURE__*/function () {
|
|
|
2656
2693
|
type: DetectableServiceType.STAC
|
|
2657
2694
|
});
|
|
2658
2695
|
}
|
|
2659
|
-
},
|
|
2696
|
+
}, _callee4);
|
|
2660
2697
|
}));
|
|
2661
|
-
return function loadSTACService(
|
|
2662
|
-
return
|
|
2698
|
+
return function loadSTACService(_x5) {
|
|
2699
|
+
return _ref4.apply(this, arguments);
|
|
2663
2700
|
};
|
|
2664
2701
|
}();
|
|
2665
2702
|
|