@evergis/api 3.0.122 → 3.0.124

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.
@@ -35,9 +35,6 @@ function _defineProperties(target, props) {
35
35
  function _createClass(Constructor, protoProps, staticProps) {
36
36
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
37
37
  if (staticProps) _defineProperties(Constructor, staticProps);
38
- Object.defineProperty(Constructor, "prototype", {
39
- writable: false
40
- });
41
38
  return Constructor;
42
39
  }
43
40
 
@@ -71,9 +68,6 @@ function _inherits(subClass, superClass) {
71
68
  configurable: true
72
69
  }
73
70
  });
74
- Object.defineProperty(subClass, "prototype", {
75
- writable: false
76
- });
77
71
  if (superClass) _setPrototypeOf(subClass, superClass);
78
72
  }
79
73
 
@@ -132,8 +126,6 @@ function _assertThisInitialized(self) {
132
126
  function _possibleConstructorReturn(self, call) {
133
127
  if (call && (typeof call === "object" || typeof call === "function")) {
134
128
  return call;
135
- } else if (call !== void 0) {
136
- throw new TypeError("Derived constructors may only return object or undefined");
137
129
  }
138
130
 
139
131
  return _assertThisInitialized(self);
@@ -167,7 +159,7 @@ function _superPropBase(object, property) {
167
159
  return object;
168
160
  }
169
161
 
170
- function _get() {
162
+ function _get(target, property, receiver) {
171
163
  if (typeof Reflect !== "undefined" && Reflect.get) {
172
164
  _get = Reflect.get;
173
165
  } else {
@@ -178,14 +170,14 @@ function _get() {
178
170
  var desc = Object.getOwnPropertyDescriptor(base, property);
179
171
 
180
172
  if (desc.get) {
181
- return desc.get.call(arguments.length < 3 ? target : receiver);
173
+ return desc.get.call(receiver);
182
174
  }
183
175
 
184
176
  return desc.value;
185
177
  };
186
178
  }
187
179
 
188
- return _get.apply(this, arguments);
180
+ return _get(target, property, receiver || target);
189
181
  }
190
182
 
191
183
  let HttpClient = /*#__PURE__*/function () {
@@ -977,8 +969,8 @@ let Notification = /*#__PURE__*/function (_NotificationService) {
977
969
  || event.code === 4002
978
970
  /* InvalidSession */
979
971
  ) {
980
- _this.connectStatus = exports.ConnectionStatus.SessionClosed;
981
- } else if (_this.reconnectTries < _this.MAX_WS_RECONNECT_TRIES) {
972
+ _this.connectStatus = exports.ConnectionStatus.SessionClosed;
973
+ } else if (_this.reconnectTries < _this.MAX_WS_RECONNECT_TRIES) {
982
974
  _this.connectStatus = exports.ConnectionStatus.Break;
983
975
  _this.reconnectTries++;
984
976
 
@@ -1484,7 +1476,7 @@ let Scheduler = /*#__PURE__*/function (_SchedulerService) {
1484
1476
  const taskProgress = await this.getTaskProgress(id);
1485
1477
  this.resolveTaskStatus(taskProgress, resolve, reject);
1486
1478
 
1487
- const taskResultCallback = async _ref => {
1479
+ const taskResultCallback = async (_ref) => {
1488
1480
  let {
1489
1481
  data
1490
1482
  } = _ref;
@@ -3625,12 +3617,12 @@ let Resources = /*#__PURE__*/function () {
3625
3617
  }, {
3626
3618
  key: "getDependentNames",
3627
3619
  value: function getDependentNames(deps, depType) {
3628
- return deps.filter(_ref => {
3620
+ return deps.filter((_ref) => {
3629
3621
  let {
3630
3622
  type
3631
3623
  } = _ref;
3632
3624
  return type === depType;
3633
- }).map(_ref2 => {
3625
+ }).map((_ref2) => {
3634
3626
  let {
3635
3627
  name
3636
3628
  } = _ref2;
@@ -6275,6 +6267,22 @@ let Api = /*#__PURE__*/function (_EventEmitter) {
6275
6267
  return Api;
6276
6268
  }(eventEmitter.EventEmitter);
6277
6269
 
6270
+ function generateRandom(min, max) {
6271
+ if (min === void 0) {
6272
+ min = 0;
6273
+ }
6274
+
6275
+ if (max === void 0) {
6276
+ max = 100;
6277
+ }
6278
+
6279
+ let difference = max - min;
6280
+ let rand = Math.random();
6281
+ rand = Math.floor(rand * difference);
6282
+ rand = rand + min;
6283
+ return rand;
6284
+ }
6285
+
6278
6286
  let EvergisTileLayer = /*#__PURE__*/function (_TileLayer) {
6279
6287
  _inherits(EvergisTileLayer, _TileLayer);
6280
6288
 
@@ -6291,6 +6299,7 @@ let EvergisTileLayer = /*#__PURE__*/function (_TileLayer) {
6291
6299
  });
6292
6300
  _this.api = api;
6293
6301
  _this.name = configuration.name;
6302
+ _this.sourceUrl = configuration.sourceUrl;
6294
6303
  _this.subDomains = configuration.subDomains;
6295
6304
  return _this;
6296
6305
  }
@@ -6298,21 +6307,16 @@ let EvergisTileLayer = /*#__PURE__*/function (_TileLayer) {
6298
6307
  _createClass(EvergisTileLayer, [{
6299
6308
  key: "getTileUrl",
6300
6309
  value: function getTileUrl(x, y, level) {
6310
+ var _this$subDomains;
6311
+
6301
6312
  const name = this.name;
6302
- const subDomains = this.subDomains;
6303
- const subDomain = subDomains && subDomains[(x + y + level) % subDomains.length];
6304
- const urlMask = this.api.layers.getTilesLayerImage({
6313
+ const subDomainIndex = this.subDomains ? generateRandom(0, ((_this$subDomains = this.subDomains) == null ? void 0 : _this$subDomains.length) - 1) : undefined;
6314
+ return this.sourceUrl ? (this.subDomains && subDomainIndex !== undefined ? this.sourceUrl.replace("{0}", this.subDomains[subDomainIndex]) : this.sourceUrl).replace("{1}", "" + level).replace("{2}", "" + x).replace("{3}", "" + y) : this.api.layers.getTilesLayerImage({
6305
6315
  x,
6306
6316
  y,
6307
6317
  z: level,
6308
6318
  name
6309
6319
  });
6310
-
6311
- if (subDomain) {
6312
- return "" + addSubDomainToLocation(subDomain) + urlMask;
6313
- }
6314
-
6315
- return urlMask;
6316
6320
  }
6317
6321
  }]);
6318
6322