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