@elastic/ems-client 8.3.2 → 8.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,13 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
1
3
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
-
3
4
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
-
5
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
-
7
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
8
-
9
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
10
-
11
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
-
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
11
  /*
14
12
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
13
  * or more contributor license agreements. Licensed under the Elastic License
@@ -23,8 +21,7 @@ import semver from 'semver';
23
21
  import { format as formatUrl, parse as parseUrl } from 'url';
24
22
  import { toAbsoluteUrl } from './utils';
25
23
  import LRUCache from 'lru-cache';
26
- var DEFAULT_EMS_VERSION = '8.3';
27
-
24
+ var DEFAULT_EMS_VERSION = '8.4';
28
25
  /**
29
26
  * plugins cannot have upstream dependencies on core/*-kibana.
30
27
  * Work-around by copy-pasting modifyUrl routine here.
@@ -32,13 +29,14 @@ var DEFAULT_EMS_VERSION = '8.3';
32
29
  * @param block
33
30
  */
34
31
  function modifyUrlLocal(url, block) {
35
- var parsed = parseUrl(url, true); // copy over the most specific version of each
32
+ var parsed = parseUrl(url, true);
33
+
34
+ // copy over the most specific version of each
36
35
  // property. By default, the parsed url includes
37
36
  // several conflicting properties (like path and
38
37
  // pathname + search, or search and query) and keeping
39
38
  // track of which property is actually used when they
40
39
  // are formatted is harder than necessary
41
-
42
40
  var meaningfulParts = {
43
41
  protocol: parsed.protocol,
44
42
  slashes: parsed.slashes,
@@ -48,10 +46,12 @@ function modifyUrlLocal(url, block) {
48
46
  pathname: parsed.pathname,
49
47
  query: parsed.query || {},
50
48
  hash: parsed.hash
51
- }; // the block modifies the meaningfulParts object, or returns a new one
49
+ };
52
50
 
53
- var modifiedParts = block(meaningfulParts) || meaningfulParts; // format the modified/replaced meaningfulParts back into a url
51
+ // the block modifies the meaningfulParts object, or returns a new one
52
+ var modifiedParts = block(meaningfulParts) || meaningfulParts;
54
53
 
54
+ // format the modified/replaced meaningfulParts back into a url
55
55
  return formatUrl({
56
56
  protocol: modifiedParts.protocol,
57
57
  slashes: modifiedParts.slashes,
@@ -63,72 +63,51 @@ function modifyUrlLocal(url, block) {
63
63
  hash: modifiedParts.hash
64
64
  });
65
65
  }
66
-
67
66
  var extendUrl = function extendUrl(url, props) {
68
67
  return modifyUrlLocal(url, function (parsed) {
69
68
  return _.merge(parsed, props);
70
69
  });
71
70
  };
71
+
72
72
  /**
73
73
  * Unescape a url template that was escaped by encodeURI() so leaflet
74
74
  * will be able to correctly locate the variables in the template
75
75
  * @param {String} url
76
76
  * @return {String}
77
77
  */
78
-
79
-
80
78
  var unescapeTemplateVars = function unescapeTemplateVars(url) {
81
79
  var ENCODED_TEMPLATE_VARS_RE = /%7B(\w+?)%7D/g;
82
80
  return url.replace(ENCODED_TEMPLATE_VARS_RE, function (total, varName) {
83
81
  return "{".concat(varName, "}");
84
82
  });
85
83
  };
86
-
87
84
  //this is not the default locale from Kibana, but the default locale supported by the Elastic Maps Service
88
85
  var DEFAULT_LANGUAGE = 'en';
89
86
  export var EMSClient = /*#__PURE__*/function () {
90
87
  /**
91
88
  * these methods are assigned outside the constructor
92
89
  */
90
+
93
91
  function EMSClient(config) {
94
92
  _classCallCheck(this, EMSClient);
95
-
96
93
  _defineProperty(this, "EMS_LOAD_TIMEOUT", 32000);
97
-
98
94
  _defineProperty(this, "_queryParams", void 0);
99
-
100
95
  _defineProperty(this, "_appVersion", void 0);
101
-
102
96
  _defineProperty(this, "_fetchFunction", void 0);
103
-
104
97
  _defineProperty(this, "_sanitizer", void 0);
105
-
106
98
  _defineProperty(this, "_manifestServiceUrl", void 0);
107
-
108
99
  _defineProperty(this, "_fileApiUrl", void 0);
109
-
110
100
  _defineProperty(this, "_tileApiUrl", void 0);
111
-
112
101
  _defineProperty(this, "_emsVersion", void 0);
113
-
114
102
  _defineProperty(this, "_emsLandingPageUrl", void 0);
115
-
116
103
  _defineProperty(this, "_language", void 0);
117
-
118
104
  _defineProperty(this, "_proxyPath", void 0);
119
-
120
105
  _defineProperty(this, "_cache", void 0);
121
-
122
106
  _defineProperty(this, "_getMainCatalog", void 0);
123
-
124
107
  _defineProperty(this, "_getDefaultTMSCatalog", void 0);
125
-
126
108
  _defineProperty(this, "_getDefaultFileCatalog", void 0);
127
-
128
109
  _defineProperty(this, "_loadTMSServices", void 0);
129
-
130
110
  _defineProperty(this, "_loadFileLayers", void 0);
131
-
132
111
  // Remove kbnVersion in 8.0
133
112
  if ('kbnVersion' in config) {
134
113
  console.warn('The "kbnVersion" parameter for ems-client is deprecated. Please use "appVersion" instead.');
@@ -136,7 +115,6 @@ export var EMSClient = /*#__PURE__*/function () {
136
115
  } else {
137
116
  this._appVersion = config.appVersion;
138
117
  }
139
-
140
118
  this._queryParams = {
141
119
  elastic_tile_service_tos: 'agree',
142
120
  my_app_name: config.appName || 'kibana',
@@ -156,10 +134,8 @@ export var EMSClient = /*#__PURE__*/function () {
156
134
  this._cache = new LRUCache({
157
135
  max: config.cacheSize || 10
158
136
  });
159
-
160
137
  this._invalidateSettings();
161
138
  }
162
-
163
139
  _createClass(EMSClient, [{
164
140
  key: "getDefaultLocale",
165
141
  value: function getDefaultLocale() {
@@ -176,19 +152,18 @@ export var EMSClient = /*#__PURE__*/function () {
176
152
  if (!i18nObject) {
177
153
  return '';
178
154
  }
179
-
180
155
  return i18nObject[this._language] ? i18nObject[this._language] : i18nObject[DEFAULT_LANGUAGE];
181
156
  }
157
+
182
158
  /**
183
159
  * this internal method is overridden by the tests to simulate custom manifest.
184
160
  */
185
-
186
161
  }, {
187
162
  key: "getManifest",
188
163
  value: function () {
189
- var _getManifest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(endpointUrl) {
164
+ var _getManifest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(endpointUrl) {
190
165
  var url, response;
191
- return regeneratorRuntime.wrap(function _callee$(_context) {
166
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
192
167
  while (1) {
193
168
  switch (_context.prev = _context.next) {
194
169
  case 0:
@@ -198,51 +173,38 @@ export var EMSClient = /*#__PURE__*/function () {
198
173
  });
199
174
  _context.next = 4;
200
175
  return this._fetchWithTimeout(url);
201
-
202
176
  case 4:
203
177
  response = _context.sent;
204
-
205
178
  if (response.ok) {
206
179
  _context.next = 7;
207
180
  break;
208
181
  }
209
-
210
182
  throw new Error(response.statusText);
211
-
212
183
  case 7:
213
184
  if (!response) {
214
185
  _context.next = 13;
215
186
  break;
216
187
  }
217
-
218
188
  _context.next = 10;
219
189
  return response.json();
220
-
221
190
  case 10:
222
191
  _context.t0 = _context.sent;
223
192
  _context.next = 14;
224
193
  break;
225
-
226
194
  case 13:
227
195
  _context.t0 = null;
228
-
229
196
  case 14:
230
197
  return _context.abrupt("return", _context.t0);
231
-
232
198
  case 17:
233
199
  _context.prev = 17;
234
200
  _context.t1 = _context["catch"](0);
235
-
236
201
  if (!(_context.t1 instanceof Error)) {
237
202
  _context.next = 23;
238
203
  break;
239
204
  }
240
-
241
205
  throw _context.t1;
242
-
243
206
  case 23:
244
207
  throw new Error('Unknown error');
245
-
246
208
  case 24:
247
209
  case "end":
248
210
  return _context.stop();
@@ -250,11 +212,9 @@ export var EMSClient = /*#__PURE__*/function () {
250
212
  }
251
213
  }, _callee, this, [[0, 17]]);
252
214
  }));
253
-
254
215
  function getManifest(_x) {
255
216
  return _getManifest.apply(this, arguments);
256
217
  }
257
-
258
218
  return getManifest;
259
219
  }()
260
220
  /**
@@ -262,7 +222,6 @@ export var EMSClient = /*#__PURE__*/function () {
262
222
  *
263
223
  * @param additionalQueryParams
264
224
  */
265
-
266
225
  }, {
267
226
  key: "addQueryParams",
268
227
  value: function addQueryParams(additionalQueryParams) {
@@ -271,9 +230,7 @@ export var EMSClient = /*#__PURE__*/function () {
271
230
  if (additionalQueryParams[_key] !== this._queryParams[_key]) {
272
231
  //changes detected.
273
232
  this._queryParams = _.assign({}, this._queryParams, additionalQueryParams);
274
-
275
233
  this._invalidateSettings();
276
-
277
234
  break;
278
235
  }
279
236
  }
@@ -282,17 +239,15 @@ export var EMSClient = /*#__PURE__*/function () {
282
239
  }, {
283
240
  key: "getMainManifest",
284
241
  value: function () {
285
- var _getMainManifest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
286
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
242
+ var _getMainManifest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
243
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
287
244
  while (1) {
288
245
  switch (_context2.prev = _context2.next) {
289
246
  case 0:
290
247
  _context2.next = 2;
291
248
  return this._getMainCatalog();
292
-
293
249
  case 2:
294
250
  return _context2.abrupt("return", _context2.sent);
295
-
296
251
  case 3:
297
252
  case "end":
298
253
  return _context2.stop();
@@ -300,27 +255,23 @@ export var EMSClient = /*#__PURE__*/function () {
300
255
  }
301
256
  }, _callee2, this);
302
257
  }));
303
-
304
258
  function getMainManifest() {
305
259
  return _getMainManifest.apply(this, arguments);
306
260
  }
307
-
308
261
  return getMainManifest;
309
262
  }()
310
263
  }, {
311
264
  key: "getDefaultFileManifest",
312
265
  value: function () {
313
- var _getDefaultFileManifest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
314
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
266
+ var _getDefaultFileManifest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
267
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
315
268
  while (1) {
316
269
  switch (_context3.prev = _context3.next) {
317
270
  case 0:
318
271
  _context3.next = 2;
319
272
  return this._getDefaultFileCatalog();
320
-
321
273
  case 2:
322
274
  return _context3.abrupt("return", _context3.sent);
323
-
324
275
  case 3:
325
276
  case "end":
326
277
  return _context3.stop();
@@ -328,27 +279,23 @@ export var EMSClient = /*#__PURE__*/function () {
328
279
  }
329
280
  }, _callee3, this);
330
281
  }));
331
-
332
282
  function getDefaultFileManifest() {
333
283
  return _getDefaultFileManifest.apply(this, arguments);
334
284
  }
335
-
336
285
  return getDefaultFileManifest;
337
286
  }()
338
287
  }, {
339
288
  key: "getDefaultTMSManifest",
340
289
  value: function () {
341
- var _getDefaultTMSManifest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
342
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
290
+ var _getDefaultTMSManifest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
291
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
343
292
  while (1) {
344
293
  switch (_context4.prev = _context4.next) {
345
294
  case 0:
346
295
  _context4.next = 2;
347
296
  return this._getDefaultTMSCatalog();
348
-
349
297
  case 2:
350
298
  return _context4.abrupt("return", _context4.sent);
351
-
352
299
  case 3:
353
300
  case "end":
354
301
  return _context4.stop();
@@ -356,27 +303,23 @@ export var EMSClient = /*#__PURE__*/function () {
356
303
  }
357
304
  }, _callee4, this);
358
305
  }));
359
-
360
306
  function getDefaultTMSManifest() {
361
307
  return _getDefaultTMSManifest.apply(this, arguments);
362
308
  }
363
-
364
309
  return getDefaultTMSManifest;
365
310
  }()
366
311
  }, {
367
312
  key: "getFileLayers",
368
313
  value: function () {
369
- var _getFileLayers = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
370
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
314
+ var _getFileLayers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
315
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
371
316
  while (1) {
372
317
  switch (_context5.prev = _context5.next) {
373
318
  case 0:
374
319
  _context5.next = 2;
375
320
  return this._loadFileLayers();
376
-
377
321
  case 2:
378
322
  return _context5.abrupt("return", _context5.sent);
379
-
380
323
  case 3:
381
324
  case "end":
382
325
  return _context5.stop();
@@ -384,27 +327,23 @@ export var EMSClient = /*#__PURE__*/function () {
384
327
  }
385
328
  }, _callee5, this);
386
329
  }));
387
-
388
330
  function getFileLayers() {
389
331
  return _getFileLayers.apply(this, arguments);
390
332
  }
391
-
392
333
  return getFileLayers;
393
334
  }()
394
335
  }, {
395
336
  key: "getTMSServices",
396
337
  value: function () {
397
- var _getTMSServices = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
398
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
338
+ var _getTMSServices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
339
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
399
340
  while (1) {
400
341
  switch (_context6.prev = _context6.next) {
401
342
  case 0:
402
343
  _context6.next = 2;
403
344
  return this._loadTMSServices();
404
-
405
345
  case 2:
406
346
  return _context6.abrupt("return", _context6.sent);
407
-
408
347
  case 3:
409
348
  case "end":
410
349
  return _context6.stop();
@@ -412,18 +351,15 @@ export var EMSClient = /*#__PURE__*/function () {
412
351
  }
413
352
  }, _callee6, this);
414
353
  }));
415
-
416
354
  function getTMSServices() {
417
355
  return _getTMSServices.apply(this, arguments);
418
356
  }
419
-
420
357
  return getTMSServices;
421
358
  }()
422
359
  }, {
423
360
  key: "cacheGeoJson",
424
361
  value: function cacheGeoJson(layerId, geoJson) {
425
362
  this._cache.set(layerId, geoJson);
426
-
427
363
  return;
428
364
  }
429
365
  }, {
@@ -461,37 +397,31 @@ export var EMSClient = /*#__PURE__*/function () {
461
397
  }, {
462
398
  key: "findFileLayerById",
463
399
  value: function () {
464
- var _findFileLayerById = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(id) {
400
+ var _findFileLayerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(id) {
465
401
  var fileLayers, i;
466
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
402
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
467
403
  while (1) {
468
404
  switch (_context7.prev = _context7.next) {
469
405
  case 0:
470
406
  _context7.next = 2;
471
407
  return this.getFileLayers();
472
-
473
408
  case 2:
474
409
  fileLayers = _context7.sent;
475
410
  i = 0;
476
-
477
411
  case 4:
478
412
  if (!(i < fileLayers.length)) {
479
413
  _context7.next = 10;
480
414
  break;
481
415
  }
482
-
483
416
  if (!fileLayers[i].hasId(id)) {
484
417
  _context7.next = 7;
485
418
  break;
486
419
  }
487
-
488
420
  return _context7.abrupt("return", fileLayers[i]);
489
-
490
421
  case 7:
491
422
  i++;
492
423
  _context7.next = 4;
493
424
  break;
494
-
495
425
  case 10:
496
426
  case "end":
497
427
  return _context7.stop();
@@ -499,47 +429,39 @@ export var EMSClient = /*#__PURE__*/function () {
499
429
  }
500
430
  }, _callee7, this);
501
431
  }));
502
-
503
432
  function findFileLayerById(_x2) {
504
433
  return _findFileLayerById.apply(this, arguments);
505
434
  }
506
-
507
435
  return findFileLayerById;
508
436
  }()
509
437
  }, {
510
438
  key: "findTMSServiceById",
511
439
  value: function () {
512
- var _findTMSServiceById = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(id) {
440
+ var _findTMSServiceById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(id) {
513
441
  var tmsServices, i;
514
- return regeneratorRuntime.wrap(function _callee8$(_context8) {
442
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
515
443
  while (1) {
516
444
  switch (_context8.prev = _context8.next) {
517
445
  case 0:
518
446
  _context8.next = 2;
519
447
  return this.getTMSServices();
520
-
521
448
  case 2:
522
449
  tmsServices = _context8.sent;
523
450
  i = 0;
524
-
525
451
  case 4:
526
452
  if (!(i < tmsServices.length)) {
527
453
  _context8.next = 10;
528
454
  break;
529
455
  }
530
-
531
456
  if (!tmsServices[i].hasId(id)) {
532
457
  _context8.next = 7;
533
458
  break;
534
459
  }
535
-
536
460
  return _context8.abrupt("return", tmsServices[i]);
537
-
538
461
  case 7:
539
462
  i++;
540
463
  _context8.next = 4;
541
464
  break;
542
-
543
465
  case 10:
544
466
  case "end":
545
467
  return _context8.stop();
@@ -547,11 +469,9 @@ export var EMSClient = /*#__PURE__*/function () {
547
469
  }
548
470
  }, _callee8, this);
549
471
  }));
550
-
551
472
  function findTMSServiceById(_x3) {
552
473
  return _findTMSServiceById.apply(this, arguments);
553
474
  }
554
-
555
475
  return findTMSServiceById;
556
476
  }()
557
477
  }, {
@@ -559,7 +479,6 @@ export var EMSClient = /*#__PURE__*/function () {
559
479
  value: function _getEmsVersion(version) {
560
480
  var userVersion = semver.valid(semver.coerce(version));
561
481
  var semverVersion = userVersion ? userVersion : semver.coerce(DEFAULT_EMS_VERSION);
562
-
563
482
  if (semverVersion) {
564
483
  return "v".concat(semver.major(semverVersion), ".").concat(semver.minor(semverVersion));
565
484
  } else {
@@ -570,12 +489,10 @@ export var EMSClient = /*#__PURE__*/function () {
570
489
  key: "_fetchWithTimeout",
571
490
  value: function _fetchWithTimeout(url) {
572
491
  var _this = this;
573
-
574
492
  return new Promise(function (resolve, reject) {
575
493
  var timer = setTimeout(function () {
576
494
  return reject(new Error("Request to ".concat(url, " timed out")));
577
495
  }, _this.EMS_LOAD_TIMEOUT);
578
-
579
496
  _this._fetchFunction(url).then(function (response) {
580
497
  clearTimeout(timer);
581
498
  resolve(response);
@@ -588,19 +505,17 @@ export var EMSClient = /*#__PURE__*/function () {
588
505
  }, {
589
506
  key: "_getManifestWithParams",
590
507
  value: function () {
591
- var _getManifestWithParams2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(url) {
508
+ var _getManifestWithParams2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(url) {
592
509
  var extendedUrl;
593
- return regeneratorRuntime.wrap(function _callee9$(_context9) {
510
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
594
511
  while (1) {
595
512
  switch (_context9.prev = _context9.next) {
596
513
  case 0:
597
514
  extendedUrl = this.extendUrlWithParams(url);
598
515
  _context9.next = 3;
599
516
  return this.getManifest(extendedUrl);
600
-
601
517
  case 3:
602
518
  return _context9.abrupt("return", _context9.sent);
603
-
604
519
  case 4:
605
520
  case "end":
606
521
  return _context9.stop();
@@ -608,23 +523,19 @@ export var EMSClient = /*#__PURE__*/function () {
608
523
  }
609
524
  }, _callee9, this);
610
525
  }));
611
-
612
526
  function _getManifestWithParams(_x4) {
613
527
  return _getManifestWithParams2.apply(this, arguments);
614
528
  }
615
-
616
529
  return _getManifestWithParams;
617
530
  }()
618
531
  }, {
619
532
  key: "_invalidateSettings",
620
533
  value: function _invalidateSettings() {
621
534
  var _this2 = this;
622
-
623
535
  this._cache.reset();
624
-
625
- this._getMainCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
536
+ this._getMainCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
626
537
  var services;
627
- return regeneratorRuntime.wrap(function _callee10$(_context10) {
538
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
628
539
  while (1) {
629
540
  switch (_context10.prev = _context10.next) {
630
541
  case 0:
@@ -632,35 +543,28 @@ export var EMSClient = /*#__PURE__*/function () {
632
543
  _context10.next = 7;
633
544
  break;
634
545
  }
635
-
636
546
  console.warn("The \"manifestServiceUrl\" parameter is deprecated in v7.6.0.\n Consider using \"tileApiUrl\" and \"fileApiUrl\" instead.");
637
547
  _context10.next = 4;
638
548
  return _this2._getManifestWithParams(_this2._manifestServiceUrl);
639
-
640
549
  case 4:
641
550
  return _context10.abrupt("return", _context10.sent);
642
-
643
551
  case 7:
644
552
  services = [];
645
-
646
553
  if (_this2._tileApiUrl) {
647
554
  services.push({
648
555
  type: 'tms',
649
556
  manifest: toAbsoluteUrl(_this2._tileApiUrl, "".concat(_this2._emsVersion, "/manifest"))
650
557
  });
651
558
  }
652
-
653
559
  if (_this2._fileApiUrl) {
654
560
  services.push({
655
561
  type: 'file',
656
562
  manifest: toAbsoluteUrl(_this2._fileApiUrl, "".concat(_this2._emsVersion, "/manifest"))
657
563
  });
658
564
  }
659
-
660
565
  return _context10.abrupt("return", {
661
566
  services: services
662
567
  });
663
-
664
568
  case 11:
665
569
  case "end":
666
570
  return _context10.stop();
@@ -668,38 +572,32 @@ export var EMSClient = /*#__PURE__*/function () {
668
572
  }
669
573
  }, _callee10);
670
574
  })));
671
- this._getDefaultTMSCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {
575
+ this._getDefaultTMSCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
672
576
  var catalogue, firstService, url;
673
- return regeneratorRuntime.wrap(function _callee11$(_context11) {
577
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
674
578
  while (1) {
675
579
  switch (_context11.prev = _context11.next) {
676
580
  case 0:
677
581
  _context11.next = 2;
678
582
  return _this2._getMainCatalog();
679
-
680
583
  case 2:
681
584
  catalogue = _context11.sent;
682
585
  firstService = catalogue.services.find(function (service) {
683
586
  return service.type === 'tms';
684
587
  });
685
-
686
588
  if (firstService) {
687
589
  _context11.next = 6;
688
590
  break;
689
591
  }
690
-
691
592
  return _context11.abrupt("return", {
692
593
  services: []
693
594
  });
694
-
695
595
  case 6:
696
596
  url = _this2._proxyPath + firstService.manifest;
697
597
  _context11.next = 9;
698
598
  return _this2.getManifest(url);
699
-
700
599
  case 9:
701
600
  return _context11.abrupt("return", _context11.sent);
702
-
703
601
  case 10:
704
602
  case "end":
705
603
  return _context11.stop();
@@ -707,61 +605,54 @@ export var EMSClient = /*#__PURE__*/function () {
707
605
  }
708
606
  }, _callee11);
709
607
  })));
710
- this._getDefaultFileCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {
608
+ this._getDefaultFileCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
711
609
  var catalogue, firstService, url;
712
- return regeneratorRuntime.wrap(function _callee12$(_context12) {
610
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
713
611
  while (1) {
714
612
  switch (_context12.prev = _context12.next) {
715
613
  case 0:
716
614
  _context12.next = 2;
717
615
  return _this2._getMainCatalog();
718
-
719
616
  case 2:
720
617
  catalogue = _context12.sent;
721
618
  firstService = catalogue.services.find(function (service) {
722
619
  return service.type === 'file';
723
620
  });
724
-
725
621
  if (firstService) {
726
622
  _context12.next = 6;
727
623
  break;
728
624
  }
729
-
730
625
  return _context12.abrupt("return", {
731
626
  layers: []
732
627
  });
733
-
734
628
  case 6:
735
629
  url = _this2._proxyPath + firstService.manifest;
736
630
  _context12.next = 9;
737
631
  return _this2.getManifest(url);
738
-
739
632
  case 9:
740
633
  return _context12.abrupt("return", _context12.sent);
741
-
742
634
  case 10:
743
635
  case "end":
744
636
  return _context12.stop();
745
637
  }
746
638
  }
747
639
  }, _callee12);
748
- }))); //Cache the actual instances of TMSService as these in turn cache sub-manifests for the style-files
640
+ })));
749
641
 
750
- this._loadTMSServices = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13() {
642
+ //Cache the actual instances of TMSService as these in turn cache sub-manifests for the style-files
643
+ this._loadTMSServices = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
751
644
  var tmsManifest;
752
- return regeneratorRuntime.wrap(function _callee13$(_context13) {
645
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
753
646
  while (1) {
754
647
  switch (_context13.prev = _context13.next) {
755
648
  case 0:
756
649
  _context13.next = 2;
757
650
  return _this2._getDefaultTMSCatalog();
758
-
759
651
  case 2:
760
652
  tmsManifest = _context13.sent;
761
653
  return _context13.abrupt("return", tmsManifest.services.map(function (serviceConfig) {
762
654
  return new TMSService(serviceConfig, _this2, _this2._proxyPath);
763
655
  }));
764
-
765
656
  case 4:
766
657
  case "end":
767
658
  return _context13.stop();
@@ -769,21 +660,19 @@ export var EMSClient = /*#__PURE__*/function () {
769
660
  }
770
661
  }, _callee13);
771
662
  })));
772
- this._loadFileLayers = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14() {
663
+ this._loadFileLayers = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
773
664
  var fileManifest;
774
- return regeneratorRuntime.wrap(function _callee14$(_context14) {
665
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
775
666
  while (1) {
776
667
  switch (_context14.prev = _context14.next) {
777
668
  case 0:
778
669
  _context14.next = 2;
779
670
  return _this2._getDefaultFileCatalog();
780
-
781
671
  case 2:
782
672
  fileManifest = _context14.sent;
783
673
  return _context14.abrupt("return", fileManifest.layers.map(function (layerConfig) {
784
674
  return new FileLayer(layerConfig, _this2, _this2._proxyPath);
785
675
  }));
786
-
787
676
  case 4:
788
677
  case "end":
789
678
  return _context14.stop();
@@ -793,6 +682,5 @@ export var EMSClient = /*#__PURE__*/function () {
793
682
  })));
794
683
  }
795
684
  }]);
796
-
797
685
  return EMSClient;
798
686
  }();