@elastic/ems-client 8.3.3 → 8.4.1
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 +5 -17
- 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 +12 -0
- package/CONTRIBUTING.md +18 -0
- package/catalog-info.yaml +68 -0
- package/package.json +7 -4
- package/src/ems_client.ts +1 -2
- package/src/tms_service.ts +5 -1
- package/target/node/ems_client.js +24 -92
- package/target/node/ems_service.js +11 -21
- package/target/node/file_layer.js +17 -62
- package/target/node/index.js +0 -4
- package/target/node/tms_service.js +33 -99
- package/target/node/utils.js +8 -10
- package/target/tms_service.d.ts +1 -1
- package/target/web/ems_client.js +297 -438
- package/target/web/ems_service.js +10 -26
- package/target/web/file_layer.js +62 -117
- package/target/web/index.js +1 -0
- package/target/web/tms_service.js +448 -651
- package/target/web/utils.js +10 -8
- 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 -19
package/target/web/ems_client.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
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 new 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 new 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 new 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; }
|
|
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
|
|
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
|
-
|
|
6
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
11
|
/*
|
|
14
12
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
15
13
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -23,8 +21,7 @@ import semver from 'semver';
|
|
|
23
21
|
import { format as formatUrl, parse as parseUrl } from 'url';
|
|
24
22
|
import { toAbsoluteUrl } from './utils';
|
|
25
23
|
import LRUCache from 'lru-cache';
|
|
26
|
-
var DEFAULT_EMS_VERSION = '8.
|
|
27
|
-
|
|
24
|
+
var DEFAULT_EMS_VERSION = '8.4';
|
|
28
25
|
/**
|
|
29
26
|
* plugins cannot have upstream dependencies on core/*-kibana.
|
|
30
27
|
* Work-around by copy-pasting modifyUrl routine here.
|
|
@@ -32,13 +29,14 @@ var DEFAULT_EMS_VERSION = '8.3';
|
|
|
32
29
|
* @param block
|
|
33
30
|
*/
|
|
34
31
|
function modifyUrlLocal(url, block) {
|
|
35
|
-
var parsed = parseUrl(url, true);
|
|
32
|
+
var parsed = parseUrl(url, true);
|
|
33
|
+
|
|
34
|
+
// copy over the most specific version of each
|
|
36
35
|
// property. By default, the parsed url includes
|
|
37
36
|
// several conflicting properties (like path and
|
|
38
37
|
// pathname + search, or search and query) and keeping
|
|
39
38
|
// track of which property is actually used when they
|
|
40
39
|
// are formatted is harder than necessary
|
|
41
|
-
|
|
42
40
|
var meaningfulParts = {
|
|
43
41
|
protocol: parsed.protocol,
|
|
44
42
|
slashes: parsed.slashes,
|
|
@@ -48,10 +46,12 @@ function modifyUrlLocal(url, block) {
|
|
|
48
46
|
pathname: parsed.pathname,
|
|
49
47
|
query: parsed.query || {},
|
|
50
48
|
hash: parsed.hash
|
|
51
|
-
};
|
|
49
|
+
};
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
// the block modifies the meaningfulParts object, or returns a new one
|
|
52
|
+
var modifiedParts = block(meaningfulParts) || meaningfulParts;
|
|
54
53
|
|
|
54
|
+
// format the modified/replaced meaningfulParts back into a url
|
|
55
55
|
return formatUrl({
|
|
56
56
|
protocol: modifiedParts.protocol,
|
|
57
57
|
slashes: modifiedParts.slashes,
|
|
@@ -63,72 +63,50 @@ function modifyUrlLocal(url, block) {
|
|
|
63
63
|
hash: modifiedParts.hash
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
|
|
67
66
|
var extendUrl = function extendUrl(url, props) {
|
|
68
67
|
return modifyUrlLocal(url, function (parsed) {
|
|
69
68
|
return _.merge(parsed, props);
|
|
70
69
|
});
|
|
71
70
|
};
|
|
71
|
+
|
|
72
72
|
/**
|
|
73
73
|
* Unescape a url template that was escaped by encodeURI() so leaflet
|
|
74
74
|
* will be able to correctly locate the variables in the template
|
|
75
75
|
* @param {String} url
|
|
76
76
|
* @return {String}
|
|
77
77
|
*/
|
|
78
|
-
|
|
79
|
-
|
|
80
78
|
var unescapeTemplateVars = function unescapeTemplateVars(url) {
|
|
81
79
|
var ENCODED_TEMPLATE_VARS_RE = /%7B(\w+?)%7D/g;
|
|
82
80
|
return url.replace(ENCODED_TEMPLATE_VARS_RE, function (total, varName) {
|
|
83
81
|
return "{".concat(varName, "}");
|
|
84
82
|
});
|
|
85
83
|
};
|
|
86
|
-
|
|
87
84
|
//this is not the default locale from Kibana, but the default locale supported by the Elastic Maps Service
|
|
88
85
|
var DEFAULT_LANGUAGE = 'en';
|
|
89
86
|
export var EMSClient = /*#__PURE__*/function () {
|
|
90
|
-
/**
|
|
91
|
-
* these methods are assigned outside the constructor
|
|
92
|
-
*/
|
|
93
87
|
function EMSClient(config) {
|
|
94
88
|
_classCallCheck(this, EMSClient);
|
|
95
|
-
|
|
96
89
|
_defineProperty(this, "EMS_LOAD_TIMEOUT", 32000);
|
|
97
|
-
|
|
98
90
|
_defineProperty(this, "_queryParams", void 0);
|
|
99
|
-
|
|
100
91
|
_defineProperty(this, "_appVersion", void 0);
|
|
101
|
-
|
|
102
92
|
_defineProperty(this, "_fetchFunction", void 0);
|
|
103
|
-
|
|
104
93
|
_defineProperty(this, "_sanitizer", void 0);
|
|
105
|
-
|
|
106
94
|
_defineProperty(this, "_manifestServiceUrl", void 0);
|
|
107
|
-
|
|
108
95
|
_defineProperty(this, "_fileApiUrl", void 0);
|
|
109
|
-
|
|
110
96
|
_defineProperty(this, "_tileApiUrl", void 0);
|
|
111
|
-
|
|
112
97
|
_defineProperty(this, "_emsVersion", void 0);
|
|
113
|
-
|
|
114
98
|
_defineProperty(this, "_emsLandingPageUrl", void 0);
|
|
115
|
-
|
|
116
99
|
_defineProperty(this, "_language", void 0);
|
|
117
|
-
|
|
118
100
|
_defineProperty(this, "_proxyPath", void 0);
|
|
119
|
-
|
|
120
101
|
_defineProperty(this, "_cache", void 0);
|
|
121
|
-
|
|
102
|
+
/**
|
|
103
|
+
* these methods are assigned outside the constructor
|
|
104
|
+
*/
|
|
122
105
|
_defineProperty(this, "_getMainCatalog", void 0);
|
|
123
|
-
|
|
124
106
|
_defineProperty(this, "_getDefaultTMSCatalog", void 0);
|
|
125
|
-
|
|
126
107
|
_defineProperty(this, "_getDefaultFileCatalog", void 0);
|
|
127
|
-
|
|
128
108
|
_defineProperty(this, "_loadTMSServices", void 0);
|
|
129
|
-
|
|
130
109
|
_defineProperty(this, "_loadFileLayers", void 0);
|
|
131
|
-
|
|
132
110
|
// Remove kbnVersion in 8.0
|
|
133
111
|
if ('kbnVersion' in config) {
|
|
134
112
|
console.warn('The "kbnVersion" parameter for ems-client is deprecated. Please use "appVersion" instead.');
|
|
@@ -136,7 +114,6 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
136
114
|
} else {
|
|
137
115
|
this._appVersion = config.appVersion;
|
|
138
116
|
}
|
|
139
|
-
|
|
140
117
|
this._queryParams = {
|
|
141
118
|
elastic_tile_service_tos: 'agree',
|
|
142
119
|
my_app_name: config.appName || 'kibana',
|
|
@@ -156,10 +133,8 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
156
133
|
this._cache = new LRUCache({
|
|
157
134
|
max: config.cacheSize || 10
|
|
158
135
|
});
|
|
159
|
-
|
|
160
136
|
this._invalidateSettings();
|
|
161
137
|
}
|
|
162
|
-
|
|
163
138
|
_createClass(EMSClient, [{
|
|
164
139
|
key: "getDefaultLocale",
|
|
165
140
|
value: function getDefaultLocale() {
|
|
@@ -176,85 +151,67 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
176
151
|
if (!i18nObject) {
|
|
177
152
|
return '';
|
|
178
153
|
}
|
|
179
|
-
|
|
180
154
|
return i18nObject[this._language] ? i18nObject[this._language] : i18nObject[DEFAULT_LANGUAGE];
|
|
181
155
|
}
|
|
156
|
+
|
|
182
157
|
/**
|
|
183
158
|
* this internal method is overridden by the tests to simulate custom manifest.
|
|
184
159
|
*/
|
|
185
|
-
|
|
186
160
|
}, {
|
|
187
161
|
key: "getManifest",
|
|
188
162
|
value: function () {
|
|
189
|
-
var _getManifest = _asyncToGenerator( /*#__PURE__*/
|
|
163
|
+
var _getManifest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(endpointUrl) {
|
|
190
164
|
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;
|
|
165
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
166
|
+
while (1) switch (_context.prev = _context.next) {
|
|
167
|
+
case 0:
|
|
168
|
+
_context.prev = 0;
|
|
169
|
+
url = extendUrl(endpointUrl, {
|
|
170
|
+
query: this._queryParams
|
|
171
|
+
});
|
|
172
|
+
_context.next = 4;
|
|
173
|
+
return this._fetchWithTimeout(url);
|
|
174
|
+
case 4:
|
|
175
|
+
response = _context.sent;
|
|
176
|
+
if (response.ok) {
|
|
177
|
+
_context.next = 7;
|
|
224
178
|
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
|
-
|
|
179
|
+
}
|
|
180
|
+
throw new Error(response.statusText);
|
|
181
|
+
case 7:
|
|
182
|
+
if (!response) {
|
|
183
|
+
_context.next = 13;
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
_context.next = 10;
|
|
187
|
+
return response.json();
|
|
188
|
+
case 10:
|
|
189
|
+
_context.t0 = _context.sent;
|
|
190
|
+
_context.next = 14;
|
|
191
|
+
break;
|
|
192
|
+
case 13:
|
|
193
|
+
_context.t0 = null;
|
|
194
|
+
case 14:
|
|
195
|
+
return _context.abrupt("return", _context.t0);
|
|
196
|
+
case 17:
|
|
197
|
+
_context.prev = 17;
|
|
198
|
+
_context.t1 = _context["catch"](0);
|
|
199
|
+
if (!(_context.t1 instanceof Error)) {
|
|
200
|
+
_context.next = 23;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
throw _context.t1;
|
|
204
|
+
case 23:
|
|
205
|
+
throw new Error('Unknown error');
|
|
206
|
+
case 24:
|
|
207
|
+
case "end":
|
|
208
|
+
return _context.stop();
|
|
250
209
|
}
|
|
251
210
|
}, _callee, this, [[0, 17]]);
|
|
252
211
|
}));
|
|
253
|
-
|
|
254
212
|
function getManifest(_x) {
|
|
255
213
|
return _getManifest.apply(this, arguments);
|
|
256
214
|
}
|
|
257
|
-
|
|
258
215
|
return getManifest;
|
|
259
216
|
}()
|
|
260
217
|
/**
|
|
@@ -262,7 +219,6 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
262
219
|
*
|
|
263
220
|
* @param additionalQueryParams
|
|
264
221
|
*/
|
|
265
|
-
|
|
266
222
|
}, {
|
|
267
223
|
key: "addQueryParams",
|
|
268
224
|
value: function addQueryParams(additionalQueryParams) {
|
|
@@ -271,9 +227,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
271
227
|
if (additionalQueryParams[_key] !== this._queryParams[_key]) {
|
|
272
228
|
//changes detected.
|
|
273
229
|
this._queryParams = _.assign({}, this._queryParams, additionalQueryParams);
|
|
274
|
-
|
|
275
230
|
this._invalidateSettings();
|
|
276
|
-
|
|
277
231
|
break;
|
|
278
232
|
}
|
|
279
233
|
}
|
|
@@ -282,148 +236,117 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
282
236
|
}, {
|
|
283
237
|
key: "getMainManifest",
|
|
284
238
|
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
|
-
}
|
|
239
|
+
var _getMainManifest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
240
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
241
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
242
|
+
case 0:
|
|
243
|
+
_context2.next = 2;
|
|
244
|
+
return this._getMainCatalog();
|
|
245
|
+
case 2:
|
|
246
|
+
return _context2.abrupt("return", _context2.sent);
|
|
247
|
+
case 3:
|
|
248
|
+
case "end":
|
|
249
|
+
return _context2.stop();
|
|
300
250
|
}
|
|
301
251
|
}, _callee2, this);
|
|
302
252
|
}));
|
|
303
|
-
|
|
304
253
|
function getMainManifest() {
|
|
305
254
|
return _getMainManifest.apply(this, arguments);
|
|
306
255
|
}
|
|
307
|
-
|
|
308
256
|
return getMainManifest;
|
|
309
257
|
}()
|
|
310
258
|
}, {
|
|
311
259
|
key: "getDefaultFileManifest",
|
|
312
260
|
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
|
-
}
|
|
261
|
+
var _getDefaultFileManifest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
262
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
263
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
264
|
+
case 0:
|
|
265
|
+
_context3.next = 2;
|
|
266
|
+
return this._getDefaultFileCatalog();
|
|
267
|
+
case 2:
|
|
268
|
+
return _context3.abrupt("return", _context3.sent);
|
|
269
|
+
case 3:
|
|
270
|
+
case "end":
|
|
271
|
+
return _context3.stop();
|
|
328
272
|
}
|
|
329
273
|
}, _callee3, this);
|
|
330
274
|
}));
|
|
331
|
-
|
|
332
275
|
function getDefaultFileManifest() {
|
|
333
276
|
return _getDefaultFileManifest.apply(this, arguments);
|
|
334
277
|
}
|
|
335
|
-
|
|
336
278
|
return getDefaultFileManifest;
|
|
337
279
|
}()
|
|
338
280
|
}, {
|
|
339
281
|
key: "getDefaultTMSManifest",
|
|
340
282
|
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
|
-
}
|
|
283
|
+
var _getDefaultTMSManifest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
284
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
285
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
286
|
+
case 0:
|
|
287
|
+
_context4.next = 2;
|
|
288
|
+
return this._getDefaultTMSCatalog();
|
|
289
|
+
case 2:
|
|
290
|
+
return _context4.abrupt("return", _context4.sent);
|
|
291
|
+
case 3:
|
|
292
|
+
case "end":
|
|
293
|
+
return _context4.stop();
|
|
356
294
|
}
|
|
357
295
|
}, _callee4, this);
|
|
358
296
|
}));
|
|
359
|
-
|
|
360
297
|
function getDefaultTMSManifest() {
|
|
361
298
|
return _getDefaultTMSManifest.apply(this, arguments);
|
|
362
299
|
}
|
|
363
|
-
|
|
364
300
|
return getDefaultTMSManifest;
|
|
365
301
|
}()
|
|
366
302
|
}, {
|
|
367
303
|
key: "getFileLayers",
|
|
368
304
|
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
|
-
}
|
|
305
|
+
var _getFileLayers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
306
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
307
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
308
|
+
case 0:
|
|
309
|
+
_context5.next = 2;
|
|
310
|
+
return this._loadFileLayers();
|
|
311
|
+
case 2:
|
|
312
|
+
return _context5.abrupt("return", _context5.sent);
|
|
313
|
+
case 3:
|
|
314
|
+
case "end":
|
|
315
|
+
return _context5.stop();
|
|
384
316
|
}
|
|
385
317
|
}, _callee5, this);
|
|
386
318
|
}));
|
|
387
|
-
|
|
388
319
|
function getFileLayers() {
|
|
389
320
|
return _getFileLayers.apply(this, arguments);
|
|
390
321
|
}
|
|
391
|
-
|
|
392
322
|
return getFileLayers;
|
|
393
323
|
}()
|
|
394
324
|
}, {
|
|
395
325
|
key: "getTMSServices",
|
|
396
326
|
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
|
-
}
|
|
327
|
+
var _getTMSServices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
328
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
329
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
330
|
+
case 0:
|
|
331
|
+
_context6.next = 2;
|
|
332
|
+
return this._loadTMSServices();
|
|
333
|
+
case 2:
|
|
334
|
+
return _context6.abrupt("return", _context6.sent);
|
|
335
|
+
case 3:
|
|
336
|
+
case "end":
|
|
337
|
+
return _context6.stop();
|
|
412
338
|
}
|
|
413
339
|
}, _callee6, this);
|
|
414
340
|
}));
|
|
415
|
-
|
|
416
341
|
function getTMSServices() {
|
|
417
342
|
return _getTMSServices.apply(this, arguments);
|
|
418
343
|
}
|
|
419
|
-
|
|
420
344
|
return getTMSServices;
|
|
421
345
|
}()
|
|
422
346
|
}, {
|
|
423
347
|
key: "cacheGeoJson",
|
|
424
348
|
value: function cacheGeoJson(layerId, geoJson) {
|
|
425
349
|
this._cache.set(layerId, geoJson);
|
|
426
|
-
|
|
427
350
|
return;
|
|
428
351
|
}
|
|
429
352
|
}, {
|
|
@@ -461,97 +384,77 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
461
384
|
}, {
|
|
462
385
|
key: "findFileLayerById",
|
|
463
386
|
value: function () {
|
|
464
|
-
var _findFileLayerById = _asyncToGenerator( /*#__PURE__*/
|
|
387
|
+
var _findFileLayerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(id) {
|
|
465
388
|
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;
|
|
389
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
390
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
391
|
+
case 0:
|
|
392
|
+
_context7.next = 2;
|
|
393
|
+
return this.getFileLayers();
|
|
394
|
+
case 2:
|
|
395
|
+
fileLayers = _context7.sent;
|
|
396
|
+
i = 0;
|
|
397
|
+
case 4:
|
|
398
|
+
if (!(i < fileLayers.length)) {
|
|
399
|
+
_context7.next = 10;
|
|
493
400
|
break;
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
401
|
+
}
|
|
402
|
+
if (!fileLayers[i].hasId(id)) {
|
|
403
|
+
_context7.next = 7;
|
|
404
|
+
break;
|
|
405
|
+
}
|
|
406
|
+
return _context7.abrupt("return", fileLayers[i]);
|
|
407
|
+
case 7:
|
|
408
|
+
i++;
|
|
409
|
+
_context7.next = 4;
|
|
410
|
+
break;
|
|
411
|
+
case 10:
|
|
412
|
+
case "end":
|
|
413
|
+
return _context7.stop();
|
|
499
414
|
}
|
|
500
415
|
}, _callee7, this);
|
|
501
416
|
}));
|
|
502
|
-
|
|
503
417
|
function findFileLayerById(_x2) {
|
|
504
418
|
return _findFileLayerById.apply(this, arguments);
|
|
505
419
|
}
|
|
506
|
-
|
|
507
420
|
return findFileLayerById;
|
|
508
421
|
}()
|
|
509
422
|
}, {
|
|
510
423
|
key: "findTMSServiceById",
|
|
511
424
|
value: function () {
|
|
512
|
-
var _findTMSServiceById = _asyncToGenerator( /*#__PURE__*/
|
|
425
|
+
var _findTMSServiceById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(id) {
|
|
513
426
|
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;
|
|
427
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
428
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
429
|
+
case 0:
|
|
430
|
+
_context8.next = 2;
|
|
431
|
+
return this.getTMSServices();
|
|
432
|
+
case 2:
|
|
433
|
+
tmsServices = _context8.sent;
|
|
434
|
+
i = 0;
|
|
435
|
+
case 4:
|
|
436
|
+
if (!(i < tmsServices.length)) {
|
|
437
|
+
_context8.next = 10;
|
|
541
438
|
break;
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
439
|
+
}
|
|
440
|
+
if (!tmsServices[i].hasId(id)) {
|
|
441
|
+
_context8.next = 7;
|
|
442
|
+
break;
|
|
443
|
+
}
|
|
444
|
+
return _context8.abrupt("return", tmsServices[i]);
|
|
445
|
+
case 7:
|
|
446
|
+
i++;
|
|
447
|
+
_context8.next = 4;
|
|
448
|
+
break;
|
|
449
|
+
case 10:
|
|
450
|
+
case "end":
|
|
451
|
+
return _context8.stop();
|
|
547
452
|
}
|
|
548
453
|
}, _callee8, this);
|
|
549
454
|
}));
|
|
550
|
-
|
|
551
455
|
function findTMSServiceById(_x3) {
|
|
552
456
|
return _findTMSServiceById.apply(this, arguments);
|
|
553
457
|
}
|
|
554
|
-
|
|
555
458
|
return findTMSServiceById;
|
|
556
459
|
}()
|
|
557
460
|
}, {
|
|
@@ -559,7 +462,6 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
559
462
|
value: function _getEmsVersion(version) {
|
|
560
463
|
var userVersion = semver.valid(semver.coerce(version));
|
|
561
464
|
var semverVersion = userVersion ? userVersion : semver.coerce(DEFAULT_EMS_VERSION);
|
|
562
|
-
|
|
563
465
|
if (semverVersion) {
|
|
564
466
|
return "v".concat(semver.major(semverVersion), ".").concat(semver.minor(semverVersion));
|
|
565
467
|
} else {
|
|
@@ -570,12 +472,10 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
570
472
|
key: "_fetchWithTimeout",
|
|
571
473
|
value: function _fetchWithTimeout(url) {
|
|
572
474
|
var _this = this;
|
|
573
|
-
|
|
574
475
|
return new Promise(function (resolve, reject) {
|
|
575
476
|
var timer = setTimeout(function () {
|
|
576
477
|
return reject(new Error("Request to ".concat(url, " timed out")));
|
|
577
478
|
}, _this.EMS_LOAD_TIMEOUT);
|
|
578
|
-
|
|
579
479
|
_this._fetchFunction(url).then(function (response) {
|
|
580
480
|
clearTimeout(timer);
|
|
581
481
|
resolve(response);
|
|
@@ -588,211 +488,170 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
588
488
|
}, {
|
|
589
489
|
key: "_getManifestWithParams",
|
|
590
490
|
value: function () {
|
|
591
|
-
var _getManifestWithParams2 = _asyncToGenerator( /*#__PURE__*/
|
|
491
|
+
var _getManifestWithParams2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(url) {
|
|
592
492
|
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
|
-
}
|
|
493
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
494
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
495
|
+
case 0:
|
|
496
|
+
extendedUrl = this.extendUrlWithParams(url);
|
|
497
|
+
_context9.next = 3;
|
|
498
|
+
return this.getManifest(extendedUrl);
|
|
499
|
+
case 3:
|
|
500
|
+
return _context9.abrupt("return", _context9.sent);
|
|
501
|
+
case 4:
|
|
502
|
+
case "end":
|
|
503
|
+
return _context9.stop();
|
|
608
504
|
}
|
|
609
505
|
}, _callee9, this);
|
|
610
506
|
}));
|
|
611
|
-
|
|
612
507
|
function _getManifestWithParams(_x4) {
|
|
613
508
|
return _getManifestWithParams2.apply(this, arguments);
|
|
614
509
|
}
|
|
615
|
-
|
|
616
510
|
return _getManifestWithParams;
|
|
617
511
|
}()
|
|
618
512
|
}, {
|
|
619
513
|
key: "_invalidateSettings",
|
|
620
514
|
value: function _invalidateSettings() {
|
|
621
515
|
var _this2 = this;
|
|
622
|
-
|
|
623
516
|
this._cache.reset();
|
|
624
|
-
|
|
625
|
-
this._getMainCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
|
|
517
|
+
this._getMainCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
626
518
|
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
|
|
519
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
520
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
521
|
+
case 0:
|
|
522
|
+
if (!_this2._manifestServiceUrl) {
|
|
523
|
+
_context10.next = 7;
|
|
524
|
+
break;
|
|
525
|
+
}
|
|
526
|
+
console.warn("The \"manifestServiceUrl\" parameter is deprecated in v7.6.0.\n Consider using \"tileApiUrl\" and \"fileApiUrl\" instead.");
|
|
527
|
+
_context10.next = 4;
|
|
528
|
+
return _this2._getManifestWithParams(_this2._manifestServiceUrl);
|
|
529
|
+
case 4:
|
|
530
|
+
return _context10.abrupt("return", _context10.sent);
|
|
531
|
+
case 7:
|
|
532
|
+
services = [];
|
|
533
|
+
if (_this2._tileApiUrl) {
|
|
534
|
+
services.push({
|
|
535
|
+
type: 'tms',
|
|
536
|
+
manifest: toAbsoluteUrl(_this2._tileApiUrl, "".concat(_this2._emsVersion, "/manifest"))
|
|
662
537
|
});
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
538
|
+
}
|
|
539
|
+
if (_this2._fileApiUrl) {
|
|
540
|
+
services.push({
|
|
541
|
+
type: 'file',
|
|
542
|
+
manifest: toAbsoluteUrl(_this2._fileApiUrl, "".concat(_this2._emsVersion, "/manifest"))
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
return _context10.abrupt("return", {
|
|
546
|
+
services: services
|
|
547
|
+
});
|
|
548
|
+
case 11:
|
|
549
|
+
case "end":
|
|
550
|
+
return _context10.stop();
|
|
668
551
|
}
|
|
669
552
|
}, _callee10);
|
|
670
553
|
})));
|
|
671
|
-
this._getDefaultTMSCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
554
|
+
this._getDefaultTMSCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
672
555
|
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
|
-
}
|
|
556
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
557
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
558
|
+
case 0:
|
|
559
|
+
_context11.next = 2;
|
|
560
|
+
return _this2._getMainCatalog();
|
|
561
|
+
case 2:
|
|
562
|
+
catalogue = _context11.sent;
|
|
563
|
+
firstService = catalogue.services.find(function (service) {
|
|
564
|
+
return service.type === 'tms';
|
|
565
|
+
});
|
|
566
|
+
if (firstService) {
|
|
567
|
+
_context11.next = 6;
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
return _context11.abrupt("return", {
|
|
571
|
+
services: []
|
|
572
|
+
});
|
|
573
|
+
case 6:
|
|
574
|
+
url = _this2._proxyPath + firstService.manifest;
|
|
575
|
+
_context11.next = 9;
|
|
576
|
+
return _this2.getManifest(url);
|
|
577
|
+
case 9:
|
|
578
|
+
return _context11.abrupt("return", _context11.sent);
|
|
579
|
+
case 10:
|
|
580
|
+
case "end":
|
|
581
|
+
return _context11.stop();
|
|
707
582
|
}
|
|
708
583
|
}, _callee11);
|
|
709
584
|
})));
|
|
710
|
-
this._getDefaultFileCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
585
|
+
this._getDefaultFileCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
711
586
|
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
|
-
}
|
|
587
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
588
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
589
|
+
case 0:
|
|
590
|
+
_context12.next = 2;
|
|
591
|
+
return _this2._getMainCatalog();
|
|
592
|
+
case 2:
|
|
593
|
+
catalogue = _context12.sent;
|
|
594
|
+
firstService = catalogue.services.find(function (service) {
|
|
595
|
+
return service.type === 'file';
|
|
596
|
+
});
|
|
597
|
+
if (firstService) {
|
|
598
|
+
_context12.next = 6;
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
return _context12.abrupt("return", {
|
|
602
|
+
layers: []
|
|
603
|
+
});
|
|
604
|
+
case 6:
|
|
605
|
+
url = _this2._proxyPath + firstService.manifest;
|
|
606
|
+
_context12.next = 9;
|
|
607
|
+
return _this2.getManifest(url);
|
|
608
|
+
case 9:
|
|
609
|
+
return _context12.abrupt("return", _context12.sent);
|
|
610
|
+
case 10:
|
|
611
|
+
case "end":
|
|
612
|
+
return _context12.stop();
|
|
746
613
|
}
|
|
747
614
|
}, _callee12);
|
|
748
|
-
})));
|
|
615
|
+
})));
|
|
749
616
|
|
|
750
|
-
|
|
617
|
+
//Cache the actual instances of TMSService as these in turn cache sub-manifests for the style-files
|
|
618
|
+
this._loadTMSServices = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
751
619
|
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
|
-
}
|
|
620
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
621
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
622
|
+
case 0:
|
|
623
|
+
_context13.next = 2;
|
|
624
|
+
return _this2._getDefaultTMSCatalog();
|
|
625
|
+
case 2:
|
|
626
|
+
tmsManifest = _context13.sent;
|
|
627
|
+
return _context13.abrupt("return", tmsManifest.services.map(function (serviceConfig) {
|
|
628
|
+
return new TMSService(serviceConfig, _this2, _this2._proxyPath);
|
|
629
|
+
}));
|
|
630
|
+
case 4:
|
|
631
|
+
case "end":
|
|
632
|
+
return _context13.stop();
|
|
769
633
|
}
|
|
770
634
|
}, _callee13);
|
|
771
635
|
})));
|
|
772
|
-
this._loadFileLayers = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
636
|
+
this._loadFileLayers = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
773
637
|
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
|
-
}
|
|
638
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
639
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
640
|
+
case 0:
|
|
641
|
+
_context14.next = 2;
|
|
642
|
+
return _this2._getDefaultFileCatalog();
|
|
643
|
+
case 2:
|
|
644
|
+
fileManifest = _context14.sent;
|
|
645
|
+
return _context14.abrupt("return", fileManifest.layers.map(function (layerConfig) {
|
|
646
|
+
return new FileLayer(layerConfig, _this2, _this2._proxyPath);
|
|
647
|
+
}));
|
|
648
|
+
case 4:
|
|
649
|
+
case "end":
|
|
650
|
+
return _context14.stop();
|
|
791
651
|
}
|
|
792
652
|
}, _callee14);
|
|
793
653
|
})));
|
|
794
654
|
}
|
|
795
655
|
}]);
|
|
796
|
-
|
|
797
656
|
return EMSClient;
|
|
798
657
|
}();
|