@elastic/ems-client 8.3.3 → 8.5.0

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