@elastic/ems-client 7.16.0 → 7.17.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 +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 +9 -0
- package/catalog-info.yaml +68 -0
- package/package.json +8 -5
- package/src/ems_client.ts +1 -1
- package/target/node/ems_client.js +24 -92
- package/target/node/ems_service.js +11 -23
- package/target/node/file_layer.js +17 -62
- package/target/node/index.js +0 -4
- package/target/node/origin.js +3 -4
- package/target/node/tms_service.js +16 -64
- package/target/node/utils.js +0 -3
- package/target/web/ems_client.js +298 -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/origin.js +1 -0
- package/target/web/tms_service.js +367 -540
- 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 _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
|
|
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,10 +134,8 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
156
134
|
this._cache = new LRUCache({
|
|
157
135
|
max: config.cacheSize || 10
|
|
158
136
|
});
|
|
159
|
-
|
|
160
137
|
this._invalidateSettings();
|
|
161
138
|
}
|
|
162
|
-
|
|
163
139
|
_createClass(EMSClient, [{
|
|
164
140
|
key: "getDefaultLocale",
|
|
165
141
|
value: function getDefaultLocale() {
|
|
@@ -176,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
163
|
value: function () {
|
|
189
|
-
var _getManifest = _asyncToGenerator( /*#__PURE__*/
|
|
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,6 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
262
220
|
*
|
|
263
221
|
* @param additionalQueryParams
|
|
264
222
|
*/
|
|
265
|
-
|
|
266
223
|
}, {
|
|
267
224
|
key: "addQueryParams",
|
|
268
225
|
value: function addQueryParams(additionalQueryParams) {
|
|
@@ -271,9 +228,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
271
228
|
if (additionalQueryParams[_key] !== this._queryParams[_key]) {
|
|
272
229
|
//changes detected.
|
|
273
230
|
this._queryParams = _.assign({}, this._queryParams, additionalQueryParams);
|
|
274
|
-
|
|
275
231
|
this._invalidateSettings();
|
|
276
|
-
|
|
277
232
|
break;
|
|
278
233
|
}
|
|
279
234
|
}
|
|
@@ -282,148 +237,117 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
282
237
|
}, {
|
|
283
238
|
key: "getMainManifest",
|
|
284
239
|
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
|
-
}
|
|
240
|
+
var _getMainManifest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
241
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
242
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
243
|
+
case 0:
|
|
244
|
+
_context2.next = 2;
|
|
245
|
+
return this._getMainCatalog();
|
|
246
|
+
case 2:
|
|
247
|
+
return _context2.abrupt("return", _context2.sent);
|
|
248
|
+
case 3:
|
|
249
|
+
case "end":
|
|
250
|
+
return _context2.stop();
|
|
300
251
|
}
|
|
301
252
|
}, _callee2, this);
|
|
302
253
|
}));
|
|
303
|
-
|
|
304
254
|
function getMainManifest() {
|
|
305
255
|
return _getMainManifest.apply(this, arguments);
|
|
306
256
|
}
|
|
307
|
-
|
|
308
257
|
return getMainManifest;
|
|
309
258
|
}()
|
|
310
259
|
}, {
|
|
311
260
|
key: "getDefaultFileManifest",
|
|
312
261
|
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
|
-
}
|
|
262
|
+
var _getDefaultFileManifest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
263
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
264
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
265
|
+
case 0:
|
|
266
|
+
_context3.next = 2;
|
|
267
|
+
return this._getDefaultFileCatalog();
|
|
268
|
+
case 2:
|
|
269
|
+
return _context3.abrupt("return", _context3.sent);
|
|
270
|
+
case 3:
|
|
271
|
+
case "end":
|
|
272
|
+
return _context3.stop();
|
|
328
273
|
}
|
|
329
274
|
}, _callee3, this);
|
|
330
275
|
}));
|
|
331
|
-
|
|
332
276
|
function getDefaultFileManifest() {
|
|
333
277
|
return _getDefaultFileManifest.apply(this, arguments);
|
|
334
278
|
}
|
|
335
|
-
|
|
336
279
|
return getDefaultFileManifest;
|
|
337
280
|
}()
|
|
338
281
|
}, {
|
|
339
282
|
key: "getDefaultTMSManifest",
|
|
340
283
|
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
|
-
}
|
|
284
|
+
var _getDefaultTMSManifest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
285
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
286
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
287
|
+
case 0:
|
|
288
|
+
_context4.next = 2;
|
|
289
|
+
return this._getDefaultTMSCatalog();
|
|
290
|
+
case 2:
|
|
291
|
+
return _context4.abrupt("return", _context4.sent);
|
|
292
|
+
case 3:
|
|
293
|
+
case "end":
|
|
294
|
+
return _context4.stop();
|
|
356
295
|
}
|
|
357
296
|
}, _callee4, this);
|
|
358
297
|
}));
|
|
359
|
-
|
|
360
298
|
function getDefaultTMSManifest() {
|
|
361
299
|
return _getDefaultTMSManifest.apply(this, arguments);
|
|
362
300
|
}
|
|
363
|
-
|
|
364
301
|
return getDefaultTMSManifest;
|
|
365
302
|
}()
|
|
366
303
|
}, {
|
|
367
304
|
key: "getFileLayers",
|
|
368
305
|
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
|
-
}
|
|
306
|
+
var _getFileLayers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
307
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
308
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
309
|
+
case 0:
|
|
310
|
+
_context5.next = 2;
|
|
311
|
+
return this._loadFileLayers();
|
|
312
|
+
case 2:
|
|
313
|
+
return _context5.abrupt("return", _context5.sent);
|
|
314
|
+
case 3:
|
|
315
|
+
case "end":
|
|
316
|
+
return _context5.stop();
|
|
384
317
|
}
|
|
385
318
|
}, _callee5, this);
|
|
386
319
|
}));
|
|
387
|
-
|
|
388
320
|
function getFileLayers() {
|
|
389
321
|
return _getFileLayers.apply(this, arguments);
|
|
390
322
|
}
|
|
391
|
-
|
|
392
323
|
return getFileLayers;
|
|
393
324
|
}()
|
|
394
325
|
}, {
|
|
395
326
|
key: "getTMSServices",
|
|
396
327
|
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
|
-
}
|
|
328
|
+
var _getTMSServices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
329
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
330
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
331
|
+
case 0:
|
|
332
|
+
_context6.next = 2;
|
|
333
|
+
return this._loadTMSServices();
|
|
334
|
+
case 2:
|
|
335
|
+
return _context6.abrupt("return", _context6.sent);
|
|
336
|
+
case 3:
|
|
337
|
+
case "end":
|
|
338
|
+
return _context6.stop();
|
|
412
339
|
}
|
|
413
340
|
}, _callee6, this);
|
|
414
341
|
}));
|
|
415
|
-
|
|
416
342
|
function getTMSServices() {
|
|
417
343
|
return _getTMSServices.apply(this, arguments);
|
|
418
344
|
}
|
|
419
|
-
|
|
420
345
|
return getTMSServices;
|
|
421
346
|
}()
|
|
422
347
|
}, {
|
|
423
348
|
key: "cacheGeoJson",
|
|
424
349
|
value: function cacheGeoJson(layerId, geoJson) {
|
|
425
350
|
this._cache.set(layerId, geoJson);
|
|
426
|
-
|
|
427
351
|
return;
|
|
428
352
|
}
|
|
429
353
|
}, {
|
|
@@ -461,97 +385,77 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
461
385
|
}, {
|
|
462
386
|
key: "findFileLayerById",
|
|
463
387
|
value: function () {
|
|
464
|
-
var _findFileLayerById = _asyncToGenerator( /*#__PURE__*/
|
|
388
|
+
var _findFileLayerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(id) {
|
|
465
389
|
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;
|
|
390
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
391
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
392
|
+
case 0:
|
|
393
|
+
_context7.next = 2;
|
|
394
|
+
return this.getFileLayers();
|
|
395
|
+
case 2:
|
|
396
|
+
fileLayers = _context7.sent;
|
|
397
|
+
i = 0;
|
|
398
|
+
case 4:
|
|
399
|
+
if (!(i < fileLayers.length)) {
|
|
400
|
+
_context7.next = 10;
|
|
493
401
|
break;
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
402
|
+
}
|
|
403
|
+
if (!fileLayers[i].hasId(id)) {
|
|
404
|
+
_context7.next = 7;
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
return _context7.abrupt("return", fileLayers[i]);
|
|
408
|
+
case 7:
|
|
409
|
+
i++;
|
|
410
|
+
_context7.next = 4;
|
|
411
|
+
break;
|
|
412
|
+
case 10:
|
|
413
|
+
case "end":
|
|
414
|
+
return _context7.stop();
|
|
499
415
|
}
|
|
500
416
|
}, _callee7, this);
|
|
501
417
|
}));
|
|
502
|
-
|
|
503
418
|
function findFileLayerById(_x2) {
|
|
504
419
|
return _findFileLayerById.apply(this, arguments);
|
|
505
420
|
}
|
|
506
|
-
|
|
507
421
|
return findFileLayerById;
|
|
508
422
|
}()
|
|
509
423
|
}, {
|
|
510
424
|
key: "findTMSServiceById",
|
|
511
425
|
value: function () {
|
|
512
|
-
var _findTMSServiceById = _asyncToGenerator( /*#__PURE__*/
|
|
426
|
+
var _findTMSServiceById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(id) {
|
|
513
427
|
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;
|
|
428
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
429
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
430
|
+
case 0:
|
|
431
|
+
_context8.next = 2;
|
|
432
|
+
return this.getTMSServices();
|
|
433
|
+
case 2:
|
|
434
|
+
tmsServices = _context8.sent;
|
|
435
|
+
i = 0;
|
|
436
|
+
case 4:
|
|
437
|
+
if (!(i < tmsServices.length)) {
|
|
438
|
+
_context8.next = 10;
|
|
541
439
|
break;
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
440
|
+
}
|
|
441
|
+
if (!tmsServices[i].hasId(id)) {
|
|
442
|
+
_context8.next = 7;
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
return _context8.abrupt("return", tmsServices[i]);
|
|
446
|
+
case 7:
|
|
447
|
+
i++;
|
|
448
|
+
_context8.next = 4;
|
|
449
|
+
break;
|
|
450
|
+
case 10:
|
|
451
|
+
case "end":
|
|
452
|
+
return _context8.stop();
|
|
547
453
|
}
|
|
548
454
|
}, _callee8, this);
|
|
549
455
|
}));
|
|
550
|
-
|
|
551
456
|
function findTMSServiceById(_x3) {
|
|
552
457
|
return _findTMSServiceById.apply(this, arguments);
|
|
553
458
|
}
|
|
554
|
-
|
|
555
459
|
return findTMSServiceById;
|
|
556
460
|
}()
|
|
557
461
|
}, {
|
|
@@ -559,7 +463,6 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
559
463
|
value: function _getEmsVersion(version) {
|
|
560
464
|
var userVersion = semver.valid(semver.coerce(version));
|
|
561
465
|
var semverVersion = userVersion ? userVersion : semver.coerce(DEFAULT_EMS_VERSION);
|
|
562
|
-
|
|
563
466
|
if (semverVersion) {
|
|
564
467
|
return "v".concat(semver.major(semverVersion), ".").concat(semver.minor(semverVersion));
|
|
565
468
|
} else {
|
|
@@ -570,12 +473,10 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
570
473
|
key: "_fetchWithTimeout",
|
|
571
474
|
value: function _fetchWithTimeout(url) {
|
|
572
475
|
var _this = this;
|
|
573
|
-
|
|
574
476
|
return new Promise(function (resolve, reject) {
|
|
575
477
|
var timer = setTimeout(function () {
|
|
576
478
|
return reject(new Error("Request to ".concat(url, " timed out")));
|
|
577
479
|
}, _this.EMS_LOAD_TIMEOUT);
|
|
578
|
-
|
|
579
480
|
_this._fetchFunction(url).then(function (response) {
|
|
580
481
|
clearTimeout(timer);
|
|
581
482
|
resolve(response);
|
|
@@ -588,211 +489,170 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
588
489
|
}, {
|
|
589
490
|
key: "_getManifestWithParams",
|
|
590
491
|
value: function () {
|
|
591
|
-
var _getManifestWithParams2 = _asyncToGenerator( /*#__PURE__*/
|
|
492
|
+
var _getManifestWithParams2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(url) {
|
|
592
493
|
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
|
-
}
|
|
494
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
495
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
496
|
+
case 0:
|
|
497
|
+
extendedUrl = this.extendUrlWithParams(url);
|
|
498
|
+
_context9.next = 3;
|
|
499
|
+
return this.getManifest(extendedUrl);
|
|
500
|
+
case 3:
|
|
501
|
+
return _context9.abrupt("return", _context9.sent);
|
|
502
|
+
case 4:
|
|
503
|
+
case "end":
|
|
504
|
+
return _context9.stop();
|
|
608
505
|
}
|
|
609
506
|
}, _callee9, this);
|
|
610
507
|
}));
|
|
611
|
-
|
|
612
508
|
function _getManifestWithParams(_x4) {
|
|
613
509
|
return _getManifestWithParams2.apply(this, arguments);
|
|
614
510
|
}
|
|
615
|
-
|
|
616
511
|
return _getManifestWithParams;
|
|
617
512
|
}()
|
|
618
513
|
}, {
|
|
619
514
|
key: "_invalidateSettings",
|
|
620
515
|
value: function _invalidateSettings() {
|
|
621
516
|
var _this2 = this;
|
|
622
|
-
|
|
623
517
|
this._cache.reset();
|
|
624
|
-
|
|
625
|
-
this._getMainCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
|
|
518
|
+
this._getMainCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
626
519
|
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
|
|
520
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
521
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
522
|
+
case 0:
|
|
523
|
+
if (!_this2._manifestServiceUrl) {
|
|
524
|
+
_context10.next = 7;
|
|
525
|
+
break;
|
|
526
|
+
}
|
|
527
|
+
console.warn("The \"manifestServiceUrl\" parameter is deprecated in v7.6.0.\n Consider using \"tileApiUrl\" and \"fileApiUrl\" instead.");
|
|
528
|
+
_context10.next = 4;
|
|
529
|
+
return _this2._getManifestWithParams(_this2._manifestServiceUrl);
|
|
530
|
+
case 4:
|
|
531
|
+
return _context10.abrupt("return", _context10.sent);
|
|
532
|
+
case 7:
|
|
533
|
+
services = [];
|
|
534
|
+
if (_this2._tileApiUrl) {
|
|
535
|
+
services.push({
|
|
536
|
+
type: 'tms',
|
|
537
|
+
manifest: toAbsoluteUrl(_this2._tileApiUrl, "".concat(_this2._emsVersion, "/manifest"))
|
|
662
538
|
});
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
539
|
+
}
|
|
540
|
+
if (_this2._fileApiUrl) {
|
|
541
|
+
services.push({
|
|
542
|
+
type: 'file',
|
|
543
|
+
manifest: toAbsoluteUrl(_this2._fileApiUrl, "".concat(_this2._emsVersion, "/manifest"))
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
return _context10.abrupt("return", {
|
|
547
|
+
services: services
|
|
548
|
+
});
|
|
549
|
+
case 11:
|
|
550
|
+
case "end":
|
|
551
|
+
return _context10.stop();
|
|
668
552
|
}
|
|
669
553
|
}, _callee10);
|
|
670
554
|
})));
|
|
671
|
-
this._getDefaultTMSCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
555
|
+
this._getDefaultTMSCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
672
556
|
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
|
-
}
|
|
557
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
558
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
559
|
+
case 0:
|
|
560
|
+
_context11.next = 2;
|
|
561
|
+
return _this2._getMainCatalog();
|
|
562
|
+
case 2:
|
|
563
|
+
catalogue = _context11.sent;
|
|
564
|
+
firstService = catalogue.services.find(function (service) {
|
|
565
|
+
return service.type === 'tms';
|
|
566
|
+
});
|
|
567
|
+
if (firstService) {
|
|
568
|
+
_context11.next = 6;
|
|
569
|
+
break;
|
|
570
|
+
}
|
|
571
|
+
return _context11.abrupt("return", {
|
|
572
|
+
services: []
|
|
573
|
+
});
|
|
574
|
+
case 6:
|
|
575
|
+
url = _this2._proxyPath + firstService.manifest;
|
|
576
|
+
_context11.next = 9;
|
|
577
|
+
return _this2.getManifest(url);
|
|
578
|
+
case 9:
|
|
579
|
+
return _context11.abrupt("return", _context11.sent);
|
|
580
|
+
case 10:
|
|
581
|
+
case "end":
|
|
582
|
+
return _context11.stop();
|
|
707
583
|
}
|
|
708
584
|
}, _callee11);
|
|
709
585
|
})));
|
|
710
|
-
this._getDefaultFileCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
586
|
+
this._getDefaultFileCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
711
587
|
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
|
-
}
|
|
588
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
589
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
590
|
+
case 0:
|
|
591
|
+
_context12.next = 2;
|
|
592
|
+
return _this2._getMainCatalog();
|
|
593
|
+
case 2:
|
|
594
|
+
catalogue = _context12.sent;
|
|
595
|
+
firstService = catalogue.services.find(function (service) {
|
|
596
|
+
return service.type === 'file';
|
|
597
|
+
});
|
|
598
|
+
if (firstService) {
|
|
599
|
+
_context12.next = 6;
|
|
600
|
+
break;
|
|
601
|
+
}
|
|
602
|
+
return _context12.abrupt("return", {
|
|
603
|
+
layers: []
|
|
604
|
+
});
|
|
605
|
+
case 6:
|
|
606
|
+
url = _this2._proxyPath + firstService.manifest;
|
|
607
|
+
_context12.next = 9;
|
|
608
|
+
return _this2.getManifest(url);
|
|
609
|
+
case 9:
|
|
610
|
+
return _context12.abrupt("return", _context12.sent);
|
|
611
|
+
case 10:
|
|
612
|
+
case "end":
|
|
613
|
+
return _context12.stop();
|
|
746
614
|
}
|
|
747
615
|
}, _callee12);
|
|
748
|
-
})));
|
|
616
|
+
})));
|
|
749
617
|
|
|
750
|
-
|
|
618
|
+
//Cache the actual instances of TMSService as these in turn cache sub-manifests for the style-files
|
|
619
|
+
this._loadTMSServices = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
751
620
|
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
|
-
}
|
|
621
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
622
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
623
|
+
case 0:
|
|
624
|
+
_context13.next = 2;
|
|
625
|
+
return _this2._getDefaultTMSCatalog();
|
|
626
|
+
case 2:
|
|
627
|
+
tmsManifest = _context13.sent;
|
|
628
|
+
return _context13.abrupt("return", tmsManifest.services.map(function (serviceConfig) {
|
|
629
|
+
return new TMSService(serviceConfig, _this2, _this2._proxyPath);
|
|
630
|
+
}));
|
|
631
|
+
case 4:
|
|
632
|
+
case "end":
|
|
633
|
+
return _context13.stop();
|
|
769
634
|
}
|
|
770
635
|
}, _callee13);
|
|
771
636
|
})));
|
|
772
|
-
this._loadFileLayers = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
637
|
+
this._loadFileLayers = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
773
638
|
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
|
-
}
|
|
639
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
640
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
641
|
+
case 0:
|
|
642
|
+
_context14.next = 2;
|
|
643
|
+
return _this2._getDefaultFileCatalog();
|
|
644
|
+
case 2:
|
|
645
|
+
fileManifest = _context14.sent;
|
|
646
|
+
return _context14.abrupt("return", fileManifest.layers.map(function (layerConfig) {
|
|
647
|
+
return new FileLayer(layerConfig, _this2, _this2._proxyPath);
|
|
648
|
+
}));
|
|
649
|
+
case 4:
|
|
650
|
+
case "end":
|
|
651
|
+
return _context14.stop();
|
|
791
652
|
}
|
|
792
653
|
}, _callee14);
|
|
793
654
|
})));
|
|
794
655
|
}
|
|
795
656
|
}]);
|
|
796
|
-
|
|
797
657
|
return EMSClient;
|
|
798
658
|
}();
|