@nextgis/ngw-leaflet 3.0.0-alpha.4 → 3.0.0-alpha.5
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/lib/ngw-leaflet.esm-browser.js +1495 -1074
- package/lib/ngw-leaflet.esm-browser.js.map +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js.map +1 -1
- package/lib/ngw-leaflet.esm-bundler.js +1 -1
- package/lib/ngw-leaflet.global.js +1495 -1074
- package/lib/ngw-leaflet.global.js.map +1 -1
- package/lib/ngw-leaflet.global.prod.js +1 -1
- package/lib/ngw-leaflet.global.prod.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.5; author: NextGIS */
|
|
2
2
|
function styleInject(css, ref) {
|
|
3
3
|
if ( ref === void 0 ) ref = {};
|
|
4
4
|
var insertAt = ref.insertAt;
|
|
@@ -62,7 +62,7 @@ EventEmitter.init = function() {
|
|
|
62
62
|
this.domain = null;
|
|
63
63
|
if (EventEmitter.usingDomains) {
|
|
64
64
|
// if there is an active domain, then attach to it.
|
|
65
|
-
if (domain.active
|
|
65
|
+
if (domain.active) ;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
if (!this._events || this._events === Object.getPrototypeOf(this)._events) {
|
|
@@ -15062,15 +15062,15 @@ function createFeaturePositionOptions(features) {
|
|
|
15062
15062
|
};
|
|
15063
15063
|
}
|
|
15064
15064
|
|
|
15065
|
-
var __defProp$
|
|
15066
|
-
var __defNormalProp$
|
|
15067
|
-
var __publicField$
|
|
15065
|
+
var __defProp$11 = Object.defineProperty;
|
|
15066
|
+
var __defNormalProp$11 = (obj, key, value) => key in obj ? __defProp$11(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15067
|
+
var __publicField$H = (obj, key, value) => __defNormalProp$11(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15068
15068
|
class BaseAdapter {
|
|
15069
15069
|
constructor(map, options) {
|
|
15070
15070
|
this.map = map;
|
|
15071
15071
|
this.options = options;
|
|
15072
|
-
__publicField$
|
|
15073
|
-
__publicField$
|
|
15072
|
+
__publicField$H(this, "layer");
|
|
15073
|
+
__publicField$H(this, "pane", "order-0");
|
|
15074
15074
|
if (options.order !== void 0) {
|
|
15075
15075
|
const pane = "order-" + options.order;
|
|
15076
15076
|
let exist = map.getPane(pane);
|
|
@@ -15099,19 +15099,19 @@ function convertMapClickEvent(evt) {
|
|
|
15099
15099
|
};
|
|
15100
15100
|
}
|
|
15101
15101
|
|
|
15102
|
-
var __defProp$
|
|
15103
|
-
var __getOwnPropSymbols$
|
|
15104
|
-
var __hasOwnProp$
|
|
15105
|
-
var __propIsEnum$
|
|
15106
|
-
var __defNormalProp$
|
|
15107
|
-
var __spreadValues$
|
|
15102
|
+
var __defProp$10 = Object.defineProperty;
|
|
15103
|
+
var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
|
|
15104
|
+
var __hasOwnProp$I = Object.prototype.hasOwnProperty;
|
|
15105
|
+
var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
|
|
15106
|
+
var __defNormalProp$10 = (obj, key, value) => key in obj ? __defProp$10(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15107
|
+
var __spreadValues$H = (a, b) => {
|
|
15108
15108
|
for (var prop in b || (b = {}))
|
|
15109
|
-
if (__hasOwnProp$
|
|
15110
|
-
__defNormalProp$
|
|
15111
|
-
if (__getOwnPropSymbols$
|
|
15112
|
-
for (var prop of __getOwnPropSymbols$
|
|
15113
|
-
if (__propIsEnum$
|
|
15114
|
-
__defNormalProp$
|
|
15109
|
+
if (__hasOwnProp$I.call(b, prop))
|
|
15110
|
+
__defNormalProp$10(a, prop, b[prop]);
|
|
15111
|
+
if (__getOwnPropSymbols$I)
|
|
15112
|
+
for (var prop of __getOwnPropSymbols$I(b)) {
|
|
15113
|
+
if (__propIsEnum$I.call(b, prop))
|
|
15114
|
+
__defNormalProp$10(a, prop, b[prop]);
|
|
15115
15115
|
}
|
|
15116
15116
|
return a;
|
|
15117
15117
|
};
|
|
@@ -15121,7 +15121,7 @@ function createMouseEvent({
|
|
|
15121
15121
|
}) {
|
|
15122
15122
|
const layer_ = source.target;
|
|
15123
15123
|
const feature = layer_.feature;
|
|
15124
|
-
const opt = __spreadValues$
|
|
15124
|
+
const opt = __spreadValues$H({
|
|
15125
15125
|
layer,
|
|
15126
15126
|
feature,
|
|
15127
15127
|
event: convertMapClickEvent(source),
|
|
@@ -15130,30 +15130,30 @@ function createMouseEvent({
|
|
|
15130
15130
|
return opt;
|
|
15131
15131
|
}
|
|
15132
15132
|
|
|
15133
|
-
var __defProp
|
|
15134
|
-
var __getOwnPropSymbols$
|
|
15135
|
-
var __hasOwnProp$
|
|
15136
|
-
var __propIsEnum$
|
|
15137
|
-
var __defNormalProp
|
|
15138
|
-
var __spreadValues$
|
|
15133
|
+
var __defProp$$ = Object.defineProperty;
|
|
15134
|
+
var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
|
|
15135
|
+
var __hasOwnProp$H = Object.prototype.hasOwnProperty;
|
|
15136
|
+
var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
|
|
15137
|
+
var __defNormalProp$$ = (obj, key, value) => key in obj ? __defProp$$(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15138
|
+
var __spreadValues$G = (a, b) => {
|
|
15139
15139
|
for (var prop in b || (b = {}))
|
|
15140
|
-
if (__hasOwnProp$
|
|
15141
|
-
__defNormalProp
|
|
15142
|
-
if (__getOwnPropSymbols$
|
|
15143
|
-
for (var prop of __getOwnPropSymbols$
|
|
15144
|
-
if (__propIsEnum$
|
|
15145
|
-
__defNormalProp
|
|
15140
|
+
if (__hasOwnProp$H.call(b, prop))
|
|
15141
|
+
__defNormalProp$$(a, prop, b[prop]);
|
|
15142
|
+
if (__getOwnPropSymbols$H)
|
|
15143
|
+
for (var prop of __getOwnPropSymbols$H(b)) {
|
|
15144
|
+
if (__propIsEnum$H.call(b, prop))
|
|
15145
|
+
__defNormalProp$$(a, prop, b[prop]);
|
|
15146
15146
|
}
|
|
15147
15147
|
return a;
|
|
15148
15148
|
};
|
|
15149
|
-
var __publicField$
|
|
15149
|
+
var __publicField$G = (obj, key, value) => __defNormalProp$$(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15150
15150
|
class GeoJsonEvents {
|
|
15151
15151
|
constructor(layer) {
|
|
15152
|
-
__publicField$
|
|
15153
|
-
__publicField$
|
|
15154
|
-
__publicField$
|
|
15155
|
-
__publicField$
|
|
15156
|
-
__publicField$
|
|
15152
|
+
__publicField$G(this, "layer");
|
|
15153
|
+
__publicField$G(this, "_onclick");
|
|
15154
|
+
__publicField$G(this, "_ondblclick");
|
|
15155
|
+
__publicField$G(this, "_mouseout");
|
|
15156
|
+
__publicField$G(this, "_mouseover");
|
|
15157
15157
|
this.layer = layer;
|
|
15158
15158
|
}
|
|
15159
15159
|
handleMouseEvents(layer) {
|
|
@@ -15162,7 +15162,7 @@ class GeoJsonEvents {
|
|
|
15162
15162
|
if (onClick_) {
|
|
15163
15163
|
this._onclick = (e) => {
|
|
15164
15164
|
const selected = !!this.layer._getSelected(layer);
|
|
15165
|
-
onClick_(__spreadValues$
|
|
15165
|
+
onClick_(__spreadValues$G({
|
|
15166
15166
|
selected
|
|
15167
15167
|
}, this._createMouseEvent(e)));
|
|
15168
15168
|
};
|
|
@@ -15172,7 +15172,7 @@ class GeoJsonEvents {
|
|
|
15172
15172
|
this._ondblclick = (e) => {
|
|
15173
15173
|
leafletSrcExports.DomEvent.stopPropagation(e);
|
|
15174
15174
|
const selected = !!this.layer._getSelected(layer);
|
|
15175
|
-
onDoubleClick(__spreadValues$
|
|
15175
|
+
onDoubleClick(__spreadValues$G({
|
|
15176
15176
|
selected
|
|
15177
15177
|
}, this._createMouseEvent(e)));
|
|
15178
15178
|
};
|
|
@@ -15850,19 +15850,19 @@ const typeExpressions = {
|
|
|
15850
15850
|
typeof: evaluateArgs(([arg]) => typeOfValue(arg))
|
|
15851
15851
|
};
|
|
15852
15852
|
|
|
15853
|
-
var __defProp$
|
|
15854
|
-
var __getOwnPropSymbols$
|
|
15855
|
-
var __hasOwnProp$
|
|
15856
|
-
var __propIsEnum$
|
|
15857
|
-
var __defNormalProp$
|
|
15858
|
-
var __spreadValues$
|
|
15853
|
+
var __defProp$_ = Object.defineProperty;
|
|
15854
|
+
var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
|
|
15855
|
+
var __hasOwnProp$G = Object.prototype.hasOwnProperty;
|
|
15856
|
+
var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
|
|
15857
|
+
var __defNormalProp$_ = (obj, key, value) => key in obj ? __defProp$_(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15858
|
+
var __spreadValues$F = (a, b) => {
|
|
15859
15859
|
for (var prop in b || (b = {}))
|
|
15860
|
-
if (__hasOwnProp$
|
|
15861
|
-
__defNormalProp$
|
|
15862
|
-
if (__getOwnPropSymbols$
|
|
15863
|
-
for (var prop of __getOwnPropSymbols$
|
|
15864
|
-
if (__propIsEnum$
|
|
15865
|
-
__defNormalProp$
|
|
15860
|
+
if (__hasOwnProp$G.call(b, prop))
|
|
15861
|
+
__defNormalProp$_(a, prop, b[prop]);
|
|
15862
|
+
if (__getOwnPropSymbols$G)
|
|
15863
|
+
for (var prop of __getOwnPropSymbols$G(b)) {
|
|
15864
|
+
if (__propIsEnum$G.call(b, prop))
|
|
15865
|
+
__defNormalProp$_(a, prop, b[prop]);
|
|
15866
15866
|
}
|
|
15867
15867
|
return a;
|
|
15868
15868
|
};
|
|
@@ -15874,7 +15874,7 @@ function isExpression(value) {
|
|
|
15874
15874
|
}
|
|
15875
15875
|
return false;
|
|
15876
15876
|
}
|
|
15877
|
-
const expressions = __spreadValues$
|
|
15877
|
+
const expressions = __spreadValues$F(__spreadValues$F(__spreadValues$F(__spreadValues$F(__spreadValues$F(__spreadValues$F({}, mathExpressions), typeExpressions), stringExpressions), lookupExpressions), decisionExpressions), interpolationExpressions);
|
|
15878
15878
|
function evaluate(expression, data = {}) {
|
|
15879
15879
|
const [name, ...args] = expression;
|
|
15880
15880
|
const expressionFun = expressions[name];
|
|
@@ -15887,19 +15887,19 @@ function evaluate(expression, data = {}) {
|
|
|
15887
15887
|
throw new Error(`Expression "${name}" is not supported.`);
|
|
15888
15888
|
}
|
|
15889
15889
|
|
|
15890
|
-
var __defProp$
|
|
15891
|
-
var __getOwnPropSymbols$
|
|
15892
|
-
var __hasOwnProp$
|
|
15893
|
-
var __propIsEnum$
|
|
15894
|
-
var __defNormalProp$
|
|
15895
|
-
var __spreadValues$
|
|
15890
|
+
var __defProp$Z = Object.defineProperty;
|
|
15891
|
+
var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
|
|
15892
|
+
var __hasOwnProp$F = Object.prototype.hasOwnProperty;
|
|
15893
|
+
var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
|
|
15894
|
+
var __defNormalProp$Z = (obj, key, value) => key in obj ? __defProp$Z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15895
|
+
var __spreadValues$E = (a, b) => {
|
|
15896
15896
|
for (var prop in b || (b = {}))
|
|
15897
|
-
if (__hasOwnProp$
|
|
15898
|
-
__defNormalProp$
|
|
15899
|
-
if (__getOwnPropSymbols$
|
|
15900
|
-
for (var prop of __getOwnPropSymbols$
|
|
15901
|
-
if (__propIsEnum$
|
|
15902
|
-
__defNormalProp$
|
|
15897
|
+
if (__hasOwnProp$F.call(b, prop))
|
|
15898
|
+
__defNormalProp$Z(a, prop, b[prop]);
|
|
15899
|
+
if (__getOwnPropSymbols$F)
|
|
15900
|
+
for (var prop of __getOwnPropSymbols$F(b)) {
|
|
15901
|
+
if (__propIsEnum$F.call(b, prop))
|
|
15902
|
+
__defNormalProp$Z(a, prop, b[prop]);
|
|
15903
15903
|
}
|
|
15904
15904
|
return a;
|
|
15905
15905
|
};
|
|
@@ -15932,25 +15932,25 @@ function createExpressionCallback(paint) {
|
|
|
15932
15932
|
for (const p in expressions) {
|
|
15933
15933
|
fromCb[p] = expressions[p](feature);
|
|
15934
15934
|
}
|
|
15935
|
-
return __spreadValues$
|
|
15935
|
+
return __spreadValues$E(__spreadValues$E({}, paint), fromCb);
|
|
15936
15936
|
};
|
|
15937
15937
|
}
|
|
15938
15938
|
return;
|
|
15939
15939
|
}
|
|
15940
15940
|
|
|
15941
|
-
var __defProp$
|
|
15942
|
-
var __getOwnPropSymbols$
|
|
15943
|
-
var __hasOwnProp$
|
|
15944
|
-
var __propIsEnum$
|
|
15945
|
-
var __defNormalProp$
|
|
15946
|
-
var __spreadValues$
|
|
15941
|
+
var __defProp$Y = Object.defineProperty;
|
|
15942
|
+
var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
|
|
15943
|
+
var __hasOwnProp$E = Object.prototype.hasOwnProperty;
|
|
15944
|
+
var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
|
|
15945
|
+
var __defNormalProp$Y = (obj, key, value) => key in obj ? __defProp$Y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15946
|
+
var __spreadValues$D = (a, b) => {
|
|
15947
15947
|
for (var prop in b || (b = {}))
|
|
15948
|
-
if (__hasOwnProp$
|
|
15949
|
-
__defNormalProp$
|
|
15950
|
-
if (__getOwnPropSymbols$
|
|
15951
|
-
for (var prop of __getOwnPropSymbols$
|
|
15952
|
-
if (__propIsEnum$
|
|
15953
|
-
__defNormalProp$
|
|
15948
|
+
if (__hasOwnProp$E.call(b, prop))
|
|
15949
|
+
__defNormalProp$Y(a, prop, b[prop]);
|
|
15950
|
+
if (__getOwnPropSymbols$E)
|
|
15951
|
+
for (var prop of __getOwnPropSymbols$E(b)) {
|
|
15952
|
+
if (__propIsEnum$E.call(b, prop))
|
|
15953
|
+
__defNormalProp$Y(a, prop, b[prop]);
|
|
15954
15954
|
}
|
|
15955
15955
|
return a;
|
|
15956
15956
|
};
|
|
@@ -15997,7 +15997,7 @@ function isPropertyFilter(filter) {
|
|
|
15997
15997
|
return false;
|
|
15998
15998
|
}
|
|
15999
15999
|
function featureFilter(feature, filters) {
|
|
16000
|
-
const properties = __spreadValues$
|
|
16000
|
+
const properties = __spreadValues$D({}, feature.properties);
|
|
16001
16001
|
if (properties) {
|
|
16002
16002
|
properties.$id = feature.id;
|
|
16003
16003
|
return propertiesFilter(properties, filters);
|
|
@@ -16032,19 +16032,19 @@ function propertiesFilter(properties, filters) {
|
|
|
16032
16032
|
return logic === "any" ? filters_.some(filterFunction) : filters_.every(filterFunction);
|
|
16033
16033
|
}
|
|
16034
16034
|
|
|
16035
|
-
var __defProp$
|
|
16036
|
-
var __getOwnPropSymbols$
|
|
16037
|
-
var __hasOwnProp$
|
|
16038
|
-
var __propIsEnum$
|
|
16039
|
-
var __defNormalProp$
|
|
16040
|
-
var __spreadValues$
|
|
16035
|
+
var __defProp$X = Object.defineProperty;
|
|
16036
|
+
var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
|
|
16037
|
+
var __hasOwnProp$D = Object.prototype.hasOwnProperty;
|
|
16038
|
+
var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
|
|
16039
|
+
var __defNormalProp$X = (obj, key, value) => key in obj ? __defProp$X(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16040
|
+
var __spreadValues$C = (a, b) => {
|
|
16041
16041
|
for (var prop in b || (b = {}))
|
|
16042
|
-
if (__hasOwnProp$
|
|
16043
|
-
__defNormalProp$
|
|
16044
|
-
if (__getOwnPropSymbols$
|
|
16045
|
-
for (var prop of __getOwnPropSymbols$
|
|
16046
|
-
if (__propIsEnum$
|
|
16047
|
-
__defNormalProp$
|
|
16042
|
+
if (__hasOwnProp$D.call(b, prop))
|
|
16043
|
+
__defNormalProp$X(a, prop, b[prop]);
|
|
16044
|
+
if (__getOwnPropSymbols$D)
|
|
16045
|
+
for (var prop of __getOwnPropSymbols$D(b)) {
|
|
16046
|
+
if (__propIsEnum$D.call(b, prop))
|
|
16047
|
+
__defNormalProp$X(a, prop, b[prop]);
|
|
16048
16048
|
}
|
|
16049
16049
|
return a;
|
|
16050
16050
|
};
|
|
@@ -16073,7 +16073,7 @@ function createPropertiesPaint(propertiesPaint) {
|
|
|
16073
16073
|
return (feature) => {
|
|
16074
16074
|
const paint = paintsFilters.find((x) => featureFilter(feature, x[0]));
|
|
16075
16075
|
if (paint) {
|
|
16076
|
-
return __spreadValues$
|
|
16076
|
+
return __spreadValues$C(__spreadValues$C({}, mask), paint[1]);
|
|
16077
16077
|
}
|
|
16078
16078
|
return mask;
|
|
16079
16079
|
};
|
|
@@ -16097,8 +16097,8 @@ function expressionCallback({
|
|
|
16097
16097
|
}
|
|
16098
16098
|
function finalizePaint({ paint, defaultPaint }) {
|
|
16099
16099
|
var _a;
|
|
16100
|
-
let newPaint = __spreadValues$
|
|
16101
|
-
newPaint = __spreadValues$
|
|
16100
|
+
let newPaint = __spreadValues$C({}, defaultPaint);
|
|
16101
|
+
newPaint = __spreadValues$C(__spreadValues$C({}, newPaint), paint);
|
|
16102
16102
|
newPaint.fill = (_a = newPaint.fill) != null ? _a : true;
|
|
16103
16103
|
newPaint.stroke = newPaint.stroke !== void 0 ? newPaint.stroke : !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
|
|
16104
16104
|
return newPaint;
|
|
@@ -16111,7 +16111,7 @@ function preparePaint({
|
|
|
16111
16111
|
if (!paint) {
|
|
16112
16112
|
throw new Error("paint is empty");
|
|
16113
16113
|
}
|
|
16114
|
-
let newPaint = __spreadValues$
|
|
16114
|
+
let newPaint = __spreadValues$C({}, defaultPaint);
|
|
16115
16115
|
if (isPaintCallback(paint)) {
|
|
16116
16116
|
const getPaintFunction = (feature) => {
|
|
16117
16117
|
const getPaint = preparePaint({
|
|
@@ -16168,41 +16168,41 @@ function preparePaint({
|
|
|
16168
16168
|
return newPaint;
|
|
16169
16169
|
}
|
|
16170
16170
|
|
|
16171
|
-
var __defProp$
|
|
16172
|
-
var __defProps$
|
|
16173
|
-
var __getOwnPropDescs$
|
|
16174
|
-
var __getOwnPropSymbols$
|
|
16175
|
-
var __hasOwnProp$
|
|
16176
|
-
var __propIsEnum$
|
|
16177
|
-
var __defNormalProp$
|
|
16178
|
-
var __spreadValues$
|
|
16171
|
+
var __defProp$W = Object.defineProperty;
|
|
16172
|
+
var __defProps$n = Object.defineProperties;
|
|
16173
|
+
var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
|
|
16174
|
+
var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
|
|
16175
|
+
var __hasOwnProp$C = Object.prototype.hasOwnProperty;
|
|
16176
|
+
var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
|
|
16177
|
+
var __defNormalProp$W = (obj, key, value) => key in obj ? __defProp$W(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16178
|
+
var __spreadValues$B = (a, b) => {
|
|
16179
16179
|
for (var prop in b || (b = {}))
|
|
16180
|
-
if (__hasOwnProp$
|
|
16181
|
-
__defNormalProp$
|
|
16182
|
-
if (__getOwnPropSymbols$
|
|
16183
|
-
for (var prop of __getOwnPropSymbols$
|
|
16184
|
-
if (__propIsEnum$
|
|
16185
|
-
__defNormalProp$
|
|
16180
|
+
if (__hasOwnProp$C.call(b, prop))
|
|
16181
|
+
__defNormalProp$W(a, prop, b[prop]);
|
|
16182
|
+
if (__getOwnPropSymbols$C)
|
|
16183
|
+
for (var prop of __getOwnPropSymbols$C(b)) {
|
|
16184
|
+
if (__propIsEnum$C.call(b, prop))
|
|
16185
|
+
__defNormalProp$W(a, prop, b[prop]);
|
|
16186
16186
|
}
|
|
16187
16187
|
return a;
|
|
16188
16188
|
};
|
|
16189
|
-
var __spreadProps$
|
|
16190
|
-
var __objRest$
|
|
16189
|
+
var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
|
|
16190
|
+
var __objRest$8 = (source, exclude) => {
|
|
16191
16191
|
var target = {};
|
|
16192
16192
|
for (var prop in source)
|
|
16193
|
-
if (__hasOwnProp$
|
|
16193
|
+
if (__hasOwnProp$C.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
16194
16194
|
target[prop] = source[prop];
|
|
16195
|
-
if (source != null && __getOwnPropSymbols$
|
|
16196
|
-
for (var prop of __getOwnPropSymbols$
|
|
16197
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
16195
|
+
if (source != null && __getOwnPropSymbols$C)
|
|
16196
|
+
for (var prop of __getOwnPropSymbols$C(source)) {
|
|
16197
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$C.call(source, prop))
|
|
16198
16198
|
target[prop] = source[prop];
|
|
16199
16199
|
}
|
|
16200
16200
|
return target;
|
|
16201
16201
|
};
|
|
16202
|
-
var __publicField$
|
|
16202
|
+
var __publicField$F = (obj, key, value) => __defNormalProp$W(obj, key + "" , value);
|
|
16203
16203
|
class GeoJsonPaint {
|
|
16204
16204
|
constructor(layer) {
|
|
16205
|
-
__publicField$
|
|
16205
|
+
__publicField$F(this, "layer");
|
|
16206
16206
|
this.layer = layer;
|
|
16207
16207
|
}
|
|
16208
16208
|
setPaintEachLayer(paint) {
|
|
@@ -16270,7 +16270,7 @@ class GeoJsonPaint {
|
|
|
16270
16270
|
return PAINT;
|
|
16271
16271
|
}
|
|
16272
16272
|
_createDivIcon(icon) {
|
|
16273
|
-
const _a = icon, { html, rotate, className } = _a, toLIconOpt = __objRest$
|
|
16273
|
+
const _a = icon, { html, rotate, className } = _a, toLIconOpt = __objRest$8(_a, ["html", "rotate", "className"]);
|
|
16274
16274
|
const element = document.createElement("div");
|
|
16275
16275
|
if (className) {
|
|
16276
16276
|
element.className = className;
|
|
@@ -16281,7 +16281,7 @@ class GeoJsonPaint {
|
|
|
16281
16281
|
if (html) {
|
|
16282
16282
|
element.innerHTML = html;
|
|
16283
16283
|
}
|
|
16284
|
-
const divIcon = new leafletSrcExports.DivIcon(__spreadProps$
|
|
16284
|
+
const divIcon = new leafletSrcExports.DivIcon(__spreadProps$n(__spreadValues$B({
|
|
16285
16285
|
className: ""
|
|
16286
16286
|
}, toLIconOpt), {
|
|
16287
16287
|
html: element
|
|
@@ -16307,7 +16307,7 @@ class GeoJsonPaint {
|
|
|
16307
16307
|
}
|
|
16308
16308
|
return (_, latlng) => {
|
|
16309
16309
|
const p = PAINT;
|
|
16310
|
-
return new leafletSrcExports.CircleMarker(latlng, this.preparePaint(__spreadValues$
|
|
16310
|
+
return new leafletSrcExports.CircleMarker(latlng, this.preparePaint(__spreadValues$B(__spreadValues$B({}, p), icon)));
|
|
16311
16311
|
};
|
|
16312
16312
|
}
|
|
16313
16313
|
createPaintOptions(paint) {
|
|
@@ -16329,27 +16329,27 @@ class GeoJsonPaint {
|
|
|
16329
16329
|
}
|
|
16330
16330
|
}
|
|
16331
16331
|
|
|
16332
|
-
var __defProp$
|
|
16333
|
-
var __defProps$
|
|
16334
|
-
var __getOwnPropDescs$
|
|
16335
|
-
var __getOwnPropSymbols$
|
|
16336
|
-
var __hasOwnProp$
|
|
16337
|
-
var __propIsEnum$
|
|
16338
|
-
var __defNormalProp$
|
|
16339
|
-
var __spreadValues$
|
|
16332
|
+
var __defProp$V = Object.defineProperty;
|
|
16333
|
+
var __defProps$m = Object.defineProperties;
|
|
16334
|
+
var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
|
|
16335
|
+
var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
|
|
16336
|
+
var __hasOwnProp$B = Object.prototype.hasOwnProperty;
|
|
16337
|
+
var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
|
|
16338
|
+
var __defNormalProp$V = (obj, key, value) => key in obj ? __defProp$V(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16339
|
+
var __spreadValues$A = (a, b) => {
|
|
16340
16340
|
for (var prop in b || (b = {}))
|
|
16341
|
-
if (__hasOwnProp$
|
|
16342
|
-
__defNormalProp$
|
|
16343
|
-
if (__getOwnPropSymbols$
|
|
16344
|
-
for (var prop of __getOwnPropSymbols$
|
|
16345
|
-
if (__propIsEnum$
|
|
16346
|
-
__defNormalProp$
|
|
16341
|
+
if (__hasOwnProp$B.call(b, prop))
|
|
16342
|
+
__defNormalProp$V(a, prop, b[prop]);
|
|
16343
|
+
if (__getOwnPropSymbols$B)
|
|
16344
|
+
for (var prop of __getOwnPropSymbols$B(b)) {
|
|
16345
|
+
if (__propIsEnum$B.call(b, prop))
|
|
16346
|
+
__defNormalProp$V(a, prop, b[prop]);
|
|
16347
16347
|
}
|
|
16348
16348
|
return a;
|
|
16349
16349
|
};
|
|
16350
|
-
var __spreadProps$
|
|
16351
|
-
var __publicField$
|
|
16352
|
-
var __async$
|
|
16350
|
+
var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
|
|
16351
|
+
var __publicField$E = (obj, key, value) => __defNormalProp$V(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16352
|
+
var __async$u = (__this, __arguments, generator) => {
|
|
16353
16353
|
return new Promise((resolve, reject) => {
|
|
16354
16354
|
var fulfilled = (value) => {
|
|
16355
16355
|
try {
|
|
@@ -16372,22 +16372,22 @@ var __async$s = (__this, __arguments, generator) => {
|
|
|
16372
16372
|
class GeoJsonAdapter extends BaseAdapter {
|
|
16373
16373
|
constructor(map, options) {
|
|
16374
16374
|
super(map, options);
|
|
16375
|
-
__publicField$
|
|
16376
|
-
__publicField$
|
|
16377
|
-
__publicField$
|
|
16378
|
-
__publicField$
|
|
16379
|
-
__publicField$
|
|
16380
|
-
__publicField$
|
|
16381
|
-
__publicField$
|
|
16382
|
-
__publicField$
|
|
16383
|
-
__publicField$
|
|
16384
|
-
__publicField$
|
|
16385
|
-
__publicField$
|
|
16386
|
-
__publicField$
|
|
16387
|
-
__publicField$
|
|
16375
|
+
__publicField$E(this, "layer");
|
|
16376
|
+
__publicField$E(this, "selected", false);
|
|
16377
|
+
__publicField$E(this, "type");
|
|
16378
|
+
__publicField$E(this, "_layers", []);
|
|
16379
|
+
__publicField$E(this, "_events");
|
|
16380
|
+
__publicField$E(this, "paint");
|
|
16381
|
+
__publicField$E(this, "selectedPaint");
|
|
16382
|
+
__publicField$E(this, "_selectedLayers", []);
|
|
16383
|
+
__publicField$E(this, "_filteredLayers", []);
|
|
16384
|
+
__publicField$E(this, "_filterFun");
|
|
16385
|
+
__publicField$E(this, "_openedPopup", []);
|
|
16386
|
+
__publicField$E(this, "_paint");
|
|
16387
|
+
__publicField$E(this, "$updateTooltip", debounce(() => {
|
|
16388
16388
|
this.updateTooltip();
|
|
16389
16389
|
}, 300));
|
|
16390
|
-
__publicField$
|
|
16390
|
+
__publicField$E(this, "$unselect", () => {
|
|
16391
16391
|
this.unselect();
|
|
16392
16392
|
});
|
|
16393
16393
|
this._events = new GeoJsonEvents(this);
|
|
@@ -16396,7 +16396,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16396
16396
|
addLayer(options) {
|
|
16397
16397
|
Object.assign(this.options, options);
|
|
16398
16398
|
this.paint = options.paint;
|
|
16399
|
-
this.layer = new leafletSrcExports.FeatureGroup([], __spreadProps$
|
|
16399
|
+
this.layer = new leafletSrcExports.FeatureGroup([], __spreadProps$m(__spreadValues$A({}, options.nativeOptions), {
|
|
16400
16400
|
pane: this.pane
|
|
16401
16401
|
}));
|
|
16402
16402
|
this.selectedPaint = options.selectedPaint;
|
|
@@ -16445,7 +16445,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16445
16445
|
}
|
|
16446
16446
|
getSelected() {
|
|
16447
16447
|
return this._selectedLayers.map((x) => {
|
|
16448
|
-
return __spreadValues$
|
|
16448
|
+
return __spreadValues$A({
|
|
16449
16449
|
target: this,
|
|
16450
16450
|
feature: x.feature,
|
|
16451
16451
|
layer: x
|
|
@@ -16464,14 +16464,14 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16464
16464
|
const filteredLayers = [];
|
|
16465
16465
|
this._layers.forEach(({ feature, layer }) => {
|
|
16466
16466
|
if (layer) {
|
|
16467
|
-
const ok = fun ? fun(__spreadValues$
|
|
16467
|
+
const ok = fun ? fun(__spreadValues$A({
|
|
16468
16468
|
target: this,
|
|
16469
16469
|
feature,
|
|
16470
16470
|
layer
|
|
16471
16471
|
}, createFeaturePositionOptions(feature))) : true;
|
|
16472
16472
|
if (ok) {
|
|
16473
16473
|
layer_.addLayer(layer);
|
|
16474
|
-
filteredLayers.push(__spreadValues$
|
|
16474
|
+
filteredLayers.push(__spreadValues$A({
|
|
16475
16475
|
target: this,
|
|
16476
16476
|
feature,
|
|
16477
16477
|
layer
|
|
@@ -16492,7 +16492,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16492
16492
|
getLayers() {
|
|
16493
16493
|
return this._layers.map(({ layer, feature }) => {
|
|
16494
16494
|
const visible = layer && !!layer._map;
|
|
16495
|
-
return __spreadValues$
|
|
16495
|
+
return __spreadValues$A({
|
|
16496
16496
|
feature,
|
|
16497
16497
|
layer,
|
|
16498
16498
|
visible,
|
|
@@ -16610,13 +16610,13 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16610
16610
|
}
|
|
16611
16611
|
}
|
|
16612
16612
|
updatePaint(paint) {
|
|
16613
|
-
this.paint = __spreadValues$
|
|
16613
|
+
this.paint = __spreadValues$A(__spreadValues$A({}, this.paint), paint);
|
|
16614
16614
|
for (const l of this._layers) {
|
|
16615
16615
|
this._paint.setPaint(l, this.paint);
|
|
16616
16616
|
}
|
|
16617
16617
|
}
|
|
16618
16618
|
updateSelectedPaint(paint) {
|
|
16619
|
-
this.selectedPaint = __spreadValues$
|
|
16619
|
+
this.selectedPaint = __spreadValues$A(__spreadValues$A({}, this.selectedPaint), paint);
|
|
16620
16620
|
for (const l of this._selectedLayers) {
|
|
16621
16621
|
this._paint.setPaint(l, this.selectedPaint);
|
|
16622
16622
|
}
|
|
@@ -16633,7 +16633,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16633
16633
|
if (feature.properties && labelField) {
|
|
16634
16634
|
message = feature.properties[labelField];
|
|
16635
16635
|
} else if (label) {
|
|
16636
|
-
message = label(__spreadValues$
|
|
16636
|
+
message = label(__spreadValues$A(__spreadValues$A({
|
|
16637
16637
|
target: this
|
|
16638
16638
|
}, layerDef), createFeaturePositionOptions(feature)));
|
|
16639
16639
|
}
|
|
@@ -16644,7 +16644,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16644
16644
|
}
|
|
16645
16645
|
}
|
|
16646
16646
|
_openPopup(_0) {
|
|
16647
|
-
return __async$
|
|
16647
|
+
return __async$u(this, arguments, function* (def, options = {}, type, latLng) {
|
|
16648
16648
|
var _a, _b;
|
|
16649
16649
|
const { feature, layer } = def;
|
|
16650
16650
|
const {
|
|
@@ -16652,7 +16652,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16652
16652
|
autoPan,
|
|
16653
16653
|
maxWidth,
|
|
16654
16654
|
closeButton: closeButton_
|
|
16655
|
-
} = __spreadValues$
|
|
16655
|
+
} = __spreadValues$A({
|
|
16656
16656
|
minWidth: 300
|
|
16657
16657
|
}, options);
|
|
16658
16658
|
const closeButton = closeButton_ != null ? closeButton_ : !this.options.selectOnHover;
|
|
@@ -16668,7 +16668,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16668
16668
|
};
|
|
16669
16669
|
let content;
|
|
16670
16670
|
if (options.createPopupContent) {
|
|
16671
|
-
content = yield options.createPopupContent(__spreadValues$
|
|
16671
|
+
content = yield options.createPopupContent(__spreadValues$A({
|
|
16672
16672
|
layer,
|
|
16673
16673
|
feature,
|
|
16674
16674
|
target: this,
|
|
@@ -16744,9 +16744,9 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16744
16744
|
lopt = {
|
|
16745
16745
|
style: (feature) => {
|
|
16746
16746
|
if (feature) {
|
|
16747
|
-
return this._paint.preparePaint(__spreadValues$
|
|
16747
|
+
return this._paint.preparePaint(__spreadValues$A(__spreadValues$A({}, PAINT), paint(feature)));
|
|
16748
16748
|
} else {
|
|
16749
|
-
return this._paint.preparePaint(__spreadProps$
|
|
16749
|
+
return this._paint.preparePaint(__spreadProps$m(__spreadValues$A({}, PAINT), { type: "path" }));
|
|
16750
16750
|
}
|
|
16751
16751
|
}
|
|
16752
16752
|
};
|
|
@@ -16762,7 +16762,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16762
16762
|
_onEachFeature(feature, layer) {
|
|
16763
16763
|
const layer_ = this.layer;
|
|
16764
16764
|
if (layer_) {
|
|
16765
|
-
const def = __spreadValues$
|
|
16765
|
+
const def = __spreadValues$A({
|
|
16766
16766
|
target: this,
|
|
16767
16767
|
feature,
|
|
16768
16768
|
layer
|
|
@@ -16797,7 +16797,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16797
16797
|
setTimeout(() => {
|
|
16798
16798
|
if (popup) {
|
|
16799
16799
|
this._openPopup(
|
|
16800
|
-
__spreadValues$
|
|
16800
|
+
__spreadValues$A({
|
|
16801
16801
|
target: this,
|
|
16802
16802
|
layer,
|
|
16803
16803
|
feature
|
|
@@ -16815,7 +16815,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16815
16815
|
leafletSrcExports.DomEvent.stopPropagation(e);
|
|
16816
16816
|
const layer = e.target;
|
|
16817
16817
|
const feature = layer.feature;
|
|
16818
|
-
const def = __spreadValues$
|
|
16818
|
+
const def = __spreadValues$A({
|
|
16819
16819
|
target: this,
|
|
16820
16820
|
layer,
|
|
16821
16821
|
feature
|
|
@@ -16848,7 +16848,7 @@ class GeoJsonAdapter extends BaseAdapter {
|
|
|
16848
16848
|
}
|
|
16849
16849
|
if (this.options.onSelect) {
|
|
16850
16850
|
const features = def.feature ? [def.feature] : [];
|
|
16851
|
-
this.options.onSelect(__spreadValues$
|
|
16851
|
+
this.options.onSelect(__spreadValues$A({
|
|
16852
16852
|
type,
|
|
16853
16853
|
layer: this,
|
|
16854
16854
|
features
|
|
@@ -16940,20 +16940,20 @@ function callAjax({
|
|
|
16940
16940
|
return [promise, abortFunc];
|
|
16941
16941
|
}
|
|
16942
16942
|
|
|
16943
|
-
var __defProp$
|
|
16944
|
-
var __defNormalProp$
|
|
16945
|
-
var __publicField$
|
|
16943
|
+
var __defProp$U = Object.defineProperty;
|
|
16944
|
+
var __defNormalProp$U = (obj, key, value) => key in obj ? __defProp$U(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16945
|
+
var __publicField$D = (obj, key, value) => __defNormalProp$U(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16946
16946
|
class Queue {
|
|
16947
16947
|
/**
|
|
16948
16948
|
* @param {PromiseQueueOptions} options - Configuration options for the queue.
|
|
16949
16949
|
*/
|
|
16950
16950
|
constructor({ concurrency = 1, delay = 0 } = {}) {
|
|
16951
|
-
__publicField$
|
|
16952
|
-
__publicField$
|
|
16953
|
-
__publicField$
|
|
16954
|
-
__publicField$
|
|
16955
|
-
__publicField$
|
|
16956
|
-
__publicField$
|
|
16951
|
+
__publicField$D(this, "queue", []);
|
|
16952
|
+
__publicField$D(this, "concurrency");
|
|
16953
|
+
__publicField$D(this, "activeCount", 0);
|
|
16954
|
+
__publicField$D(this, "timeoutId");
|
|
16955
|
+
__publicField$D(this, "delay");
|
|
16956
|
+
__publicField$D(this, "toAbort", []);
|
|
16957
16957
|
this.concurrency = concurrency;
|
|
16958
16958
|
this.delay = delay;
|
|
16959
16959
|
}
|
|
@@ -17029,13 +17029,13 @@ class Queue {
|
|
|
17029
17029
|
|
|
17030
17030
|
const imageQueue = new Queue({ concurrency: 6, delay: 200 });
|
|
17031
17031
|
|
|
17032
|
-
var __defProp$
|
|
17033
|
-
var __defNormalProp$
|
|
17034
|
-
var __publicField$
|
|
17032
|
+
var __defProp$T = Object.defineProperty;
|
|
17033
|
+
var __defNormalProp$T = (obj, key, value) => key in obj ? __defProp$T(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17034
|
+
var __publicField$C = (obj, key, value) => __defNormalProp$T(obj, key + "" , value);
|
|
17035
17035
|
class ImageOverlay extends leafletSrcExports.ImageOverlay {
|
|
17036
17036
|
constructor(imageUrl, bounds, options) {
|
|
17037
17037
|
super(imageUrl, bounds, options);
|
|
17038
|
-
__publicField$
|
|
17038
|
+
__publicField$C(this, "_aborter");
|
|
17039
17039
|
}
|
|
17040
17040
|
cancelLoad() {
|
|
17041
17041
|
if (this._aborter) {
|
|
@@ -17064,14 +17064,14 @@ class ImageOverlay extends leafletSrcExports.ImageOverlay {
|
|
|
17064
17064
|
}
|
|
17065
17065
|
}
|
|
17066
17066
|
|
|
17067
|
-
var __defProp$
|
|
17068
|
-
var __defNormalProp$
|
|
17069
|
-
var __publicField$
|
|
17067
|
+
var __defProp$S = Object.defineProperty;
|
|
17068
|
+
var __defNormalProp$S = (obj, key, value) => key in obj ? __defProp$S(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17069
|
+
var __publicField$B = (obj, key, value) => __defNormalProp$S(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
17070
17070
|
class ImageLayer extends leafletSrcExports.Layer {
|
|
17071
17071
|
constructor(url, options) {
|
|
17072
17072
|
var _a;
|
|
17073
17073
|
super(options);
|
|
17074
|
-
__publicField$
|
|
17074
|
+
__publicField$B(this, "defaultWmsParams", {
|
|
17075
17075
|
service: "WMS",
|
|
17076
17076
|
request: "GetMap",
|
|
17077
17077
|
version: "1.1.1",
|
|
@@ -17080,7 +17080,7 @@ class ImageLayer extends leafletSrcExports.Layer {
|
|
|
17080
17080
|
format: "image/jpeg",
|
|
17081
17081
|
transparent: false
|
|
17082
17082
|
});
|
|
17083
|
-
__publicField$
|
|
17083
|
+
__publicField$B(this, "options", {
|
|
17084
17084
|
crs: null,
|
|
17085
17085
|
uppercase: false,
|
|
17086
17086
|
attribution: "",
|
|
@@ -17093,11 +17093,11 @@ class ImageLayer extends leafletSrcExports.Layer {
|
|
|
17093
17093
|
viewPortBuffer: 0,
|
|
17094
17094
|
setViewDelay: 100
|
|
17095
17095
|
});
|
|
17096
|
-
__publicField$
|
|
17097
|
-
__publicField$
|
|
17098
|
-
__publicField$
|
|
17099
|
-
__publicField$
|
|
17100
|
-
__publicField$
|
|
17096
|
+
__publicField$B(this, "wmsParams");
|
|
17097
|
+
__publicField$B(this, "_url");
|
|
17098
|
+
__publicField$B(this, "_currentUrl");
|
|
17099
|
+
__publicField$B(this, "_currentOverlay");
|
|
17100
|
+
__publicField$B(this, "_loadedOverlay");
|
|
17101
17101
|
this._url = url;
|
|
17102
17102
|
const params = {};
|
|
17103
17103
|
const opts = {};
|
|
@@ -17261,34 +17261,34 @@ class ImageLayer extends leafletSrcExports.Layer {
|
|
|
17261
17261
|
}
|
|
17262
17262
|
}
|
|
17263
17263
|
|
|
17264
|
-
var __defProp$
|
|
17265
|
-
var __getOwnPropSymbols$
|
|
17266
|
-
var __hasOwnProp$
|
|
17267
|
-
var __propIsEnum$
|
|
17268
|
-
var __defNormalProp$
|
|
17269
|
-
var __spreadValues$
|
|
17264
|
+
var __defProp$R = Object.defineProperty;
|
|
17265
|
+
var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
|
|
17266
|
+
var __hasOwnProp$A = Object.prototype.hasOwnProperty;
|
|
17267
|
+
var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
|
|
17268
|
+
var __defNormalProp$R = (obj, key, value) => key in obj ? __defProp$R(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17269
|
+
var __spreadValues$z = (a, b) => {
|
|
17270
17270
|
for (var prop in b || (b = {}))
|
|
17271
|
-
if (__hasOwnProp$
|
|
17272
|
-
__defNormalProp$
|
|
17273
|
-
if (__getOwnPropSymbols$
|
|
17274
|
-
for (var prop of __getOwnPropSymbols$
|
|
17275
|
-
if (__propIsEnum$
|
|
17276
|
-
__defNormalProp$
|
|
17271
|
+
if (__hasOwnProp$A.call(b, prop))
|
|
17272
|
+
__defNormalProp$R(a, prop, b[prop]);
|
|
17273
|
+
if (__getOwnPropSymbols$A)
|
|
17274
|
+
for (var prop of __getOwnPropSymbols$A(b)) {
|
|
17275
|
+
if (__propIsEnum$A.call(b, prop))
|
|
17276
|
+
__defNormalProp$R(a, prop, b[prop]);
|
|
17277
17277
|
}
|
|
17278
17278
|
return a;
|
|
17279
17279
|
};
|
|
17280
|
-
var __publicField$
|
|
17280
|
+
var __publicField$A = (obj, key, value) => __defNormalProp$R(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
17281
17281
|
class ImageAdapter extends BaseAdapter {
|
|
17282
17282
|
constructor() {
|
|
17283
17283
|
super(...arguments);
|
|
17284
|
-
__publicField$
|
|
17284
|
+
__publicField$A(this, "layer");
|
|
17285
17285
|
}
|
|
17286
17286
|
addLayer(options) {
|
|
17287
17287
|
const url = options && options.url;
|
|
17288
17288
|
if (url) {
|
|
17289
|
-
options = __spreadValues$
|
|
17289
|
+
options = __spreadValues$z({ transparent: true }, options);
|
|
17290
17290
|
const updateWmsParamsFromOpt = options.updateWmsParams;
|
|
17291
|
-
this.layer = new ImageLayer(url, __spreadValues$
|
|
17291
|
+
this.layer = new ImageLayer(url, __spreadValues$z(__spreadValues$z(__spreadValues$z({
|
|
17292
17292
|
pane: this.pane,
|
|
17293
17293
|
headers: options.headers,
|
|
17294
17294
|
setViewDelay: options.setViewDelay
|
|
@@ -17311,7 +17311,7 @@ class ImageAdapter extends BaseAdapter {
|
|
|
17311
17311
|
}
|
|
17312
17312
|
}
|
|
17313
17313
|
}
|
|
17314
|
-
__publicField$
|
|
17314
|
+
__publicField$A(ImageAdapter, "queue", imageQueue);
|
|
17315
17315
|
|
|
17316
17316
|
function makeRemote(Base) {
|
|
17317
17317
|
return class RemoteTileLayer extends Base {
|
|
@@ -17373,33 +17373,33 @@ class TileLayerBase extends leafletSrcExports.TileLayer {
|
|
|
17373
17373
|
}
|
|
17374
17374
|
const TileLayer = makeRemote(TileLayerBase);
|
|
17375
17375
|
|
|
17376
|
-
var __defProp$
|
|
17377
|
-
var __defProps$
|
|
17378
|
-
var __getOwnPropDescs$
|
|
17379
|
-
var __getOwnPropSymbols$
|
|
17380
|
-
var __hasOwnProp$
|
|
17381
|
-
var __propIsEnum$
|
|
17382
|
-
var __defNormalProp$
|
|
17383
|
-
var __spreadValues$
|
|
17376
|
+
var __defProp$Q = Object.defineProperty;
|
|
17377
|
+
var __defProps$l = Object.defineProperties;
|
|
17378
|
+
var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
|
|
17379
|
+
var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
|
|
17380
|
+
var __hasOwnProp$z = Object.prototype.hasOwnProperty;
|
|
17381
|
+
var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
|
|
17382
|
+
var __defNormalProp$Q = (obj, key, value) => key in obj ? __defProp$Q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17383
|
+
var __spreadValues$y = (a, b) => {
|
|
17384
17384
|
for (var prop in b || (b = {}))
|
|
17385
|
-
if (__hasOwnProp$
|
|
17386
|
-
__defNormalProp$
|
|
17387
|
-
if (__getOwnPropSymbols$
|
|
17388
|
-
for (var prop of __getOwnPropSymbols$
|
|
17389
|
-
if (__propIsEnum$
|
|
17390
|
-
__defNormalProp$
|
|
17385
|
+
if (__hasOwnProp$z.call(b, prop))
|
|
17386
|
+
__defNormalProp$Q(a, prop, b[prop]);
|
|
17387
|
+
if (__getOwnPropSymbols$z)
|
|
17388
|
+
for (var prop of __getOwnPropSymbols$z(b)) {
|
|
17389
|
+
if (__propIsEnum$z.call(b, prop))
|
|
17390
|
+
__defNormalProp$Q(a, prop, b[prop]);
|
|
17391
17391
|
}
|
|
17392
17392
|
return a;
|
|
17393
17393
|
};
|
|
17394
|
-
var __spreadProps$
|
|
17395
|
-
var __objRest$
|
|
17394
|
+
var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
|
|
17395
|
+
var __objRest$7 = (source, exclude) => {
|
|
17396
17396
|
var target = {};
|
|
17397
17397
|
for (var prop in source)
|
|
17398
|
-
if (__hasOwnProp$
|
|
17398
|
+
if (__hasOwnProp$z.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
17399
17399
|
target[prop] = source[prop];
|
|
17400
|
-
if (source != null && __getOwnPropSymbols$
|
|
17401
|
-
for (var prop of __getOwnPropSymbols$
|
|
17402
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
17400
|
+
if (source != null && __getOwnPropSymbols$z)
|
|
17401
|
+
for (var prop of __getOwnPropSymbols$z(source)) {
|
|
17402
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$z.call(source, prop))
|
|
17403
17403
|
target[prop] = source[prop];
|
|
17404
17404
|
}
|
|
17405
17405
|
return target;
|
|
@@ -17408,9 +17408,9 @@ class TileAdapter extends BaseAdapter {
|
|
|
17408
17408
|
addLayer(options) {
|
|
17409
17409
|
this.options = Object.assign(this.options, options);
|
|
17410
17410
|
if (options) {
|
|
17411
|
-
const _a = options, { url } = _a, opt = __objRest$
|
|
17411
|
+
const _a = options, { url } = _a, opt = __objRest$7(_a, ["url"]);
|
|
17412
17412
|
if (url) {
|
|
17413
|
-
const tileLayerOptions = __spreadValues$
|
|
17413
|
+
const tileLayerOptions = __spreadValues$y({
|
|
17414
17414
|
pane: this.pane,
|
|
17415
17415
|
attribution: opt.attribution,
|
|
17416
17416
|
minZoom: opt.minZoom,
|
|
@@ -17421,7 +17421,7 @@ class TileAdapter extends BaseAdapter {
|
|
|
17421
17421
|
}
|
|
17422
17422
|
let layer;
|
|
17423
17423
|
if (opt.headers || opt.withCredentials) {
|
|
17424
|
-
layer = new TileLayer(url, __spreadProps$
|
|
17424
|
+
layer = new TileLayer(url, __spreadProps$l(__spreadValues$y({}, tileLayerOptions), {
|
|
17425
17425
|
headers: opt.headers,
|
|
17426
17426
|
withCredentials: opt.withCredentials,
|
|
17427
17427
|
setViewDelay: opt.setViewDelay
|
|
@@ -17444,29 +17444,29 @@ class TileAdapter extends BaseAdapter {
|
|
|
17444
17444
|
}
|
|
17445
17445
|
}
|
|
17446
17446
|
|
|
17447
|
-
var __defProp$
|
|
17448
|
-
var __defProps$
|
|
17449
|
-
var __getOwnPropDescs$
|
|
17450
|
-
var __getOwnPropSymbols$
|
|
17451
|
-
var __hasOwnProp$
|
|
17452
|
-
var __propIsEnum$
|
|
17453
|
-
var __defNormalProp$
|
|
17454
|
-
var __spreadValues$
|
|
17447
|
+
var __defProp$P = Object.defineProperty;
|
|
17448
|
+
var __defProps$k = Object.defineProperties;
|
|
17449
|
+
var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
|
|
17450
|
+
var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
|
|
17451
|
+
var __hasOwnProp$y = Object.prototype.hasOwnProperty;
|
|
17452
|
+
var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
|
|
17453
|
+
var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17454
|
+
var __spreadValues$x = (a, b) => {
|
|
17455
17455
|
for (var prop in b || (b = {}))
|
|
17456
|
-
if (__hasOwnProp$
|
|
17457
|
-
__defNormalProp$
|
|
17458
|
-
if (__getOwnPropSymbols$
|
|
17459
|
-
for (var prop of __getOwnPropSymbols$
|
|
17460
|
-
if (__propIsEnum$
|
|
17461
|
-
__defNormalProp$
|
|
17456
|
+
if (__hasOwnProp$y.call(b, prop))
|
|
17457
|
+
__defNormalProp$P(a, prop, b[prop]);
|
|
17458
|
+
if (__getOwnPropSymbols$y)
|
|
17459
|
+
for (var prop of __getOwnPropSymbols$y(b)) {
|
|
17460
|
+
if (__propIsEnum$y.call(b, prop))
|
|
17461
|
+
__defNormalProp$P(a, prop, b[prop]);
|
|
17462
17462
|
}
|
|
17463
17463
|
return a;
|
|
17464
17464
|
};
|
|
17465
|
-
var __spreadProps$
|
|
17465
|
+
var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
|
|
17466
17466
|
class OsmAdapter extends TileAdapter {
|
|
17467
17467
|
addLayer(options) {
|
|
17468
17468
|
const url = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
|
|
17469
|
-
return super.addLayer(__spreadProps$
|
|
17469
|
+
return super.addLayer(__spreadProps$k(__spreadValues$x({
|
|
17470
17470
|
name: "OpenStreetMap",
|
|
17471
17471
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
17472
17472
|
}, options), {
|
|
@@ -17482,33 +17482,33 @@ class WmsLayerBase extends leafletSrcExports.TileLayer.WMS {
|
|
|
17482
17482
|
}
|
|
17483
17483
|
const WmsLayer = makeRemote(WmsLayerBase);
|
|
17484
17484
|
|
|
17485
|
-
var __defProp$
|
|
17486
|
-
var __defProps$
|
|
17487
|
-
var __getOwnPropDescs$
|
|
17488
|
-
var __getOwnPropSymbols$
|
|
17489
|
-
var __hasOwnProp$
|
|
17490
|
-
var __propIsEnum$
|
|
17491
|
-
var __defNormalProp$
|
|
17492
|
-
var __spreadValues$
|
|
17485
|
+
var __defProp$O = Object.defineProperty;
|
|
17486
|
+
var __defProps$j = Object.defineProperties;
|
|
17487
|
+
var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
|
|
17488
|
+
var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
|
|
17489
|
+
var __hasOwnProp$x = Object.prototype.hasOwnProperty;
|
|
17490
|
+
var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
|
|
17491
|
+
var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17492
|
+
var __spreadValues$w = (a, b) => {
|
|
17493
17493
|
for (var prop in b || (b = {}))
|
|
17494
|
-
if (__hasOwnProp$
|
|
17495
|
-
__defNormalProp$
|
|
17496
|
-
if (__getOwnPropSymbols$
|
|
17497
|
-
for (var prop of __getOwnPropSymbols$
|
|
17498
|
-
if (__propIsEnum$
|
|
17499
|
-
__defNormalProp$
|
|
17494
|
+
if (__hasOwnProp$x.call(b, prop))
|
|
17495
|
+
__defNormalProp$O(a, prop, b[prop]);
|
|
17496
|
+
if (__getOwnPropSymbols$x)
|
|
17497
|
+
for (var prop of __getOwnPropSymbols$x(b)) {
|
|
17498
|
+
if (__propIsEnum$x.call(b, prop))
|
|
17499
|
+
__defNormalProp$O(a, prop, b[prop]);
|
|
17500
17500
|
}
|
|
17501
17501
|
return a;
|
|
17502
17502
|
};
|
|
17503
|
-
var __spreadProps$
|
|
17504
|
-
var __objRest$
|
|
17503
|
+
var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
|
|
17504
|
+
var __objRest$6 = (source, exclude) => {
|
|
17505
17505
|
var target = {};
|
|
17506
17506
|
for (var prop in source)
|
|
17507
|
-
if (__hasOwnProp$
|
|
17507
|
+
if (__hasOwnProp$x.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
17508
17508
|
target[prop] = source[prop];
|
|
17509
|
-
if (source != null && __getOwnPropSymbols$
|
|
17510
|
-
for (var prop of __getOwnPropSymbols$
|
|
17511
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
17509
|
+
if (source != null && __getOwnPropSymbols$x)
|
|
17510
|
+
for (var prop of __getOwnPropSymbols$x(source)) {
|
|
17511
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$x.call(source, prop))
|
|
17512
17512
|
target[prop] = source[prop];
|
|
17513
17513
|
}
|
|
17514
17514
|
return target;
|
|
@@ -17516,9 +17516,9 @@ var __objRest$4 = (source, exclude) => {
|
|
|
17516
17516
|
class WmsAdapter extends BaseAdapter {
|
|
17517
17517
|
addLayer(options) {
|
|
17518
17518
|
Object.assign(this.options, options);
|
|
17519
|
-
const _a = options, { url } = _a, opt = __objRest$
|
|
17519
|
+
const _a = options, { url } = _a, opt = __objRest$6(_a, ["url"]);
|
|
17520
17520
|
if (url) {
|
|
17521
|
-
const layerOptions = __spreadValues$
|
|
17521
|
+
const layerOptions = __spreadValues$w({
|
|
17522
17522
|
pane: this.pane,
|
|
17523
17523
|
attribution: opt.attribution,
|
|
17524
17524
|
minZoom: opt.minZoom,
|
|
@@ -17529,7 +17529,7 @@ class WmsAdapter extends BaseAdapter {
|
|
|
17529
17529
|
}, options.nativeOptions);
|
|
17530
17530
|
let layer;
|
|
17531
17531
|
if (opt.headers || opt.withCredentials) {
|
|
17532
|
-
layer = new WmsLayer(url, __spreadProps$
|
|
17532
|
+
layer = new WmsLayer(url, __spreadProps$j(__spreadValues$w({}, layerOptions), {
|
|
17533
17533
|
headers: opt.headers,
|
|
17534
17534
|
withCredentials: opt.withCredentials
|
|
17535
17535
|
}));
|
|
@@ -17549,33 +17549,33 @@ function arrayToBoundsExpression(bounds) {
|
|
|
17549
17549
|
];
|
|
17550
17550
|
}
|
|
17551
17551
|
|
|
17552
|
-
var __defProp$
|
|
17553
|
-
var __getOwnPropSymbols$
|
|
17554
|
-
var __hasOwnProp$
|
|
17555
|
-
var __propIsEnum$
|
|
17556
|
-
var __defNormalProp$
|
|
17557
|
-
var __spreadValues$
|
|
17552
|
+
var __defProp$N = Object.defineProperty;
|
|
17553
|
+
var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
|
|
17554
|
+
var __hasOwnProp$w = Object.prototype.hasOwnProperty;
|
|
17555
|
+
var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
|
|
17556
|
+
var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17557
|
+
var __spreadValues$v = (a, b) => {
|
|
17558
17558
|
for (var prop in b || (b = {}))
|
|
17559
|
-
if (__hasOwnProp$
|
|
17560
|
-
__defNormalProp$
|
|
17561
|
-
if (__getOwnPropSymbols$
|
|
17562
|
-
for (var prop of __getOwnPropSymbols$
|
|
17563
|
-
if (__propIsEnum$
|
|
17564
|
-
__defNormalProp$
|
|
17559
|
+
if (__hasOwnProp$w.call(b, prop))
|
|
17560
|
+
__defNormalProp$N(a, prop, b[prop]);
|
|
17561
|
+
if (__getOwnPropSymbols$w)
|
|
17562
|
+
for (var prop of __getOwnPropSymbols$w(b)) {
|
|
17563
|
+
if (__propIsEnum$w.call(b, prop))
|
|
17564
|
+
__defNormalProp$N(a, prop, b[prop]);
|
|
17565
17565
|
}
|
|
17566
17566
|
return a;
|
|
17567
17567
|
};
|
|
17568
|
-
var __publicField$
|
|
17568
|
+
var __publicField$z = (obj, key, value) => __defNormalProp$N(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
17569
17569
|
const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
17570
17570
|
constructor() {
|
|
17571
|
-
__publicField$
|
|
17572
|
-
__publicField$
|
|
17573
|
-
__publicField$
|
|
17574
|
-
__publicField$
|
|
17575
|
-
__publicField$
|
|
17576
|
-
__publicField$
|
|
17577
|
-
__publicField$
|
|
17578
|
-
__publicField$
|
|
17571
|
+
__publicField$z(this, "options", { target: "map" });
|
|
17572
|
+
__publicField$z(this, "layerAdapters", _LeafletMapAdapter.layerAdapters);
|
|
17573
|
+
__publicField$z(this, "controlAdapters", _LeafletMapAdapter.controlAdapters);
|
|
17574
|
+
__publicField$z(this, "emitter", new EventEmitter());
|
|
17575
|
+
__publicField$z(this, "map");
|
|
17576
|
+
__publicField$z(this, "_resizeObserver");
|
|
17577
|
+
__publicField$z(this, "_unselectCb", []);
|
|
17578
|
+
__publicField$z(this, "_universalEvents", [
|
|
17579
17579
|
"move",
|
|
17580
17580
|
"zoom",
|
|
17581
17581
|
"zoomend",
|
|
@@ -17583,14 +17583,14 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
|
17583
17583
|
"moveend",
|
|
17584
17584
|
"movestart"
|
|
17585
17585
|
]);
|
|
17586
|
-
__publicField$
|
|
17586
|
+
__publicField$z(this, "_positionEvents", [
|
|
17587
17587
|
"mousemove",
|
|
17588
17588
|
"mouseout",
|
|
17589
17589
|
"mouseover"
|
|
17590
17590
|
]);
|
|
17591
17591
|
}
|
|
17592
17592
|
create(options) {
|
|
17593
|
-
this.options = __spreadValues$
|
|
17593
|
+
this.options = __spreadValues$v({}, options);
|
|
17594
17594
|
if (this.options.target) {
|
|
17595
17595
|
const {
|
|
17596
17596
|
zoom,
|
|
@@ -17600,7 +17600,7 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
|
17600
17600
|
maxBounds: mb,
|
|
17601
17601
|
mapAdapterOptions
|
|
17602
17602
|
} = this.options;
|
|
17603
|
-
this.map = this.options.map || new leafletSrcExports.Map(this.options.target, __spreadValues$
|
|
17603
|
+
this.map = this.options.map || new leafletSrcExports.Map(this.options.target, __spreadValues$v({
|
|
17604
17604
|
attributionControl: false,
|
|
17605
17605
|
zoomControl: false,
|
|
17606
17606
|
maxBounds: mb ? arrayToBoundsExpression(mb) : void 0,
|
|
@@ -17883,7 +17883,7 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
|
|
|
17883
17883
|
}
|
|
17884
17884
|
}
|
|
17885
17885
|
};
|
|
17886
|
-
__publicField$
|
|
17886
|
+
__publicField$z(_LeafletMapAdapter, "layerAdapters", {
|
|
17887
17887
|
GEOJSON: GeoJsonAdapter,
|
|
17888
17888
|
IMAGE: ImageAdapter,
|
|
17889
17889
|
TILE: TileAdapter,
|
|
@@ -17891,11 +17891,11 @@ __publicField$x(_LeafletMapAdapter, "layerAdapters", {
|
|
|
17891
17891
|
// // MVT: MvtAdapter,
|
|
17892
17892
|
OSM: OsmAdapter
|
|
17893
17893
|
});
|
|
17894
|
-
__publicField$
|
|
17894
|
+
__publicField$z(_LeafletMapAdapter, "controlAdapters", {
|
|
17895
17895
|
ZOOM: leafletSrcExports.Control.Zoom,
|
|
17896
17896
|
ATTRIBUTION: AttributionControl
|
|
17897
17897
|
});
|
|
17898
|
-
__publicField$
|
|
17898
|
+
__publicField$z(_LeafletMapAdapter, "Map", leafletSrcExports.Map);
|
|
17899
17899
|
let LeafletMapAdapter = _LeafletMapAdapter;
|
|
17900
17900
|
|
|
17901
17901
|
const svgPath = {
|
|
@@ -17970,12 +17970,12 @@ function getIcon(opt = {}) {
|
|
|
17970
17970
|
};
|
|
17971
17971
|
}
|
|
17972
17972
|
|
|
17973
|
-
var __defProp$
|
|
17974
|
-
var __defNormalProp$
|
|
17975
|
-
var __publicField$
|
|
17973
|
+
var __defProp$M = Object.defineProperty;
|
|
17974
|
+
var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
17975
|
+
var __publicField$y = (obj, key, value) => __defNormalProp$M(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
17976
17976
|
const _Cache = class _Cache {
|
|
17977
17977
|
constructor(options = {}) {
|
|
17978
|
-
__publicField$
|
|
17978
|
+
__publicField$y(this, "cache", []);
|
|
17979
17979
|
var _a;
|
|
17980
17980
|
const namespace = (_a = options.namespace) != null ? _a : "default";
|
|
17981
17981
|
if (_Cache.instance[namespace]) {
|
|
@@ -18081,12 +18081,12 @@ const _Cache = class _Cache {
|
|
|
18081
18081
|
return objectDeepEqual(itemProps || {}, objectRemoveEmpty(props));
|
|
18082
18082
|
}
|
|
18083
18083
|
};
|
|
18084
|
-
__publicField$
|
|
18084
|
+
__publicField$y(_Cache, "instance", {});
|
|
18085
18085
|
let Cache = _Cache;
|
|
18086
18086
|
|
|
18087
18087
|
var pkg = {
|
|
18088
18088
|
name: "@nextgis/ngw-connector",
|
|
18089
|
-
version: "3.0.0-alpha.
|
|
18089
|
+
version: "3.0.0-alpha.5",
|
|
18090
18090
|
_priority: 12,
|
|
18091
18091
|
description: "A lightweight HTTP client optimized for use with NextGIS Web API",
|
|
18092
18092
|
main: "index.js",
|
|
@@ -18095,15 +18095,15 @@ var pkg = {
|
|
|
18095
18095
|
jsdelivr: "lib/ngw-connector.global.prod.js",
|
|
18096
18096
|
types: "lib/index.d.ts",
|
|
18097
18097
|
dependencies: {
|
|
18098
|
-
"@nextgis/cache": "^3.0.0-alpha.
|
|
18099
|
-
"@nextgis/cancelable-promise": "^3.0.0-alpha.
|
|
18100
|
-
"@nextgis/utils": "^3.0.0-alpha.
|
|
18098
|
+
"@nextgis/cache": "^3.0.0-alpha.5",
|
|
18099
|
+
"@nextgis/cancelable-promise": "^3.0.0-alpha.5",
|
|
18100
|
+
"@nextgis/utils": "^3.0.0-alpha.5",
|
|
18101
18101
|
"@types/events": "^3.0.0",
|
|
18102
18102
|
events: "*",
|
|
18103
18103
|
"form-data": "^4.0.0"
|
|
18104
18104
|
},
|
|
18105
18105
|
devDependencies: {
|
|
18106
|
-
"@nextgis/build-tools": "^3.0.0-alpha.
|
|
18106
|
+
"@nextgis/build-tools": "^3.0.0-alpha.5"
|
|
18107
18107
|
},
|
|
18108
18108
|
scripts: {
|
|
18109
18109
|
clean: "rimraf ./lib",
|
|
@@ -18137,87 +18137,179 @@ var pkg = {
|
|
|
18137
18137
|
type: "git",
|
|
18138
18138
|
url: "git://github.com/nextgis/nextgis_frontend.git"
|
|
18139
18139
|
},
|
|
18140
|
+
engines: {
|
|
18141
|
+
node: ">=18.20.4"
|
|
18142
|
+
},
|
|
18140
18143
|
gitHead: "edc68033f914f6c95c4125b9738bba6d36e990b4"
|
|
18141
18144
|
};
|
|
18142
18145
|
|
|
18143
|
-
|
|
18144
|
-
|
|
18145
|
-
|
|
18146
|
+
const CONNECTORS = [];
|
|
18147
|
+
function addConnector(connector) {
|
|
18148
|
+
CONNECTORS.push(connector);
|
|
18149
|
+
}
|
|
18150
|
+
function findConnector(options) {
|
|
18151
|
+
return CONNECTORS.find((x) => {
|
|
18152
|
+
if (x.options.baseUrl === options.baseUrl) {
|
|
18153
|
+
if (options.auth) {
|
|
18154
|
+
if (x.options.auth) {
|
|
18155
|
+
return objectDeepEqual(x.options.auth, options.auth);
|
|
18156
|
+
}
|
|
18157
|
+
} else {
|
|
18158
|
+
return true;
|
|
18159
|
+
}
|
|
18160
|
+
}
|
|
18161
|
+
});
|
|
18162
|
+
}
|
|
18163
|
+
function removeConnector(connector) {
|
|
18164
|
+
const index = CONNECTORS.indexOf(connector);
|
|
18165
|
+
if (index !== -1) {
|
|
18166
|
+
CONNECTORS.splice(index, 1);
|
|
18167
|
+
}
|
|
18168
|
+
}
|
|
18169
|
+
|
|
18170
|
+
class AbortError extends Error {
|
|
18171
|
+
constructor(message = "AbortError") {
|
|
18172
|
+
super(message);
|
|
18173
|
+
this.name = "AbortError";
|
|
18174
|
+
}
|
|
18175
|
+
}
|
|
18176
|
+
|
|
18177
|
+
var __defProp$L = Object.defineProperty;
|
|
18178
|
+
var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18179
|
+
var __publicField$x = (obj, key, value) => __defNormalProp$L(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18146
18180
|
class NgwError extends Error {
|
|
18147
18181
|
constructor(er) {
|
|
18148
18182
|
super();
|
|
18149
|
-
__publicField$
|
|
18150
|
-
__publicField$
|
|
18151
|
-
__publicField$
|
|
18152
|
-
__publicField$
|
|
18153
|
-
__publicField$
|
|
18154
|
-
__publicField$
|
|
18155
|
-
__publicField$
|
|
18156
|
-
__publicField$
|
|
18183
|
+
__publicField$x(this, "name", "NgwError");
|
|
18184
|
+
__publicField$x(this, "title");
|
|
18185
|
+
__publicField$x(this, "message");
|
|
18186
|
+
__publicField$x(this, "detail");
|
|
18187
|
+
__publicField$x(this, "exception");
|
|
18188
|
+
__publicField$x(this, "status_code");
|
|
18189
|
+
__publicField$x(this, "data");
|
|
18190
|
+
__publicField$x(this, "guru_meditation");
|
|
18157
18191
|
Object.assign(this, er);
|
|
18158
18192
|
Object.setPrototypeOf(this, NgwError.prototype);
|
|
18159
18193
|
}
|
|
18160
18194
|
}
|
|
18161
18195
|
|
|
18162
|
-
var __defProp$
|
|
18163
|
-
var __defNormalProp$
|
|
18164
|
-
var __publicField$
|
|
18196
|
+
var __defProp$K = Object.defineProperty;
|
|
18197
|
+
var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18198
|
+
var __publicField$w = (obj, key, value) => __defNormalProp$K(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18199
|
+
class InsufficientPermissionsError extends NgwError {
|
|
18200
|
+
constructor(obj) {
|
|
18201
|
+
super(obj);
|
|
18202
|
+
__publicField$w(this, "name", "InsufficientPermissionsError");
|
|
18203
|
+
__publicField$w(this, "exception", "nextgisweb.core.exception.InsufficientPermissions");
|
|
18204
|
+
Object.setPrototypeOf(this, InsufficientPermissionsError.prototype);
|
|
18205
|
+
}
|
|
18206
|
+
}
|
|
18207
|
+
|
|
18208
|
+
var __defProp$J = Object.defineProperty;
|
|
18209
|
+
var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18210
|
+
var __publicField$v = (obj, key, value) => __defNormalProp$J(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18165
18211
|
class ResourceNotFoundError extends NgwError {
|
|
18166
18212
|
constructor(obj) {
|
|
18167
18213
|
super(obj);
|
|
18168
|
-
__publicField$
|
|
18169
|
-
__publicField$
|
|
18214
|
+
__publicField$v(this, "name", "ResourceNotFoundError");
|
|
18215
|
+
__publicField$v(this, "exception", "nextgisweb.resource.exception.ResourceNotFound");
|
|
18170
18216
|
Object.setPrototypeOf(this, ResourceNotFoundError.prototype);
|
|
18171
18217
|
}
|
|
18172
18218
|
}
|
|
18173
18219
|
|
|
18174
|
-
|
|
18175
|
-
|
|
18220
|
+
var __defProp$I = Object.defineProperty;
|
|
18221
|
+
var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18222
|
+
var __publicField$u = (obj, key, value) => __defNormalProp$I(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18223
|
+
class BaseAPIError extends Error {
|
|
18224
|
+
constructor(message) {
|
|
18225
|
+
super(message || "Something went wrong.");
|
|
18226
|
+
__publicField$u(this, "title");
|
|
18227
|
+
this.name = "BaseAPIError";
|
|
18228
|
+
this.title = "Unknown API error";
|
|
18229
|
+
if (Error.captureStackTrace) {
|
|
18230
|
+
Error.captureStackTrace(this, BaseAPIError);
|
|
18231
|
+
}
|
|
18232
|
+
}
|
|
18176
18233
|
}
|
|
18177
|
-
|
|
18178
|
-
|
|
18179
|
-
|
|
18234
|
+
class NetworksResponseError extends BaseAPIError {
|
|
18235
|
+
// prettier-ignore
|
|
18236
|
+
constructor(message) {
|
|
18237
|
+
super(message || "There is no response from the server or problem connecting to server.");
|
|
18238
|
+
__publicField$u(this, "detail");
|
|
18239
|
+
this.title = "Network error";
|
|
18240
|
+
this.detail = "Check network connectivity and try again later.";
|
|
18241
|
+
}
|
|
18180
18242
|
}
|
|
18181
|
-
|
|
18182
|
-
|
|
18183
|
-
|
|
18184
|
-
|
|
18185
|
-
|
|
18186
|
-
|
|
18187
|
-
|
|
18188
|
-
|
|
18189
|
-
|
|
18190
|
-
|
|
18191
|
-
|
|
18192
|
-
|
|
18193
|
-
|
|
18194
|
-
|
|
18195
|
-
|
|
18196
|
-
|
|
18197
|
-
|
|
18243
|
+
class InvalidResponseError extends BaseAPIError {
|
|
18244
|
+
constructor(message) {
|
|
18245
|
+
super(message || "Something went wrong.");
|
|
18246
|
+
this.title = "Unexpected server response";
|
|
18247
|
+
}
|
|
18248
|
+
}
|
|
18249
|
+
class ServerResponseError extends BaseAPIError {
|
|
18250
|
+
constructor(data) {
|
|
18251
|
+
super(data.message);
|
|
18252
|
+
__publicField$u(this, "detail");
|
|
18253
|
+
__publicField$u(this, "data");
|
|
18254
|
+
this.title = data.title || this.title;
|
|
18255
|
+
this.detail = data.detail || null;
|
|
18256
|
+
this.data = data;
|
|
18257
|
+
}
|
|
18258
|
+
}
|
|
18259
|
+
class LunkwillError extends Error {
|
|
18260
|
+
// prettier-ignore
|
|
18261
|
+
constructor(message, data = {}) {
|
|
18262
|
+
super(message || "Unexpected error while processing long-running request.");
|
|
18263
|
+
__publicField$u(this, "title");
|
|
18264
|
+
__publicField$u(this, "data");
|
|
18265
|
+
this.name = "LunkwillError";
|
|
18266
|
+
this.title = "Long-running request error";
|
|
18267
|
+
this.data = data;
|
|
18268
|
+
if (Error.captureStackTrace) {
|
|
18269
|
+
Error.captureStackTrace(this, LunkwillError);
|
|
18198
18270
|
}
|
|
18199
18271
|
}
|
|
18200
|
-
|
|
18272
|
+
}
|
|
18273
|
+
class LunkwillRequestCancelled extends LunkwillError {
|
|
18274
|
+
constructor(data) {
|
|
18275
|
+
super("Long-running request was cancelled.", data);
|
|
18276
|
+
}
|
|
18277
|
+
}
|
|
18278
|
+
class LunkwillRequestFailed extends LunkwillError {
|
|
18279
|
+
constructor(data) {
|
|
18280
|
+
super(void 0, data);
|
|
18281
|
+
}
|
|
18201
18282
|
}
|
|
18202
18283
|
|
|
18203
|
-
var __defProp$
|
|
18204
|
-
var __getOwnPropSymbols$
|
|
18205
|
-
var __hasOwnProp$
|
|
18206
|
-
var __propIsEnum$
|
|
18207
|
-
var __defNormalProp$
|
|
18208
|
-
var __spreadValues$
|
|
18284
|
+
var __defProp$H = Object.defineProperty;
|
|
18285
|
+
var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
|
|
18286
|
+
var __hasOwnProp$v = Object.prototype.hasOwnProperty;
|
|
18287
|
+
var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
|
|
18288
|
+
var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18289
|
+
var __spreadValues$u = (a, b) => {
|
|
18209
18290
|
for (var prop in b || (b = {}))
|
|
18210
|
-
if (__hasOwnProp$
|
|
18211
|
-
__defNormalProp$
|
|
18212
|
-
if (__getOwnPropSymbols$
|
|
18213
|
-
for (var prop of __getOwnPropSymbols$
|
|
18214
|
-
if (__propIsEnum$
|
|
18215
|
-
__defNormalProp$
|
|
18291
|
+
if (__hasOwnProp$v.call(b, prop))
|
|
18292
|
+
__defNormalProp$H(a, prop, b[prop]);
|
|
18293
|
+
if (__getOwnPropSymbols$v)
|
|
18294
|
+
for (var prop of __getOwnPropSymbols$v(b)) {
|
|
18295
|
+
if (__propIsEnum$v.call(b, prop))
|
|
18296
|
+
__defNormalProp$H(a, prop, b[prop]);
|
|
18216
18297
|
}
|
|
18217
18298
|
return a;
|
|
18218
18299
|
};
|
|
18219
|
-
var
|
|
18220
|
-
var
|
|
18300
|
+
var __objRest$5 = (source, exclude) => {
|
|
18301
|
+
var target = {};
|
|
18302
|
+
for (var prop in source)
|
|
18303
|
+
if (__hasOwnProp$v.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
18304
|
+
target[prop] = source[prop];
|
|
18305
|
+
if (source != null && __getOwnPropSymbols$v)
|
|
18306
|
+
for (var prop of __getOwnPropSymbols$v(source)) {
|
|
18307
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$v.call(source, prop))
|
|
18308
|
+
target[prop] = source[prop];
|
|
18309
|
+
}
|
|
18310
|
+
return target;
|
|
18311
|
+
};
|
|
18312
|
+
var __async$t = (__this, __arguments, generator) => {
|
|
18221
18313
|
return new Promise((resolve, reject) => {
|
|
18222
18314
|
var fulfilled = (value) => {
|
|
18223
18315
|
try {
|
|
@@ -18237,62 +18329,915 @@ var __async$r = (__this, __arguments, generator) => {
|
|
|
18237
18329
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
18238
18330
|
});
|
|
18239
18331
|
};
|
|
18240
|
-
|
|
18241
|
-
|
|
18242
|
-
|
|
18243
|
-
|
|
18244
|
-
|
|
18245
|
-
|
|
18246
|
-
|
|
18247
|
-
|
|
18248
|
-
|
|
18249
|
-
|
|
18250
|
-
|
|
18251
|
-
|
|
18252
|
-
|
|
18253
|
-
|
|
18254
|
-
|
|
18255
|
-
|
|
18256
|
-
|
|
18257
|
-
|
|
18258
|
-
|
|
18259
|
-
|
|
18260
|
-
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18332
|
+
function lunkwillCheckResponse(lwResp) {
|
|
18333
|
+
const ct = lwResp.headers.get("content-type");
|
|
18334
|
+
return ct !== void 0 && ct !== null && ct.includes("application/vnd.lunkwill.request-summary+json");
|
|
18335
|
+
}
|
|
18336
|
+
function responseJson(response) {
|
|
18337
|
+
return __async$t(this, null, function* () {
|
|
18338
|
+
try {
|
|
18339
|
+
return response.json();
|
|
18340
|
+
} catch (e) {
|
|
18341
|
+
throw new Error();
|
|
18342
|
+
}
|
|
18343
|
+
});
|
|
18344
|
+
}
|
|
18345
|
+
function lunkwillResponseUrl(lwResp) {
|
|
18346
|
+
return __async$t(this, null, function* () {
|
|
18347
|
+
const lwData = yield responseJson(lwResp);
|
|
18348
|
+
let delay = lwData.delay_ms;
|
|
18349
|
+
const retry = lwData.retry_ms !== void 0 ? lwData.retry_ms : 2e3;
|
|
18350
|
+
const sum = `/api/lunkwill/${lwData.id}/summary`;
|
|
18351
|
+
const res = `/api/lunkwill/${lwData.id}/response`;
|
|
18352
|
+
const sleep = (msec) => new Promise((resolve) => setTimeout(resolve, msec));
|
|
18353
|
+
let failed = false;
|
|
18354
|
+
let ready = false;
|
|
18355
|
+
while (!ready) {
|
|
18356
|
+
yield sleep(failed ? retry : delay);
|
|
18357
|
+
failed = false;
|
|
18358
|
+
let lwResp2;
|
|
18359
|
+
let lwData2;
|
|
18360
|
+
try {
|
|
18361
|
+
lwResp2 = yield fetch(sum, { credentials: "same-origin" });
|
|
18362
|
+
lwData2 = yield lwResp2.json();
|
|
18363
|
+
} catch (e) {
|
|
18364
|
+
failed = true;
|
|
18365
|
+
continue;
|
|
18366
|
+
}
|
|
18367
|
+
switch (lwData2.status) {
|
|
18368
|
+
case void 0:
|
|
18369
|
+
throw new LunkwillError(void 0, lwData2);
|
|
18370
|
+
case "ready":
|
|
18371
|
+
ready = true;
|
|
18372
|
+
break;
|
|
18373
|
+
case "cancelled":
|
|
18374
|
+
throw new LunkwillRequestCancelled(lwData2);
|
|
18375
|
+
case "failed":
|
|
18376
|
+
throw new LunkwillRequestFailed(lwData2);
|
|
18377
|
+
case "spooled":
|
|
18378
|
+
case "processing":
|
|
18379
|
+
case "buffering":
|
|
18380
|
+
delay = lwData2.delay_ms;
|
|
18381
|
+
break;
|
|
18382
|
+
default:
|
|
18383
|
+
throw new LunkwillError(void 0, lwData2);
|
|
18272
18384
|
}
|
|
18273
18385
|
}
|
|
18274
|
-
|
|
18275
|
-
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
|
|
18386
|
+
return res;
|
|
18387
|
+
});
|
|
18388
|
+
}
|
|
18389
|
+
function lunkwillFetch(lwRespUrl) {
|
|
18390
|
+
return __async$t(this, null, function* () {
|
|
18391
|
+
try {
|
|
18392
|
+
return yield window.fetch(lwRespUrl, { credentials: "same-origin" });
|
|
18393
|
+
} catch (e) {
|
|
18394
|
+
throw new NetworksResponseError();
|
|
18280
18395
|
}
|
|
18281
|
-
|
|
18282
|
-
|
|
18283
|
-
|
|
18284
|
-
|
|
18285
|
-
|
|
18286
|
-
|
|
18396
|
+
});
|
|
18397
|
+
}
|
|
18398
|
+
const mediaContentTypes = [
|
|
18399
|
+
"application/pdf",
|
|
18400
|
+
"image/png",
|
|
18401
|
+
"image/jpeg",
|
|
18402
|
+
"image/tiff",
|
|
18403
|
+
"text/csv"
|
|
18404
|
+
];
|
|
18405
|
+
const mediaContentTypesRegex = new RegExp(mediaContentTypes.join("|"));
|
|
18406
|
+
function isMediaContentType(contentType) {
|
|
18407
|
+
return mediaContentTypesRegex.test(contentType);
|
|
18408
|
+
}
|
|
18409
|
+
function encodeQueryParams(value) {
|
|
18410
|
+
const result = [];
|
|
18411
|
+
for (const [k, v] of Object.entries(value)) {
|
|
18412
|
+
if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") {
|
|
18413
|
+
result.push(`${k}=${encodeURIComponent(v)}`);
|
|
18414
|
+
} else if (Array.isArray(v)) {
|
|
18415
|
+
result.push(`${k}=${v.map(encodeURIComponent).join(",")}`);
|
|
18416
|
+
} else {
|
|
18417
|
+
for (const [sk, sv] of Object.entries(v)) {
|
|
18418
|
+
const ske = `${k}[${encodeURIComponent(sk)}]`;
|
|
18419
|
+
if (typeof sv === "string" || typeof sv === "number" || typeof sv === "boolean") {
|
|
18420
|
+
result.push(`${ske}=${encodeURIComponent(sv)}`);
|
|
18421
|
+
} else if (Array.isArray(sv)) {
|
|
18422
|
+
const sve = sv.map(encodeURIComponent);
|
|
18423
|
+
result.push(`${ske}=${sve.join(",")}`);
|
|
18424
|
+
}
|
|
18287
18425
|
}
|
|
18288
|
-
|
|
18289
|
-
});
|
|
18426
|
+
}
|
|
18290
18427
|
}
|
|
18291
|
-
|
|
18292
|
-
|
|
18293
|
-
|
|
18294
|
-
|
|
18295
|
-
|
|
18428
|
+
return result.join("&");
|
|
18429
|
+
}
|
|
18430
|
+
function generateUrl(path, query) {
|
|
18431
|
+
let urlParams = "";
|
|
18432
|
+
if (query !== void 0) {
|
|
18433
|
+
urlParams = "?" + encodeQueryParams(query);
|
|
18434
|
+
}
|
|
18435
|
+
return path + urlParams;
|
|
18436
|
+
}
|
|
18437
|
+
function request(path, options, cacheEngine) {
|
|
18438
|
+
return __async$t(this, null, function* () {
|
|
18439
|
+
var _b;
|
|
18440
|
+
const defaults = {
|
|
18441
|
+
method: "GET",
|
|
18442
|
+
credentials: "same-origin",
|
|
18443
|
+
headers: {}
|
|
18444
|
+
};
|
|
18445
|
+
const _a = __spreadValues$u(__spreadValues$u({}, defaults), options), {
|
|
18446
|
+
withCredentials,
|
|
18447
|
+
responseType,
|
|
18448
|
+
cacheProps,
|
|
18449
|
+
cacheName,
|
|
18450
|
+
lunkwill,
|
|
18451
|
+
cache,
|
|
18452
|
+
query,
|
|
18453
|
+
json
|
|
18454
|
+
} = _a, opt = __objRest$5(_a, [
|
|
18455
|
+
"withCredentials",
|
|
18456
|
+
"responseType",
|
|
18457
|
+
"cacheProps",
|
|
18458
|
+
"cacheName",
|
|
18459
|
+
"lunkwill",
|
|
18460
|
+
"cache",
|
|
18461
|
+
"query",
|
|
18462
|
+
"json"
|
|
18463
|
+
]);
|
|
18464
|
+
if (withCredentials) {
|
|
18465
|
+
opt.credentials = "include";
|
|
18466
|
+
}
|
|
18467
|
+
let useLunkwill = false;
|
|
18468
|
+
if (lunkwill !== void 0) {
|
|
18469
|
+
lunkwill.toHeaders(opt.headers || {});
|
|
18470
|
+
useLunkwill = true;
|
|
18471
|
+
}
|
|
18472
|
+
const lunkwillReturnUrl = !!opt.lunkwillReturnUrl;
|
|
18473
|
+
delete opt.lunkwillReturnUrl;
|
|
18474
|
+
if (json !== void 0) {
|
|
18475
|
+
opt.body = JSON.stringify(json);
|
|
18476
|
+
const headers = opt.headers || {};
|
|
18477
|
+
headers["Content-Type"] = "application/json";
|
|
18478
|
+
opt.headers = headers;
|
|
18479
|
+
}
|
|
18480
|
+
const url = generateUrl(path, query);
|
|
18481
|
+
const makeRequest = () => __async$t(this, null, function* () {
|
|
18482
|
+
let response;
|
|
18483
|
+
try {
|
|
18484
|
+
response = yield fetch(url, opt);
|
|
18485
|
+
} catch (e) {
|
|
18486
|
+
if (e.name === "AbortError") {
|
|
18487
|
+
throw e;
|
|
18488
|
+
}
|
|
18489
|
+
throw new NetworksResponseError();
|
|
18490
|
+
}
|
|
18491
|
+
if (useLunkwill && lunkwillCheckResponse(response)) {
|
|
18492
|
+
const lwRespUrl = yield lunkwillResponseUrl(response);
|
|
18493
|
+
if (lunkwillReturnUrl) {
|
|
18494
|
+
return lwRespUrl;
|
|
18495
|
+
}
|
|
18496
|
+
response = yield lunkwillFetch(lwRespUrl);
|
|
18497
|
+
}
|
|
18498
|
+
const respCType = response.headers.get("content-type");
|
|
18499
|
+
const respJSON = respCType && (respCType.includes("application/json") || respCType.includes("application/vnd.lunkwill.request-summary+json"));
|
|
18500
|
+
let body;
|
|
18501
|
+
try {
|
|
18502
|
+
const respMedia = respCType && isMediaContentType(respCType);
|
|
18503
|
+
if (responseType === "blob" || respMedia) {
|
|
18504
|
+
body = yield response.blob();
|
|
18505
|
+
} else if (respJSON) {
|
|
18506
|
+
body = yield response.json();
|
|
18507
|
+
} else {
|
|
18508
|
+
throw new InvalidResponseError();
|
|
18509
|
+
}
|
|
18510
|
+
} catch (e) {
|
|
18511
|
+
if (e.name === "AbortError" || e instanceof InvalidResponseError) {
|
|
18512
|
+
throw e;
|
|
18513
|
+
}
|
|
18514
|
+
throw new InvalidResponseError();
|
|
18515
|
+
}
|
|
18516
|
+
if (400 <= response.status && response.status <= 599) {
|
|
18517
|
+
throw new ServerResponseError(body);
|
|
18518
|
+
}
|
|
18519
|
+
return body;
|
|
18520
|
+
});
|
|
18521
|
+
if (cacheEngine && cache && ((_b = opt.method) == null ? void 0 : _b.toUpperCase()) === "GET") {
|
|
18522
|
+
const cacheOptions = cacheProps ? cacheProps : __spreadValues$u({}, objectRemoveEmpty({
|
|
18523
|
+
withCredentials,
|
|
18524
|
+
responseType
|
|
18525
|
+
}));
|
|
18526
|
+
return cacheEngine.add(cacheName || url, makeRequest, cacheOptions, false);
|
|
18527
|
+
}
|
|
18528
|
+
return makeRequest();
|
|
18529
|
+
});
|
|
18530
|
+
}
|
|
18531
|
+
|
|
18532
|
+
var __defProp$G = Object.defineProperty;
|
|
18533
|
+
var __defProps$i = Object.defineProperties;
|
|
18534
|
+
var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
|
|
18535
|
+
var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
|
|
18536
|
+
var __hasOwnProp$u = Object.prototype.hasOwnProperty;
|
|
18537
|
+
var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
|
|
18538
|
+
var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18539
|
+
var __spreadValues$t = (a, b) => {
|
|
18540
|
+
for (var prop in b || (b = {}))
|
|
18541
|
+
if (__hasOwnProp$u.call(b, prop))
|
|
18542
|
+
__defNormalProp$G(a, prop, b[prop]);
|
|
18543
|
+
if (__getOwnPropSymbols$u)
|
|
18544
|
+
for (var prop of __getOwnPropSymbols$u(b)) {
|
|
18545
|
+
if (__propIsEnum$u.call(b, prop))
|
|
18546
|
+
__defNormalProp$G(a, prop, b[prop]);
|
|
18547
|
+
}
|
|
18548
|
+
return a;
|
|
18549
|
+
};
|
|
18550
|
+
var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
|
|
18551
|
+
var __objRest$4 = (source, exclude) => {
|
|
18552
|
+
var target = {};
|
|
18553
|
+
for (var prop in source)
|
|
18554
|
+
if (__hasOwnProp$u.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
18555
|
+
target[prop] = source[prop];
|
|
18556
|
+
if (source != null && __getOwnPropSymbols$u)
|
|
18557
|
+
for (var prop of __getOwnPropSymbols$u(source)) {
|
|
18558
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$u.call(source, prop))
|
|
18559
|
+
target[prop] = source[prop];
|
|
18560
|
+
}
|
|
18561
|
+
return target;
|
|
18562
|
+
};
|
|
18563
|
+
var __async$s = (__this, __arguments, generator) => {
|
|
18564
|
+
return new Promise((resolve, reject) => {
|
|
18565
|
+
var fulfilled = (value) => {
|
|
18566
|
+
try {
|
|
18567
|
+
step(generator.next(value));
|
|
18568
|
+
} catch (e) {
|
|
18569
|
+
reject(e);
|
|
18570
|
+
}
|
|
18571
|
+
};
|
|
18572
|
+
var rejected = (value) => {
|
|
18573
|
+
try {
|
|
18574
|
+
step(generator.throw(value));
|
|
18575
|
+
} catch (e) {
|
|
18576
|
+
reject(e);
|
|
18577
|
+
}
|
|
18578
|
+
};
|
|
18579
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18580
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
18581
|
+
});
|
|
18582
|
+
};
|
|
18583
|
+
function routeURL(name, baseUrl, routeData, ...rest) {
|
|
18584
|
+
const [template, ...params] = routeData[name];
|
|
18585
|
+
const first = rest[0];
|
|
18586
|
+
let sub;
|
|
18587
|
+
if (first === void 0) {
|
|
18588
|
+
sub = [];
|
|
18589
|
+
} else if (typeof first === "object" && first !== null) {
|
|
18590
|
+
if (rest.length > 1) {
|
|
18591
|
+
throw new Error("Too many arguments for route(name, object)!");
|
|
18592
|
+
}
|
|
18593
|
+
sub = [];
|
|
18594
|
+
for (const [p, v] of Object.entries(first)) {
|
|
18595
|
+
sub[params.indexOf(p)] = String(v);
|
|
18596
|
+
}
|
|
18597
|
+
} else {
|
|
18598
|
+
sub = rest.map((v) => String(v));
|
|
18599
|
+
}
|
|
18600
|
+
return fixUrlStr(
|
|
18601
|
+
baseUrl + template.replace(/\{(\w+)\}/g, function(m, a) {
|
|
18602
|
+
const idx = parseInt(a);
|
|
18603
|
+
const value = sub[idx];
|
|
18604
|
+
if (value === void 0) {
|
|
18605
|
+
const msg = `Undefined parameter ${idx} in "${template}".`;
|
|
18606
|
+
throw new Error(msg);
|
|
18607
|
+
}
|
|
18608
|
+
return String(value);
|
|
18609
|
+
})
|
|
18610
|
+
);
|
|
18611
|
+
}
|
|
18612
|
+
function route(name, connector, ...rest) {
|
|
18613
|
+
const result = {
|
|
18614
|
+
url: (opt) => __async$s(this, null, function* () {
|
|
18615
|
+
var _a;
|
|
18616
|
+
const routeData = yield connector.connect();
|
|
18617
|
+
const template = routeURL(
|
|
18618
|
+
name,
|
|
18619
|
+
(_a = connector.options.baseUrl) != null ? _a : "",
|
|
18620
|
+
routeData,
|
|
18621
|
+
...rest
|
|
18622
|
+
);
|
|
18623
|
+
return generateUrl(template, opt == null ? void 0 : opt.query);
|
|
18624
|
+
})
|
|
18625
|
+
};
|
|
18626
|
+
const methods = ["get", "post", "put", "delete", "patch"];
|
|
18627
|
+
for (const method of methods) {
|
|
18628
|
+
const methodResp = (requestOptions) => __async$s(this, null, function* () {
|
|
18629
|
+
var _b;
|
|
18630
|
+
const _a = requestOptions || {}, { headers: optHeaders } = _a, restOpt = __objRest$4(_a, ["headers"]);
|
|
18631
|
+
const routeData = yield connector.connect();
|
|
18632
|
+
const template = routeURL(
|
|
18633
|
+
name,
|
|
18634
|
+
(_b = connector.options.baseUrl) != null ? _b : "",
|
|
18635
|
+
routeData,
|
|
18636
|
+
...rest
|
|
18637
|
+
);
|
|
18638
|
+
const headers = objectRemoveEmpty(__spreadValues$t(__spreadValues$t({}, connector.getAuthorizationHeaders()), optHeaders != null ? optHeaders : {}));
|
|
18639
|
+
return request(
|
|
18640
|
+
template,
|
|
18641
|
+
__spreadProps$i(__spreadValues$t({
|
|
18642
|
+
headers
|
|
18643
|
+
}, restOpt), {
|
|
18644
|
+
method
|
|
18645
|
+
}),
|
|
18646
|
+
connector.cache
|
|
18647
|
+
);
|
|
18648
|
+
});
|
|
18649
|
+
result[method] = methodResp;
|
|
18650
|
+
}
|
|
18651
|
+
return result;
|
|
18652
|
+
}
|
|
18653
|
+
|
|
18654
|
+
var __defProp$F = Object.defineProperty;
|
|
18655
|
+
var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18656
|
+
var __publicField$t = (obj, key, value) => __defNormalProp$F(obj, key + "" , value);
|
|
18657
|
+
class NetworkError extends Error {
|
|
18658
|
+
constructor(url) {
|
|
18659
|
+
super();
|
|
18660
|
+
__publicField$t(this, "name", "NetworkError");
|
|
18661
|
+
Object.setPrototypeOf(this, NetworkError.prototype);
|
|
18662
|
+
this.message = `Unable to request ${url}.
|
|
18663
|
+
Possibly invalid NGW URL entered or CORS not configured to get request from ${location.origin}`;
|
|
18664
|
+
}
|
|
18665
|
+
}
|
|
18666
|
+
|
|
18667
|
+
function isObject(val) {
|
|
18668
|
+
return Object.prototype.toString.call(val) === "[object Object]";
|
|
18669
|
+
}
|
|
18670
|
+
|
|
18671
|
+
let loadData;
|
|
18672
|
+
{
|
|
18673
|
+
loadData = (url, callback, options = {}, error, onCancel) => {
|
|
18674
|
+
options.method = options.method || "GET";
|
|
18675
|
+
const xhr = new XMLHttpRequest();
|
|
18676
|
+
xhr.open(options.method || "GET", url, true);
|
|
18677
|
+
if (options.responseType === "blob") {
|
|
18678
|
+
xhr.responseType = options.responseType;
|
|
18679
|
+
}
|
|
18680
|
+
const getResponseText = () => {
|
|
18681
|
+
try {
|
|
18682
|
+
return JSON.parse(xhr.responseText);
|
|
18683
|
+
} catch (er) {
|
|
18684
|
+
return xhr.responseText;
|
|
18685
|
+
}
|
|
18686
|
+
};
|
|
18687
|
+
const processingResponse = (forError = false) => {
|
|
18688
|
+
const cb = forError ? error : callback;
|
|
18689
|
+
if (options.responseType === "blob") {
|
|
18690
|
+
cb(xhr.response);
|
|
18691
|
+
} else {
|
|
18692
|
+
if (xhr.responseText) {
|
|
18693
|
+
cb(getResponseText());
|
|
18694
|
+
} else {
|
|
18695
|
+
error({ message: "" });
|
|
18696
|
+
}
|
|
18697
|
+
}
|
|
18698
|
+
};
|
|
18699
|
+
xhr.onload = () => {
|
|
18700
|
+
if ([401, 403, 404, 422, 500].indexOf(xhr.status) !== -1) {
|
|
18701
|
+
error(new NgwError(getResponseText()));
|
|
18702
|
+
}
|
|
18703
|
+
processingResponse();
|
|
18704
|
+
};
|
|
18705
|
+
xhr.onerror = (er) => {
|
|
18706
|
+
if (xhr.status === 0) {
|
|
18707
|
+
error(new NetworkError(url));
|
|
18708
|
+
} else {
|
|
18709
|
+
error(er);
|
|
18710
|
+
}
|
|
18711
|
+
};
|
|
18712
|
+
xhr.upload.onprogress = function(e) {
|
|
18713
|
+
if (e.lengthComputable) {
|
|
18714
|
+
const percentComplete = e.loaded / e.total * 100;
|
|
18715
|
+
if (options.onProgress) {
|
|
18716
|
+
options.onProgress(percentComplete, e);
|
|
18717
|
+
}
|
|
18718
|
+
}
|
|
18719
|
+
};
|
|
18720
|
+
const headers = options.headers;
|
|
18721
|
+
if (headers) {
|
|
18722
|
+
for (const h in headers) {
|
|
18723
|
+
const header = headers[h];
|
|
18724
|
+
if (typeof header === "string") {
|
|
18725
|
+
xhr.setRequestHeader(h, header);
|
|
18726
|
+
}
|
|
18727
|
+
}
|
|
18728
|
+
}
|
|
18729
|
+
if (options.withCredentials !== void 0) {
|
|
18730
|
+
xhr.withCredentials = options.withCredentials;
|
|
18731
|
+
}
|
|
18732
|
+
let data;
|
|
18733
|
+
if (options.file) {
|
|
18734
|
+
data = new FormData();
|
|
18735
|
+
data.append("file", options.file);
|
|
18736
|
+
if (options.data) {
|
|
18737
|
+
for (const d in options.data) {
|
|
18738
|
+
data.append(d, data[d]);
|
|
18739
|
+
}
|
|
18740
|
+
}
|
|
18741
|
+
} else {
|
|
18742
|
+
data = options.data ? typeof options.data === "string" ? options.data : JSON.stringify(options.data) : null;
|
|
18743
|
+
}
|
|
18744
|
+
if (onCancel) {
|
|
18745
|
+
onCancel(() => {
|
|
18746
|
+
xhr.abort();
|
|
18747
|
+
});
|
|
18748
|
+
}
|
|
18749
|
+
xhr.send(data);
|
|
18750
|
+
};
|
|
18751
|
+
}
|
|
18752
|
+
|
|
18753
|
+
const templateRe = /\{ *([\w_-]+) *\}/g;
|
|
18754
|
+
function template(str, data) {
|
|
18755
|
+
return str.replace(templateRe, (s, key) => {
|
|
18756
|
+
let value = data[key];
|
|
18757
|
+
if (value === void 0) {
|
|
18758
|
+
throw new Error("No value provided for letiable " + s);
|
|
18759
|
+
} else if (typeof value === "function") {
|
|
18760
|
+
value = value(data);
|
|
18761
|
+
}
|
|
18762
|
+
return value;
|
|
18763
|
+
});
|
|
18764
|
+
}
|
|
18765
|
+
|
|
18766
|
+
var __defProp$E = Object.defineProperty;
|
|
18767
|
+
var __defProps$h = Object.defineProperties;
|
|
18768
|
+
var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
|
|
18769
|
+
var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
|
|
18770
|
+
var __hasOwnProp$t = Object.prototype.hasOwnProperty;
|
|
18771
|
+
var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
|
|
18772
|
+
var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18773
|
+
var __spreadValues$s = (a, b) => {
|
|
18774
|
+
for (var prop in b || (b = {}))
|
|
18775
|
+
if (__hasOwnProp$t.call(b, prop))
|
|
18776
|
+
__defNormalProp$E(a, prop, b[prop]);
|
|
18777
|
+
if (__getOwnPropSymbols$t)
|
|
18778
|
+
for (var prop of __getOwnPropSymbols$t(b)) {
|
|
18779
|
+
if (__propIsEnum$t.call(b, prop))
|
|
18780
|
+
__defNormalProp$E(a, prop, b[prop]);
|
|
18781
|
+
}
|
|
18782
|
+
return a;
|
|
18783
|
+
};
|
|
18784
|
+
var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
|
|
18785
|
+
var __objRest$3 = (source, exclude) => {
|
|
18786
|
+
var target = {};
|
|
18787
|
+
for (var prop in source)
|
|
18788
|
+
if (__hasOwnProp$t.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
18789
|
+
target[prop] = source[prop];
|
|
18790
|
+
if (source != null && __getOwnPropSymbols$t)
|
|
18791
|
+
for (var prop of __getOwnPropSymbols$t(source)) {
|
|
18792
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$t.call(source, prop))
|
|
18793
|
+
target[prop] = source[prop];
|
|
18794
|
+
}
|
|
18795
|
+
return target;
|
|
18796
|
+
};
|
|
18797
|
+
var __publicField$s = (obj, key, value) => __defNormalProp$E(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18798
|
+
var __async$r = (__this, __arguments, generator) => {
|
|
18799
|
+
return new Promise((resolve, reject) => {
|
|
18800
|
+
var fulfilled = (value) => {
|
|
18801
|
+
try {
|
|
18802
|
+
step(generator.next(value));
|
|
18803
|
+
} catch (e) {
|
|
18804
|
+
reject(e);
|
|
18805
|
+
}
|
|
18806
|
+
};
|
|
18807
|
+
var rejected = (value) => {
|
|
18808
|
+
try {
|
|
18809
|
+
step(generator.throw(value));
|
|
18810
|
+
} catch (e) {
|
|
18811
|
+
reject(e);
|
|
18812
|
+
}
|
|
18813
|
+
};
|
|
18814
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18815
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
18816
|
+
});
|
|
18817
|
+
};
|
|
18818
|
+
let ID$2 = 0;
|
|
18819
|
+
let REQUEST_ID = 0;
|
|
18820
|
+
class NgwConnector {
|
|
18821
|
+
constructor(options) {
|
|
18822
|
+
this.options = options;
|
|
18823
|
+
__publicField$s(this, "id", ID$2++);
|
|
18824
|
+
__publicField$s(this, "emitter", new EventEmitter());
|
|
18825
|
+
__publicField$s(this, "user");
|
|
18826
|
+
__publicField$s(this, "cache");
|
|
18827
|
+
__publicField$s(this, "withCredentials");
|
|
18828
|
+
__publicField$s(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
|
|
18829
|
+
__publicField$s(this, "routeStr", "/api/component/pyramid/route");
|
|
18830
|
+
__publicField$s(this, "activeRequests", {});
|
|
18831
|
+
__publicField$s(this, "requestTransform");
|
|
18832
|
+
const exist = findConnector(options);
|
|
18833
|
+
this.cache = new Cache({ namespace: options.cacheId });
|
|
18834
|
+
if (exist) {
|
|
18835
|
+
return exist;
|
|
18836
|
+
} else {
|
|
18837
|
+
const { route: route2, requestTransform, withCredentials } = this.options;
|
|
18838
|
+
if (route2) {
|
|
18839
|
+
this.routeStr = route2;
|
|
18840
|
+
}
|
|
18841
|
+
if (requestTransform) {
|
|
18842
|
+
this.requestTransform = requestTransform;
|
|
18843
|
+
}
|
|
18844
|
+
if (withCredentials !== void 0) {
|
|
18845
|
+
this.withCredentials = withCredentials;
|
|
18846
|
+
}
|
|
18847
|
+
addConnector(this);
|
|
18848
|
+
}
|
|
18849
|
+
}
|
|
18850
|
+
static create(options) {
|
|
18851
|
+
return new this(options);
|
|
18852
|
+
}
|
|
18853
|
+
/**
|
|
18854
|
+
* Clear the cache.
|
|
18855
|
+
*/
|
|
18856
|
+
clearCache() {
|
|
18857
|
+
this.cache.clean();
|
|
18858
|
+
}
|
|
18859
|
+
setRequestTransform(requestTransform) {
|
|
18860
|
+
this.requestTransform = requestTransform;
|
|
18861
|
+
}
|
|
18862
|
+
/**
|
|
18863
|
+
* Fast way to specify the connection address to NextGIS Web.
|
|
18864
|
+
* The current connection will be severed.
|
|
18865
|
+
* @param baseUrl - NGW url
|
|
18866
|
+
*/
|
|
18867
|
+
setNgw(baseUrl) {
|
|
18868
|
+
this.logout();
|
|
18869
|
+
this.options.baseUrl = baseUrl;
|
|
18870
|
+
addConnector(this);
|
|
18871
|
+
}
|
|
18872
|
+
/**
|
|
18873
|
+
* Establishing a connection with NextGIS Web to fulfill all other requests.
|
|
18874
|
+
* @remarks
|
|
18875
|
+
* This method need not be called manually as it is used when forming a request in {@link apiRequest | apiRequest}.
|
|
18876
|
+
* Can be used to check connection.
|
|
18877
|
+
* @example
|
|
18878
|
+
* ```javascript
|
|
18879
|
+
* const connector = new NgwConnector({ baseUrl: 'https://demo.nextgis.com' });
|
|
18880
|
+
* connector.connect()
|
|
18881
|
+
* .then(() => console.log('Ok'))
|
|
18882
|
+
* .catch((er) => console.log('Connection problem', er));
|
|
18883
|
+
* ```
|
|
18884
|
+
*/
|
|
18885
|
+
connect() {
|
|
18886
|
+
return __async$r(this, null, function* () {
|
|
18887
|
+
const auth = this.options.auth;
|
|
18888
|
+
if (auth) {
|
|
18889
|
+
const { login, password } = auth;
|
|
18890
|
+
if (login && password) {
|
|
18891
|
+
yield this._login({ login, password });
|
|
18892
|
+
}
|
|
18893
|
+
}
|
|
18894
|
+
const routeUrl = `${this.routeStr}?client=${this.client}`;
|
|
18895
|
+
return yield this.makeQuery(
|
|
18896
|
+
routeUrl,
|
|
18897
|
+
{},
|
|
18898
|
+
{
|
|
18899
|
+
cacheName: "route",
|
|
18900
|
+
cache: true,
|
|
18901
|
+
cacheProps: {
|
|
18902
|
+
id: this.id,
|
|
18903
|
+
auth,
|
|
18904
|
+
baseUrl: this.options.baseUrl
|
|
18905
|
+
}
|
|
18906
|
+
}
|
|
18907
|
+
);
|
|
18908
|
+
});
|
|
18909
|
+
}
|
|
18910
|
+
/**
|
|
18911
|
+
* Quick way to change NextGIS Web user.
|
|
18912
|
+
* @param credentials - New user credentials
|
|
18913
|
+
*/
|
|
18914
|
+
login(credentials, options) {
|
|
18915
|
+
this.logout();
|
|
18916
|
+
addConnector(this);
|
|
18917
|
+
return this._login(credentials, options);
|
|
18918
|
+
}
|
|
18919
|
+
/**
|
|
18920
|
+
* Disconnecting a user. Aborting all current requests
|
|
18921
|
+
*/
|
|
18922
|
+
logout() {
|
|
18923
|
+
this.abort();
|
|
18924
|
+
removeConnector(this);
|
|
18925
|
+
this.options.auth = void 0;
|
|
18926
|
+
this.user = void 0;
|
|
18927
|
+
this.clearCache();
|
|
18928
|
+
this.emitter.emit("logout");
|
|
18929
|
+
}
|
|
18930
|
+
getUserInfo(credentials, options) {
|
|
18931
|
+
return __async$r(this, null, function* () {
|
|
18932
|
+
if (this.user && this.user.id) {
|
|
18933
|
+
return this.user;
|
|
18934
|
+
}
|
|
18935
|
+
if (credentials) {
|
|
18936
|
+
this.options.auth = credentials;
|
|
18937
|
+
}
|
|
18938
|
+
const options_ = __spreadValues$s({
|
|
18939
|
+
headers: this.getAuthorizationHeaders(credentials),
|
|
18940
|
+
cache: true
|
|
18941
|
+
}, options);
|
|
18942
|
+
return this.makeQuery(
|
|
18943
|
+
"/api/component/auth/current_user",
|
|
18944
|
+
{},
|
|
18945
|
+
options_
|
|
18946
|
+
);
|
|
18947
|
+
});
|
|
18948
|
+
}
|
|
18949
|
+
/**
|
|
18950
|
+
* Obtaining the required Headers for authentication of requests in the NGW.
|
|
18951
|
+
*/
|
|
18952
|
+
getAuthorizationHeaders(credentials) {
|
|
18953
|
+
const client = this.makeClientId(credentials);
|
|
18954
|
+
if (client) {
|
|
18955
|
+
return {
|
|
18956
|
+
Authorization: `Basic ${client}`
|
|
18957
|
+
};
|
|
18958
|
+
}
|
|
18959
|
+
return {};
|
|
18960
|
+
}
|
|
18961
|
+
makeClientId(credentials) {
|
|
18962
|
+
credentials = credentials || this.options.auth;
|
|
18963
|
+
if (credentials) {
|
|
18964
|
+
const { login, password } = credentials;
|
|
18965
|
+
const encodedStr = [login, password].map(encodeURIComponent).join(":");
|
|
18966
|
+
{
|
|
18967
|
+
return window.btoa(encodedStr);
|
|
18968
|
+
}
|
|
18969
|
+
}
|
|
18970
|
+
}
|
|
18971
|
+
/** Stop all api requests */
|
|
18972
|
+
abort() {
|
|
18973
|
+
for (const abortController of Object.values(this.activeRequests)) {
|
|
18974
|
+
abortController.abort();
|
|
18975
|
+
}
|
|
18976
|
+
this.activeRequests = {};
|
|
18977
|
+
}
|
|
18978
|
+
getActiveApiRequests() {
|
|
18979
|
+
return __spreadValues$s({}, this.activeRequests);
|
|
18980
|
+
}
|
|
18981
|
+
route(name, ...rest) {
|
|
18982
|
+
return route(name, this, ...rest);
|
|
18983
|
+
}
|
|
18984
|
+
/**
|
|
18985
|
+
* Send request to NGW.
|
|
18986
|
+
* @param url - URL address to NGW
|
|
18987
|
+
* @param params - Query params
|
|
18988
|
+
* @param options - Request options
|
|
18989
|
+
*/
|
|
18990
|
+
makeQuery(_0, _1) {
|
|
18991
|
+
return __async$r(this, arguments, function* (url, params, options = {}) {
|
|
18992
|
+
var _b;
|
|
18993
|
+
url = (this.options.baseUrl ? this.options.baseUrl : "") + url;
|
|
18994
|
+
if (!url) {
|
|
18995
|
+
throw new Error("Empty `url` not allowed");
|
|
18996
|
+
}
|
|
18997
|
+
if (params) {
|
|
18998
|
+
const _a = params, restParams = __objRest$3(_a, ["paramList"]);
|
|
18999
|
+
url = template(url, restParams);
|
|
19000
|
+
}
|
|
19001
|
+
url = encodeURI(fixUrlStr(url));
|
|
19002
|
+
options = __spreadValues$s({ withCredentials: this.withCredentials }, options);
|
|
19003
|
+
const {
|
|
19004
|
+
cache,
|
|
19005
|
+
signal: externalSignal,
|
|
19006
|
+
method = "GET",
|
|
19007
|
+
headers,
|
|
19008
|
+
cacheName,
|
|
19009
|
+
cacheProps,
|
|
19010
|
+
responseType,
|
|
19011
|
+
withCredentials
|
|
19012
|
+
} = options;
|
|
19013
|
+
const internalAbortController = new AbortController();
|
|
19014
|
+
const internalSignal = internalAbortController.signal;
|
|
19015
|
+
if (externalSignal) {
|
|
19016
|
+
if (externalSignal.aborted) {
|
|
19017
|
+
throw new AbortError();
|
|
19018
|
+
}
|
|
19019
|
+
externalSignal.addEventListener("abort", () => {
|
|
19020
|
+
internalAbortController.abort();
|
|
19021
|
+
});
|
|
19022
|
+
}
|
|
19023
|
+
options.signal = internalSignal;
|
|
19024
|
+
const createPromise = () => __async$r(this, null, function* () {
|
|
19025
|
+
const id = REQUEST_ID++;
|
|
19026
|
+
this.activeRequests[id] = internalAbortController;
|
|
19027
|
+
try {
|
|
19028
|
+
return this._loadData(url, options);
|
|
19029
|
+
} finally {
|
|
19030
|
+
this._cleanActiveRequest(id);
|
|
19031
|
+
}
|
|
19032
|
+
});
|
|
19033
|
+
if (cache && method === "GET") {
|
|
19034
|
+
const cacheOptions = cacheProps ? cacheProps : __spreadProps$h(__spreadValues$s({}, objectRemoveEmpty({
|
|
19035
|
+
headers,
|
|
19036
|
+
withCredentials,
|
|
19037
|
+
responseType,
|
|
19038
|
+
baseUrl: this.options.baseUrl,
|
|
19039
|
+
userId: (_b = this.user) == null ? void 0 : _b.id
|
|
19040
|
+
})), {
|
|
19041
|
+
params
|
|
19042
|
+
});
|
|
19043
|
+
return this.cache.add(
|
|
19044
|
+
cacheName || url,
|
|
19045
|
+
createPromise,
|
|
19046
|
+
cacheOptions,
|
|
19047
|
+
false
|
|
19048
|
+
);
|
|
19049
|
+
}
|
|
19050
|
+
return createPromise();
|
|
19051
|
+
});
|
|
19052
|
+
}
|
|
19053
|
+
_loadData(url, options) {
|
|
19054
|
+
options.responseType = options.responseType || "json";
|
|
19055
|
+
return new Promise((resolve, reject) => {
|
|
19056
|
+
var _a;
|
|
19057
|
+
if (this.user) {
|
|
19058
|
+
options = options || {};
|
|
19059
|
+
options.headers = __spreadValues$s(__spreadValues$s({}, this.getAuthorizationHeaders()), options.headers);
|
|
19060
|
+
}
|
|
19061
|
+
if (this.requestTransform) {
|
|
19062
|
+
const [transUrl, transOptions] = this.requestTransform(url, options);
|
|
19063
|
+
url = transUrl;
|
|
19064
|
+
options = transOptions;
|
|
19065
|
+
}
|
|
19066
|
+
let runOnAbort = void 0;
|
|
19067
|
+
loadData(url, resolve, options, reject, (handler) => {
|
|
19068
|
+
runOnAbort = handler;
|
|
19069
|
+
});
|
|
19070
|
+
(_a = options.signal) == null ? void 0 : _a.addEventListener("abort", () => {
|
|
19071
|
+
if (runOnAbort !== void 0) {
|
|
19072
|
+
runOnAbort();
|
|
19073
|
+
}
|
|
19074
|
+
reject(new AbortError());
|
|
19075
|
+
});
|
|
19076
|
+
}).catch((httpError) => {
|
|
19077
|
+
if (httpError.name !== "AbortError") {
|
|
19078
|
+
{
|
|
19079
|
+
console.warn("DEV WARN", httpError);
|
|
19080
|
+
}
|
|
19081
|
+
const er = this._handleHttpError(httpError);
|
|
19082
|
+
if (er) {
|
|
19083
|
+
throw er;
|
|
19084
|
+
}
|
|
19085
|
+
}
|
|
19086
|
+
throw httpError;
|
|
19087
|
+
});
|
|
19088
|
+
}
|
|
19089
|
+
_login(credentials, options) {
|
|
19090
|
+
return __async$r(this, null, function* () {
|
|
19091
|
+
try {
|
|
19092
|
+
const data = yield this.getUserInfo(credentials, options);
|
|
19093
|
+
this.user = data;
|
|
19094
|
+
this.emitter.emit("login", data);
|
|
19095
|
+
return data;
|
|
19096
|
+
} catch (er) {
|
|
19097
|
+
this.emitter.emit("login:error", er);
|
|
19098
|
+
throw er;
|
|
19099
|
+
}
|
|
19100
|
+
});
|
|
19101
|
+
}
|
|
19102
|
+
_cleanActiveRequest(requestId) {
|
|
19103
|
+
delete this.activeRequests[requestId];
|
|
19104
|
+
}
|
|
19105
|
+
_handleHttpError(er) {
|
|
19106
|
+
if (er) {
|
|
19107
|
+
if (er instanceof NgwError) {
|
|
19108
|
+
if (er.exception === "nextgisweb.resource.exception.ResourceNotFound") {
|
|
19109
|
+
throw new ResourceNotFoundError(er);
|
|
19110
|
+
} else if (er.exception === "nextgisweb.core.exception.InsufficientPermissions") {
|
|
19111
|
+
throw new InsufficientPermissionsError(er);
|
|
19112
|
+
}
|
|
19113
|
+
}
|
|
19114
|
+
}
|
|
19115
|
+
return er;
|
|
19116
|
+
}
|
|
19117
|
+
}
|
|
19118
|
+
__publicField$s(NgwConnector, "errors", {
|
|
19119
|
+
NgwError,
|
|
19120
|
+
ResourceNotFoundError
|
|
19121
|
+
});
|
|
19122
|
+
|
|
19123
|
+
function resourceCompare(res1, res2) {
|
|
19124
|
+
return objectDeepEqual(res1, res2);
|
|
19125
|
+
}
|
|
19126
|
+
|
|
19127
|
+
const exclude = ["description"];
|
|
19128
|
+
function resourceToQuery(resource, prefix = "") {
|
|
19129
|
+
prefix = prefix ? prefix + "__" : "";
|
|
19130
|
+
const query = {};
|
|
19131
|
+
for (const [key, value] of Object.entries(resource)) {
|
|
19132
|
+
if (exclude.indexOf(key) === -1) {
|
|
19133
|
+
if (isObject(value)) {
|
|
19134
|
+
if (key === "owner_user") {
|
|
19135
|
+
const children = resourceToQuery(value, key);
|
|
19136
|
+
Object.assign(query, children);
|
|
19137
|
+
} else if (key === "parent" && "id" in value) {
|
|
19138
|
+
query.parent_id = value.id;
|
|
19139
|
+
}
|
|
19140
|
+
} else if (defined(value)) {
|
|
19141
|
+
query[prefix + key] = value;
|
|
19142
|
+
}
|
|
19143
|
+
}
|
|
19144
|
+
}
|
|
19145
|
+
return query;
|
|
19146
|
+
}
|
|
19147
|
+
|
|
19148
|
+
var __defProp$D = Object.defineProperty;
|
|
19149
|
+
var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
|
|
19150
|
+
var __hasOwnProp$s = Object.prototype.hasOwnProperty;
|
|
19151
|
+
var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
|
|
19152
|
+
var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
19153
|
+
var __spreadValues$r = (a, b) => {
|
|
19154
|
+
for (var prop in b || (b = {}))
|
|
19155
|
+
if (__hasOwnProp$s.call(b, prop))
|
|
19156
|
+
__defNormalProp$D(a, prop, b[prop]);
|
|
19157
|
+
if (__getOwnPropSymbols$s)
|
|
19158
|
+
for (var prop of __getOwnPropSymbols$s(b)) {
|
|
19159
|
+
if (__propIsEnum$s.call(b, prop))
|
|
19160
|
+
__defNormalProp$D(a, prop, b[prop]);
|
|
19161
|
+
}
|
|
19162
|
+
return a;
|
|
19163
|
+
};
|
|
19164
|
+
var __publicField$r = (obj, key, value) => __defNormalProp$D(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
19165
|
+
var __async$q = (__this, __arguments, generator) => {
|
|
19166
|
+
return new Promise((resolve, reject) => {
|
|
19167
|
+
var fulfilled = (value) => {
|
|
19168
|
+
try {
|
|
19169
|
+
step(generator.next(value));
|
|
19170
|
+
} catch (e) {
|
|
19171
|
+
reject(e);
|
|
19172
|
+
}
|
|
19173
|
+
};
|
|
19174
|
+
var rejected = (value) => {
|
|
19175
|
+
try {
|
|
19176
|
+
step(generator.throw(value));
|
|
19177
|
+
} catch (e) {
|
|
19178
|
+
reject(e);
|
|
19179
|
+
}
|
|
19180
|
+
};
|
|
19181
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
19182
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19183
|
+
});
|
|
19184
|
+
};
|
|
19185
|
+
class ResourcesControl {
|
|
19186
|
+
constructor({
|
|
19187
|
+
connector,
|
|
19188
|
+
cacheId
|
|
19189
|
+
}) {
|
|
19190
|
+
__publicField$r(this, "cache");
|
|
19191
|
+
__publicField$r(this, "connector");
|
|
19192
|
+
this.connector = connector;
|
|
19193
|
+
this.cache = new Cache({ namespace: cacheId });
|
|
19194
|
+
}
|
|
19195
|
+
// -------------------------------------------------------------------------
|
|
19196
|
+
// Resource Methods
|
|
19197
|
+
// -------------------------------------------------------------------------
|
|
19198
|
+
/**
|
|
19199
|
+
* Receive resource from NGW by id, keyname or search-object parameter.
|
|
19200
|
+
* @param resource - Resource id, keyname or search-object
|
|
19201
|
+
*
|
|
19202
|
+
* @remarks
|
|
19203
|
+
* Fetching resource would be cached to speed up next call
|
|
19204
|
+
*/
|
|
19205
|
+
getOne(resource, requestOptions) {
|
|
19206
|
+
const opt = __spreadValues$r({}, requestOptions);
|
|
19207
|
+
if (typeof resource === "string") ; else if (typeof resource === "number") ; else if (isObject(resource)) {
|
|
19208
|
+
if (resource.id !== void 0) {
|
|
19209
|
+
resource.id;
|
|
19210
|
+
} else {
|
|
19211
|
+
if (resource.keyname) {
|
|
19212
|
+
resource.keyname;
|
|
19213
|
+
}
|
|
19214
|
+
if (resource.display_name) {
|
|
19215
|
+
resource.display_name;
|
|
19216
|
+
}
|
|
19217
|
+
}
|
|
19218
|
+
}
|
|
19219
|
+
if (typeof resource === "string") {
|
|
19220
|
+
return this._fetchResourceBy({ keyname: resource }, opt);
|
|
19221
|
+
} else if (typeof resource === "number") {
|
|
19222
|
+
return this._fetchResourceById(resource, opt);
|
|
19223
|
+
} else if (isObject(resource)) {
|
|
19224
|
+
return this._fetchResourceBy(resource, opt);
|
|
19225
|
+
}
|
|
19226
|
+
return Promise.resolve(void 0);
|
|
19227
|
+
}
|
|
19228
|
+
getOneOrFail(resource, requestOptions) {
|
|
19229
|
+
return this.getOne(resource, requestOptions).then((res) => {
|
|
19230
|
+
if (res) {
|
|
19231
|
+
return res;
|
|
19232
|
+
}
|
|
19233
|
+
throw new ResourceNotFoundError();
|
|
19234
|
+
});
|
|
19235
|
+
}
|
|
19236
|
+
/**
|
|
19237
|
+
* A fast way to retrieve resource ID for any resource definition.
|
|
19238
|
+
* @param resource - Any available resource definition
|
|
19239
|
+
*
|
|
19240
|
+
* @remarks
|
|
18296
19241
|
* There are situations when exactly the resource id is needed
|
|
18297
19242
|
* (for example, to compose the correct request to the api)
|
|
18298
19243
|
* then this method will come in handy to facilitate the extraction of the identifier
|
|
@@ -18335,7 +19280,7 @@ class ResourcesControl {
|
|
|
18335
19280
|
} else {
|
|
18336
19281
|
Object.assign(query, resourceToQuery(resource));
|
|
18337
19282
|
}
|
|
18338
|
-
return this.connector.get("resource.search", requestOptions, __spreadValues$
|
|
19283
|
+
return this.connector.get("resource.search", requestOptions, __spreadValues$r({
|
|
18339
19284
|
serialization: "full"
|
|
18340
19285
|
}, query)).then((resources) => {
|
|
18341
19286
|
if ((requestOptions == null ? void 0 : requestOptions.cache) && resources) {
|
|
@@ -18396,345 +19341,91 @@ class ResourcesControl {
|
|
|
18396
19341
|
id: item.resource.id
|
|
18397
19342
|
});
|
|
18398
19343
|
}
|
|
18399
|
-
_items.push(item);
|
|
18400
|
-
if ((requestOptions == null ? void 0 : requestOptions.recursive) && item.resource.children) {
|
|
18401
|
-
recursivePromises.push(
|
|
18402
|
-
this._getChildrenOf(item.resource.id, requestOptions, _items)
|
|
18403
|
-
);
|
|
18404
|
-
}
|
|
18405
|
-
}
|
|
18406
|
-
if (recursivePromises.length) {
|
|
18407
|
-
return Promise.all(recursivePromises).then(() => {
|
|
18408
|
-
return _items;
|
|
18409
|
-
});
|
|
18410
|
-
}
|
|
18411
|
-
return _items;
|
|
18412
|
-
});
|
|
18413
|
-
}
|
|
18414
|
-
_cleanResourceItemCache(id) {
|
|
18415
|
-
return __async$r(this, null, function* () {
|
|
18416
|
-
var _a;
|
|
18417
|
-
const all = this.cache.all();
|
|
18418
|
-
const toDelete = [];
|
|
18419
|
-
for (const c of all) {
|
|
18420
|
-
const cid = (_a = c.props) == null ? void 0 : _a.id;
|
|
18421
|
-
if (["resource.item", "resource"].includes(c.key) && cid !== void 0) {
|
|
18422
|
-
if (typeof cid === "number") {
|
|
18423
|
-
if (cid === id) {
|
|
18424
|
-
toDelete.push(c);
|
|
18425
|
-
}
|
|
18426
|
-
} else {
|
|
18427
|
-
const rid = yield this.getId(cid);
|
|
18428
|
-
if (rid === id) {
|
|
18429
|
-
toDelete.push(c);
|
|
18430
|
-
}
|
|
18431
|
-
}
|
|
18432
|
-
}
|
|
18433
|
-
}
|
|
18434
|
-
for (const d of toDelete) {
|
|
18435
|
-
this.cache.delete(d);
|
|
18436
|
-
}
|
|
18437
|
-
});
|
|
18438
|
-
}
|
|
18439
|
-
_fetchResourceById(id, requestOptions) {
|
|
18440
|
-
return this.connector.get("resource.item", requestOptions, { id });
|
|
18441
|
-
}
|
|
18442
|
-
_fetchResourceBy(resource, requestOptions) {
|
|
18443
|
-
return this.getMany(resource, requestOptions).then((resources) => {
|
|
18444
|
-
return resources[0];
|
|
18445
|
-
});
|
|
18446
|
-
}
|
|
18447
|
-
_resourceCacheFilter(resource) {
|
|
18448
|
-
return Promise.all(this.cache.matchAll("resource.item")).then(
|
|
18449
|
-
(resources) => {
|
|
18450
|
-
const items = [];
|
|
18451
|
-
resources.filter((x) => {
|
|
18452
|
-
if (x) {
|
|
18453
|
-
if (resource.keyname && x.resource.keyname) {
|
|
18454
|
-
return resource.keyname === x.resource.keyname;
|
|
18455
|
-
}
|
|
18456
|
-
if (defined(resource.id) && defined(x.resource.id)) {
|
|
18457
|
-
return resource.id === x.resource.id;
|
|
18458
|
-
}
|
|
18459
|
-
return resourceCompare(resource, x.resource);
|
|
18460
|
-
}
|
|
18461
|
-
});
|
|
18462
|
-
return items;
|
|
18463
|
-
}
|
|
18464
|
-
);
|
|
18465
|
-
}
|
|
18466
|
-
}
|
|
18467
|
-
|
|
18468
|
-
const CONNECTORS = [];
|
|
18469
|
-
function addConnector(connector) {
|
|
18470
|
-
CONNECTORS.push(connector);
|
|
18471
|
-
}
|
|
18472
|
-
function findConnector(options) {
|
|
18473
|
-
return CONNECTORS.find((x) => {
|
|
18474
|
-
if (x.options.baseUrl === options.baseUrl) {
|
|
18475
|
-
if (options.auth) {
|
|
18476
|
-
if (x.options.auth) {
|
|
18477
|
-
return objectDeepEqual(x.options.auth, options.auth);
|
|
18478
|
-
}
|
|
18479
|
-
} else {
|
|
18480
|
-
return true;
|
|
18481
|
-
}
|
|
18482
|
-
}
|
|
18483
|
-
});
|
|
18484
|
-
}
|
|
18485
|
-
function removeConnector(connector) {
|
|
18486
|
-
const index = CONNECTORS.indexOf(connector);
|
|
18487
|
-
if (index !== -1) {
|
|
18488
|
-
CONNECTORS.splice(index, 1);
|
|
18489
|
-
}
|
|
18490
|
-
}
|
|
18491
|
-
|
|
18492
|
-
class AbortError extends Error {
|
|
18493
|
-
constructor(message = "AbortError") {
|
|
18494
|
-
super(message);
|
|
18495
|
-
this.name = "AbortError";
|
|
18496
|
-
}
|
|
18497
|
-
}
|
|
18498
|
-
|
|
18499
|
-
var __defProp$E = Object.defineProperty;
|
|
18500
|
-
var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18501
|
-
var __publicField$s = (obj, key, value) => __defNormalProp$E(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18502
|
-
class InsufficientPermissionsError extends NgwError {
|
|
18503
|
-
constructor(obj) {
|
|
18504
|
-
super(obj);
|
|
18505
|
-
__publicField$s(this, "name", "InsufficientPermissionsError");
|
|
18506
|
-
__publicField$s(this, "exception", "nextgisweb.core.exception.InsufficientPermissions");
|
|
18507
|
-
Object.setPrototypeOf(this, InsufficientPermissionsError.prototype);
|
|
18508
|
-
}
|
|
18509
|
-
}
|
|
18510
|
-
|
|
18511
|
-
const templateRe = /\{ *([\w_-]+) *\}/g;
|
|
18512
|
-
function template(str, data) {
|
|
18513
|
-
return str.replace(templateRe, (s, key) => {
|
|
18514
|
-
let value = data[key];
|
|
18515
|
-
if (value === void 0) {
|
|
18516
|
-
throw new Error("No value provided for letiable " + s);
|
|
18517
|
-
} else if (typeof value === "function") {
|
|
18518
|
-
value = value(data);
|
|
18519
|
-
}
|
|
18520
|
-
return value;
|
|
18521
|
-
});
|
|
18522
|
-
}
|
|
18523
|
-
|
|
18524
|
-
var __defProp$D = Object.defineProperty;
|
|
18525
|
-
var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
|
|
18526
|
-
var __hasOwnProp$s = Object.prototype.hasOwnProperty;
|
|
18527
|
-
var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
|
|
18528
|
-
var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18529
|
-
var __spreadValues$r = (a, b) => {
|
|
18530
|
-
for (var prop in b || (b = {}))
|
|
18531
|
-
if (__hasOwnProp$s.call(b, prop))
|
|
18532
|
-
__defNormalProp$D(a, prop, b[prop]);
|
|
18533
|
-
if (__getOwnPropSymbols$s)
|
|
18534
|
-
for (var prop of __getOwnPropSymbols$s(b)) {
|
|
18535
|
-
if (__propIsEnum$s.call(b, prop))
|
|
18536
|
-
__defNormalProp$D(a, prop, b[prop]);
|
|
18537
|
-
}
|
|
18538
|
-
return a;
|
|
18539
|
-
};
|
|
18540
|
-
var __async$q = (__this, __arguments, generator) => {
|
|
18541
|
-
return new Promise((resolve, reject) => {
|
|
18542
|
-
var fulfilled = (value) => {
|
|
18543
|
-
try {
|
|
18544
|
-
step(generator.next(value));
|
|
18545
|
-
} catch (e) {
|
|
18546
|
-
reject(e);
|
|
18547
|
-
}
|
|
18548
|
-
};
|
|
18549
|
-
var rejected = (value) => {
|
|
18550
|
-
try {
|
|
18551
|
-
step(generator.throw(value));
|
|
18552
|
-
} catch (e) {
|
|
18553
|
-
reject(e);
|
|
18554
|
-
}
|
|
18555
|
-
};
|
|
18556
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18557
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
18558
|
-
});
|
|
18559
|
-
};
|
|
18560
|
-
function apiRequest(opt) {
|
|
18561
|
-
return __async$q(this, null, function* () {
|
|
18562
|
-
const { params, name, connector, requestOptions } = opt;
|
|
18563
|
-
const apiItems = yield connector.connect();
|
|
18564
|
-
let apiItem = apiItems && apiItems[name];
|
|
18565
|
-
if (apiItem) {
|
|
18566
|
-
apiItem = [...apiItem];
|
|
18567
|
-
let url = apiItem.shift();
|
|
18568
|
-
if (apiItem.length) {
|
|
18569
|
-
const replaceParams = {};
|
|
18570
|
-
for (let fry = 0; fry < apiItem.length; fry++) {
|
|
18571
|
-
const arg = apiItem[fry];
|
|
18572
|
-
replaceParams[fry] = `{${arg}}`;
|
|
18573
|
-
if (params[arg] === void 0) {
|
|
18574
|
-
throw new Error(`\`${arg}\` URL API argument is not specified`);
|
|
18575
|
-
}
|
|
18576
|
-
}
|
|
18577
|
-
if (url) {
|
|
18578
|
-
url = template(url, replaceParams);
|
|
18579
|
-
}
|
|
18580
|
-
}
|
|
18581
|
-
if (params) {
|
|
18582
|
-
const paramArray = [];
|
|
18583
|
-
const paramList = params.paramList;
|
|
18584
|
-
if (Array.isArray(paramList)) {
|
|
18585
|
-
paramList.forEach(([key, value]) => {
|
|
18586
|
-
paramArray.push(`${key}=${value}`);
|
|
18587
|
-
});
|
|
18588
|
-
}
|
|
18589
|
-
for (const p in params) {
|
|
18590
|
-
if (apiItem.indexOf(p) === -1) {
|
|
18591
|
-
paramArray.push(`${p}=${params[p]}`);
|
|
18592
|
-
}
|
|
18593
|
-
}
|
|
18594
|
-
if (paramArray.length) {
|
|
18595
|
-
url = `${url}?${paramArray.join("&")}`;
|
|
19344
|
+
_items.push(item);
|
|
19345
|
+
if ((requestOptions == null ? void 0 : requestOptions.recursive) && item.resource.children) {
|
|
19346
|
+
recursivePromises.push(
|
|
19347
|
+
this._getChildrenOf(item.resource.id, requestOptions, _items)
|
|
19348
|
+
);
|
|
18596
19349
|
}
|
|
18597
19350
|
}
|
|
18598
|
-
if (
|
|
18599
|
-
return
|
|
18600
|
-
|
|
18601
|
-
}
|
|
18602
|
-
} else {
|
|
18603
|
-
throw new Error("Request URL is not set");
|
|
19351
|
+
if (recursivePromises.length) {
|
|
19352
|
+
return Promise.all(recursivePromises).then(() => {
|
|
19353
|
+
return _items;
|
|
19354
|
+
});
|
|
18604
19355
|
}
|
|
18605
|
-
|
|
18606
|
-
|
|
18607
|
-
}
|
|
18608
|
-
});
|
|
18609
|
-
}
|
|
18610
|
-
|
|
18611
|
-
var __defProp$C = Object.defineProperty;
|
|
18612
|
-
var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18613
|
-
var __publicField$r = (obj, key, value) => __defNormalProp$C(obj, key + "" , value);
|
|
18614
|
-
class NetworkError extends Error {
|
|
18615
|
-
constructor(url) {
|
|
18616
|
-
super();
|
|
18617
|
-
__publicField$r(this, "name", "NetworkError");
|
|
18618
|
-
Object.setPrototypeOf(this, NetworkError.prototype);
|
|
18619
|
-
this.message = `Unable to request ${url}.
|
|
18620
|
-
Possibly invalid NGW URL entered or CORS not configured to get request from ${location.origin}`;
|
|
19356
|
+
return _items;
|
|
19357
|
+
});
|
|
18621
19358
|
}
|
|
18622
|
-
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
|
|
18627
|
-
|
|
18628
|
-
|
|
18629
|
-
|
|
18630
|
-
|
|
18631
|
-
|
|
18632
|
-
|
|
18633
|
-
|
|
18634
|
-
|
|
18635
|
-
|
|
18636
|
-
|
|
18637
|
-
|
|
18638
|
-
|
|
18639
|
-
|
|
18640
|
-
const processingResponse = (forError = false) => {
|
|
18641
|
-
const cb = forError ? error : callback;
|
|
18642
|
-
if (options.responseType === "blob") {
|
|
18643
|
-
cb(xhr.response);
|
|
18644
|
-
} else {
|
|
18645
|
-
if (xhr.responseText) {
|
|
18646
|
-
cb(getResponseText());
|
|
18647
|
-
} else {
|
|
18648
|
-
error({ message: "" });
|
|
18649
|
-
}
|
|
18650
|
-
}
|
|
18651
|
-
};
|
|
18652
|
-
xhr.onload = () => {
|
|
18653
|
-
if ([401, 403, 404, 422, 500].indexOf(xhr.status) !== -1) {
|
|
18654
|
-
error(new NgwError(getResponseText()));
|
|
18655
|
-
}
|
|
18656
|
-
processingResponse();
|
|
18657
|
-
};
|
|
18658
|
-
xhr.onerror = (er) => {
|
|
18659
|
-
if (xhr.status === 0) {
|
|
18660
|
-
error(new NetworkError(url));
|
|
18661
|
-
} else {
|
|
18662
|
-
error(er);
|
|
18663
|
-
}
|
|
18664
|
-
};
|
|
18665
|
-
xhr.upload.onprogress = function(e) {
|
|
18666
|
-
if (e.lengthComputable) {
|
|
18667
|
-
const percentComplete = e.loaded / e.total * 100;
|
|
18668
|
-
if (options.onProgress) {
|
|
18669
|
-
options.onProgress(percentComplete, e);
|
|
19359
|
+
_cleanResourceItemCache(id) {
|
|
19360
|
+
return __async$q(this, null, function* () {
|
|
19361
|
+
var _a;
|
|
19362
|
+
const all = this.cache.all();
|
|
19363
|
+
const toDelete = [];
|
|
19364
|
+
for (const c of all) {
|
|
19365
|
+
const cid = (_a = c.props) == null ? void 0 : _a.id;
|
|
19366
|
+
if (["resource.item", "resource"].includes(c.key) && cid !== void 0) {
|
|
19367
|
+
if (typeof cid === "number") {
|
|
19368
|
+
if (cid === id) {
|
|
19369
|
+
toDelete.push(c);
|
|
19370
|
+
}
|
|
19371
|
+
} else {
|
|
19372
|
+
const rid = yield this.getId(cid);
|
|
19373
|
+
if (rid === id) {
|
|
19374
|
+
toDelete.push(c);
|
|
19375
|
+
}
|
|
19376
|
+
}
|
|
18670
19377
|
}
|
|
18671
19378
|
}
|
|
18672
|
-
|
|
18673
|
-
|
|
18674
|
-
if (headers) {
|
|
18675
|
-
for (const h in headers) {
|
|
18676
|
-
const header = headers[h];
|
|
18677
|
-
if (typeof header === "string") {
|
|
18678
|
-
xhr.setRequestHeader(h, header);
|
|
18679
|
-
}
|
|
19379
|
+
for (const d of toDelete) {
|
|
19380
|
+
this.cache.delete(d);
|
|
18680
19381
|
}
|
|
18681
|
-
}
|
|
18682
|
-
|
|
18683
|
-
|
|
18684
|
-
}
|
|
18685
|
-
|
|
18686
|
-
|
|
18687
|
-
|
|
18688
|
-
|
|
18689
|
-
|
|
18690
|
-
|
|
18691
|
-
|
|
18692
|
-
|
|
19382
|
+
});
|
|
19383
|
+
}
|
|
19384
|
+
_fetchResourceById(id, requestOptions) {
|
|
19385
|
+
return this.connector.get("resource.item", requestOptions, { id });
|
|
19386
|
+
}
|
|
19387
|
+
_fetchResourceBy(resource, requestOptions) {
|
|
19388
|
+
return this.getMany(resource, requestOptions).then((resources) => {
|
|
19389
|
+
return resources[0];
|
|
19390
|
+
});
|
|
19391
|
+
}
|
|
19392
|
+
_resourceCacheFilter(resource) {
|
|
19393
|
+
return Promise.all(this.cache.matchAll("resource.item")).then(
|
|
19394
|
+
(resources) => {
|
|
19395
|
+
const items = [];
|
|
19396
|
+
resources.filter((x) => {
|
|
19397
|
+
if (x) {
|
|
19398
|
+
if (resource.keyname && x.resource.keyname) {
|
|
19399
|
+
return resource.keyname === x.resource.keyname;
|
|
19400
|
+
}
|
|
19401
|
+
if (defined(resource.id) && defined(x.resource.id)) {
|
|
19402
|
+
return resource.id === x.resource.id;
|
|
19403
|
+
}
|
|
19404
|
+
return resourceCompare(resource, x.resource);
|
|
19405
|
+
}
|
|
19406
|
+
});
|
|
19407
|
+
return items;
|
|
18693
19408
|
}
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
}
|
|
18697
|
-
if (onCancel) {
|
|
18698
|
-
onCancel(() => {
|
|
18699
|
-
xhr.abort();
|
|
18700
|
-
});
|
|
18701
|
-
}
|
|
18702
|
-
xhr.send(data);
|
|
18703
|
-
};
|
|
19409
|
+
);
|
|
19410
|
+
}
|
|
18704
19411
|
}
|
|
18705
19412
|
|
|
18706
|
-
var __defProp$
|
|
18707
|
-
var __defProps$h = Object.defineProperties;
|
|
18708
|
-
var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
|
|
19413
|
+
var __defProp$C = Object.defineProperty;
|
|
18709
19414
|
var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
|
|
18710
19415
|
var __hasOwnProp$r = Object.prototype.hasOwnProperty;
|
|
18711
19416
|
var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
|
|
18712
|
-
var __defNormalProp$
|
|
19417
|
+
var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
18713
19418
|
var __spreadValues$q = (a, b) => {
|
|
18714
19419
|
for (var prop in b || (b = {}))
|
|
18715
19420
|
if (__hasOwnProp$r.call(b, prop))
|
|
18716
|
-
__defNormalProp$
|
|
19421
|
+
__defNormalProp$C(a, prop, b[prop]);
|
|
18717
19422
|
if (__getOwnPropSymbols$r)
|
|
18718
19423
|
for (var prop of __getOwnPropSymbols$r(b)) {
|
|
18719
19424
|
if (__propIsEnum$r.call(b, prop))
|
|
18720
|
-
__defNormalProp$
|
|
19425
|
+
__defNormalProp$C(a, prop, b[prop]);
|
|
18721
19426
|
}
|
|
18722
19427
|
return a;
|
|
18723
19428
|
};
|
|
18724
|
-
var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
|
|
18725
|
-
var __objRest$3 = (source, exclude) => {
|
|
18726
|
-
var target = {};
|
|
18727
|
-
for (var prop in source)
|
|
18728
|
-
if (__hasOwnProp$r.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
18729
|
-
target[prop] = source[prop];
|
|
18730
|
-
if (source != null && __getOwnPropSymbols$r)
|
|
18731
|
-
for (var prop of __getOwnPropSymbols$r(source)) {
|
|
18732
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$r.call(source, prop))
|
|
18733
|
-
target[prop] = source[prop];
|
|
18734
|
-
}
|
|
18735
|
-
return target;
|
|
18736
|
-
};
|
|
18737
|
-
var __publicField$q = (obj, key, value) => __defNormalProp$B(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
18738
19429
|
var __async$p = (__this, __arguments, generator) => {
|
|
18739
19430
|
return new Promise((resolve, reject) => {
|
|
18740
19431
|
var fulfilled = (value) => {
|
|
@@ -18755,172 +19446,76 @@ var __async$p = (__this, __arguments, generator) => {
|
|
|
18755
19446
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
18756
19447
|
});
|
|
18757
19448
|
};
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
|
|
18761
|
-
|
|
18762
|
-
|
|
18763
|
-
|
|
18764
|
-
|
|
18765
|
-
|
|
18766
|
-
|
|
18767
|
-
|
|
18768
|
-
|
|
18769
|
-
|
|
18770
|
-
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
} else {
|
|
18778
|
-
const { route, requestTransform, withCredentials } = this.options;
|
|
18779
|
-
if (route) {
|
|
18780
|
-
this.routeStr = route;
|
|
18781
|
-
}
|
|
18782
|
-
if (requestTransform) {
|
|
18783
|
-
this.requestTransform = requestTransform;
|
|
18784
|
-
}
|
|
18785
|
-
if (withCredentials !== void 0) {
|
|
18786
|
-
this.withCredentials = withCredentials;
|
|
18787
|
-
}
|
|
18788
|
-
this.resources = new ResourcesControl({
|
|
18789
|
-
connector: this,
|
|
18790
|
-
cacheId: options.cacheId
|
|
18791
|
-
});
|
|
18792
|
-
addConnector(this);
|
|
18793
|
-
}
|
|
18794
|
-
}
|
|
18795
|
-
static create(options) {
|
|
18796
|
-
return new this(options);
|
|
18797
|
-
}
|
|
18798
|
-
/**
|
|
18799
|
-
* Clear the cache.
|
|
18800
|
-
*/
|
|
18801
|
-
clearCache() {
|
|
18802
|
-
this.cache.clean();
|
|
18803
|
-
this.resources.cache.clean();
|
|
18804
|
-
}
|
|
18805
|
-
setRequestTransform(requestTransform) {
|
|
18806
|
-
this.requestTransform = requestTransform;
|
|
18807
|
-
}
|
|
18808
|
-
/**
|
|
18809
|
-
* Fast way to specify the connection address to NextGIS Web.
|
|
18810
|
-
* The current connection will be severed.
|
|
18811
|
-
* @param baseUrl - NGW url
|
|
18812
|
-
*/
|
|
18813
|
-
setNgw(baseUrl) {
|
|
18814
|
-
this.logout();
|
|
18815
|
-
this.options.baseUrl = baseUrl;
|
|
18816
|
-
addConnector(this);
|
|
18817
|
-
}
|
|
18818
|
-
/**
|
|
18819
|
-
* Establishing a connection with NextGIS Web to fulfill all other requests.
|
|
18820
|
-
* @remarks
|
|
18821
|
-
* This method need not be called manually as it is used when forming a request in {@link apiRequest | apiRequest}.
|
|
18822
|
-
* Can be used to check connection.
|
|
18823
|
-
* @example
|
|
18824
|
-
* ```javascript
|
|
18825
|
-
* const connector = new NgwConnector({baseUrl: 'https://demo.nextgis.com'});
|
|
18826
|
-
* connector.connect()
|
|
18827
|
-
* .then(() => console.log('Ok'))
|
|
18828
|
-
* .catch((er) => console.log('Connection problem', er));
|
|
18829
|
-
* ```
|
|
18830
|
-
*/
|
|
18831
|
-
connect() {
|
|
18832
|
-
return __async$p(this, null, function* () {
|
|
18833
|
-
const auth = this.options.auth;
|
|
18834
|
-
if (auth) {
|
|
18835
|
-
const { login, password } = auth;
|
|
18836
|
-
if (login && password) {
|
|
18837
|
-
yield this._login({ login, password });
|
|
19449
|
+
function apiRequest(opt) {
|
|
19450
|
+
return __async$p(this, null, function* () {
|
|
19451
|
+
const { params, name, connector, requestOptions } = opt;
|
|
19452
|
+
const apiItems = yield connector.connect();
|
|
19453
|
+
let apiItem = apiItems && apiItems[name];
|
|
19454
|
+
if (apiItem) {
|
|
19455
|
+
apiItem = [...apiItem];
|
|
19456
|
+
let url = apiItem.shift();
|
|
19457
|
+
if (apiItem.length) {
|
|
19458
|
+
const replaceParams = {};
|
|
19459
|
+
for (let fry = 0; fry < apiItem.length; fry++) {
|
|
19460
|
+
const arg = apiItem[fry];
|
|
19461
|
+
replaceParams[fry] = `{${arg}}`;
|
|
19462
|
+
if (params[arg] === void 0) {
|
|
19463
|
+
throw new Error(`\`${arg}\` URL API argument is not specified`);
|
|
19464
|
+
}
|
|
19465
|
+
}
|
|
19466
|
+
if (url) {
|
|
19467
|
+
url = template(url, replaceParams);
|
|
18838
19468
|
}
|
|
18839
19469
|
}
|
|
18840
|
-
|
|
18841
|
-
|
|
18842
|
-
|
|
18843
|
-
{
|
|
18844
|
-
|
|
18845
|
-
|
|
18846
|
-
|
|
18847
|
-
|
|
18848
|
-
|
|
18849
|
-
|
|
18850
|
-
|
|
19470
|
+
if (params) {
|
|
19471
|
+
const paramArray = [];
|
|
19472
|
+
const paramList = params.paramList;
|
|
19473
|
+
if (Array.isArray(paramList)) {
|
|
19474
|
+
paramList.forEach(([key, value]) => {
|
|
19475
|
+
paramArray.push(`${key}=${value}`);
|
|
19476
|
+
});
|
|
19477
|
+
}
|
|
19478
|
+
for (const p in params) {
|
|
19479
|
+
if (apiItem.indexOf(p) === -1) {
|
|
19480
|
+
paramArray.push(`${p}=${params[p]}`);
|
|
18851
19481
|
}
|
|
18852
19482
|
}
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
|
|
18856
|
-
/**
|
|
18857
|
-
* Quick way to change NextGIS Web user.
|
|
18858
|
-
* @param credentials - New user credentials
|
|
18859
|
-
*/
|
|
18860
|
-
login(credentials, options) {
|
|
18861
|
-
this.logout();
|
|
18862
|
-
addConnector(this);
|
|
18863
|
-
return this._login(credentials, options);
|
|
18864
|
-
}
|
|
18865
|
-
/**
|
|
18866
|
-
* Disconnecting a user. Aborting all current requests
|
|
18867
|
-
*/
|
|
18868
|
-
logout() {
|
|
18869
|
-
this.abort();
|
|
18870
|
-
removeConnector(this);
|
|
18871
|
-
this.options.auth = void 0;
|
|
18872
|
-
this.user = void 0;
|
|
18873
|
-
this.clearCache();
|
|
18874
|
-
this.emitter.emit("logout");
|
|
18875
|
-
}
|
|
18876
|
-
getUserInfo(credentials, options) {
|
|
18877
|
-
return __async$p(this, null, function* () {
|
|
18878
|
-
if (this.user && this.user.id) {
|
|
18879
|
-
return this.user;
|
|
19483
|
+
if (paramArray.length) {
|
|
19484
|
+
url = `${url}?${paramArray.join("&")}`;
|
|
19485
|
+
}
|
|
18880
19486
|
}
|
|
18881
|
-
if (
|
|
18882
|
-
|
|
19487
|
+
if (url) {
|
|
19488
|
+
return connector.makeQuery(url, params, __spreadValues$q({
|
|
19489
|
+
cacheName: name
|
|
19490
|
+
}, requestOptions));
|
|
19491
|
+
} else {
|
|
19492
|
+
throw new Error("Request URL is not set");
|
|
18883
19493
|
}
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
|
|
18887
|
-
|
|
18888
|
-
|
|
18889
|
-
|
|
18890
|
-
|
|
18891
|
-
|
|
19494
|
+
} else {
|
|
19495
|
+
return void 0;
|
|
19496
|
+
}
|
|
19497
|
+
});
|
|
19498
|
+
}
|
|
19499
|
+
|
|
19500
|
+
var __defProp$B = Object.defineProperty;
|
|
19501
|
+
var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
19502
|
+
var __publicField$q = (obj, key, value) => __defNormalProp$B(obj, key + "" , value);
|
|
19503
|
+
class NgwConnectorExtended extends NgwConnector {
|
|
19504
|
+
constructor(options) {
|
|
19505
|
+
super(options);
|
|
19506
|
+
this.options = options;
|
|
19507
|
+
__publicField$q(this, "resources");
|
|
19508
|
+
this.resources = new ResourcesControl({
|
|
19509
|
+
connector: this,
|
|
19510
|
+
cacheId: options.cacheId
|
|
18892
19511
|
});
|
|
18893
19512
|
}
|
|
18894
19513
|
/**
|
|
18895
|
-
*
|
|
19514
|
+
* Clear the cache.
|
|
18896
19515
|
*/
|
|
18897
|
-
|
|
18898
|
-
|
|
18899
|
-
|
|
18900
|
-
return {
|
|
18901
|
-
Authorization: `Basic ${client}`
|
|
18902
|
-
};
|
|
18903
|
-
}
|
|
18904
|
-
}
|
|
18905
|
-
makeClientId(credentials) {
|
|
18906
|
-
credentials = credentials || this.options.auth;
|
|
18907
|
-
if (credentials) {
|
|
18908
|
-
const { login, password } = credentials;
|
|
18909
|
-
const encodedStr = [login, password].map(encodeURIComponent).join(":");
|
|
18910
|
-
{
|
|
18911
|
-
return window.btoa(encodedStr);
|
|
18912
|
-
}
|
|
18913
|
-
}
|
|
18914
|
-
}
|
|
18915
|
-
/** Stop all api requests */
|
|
18916
|
-
abort() {
|
|
18917
|
-
for (const abortController of Object.values(this.activeRequests)) {
|
|
18918
|
-
abortController.abort();
|
|
18919
|
-
}
|
|
18920
|
-
this.activeRequests = {};
|
|
18921
|
-
}
|
|
18922
|
-
getActiveApiRequests() {
|
|
18923
|
-
return __spreadValues$q({}, this.activeRequests);
|
|
19516
|
+
clearCache() {
|
|
19517
|
+
super.clearCache();
|
|
19518
|
+
this.resources.cache.clean();
|
|
18924
19519
|
}
|
|
18925
19520
|
/**
|
|
18926
19521
|
* Send request to NGW api router.
|
|
@@ -19039,75 +19634,6 @@ class NgwConnector {
|
|
|
19039
19634
|
options
|
|
19040
19635
|
);
|
|
19041
19636
|
}
|
|
19042
|
-
/**
|
|
19043
|
-
* Send request to NGW.
|
|
19044
|
-
* @param url - URL address to NGW
|
|
19045
|
-
* @param params - Query params
|
|
19046
|
-
* @param options - Request options
|
|
19047
|
-
*/
|
|
19048
|
-
makeQuery(_0, _1) {
|
|
19049
|
-
return __async$p(this, arguments, function* (url, params, options = {}) {
|
|
19050
|
-
var _b;
|
|
19051
|
-
url = (this.options.baseUrl ? this.options.baseUrl : "") + url;
|
|
19052
|
-
if (!url) {
|
|
19053
|
-
throw new Error("Empty `url` not allowed");
|
|
19054
|
-
}
|
|
19055
|
-
if (params) {
|
|
19056
|
-
const _a = params, restParams = __objRest$3(_a, ["paramList"]);
|
|
19057
|
-
url = template(url, restParams);
|
|
19058
|
-
}
|
|
19059
|
-
url = encodeURI(fixUrlStr(url));
|
|
19060
|
-
options = __spreadValues$q({ withCredentials: this.withCredentials }, options);
|
|
19061
|
-
const {
|
|
19062
|
-
cache,
|
|
19063
|
-
signal: externalSignal,
|
|
19064
|
-
method = "GET",
|
|
19065
|
-
headers,
|
|
19066
|
-
cacheName,
|
|
19067
|
-
cacheProps,
|
|
19068
|
-
responseType,
|
|
19069
|
-
withCredentials
|
|
19070
|
-
} = options;
|
|
19071
|
-
const internalAbortController = new AbortController();
|
|
19072
|
-
const internalSignal = internalAbortController.signal;
|
|
19073
|
-
if (externalSignal) {
|
|
19074
|
-
if (externalSignal.aborted) {
|
|
19075
|
-
throw new AbortError();
|
|
19076
|
-
}
|
|
19077
|
-
externalSignal.addEventListener("abort", () => {
|
|
19078
|
-
internalAbortController.abort();
|
|
19079
|
-
});
|
|
19080
|
-
}
|
|
19081
|
-
options.signal = internalSignal;
|
|
19082
|
-
const createPromise = () => __async$p(this, null, function* () {
|
|
19083
|
-
const id = REQUEST_ID++;
|
|
19084
|
-
this.activeRequests[id] = internalAbortController;
|
|
19085
|
-
try {
|
|
19086
|
-
return this._loadData(url, options);
|
|
19087
|
-
} finally {
|
|
19088
|
-
this._cleanActiveRequest(id);
|
|
19089
|
-
}
|
|
19090
|
-
});
|
|
19091
|
-
if (cache && method === "GET") {
|
|
19092
|
-
const cacheOptions = cacheProps ? cacheProps : __spreadProps$h(__spreadValues$q({}, objectRemoveEmpty({
|
|
19093
|
-
headers,
|
|
19094
|
-
withCredentials,
|
|
19095
|
-
responseType,
|
|
19096
|
-
baseUrl: this.options.baseUrl,
|
|
19097
|
-
userId: (_b = this.user) == null ? void 0 : _b.id
|
|
19098
|
-
})), {
|
|
19099
|
-
params
|
|
19100
|
-
});
|
|
19101
|
-
return this.cache.add(
|
|
19102
|
-
cacheName || url,
|
|
19103
|
-
createPromise,
|
|
19104
|
-
cacheOptions,
|
|
19105
|
-
false
|
|
19106
|
-
);
|
|
19107
|
-
}
|
|
19108
|
-
return createPromise();
|
|
19109
|
-
});
|
|
19110
|
-
}
|
|
19111
19637
|
// -------------------------------------------------------------------------
|
|
19112
19638
|
// Resource Methods
|
|
19113
19639
|
// -------------------------------------------------------------------------
|
|
@@ -19183,78 +19709,7 @@ class NgwConnector {
|
|
|
19183
19709
|
deleteResource(resource) {
|
|
19184
19710
|
return this.resources.delete(resource);
|
|
19185
19711
|
}
|
|
19186
|
-
/**
|
|
19187
|
-
* @internal
|
|
19188
|
-
*/
|
|
19189
|
-
_loadData(url, options) {
|
|
19190
|
-
options.responseType = options.responseType || "json";
|
|
19191
|
-
return new Promise((resolve, reject) => {
|
|
19192
|
-
var _a;
|
|
19193
|
-
if (this.user) {
|
|
19194
|
-
options = options || {};
|
|
19195
|
-
options.headers = __spreadValues$q(__spreadValues$q({}, this.getAuthorizationHeaders()), options.headers);
|
|
19196
|
-
}
|
|
19197
|
-
if (this.requestTransform) {
|
|
19198
|
-
const [transUrl, transOptions] = this.requestTransform(url, options);
|
|
19199
|
-
url = transUrl;
|
|
19200
|
-
options = transOptions;
|
|
19201
|
-
}
|
|
19202
|
-
let runOnAbort = void 0;
|
|
19203
|
-
loadData(url, resolve, options, reject, (handler) => {
|
|
19204
|
-
runOnAbort = handler;
|
|
19205
|
-
});
|
|
19206
|
-
(_a = options.signal) == null ? void 0 : _a.addEventListener("abort", () => {
|
|
19207
|
-
if (runOnAbort !== void 0) {
|
|
19208
|
-
runOnAbort();
|
|
19209
|
-
}
|
|
19210
|
-
reject(new AbortError());
|
|
19211
|
-
});
|
|
19212
|
-
}).catch((httpError) => {
|
|
19213
|
-
if (httpError.name !== "AbortError") {
|
|
19214
|
-
{
|
|
19215
|
-
console.warn("DEV WARN", httpError);
|
|
19216
|
-
}
|
|
19217
|
-
const er = this._handleHttpError(httpError);
|
|
19218
|
-
if (er) {
|
|
19219
|
-
throw er;
|
|
19220
|
-
}
|
|
19221
|
-
}
|
|
19222
|
-
throw httpError;
|
|
19223
|
-
});
|
|
19224
|
-
}
|
|
19225
|
-
_login(credentials, options) {
|
|
19226
|
-
return __async$p(this, null, function* () {
|
|
19227
|
-
try {
|
|
19228
|
-
const data = yield this.getUserInfo(credentials, options);
|
|
19229
|
-
this.user = data;
|
|
19230
|
-
this.emitter.emit("login", data);
|
|
19231
|
-
return data;
|
|
19232
|
-
} catch (er) {
|
|
19233
|
-
this.emitter.emit("login:error", er);
|
|
19234
|
-
throw er;
|
|
19235
|
-
}
|
|
19236
|
-
});
|
|
19237
|
-
}
|
|
19238
|
-
_cleanActiveRequest(requestId) {
|
|
19239
|
-
delete this.activeRequests[requestId];
|
|
19240
|
-
}
|
|
19241
|
-
_handleHttpError(er) {
|
|
19242
|
-
if (er) {
|
|
19243
|
-
if (er instanceof NgwError) {
|
|
19244
|
-
if (er.exception === "nextgisweb.resource.exception.ResourceNotFound") {
|
|
19245
|
-
throw new ResourceNotFoundError(er);
|
|
19246
|
-
} else if (er.exception === "nextgisweb.core.exception.InsufficientPermissions") {
|
|
19247
|
-
throw new InsufficientPermissionsError(er);
|
|
19248
|
-
}
|
|
19249
|
-
}
|
|
19250
|
-
}
|
|
19251
|
-
return er;
|
|
19252
|
-
}
|
|
19253
19712
|
}
|
|
19254
|
-
__publicField$q(NgwConnector, "errors", {
|
|
19255
|
-
NgwError,
|
|
19256
|
-
ResourceNotFoundError
|
|
19257
|
-
});
|
|
19258
19713
|
|
|
19259
19714
|
var __defProp$A = Object.defineProperty;
|
|
19260
19715
|
var __defProps$g = Object.defineProperties;
|
|
@@ -22353,7 +22808,6 @@ class NgwWebmapLayerAdapter {
|
|
|
22353
22808
|
__publicField$c(this, "emitter", new EventEmitter());
|
|
22354
22809
|
__publicField$c(this, "_extent");
|
|
22355
22810
|
__publicField$c(this, "response");
|
|
22356
|
-
__publicField$c(this, "_webmapLayersIds");
|
|
22357
22811
|
__publicField$c(this, "_webmapBaselayersIds", []);
|
|
22358
22812
|
__publicField$c(this, "_lastActiveBaselayer");
|
|
22359
22813
|
const r = options.resourceId;
|
|
@@ -22398,7 +22852,6 @@ class NgwWebmapLayerAdapter {
|
|
|
22398
22852
|
}
|
|
22399
22853
|
delete this.layer;
|
|
22400
22854
|
delete this.response;
|
|
22401
|
-
delete this._webmapLayersIds;
|
|
22402
22855
|
}
|
|
22403
22856
|
showLayer() {
|
|
22404
22857
|
return __async$9(this, null, function* () {
|
|
@@ -22489,26 +22942,19 @@ class NgwWebmapLayerAdapter {
|
|
|
22489
22942
|
getIdentificationIds(options) {
|
|
22490
22943
|
return __async$9(this, null, function* () {
|
|
22491
22944
|
const visibleLayers = [];
|
|
22492
|
-
let
|
|
22493
|
-
|
|
22494
|
-
|
|
22495
|
-
|
|
22496
|
-
|
|
22497
|
-
|
|
22498
|
-
|
|
22499
|
-
|
|
22500
|
-
|
|
22501
|
-
|
|
22502
|
-
const parentId = item.parentId;
|
|
22503
|
-
if (parentId !== void 0 && item.item_type === "layer" && item.layer_identifiable) {
|
|
22504
|
-
const visible = x.properties.property("visibility");
|
|
22505
|
-
const isVisible = visible.get() && !visible.isBlocked();
|
|
22506
|
-
if (isVisible) {
|
|
22507
|
-
visibleLayers.push(parentId);
|
|
22508
|
-
}
|
|
22945
|
+
let deps = this.getDependLayers();
|
|
22946
|
+
deps = deps.sort((a, b) => b.id - a.id);
|
|
22947
|
+
deps.forEach((x) => {
|
|
22948
|
+
const item = x.item;
|
|
22949
|
+
const parentId = item.style_parent_id;
|
|
22950
|
+
if (parentId !== void 0 && item.item_type === "layer" && item.layer_identifiable) {
|
|
22951
|
+
const visible = x.properties.property("visibility");
|
|
22952
|
+
const isVisible = visible.get() && !visible.isBlocked();
|
|
22953
|
+
if (isVisible) {
|
|
22954
|
+
visibleLayers.push(parentId);
|
|
22509
22955
|
}
|
|
22510
|
-
}
|
|
22511
|
-
}
|
|
22956
|
+
}
|
|
22957
|
+
});
|
|
22512
22958
|
return visibleLayers;
|
|
22513
22959
|
});
|
|
22514
22960
|
}
|
|
@@ -22637,31 +23083,6 @@ class NgwWebmapLayerAdapter {
|
|
|
22637
23083
|
}
|
|
22638
23084
|
return item;
|
|
22639
23085
|
}
|
|
22640
|
-
_getWebMapIds(options) {
|
|
22641
|
-
return __async$9(this, null, function* () {
|
|
22642
|
-
const webMapItem = this.layer;
|
|
22643
|
-
if (webMapItem && webMapItem.item.item_type === "root") {
|
|
22644
|
-
const layers = webMapItem.tree.getDescendants();
|
|
22645
|
-
const promises = [];
|
|
22646
|
-
for (const x of layers) {
|
|
22647
|
-
const item = x.item;
|
|
22648
|
-
if (item.item_type === "layer") {
|
|
22649
|
-
const id = item.layer_style_id;
|
|
22650
|
-
const promise = this.options.connector.getResource(id, options).then((y) => {
|
|
22651
|
-
if (y) {
|
|
22652
|
-
const parentId = Number(y.resource.parent.id);
|
|
22653
|
-
item.parentId = parentId;
|
|
22654
|
-
return parentId;
|
|
22655
|
-
}
|
|
22656
|
-
});
|
|
22657
|
-
promises.push(promise);
|
|
22658
|
-
}
|
|
22659
|
-
}
|
|
22660
|
-
const ids = yield Promise.all(promises);
|
|
22661
|
-
return ids.filter((x) => x !== void 0);
|
|
22662
|
-
}
|
|
22663
|
-
});
|
|
22664
|
-
}
|
|
22665
23086
|
}
|
|
22666
23087
|
|
|
22667
23088
|
var __defProp$f = Object.defineProperty;
|
|
@@ -22716,7 +23137,7 @@ class NgwKit {
|
|
|
22716
23137
|
} else {
|
|
22717
23138
|
throw new Error("url is not defined");
|
|
22718
23139
|
}
|
|
22719
|
-
this.connector = new
|
|
23140
|
+
this.connector = new NgwConnectorExtended({
|
|
22720
23141
|
baseUrl: this.url,
|
|
22721
23142
|
auth: this.options.auth
|
|
22722
23143
|
});
|
|
@@ -25337,7 +25758,7 @@ function prepareWebMapOptions(options) {
|
|
|
25337
25758
|
});
|
|
25338
25759
|
}
|
|
25339
25760
|
if (!options.connector) {
|
|
25340
|
-
options.connector = new
|
|
25761
|
+
options.connector = new NgwConnectorExtended({
|
|
25341
25762
|
baseUrl: options.baseUrl || "",
|
|
25342
25763
|
auth: options.auth,
|
|
25343
25764
|
withCredentials: options.withCredentials
|
|
@@ -25611,7 +26032,7 @@ const _NgwMap = class _NgwMap extends WebMap {
|
|
|
25611
26032
|
if (mem.layer.getDependLayers) {
|
|
25612
26033
|
const dependLayers = mem.layer.getDependLayers();
|
|
25613
26034
|
const dependFit = dependLayers.find((x) => {
|
|
25614
|
-
return x.item && x.item.
|
|
26035
|
+
return x.item && x.item.style_parent_id === id;
|
|
25615
26036
|
});
|
|
25616
26037
|
if (dependFit) {
|
|
25617
26038
|
return dependFit.layer;
|