@elastic/ems-client 7.15.1 → 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 +16 -0
- package/catalog-info.yaml +68 -0
- package/package.json +8 -5
- package/src/ems_client.ts +14 -12
- package/src/file_layer.ts +0 -1
- package/target/node/ems_client.js +33 -100
- package/target/node/ems_service.js +11 -23
- package/target/node/file_layer.js +18 -64
- package/target/node/index.js +6 -10
- 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 +300 -432
- package/target/web/ems_service.js +10 -26
- package/target/web/file_layer.js +62 -118
- 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/ems_client.js +0 -443
- package/target/ems_service.js +0 -76
- package/target/file_layer.js +0 -123
- package/target/index.js +0 -28
- package/target/origin.js +0 -24
- package/target/tms_service.js +0 -429
- package/target/tsdoc-metadata.json +0 -11
- package/target/utils.js +0 -42
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.15';
|
|
|
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,77 +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__*/
|
|
190
|
-
var url,
|
|
191
|
-
return
|
|
192
|
-
while (1) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (!result) {
|
|
206
|
-
_context.next = 11;
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
_context.next = 8;
|
|
211
|
-
return result.json();
|
|
212
|
-
|
|
213
|
-
case 8:
|
|
214
|
-
_context.t0 = _context.sent;
|
|
215
|
-
_context.next = 12;
|
|
164
|
+
var _getManifest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(endpointUrl) {
|
|
165
|
+
var url, response;
|
|
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;
|
|
216
179
|
break;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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();
|
|
242
210
|
}
|
|
243
|
-
}, _callee, this, [[0,
|
|
211
|
+
}, _callee, this, [[0, 17]]);
|
|
244
212
|
}));
|
|
245
|
-
|
|
246
213
|
function getManifest(_x) {
|
|
247
214
|
return _getManifest.apply(this, arguments);
|
|
248
215
|
}
|
|
249
|
-
|
|
250
216
|
return getManifest;
|
|
251
217
|
}()
|
|
252
218
|
/**
|
|
@@ -254,7 +220,6 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
254
220
|
*
|
|
255
221
|
* @param additionalQueryParams
|
|
256
222
|
*/
|
|
257
|
-
|
|
258
223
|
}, {
|
|
259
224
|
key: "addQueryParams",
|
|
260
225
|
value: function addQueryParams(additionalQueryParams) {
|
|
@@ -263,9 +228,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
263
228
|
if (additionalQueryParams[_key] !== this._queryParams[_key]) {
|
|
264
229
|
//changes detected.
|
|
265
230
|
this._queryParams = _.assign({}, this._queryParams, additionalQueryParams);
|
|
266
|
-
|
|
267
231
|
this._invalidateSettings();
|
|
268
|
-
|
|
269
232
|
break;
|
|
270
233
|
}
|
|
271
234
|
}
|
|
@@ -274,148 +237,117 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
274
237
|
}, {
|
|
275
238
|
key: "getMainManifest",
|
|
276
239
|
value: function () {
|
|
277
|
-
var _getMainManifest = _asyncToGenerator( /*#__PURE__*/
|
|
278
|
-
return
|
|
279
|
-
while (1) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
case 3:
|
|
289
|
-
case "end":
|
|
290
|
-
return _context2.stop();
|
|
291
|
-
}
|
|
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();
|
|
292
251
|
}
|
|
293
252
|
}, _callee2, this);
|
|
294
253
|
}));
|
|
295
|
-
|
|
296
254
|
function getMainManifest() {
|
|
297
255
|
return _getMainManifest.apply(this, arguments);
|
|
298
256
|
}
|
|
299
|
-
|
|
300
257
|
return getMainManifest;
|
|
301
258
|
}()
|
|
302
259
|
}, {
|
|
303
260
|
key: "getDefaultFileManifest",
|
|
304
261
|
value: function () {
|
|
305
|
-
var _getDefaultFileManifest = _asyncToGenerator( /*#__PURE__*/
|
|
306
|
-
return
|
|
307
|
-
while (1) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
case 3:
|
|
317
|
-
case "end":
|
|
318
|
-
return _context3.stop();
|
|
319
|
-
}
|
|
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();
|
|
320
273
|
}
|
|
321
274
|
}, _callee3, this);
|
|
322
275
|
}));
|
|
323
|
-
|
|
324
276
|
function getDefaultFileManifest() {
|
|
325
277
|
return _getDefaultFileManifest.apply(this, arguments);
|
|
326
278
|
}
|
|
327
|
-
|
|
328
279
|
return getDefaultFileManifest;
|
|
329
280
|
}()
|
|
330
281
|
}, {
|
|
331
282
|
key: "getDefaultTMSManifest",
|
|
332
283
|
value: function () {
|
|
333
|
-
var _getDefaultTMSManifest = _asyncToGenerator( /*#__PURE__*/
|
|
334
|
-
return
|
|
335
|
-
while (1) {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
case 3:
|
|
345
|
-
case "end":
|
|
346
|
-
return _context4.stop();
|
|
347
|
-
}
|
|
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();
|
|
348
295
|
}
|
|
349
296
|
}, _callee4, this);
|
|
350
297
|
}));
|
|
351
|
-
|
|
352
298
|
function getDefaultTMSManifest() {
|
|
353
299
|
return _getDefaultTMSManifest.apply(this, arguments);
|
|
354
300
|
}
|
|
355
|
-
|
|
356
301
|
return getDefaultTMSManifest;
|
|
357
302
|
}()
|
|
358
303
|
}, {
|
|
359
304
|
key: "getFileLayers",
|
|
360
305
|
value: function () {
|
|
361
|
-
var _getFileLayers = _asyncToGenerator( /*#__PURE__*/
|
|
362
|
-
return
|
|
363
|
-
while (1) {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
case 3:
|
|
373
|
-
case "end":
|
|
374
|
-
return _context5.stop();
|
|
375
|
-
}
|
|
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();
|
|
376
317
|
}
|
|
377
318
|
}, _callee5, this);
|
|
378
319
|
}));
|
|
379
|
-
|
|
380
320
|
function getFileLayers() {
|
|
381
321
|
return _getFileLayers.apply(this, arguments);
|
|
382
322
|
}
|
|
383
|
-
|
|
384
323
|
return getFileLayers;
|
|
385
324
|
}()
|
|
386
325
|
}, {
|
|
387
326
|
key: "getTMSServices",
|
|
388
327
|
value: function () {
|
|
389
|
-
var _getTMSServices = _asyncToGenerator( /*#__PURE__*/
|
|
390
|
-
return
|
|
391
|
-
while (1) {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
case 3:
|
|
401
|
-
case "end":
|
|
402
|
-
return _context6.stop();
|
|
403
|
-
}
|
|
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();
|
|
404
339
|
}
|
|
405
340
|
}, _callee6, this);
|
|
406
341
|
}));
|
|
407
|
-
|
|
408
342
|
function getTMSServices() {
|
|
409
343
|
return _getTMSServices.apply(this, arguments);
|
|
410
344
|
}
|
|
411
|
-
|
|
412
345
|
return getTMSServices;
|
|
413
346
|
}()
|
|
414
347
|
}, {
|
|
415
348
|
key: "cacheGeoJson",
|
|
416
349
|
value: function cacheGeoJson(layerId, geoJson) {
|
|
417
350
|
this._cache.set(layerId, geoJson);
|
|
418
|
-
|
|
419
351
|
return;
|
|
420
352
|
}
|
|
421
353
|
}, {
|
|
@@ -453,97 +385,77 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
453
385
|
}, {
|
|
454
386
|
key: "findFileLayerById",
|
|
455
387
|
value: function () {
|
|
456
|
-
var _findFileLayerById = _asyncToGenerator( /*#__PURE__*/
|
|
388
|
+
var _findFileLayerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(id) {
|
|
457
389
|
var fileLayers, i;
|
|
458
|
-
return
|
|
459
|
-
while (1) {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
case 4:
|
|
470
|
-
if (!(i < fileLayers.length)) {
|
|
471
|
-
_context7.next = 10;
|
|
472
|
-
break;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
if (!fileLayers[i].hasId(id)) {
|
|
476
|
-
_context7.next = 7;
|
|
477
|
-
break;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
return _context7.abrupt("return", fileLayers[i]);
|
|
481
|
-
|
|
482
|
-
case 7:
|
|
483
|
-
i++;
|
|
484
|
-
_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;
|
|
485
401
|
break;
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
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();
|
|
491
415
|
}
|
|
492
416
|
}, _callee7, this);
|
|
493
417
|
}));
|
|
494
|
-
|
|
495
418
|
function findFileLayerById(_x2) {
|
|
496
419
|
return _findFileLayerById.apply(this, arguments);
|
|
497
420
|
}
|
|
498
|
-
|
|
499
421
|
return findFileLayerById;
|
|
500
422
|
}()
|
|
501
423
|
}, {
|
|
502
424
|
key: "findTMSServiceById",
|
|
503
425
|
value: function () {
|
|
504
|
-
var _findTMSServiceById = _asyncToGenerator( /*#__PURE__*/
|
|
426
|
+
var _findTMSServiceById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(id) {
|
|
505
427
|
var tmsServices, i;
|
|
506
|
-
return
|
|
507
|
-
while (1) {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
case 4:
|
|
518
|
-
if (!(i < tmsServices.length)) {
|
|
519
|
-
_context8.next = 10;
|
|
520
|
-
break;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
if (!tmsServices[i].hasId(id)) {
|
|
524
|
-
_context8.next = 7;
|
|
525
|
-
break;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
return _context8.abrupt("return", tmsServices[i]);
|
|
529
|
-
|
|
530
|
-
case 7:
|
|
531
|
-
i++;
|
|
532
|
-
_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;
|
|
533
439
|
break;
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
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();
|
|
539
453
|
}
|
|
540
454
|
}, _callee8, this);
|
|
541
455
|
}));
|
|
542
|
-
|
|
543
456
|
function findTMSServiceById(_x3) {
|
|
544
457
|
return _findTMSServiceById.apply(this, arguments);
|
|
545
458
|
}
|
|
546
|
-
|
|
547
459
|
return findTMSServiceById;
|
|
548
460
|
}()
|
|
549
461
|
}, {
|
|
@@ -551,7 +463,6 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
551
463
|
value: function _getEmsVersion(version) {
|
|
552
464
|
var userVersion = semver.valid(semver.coerce(version));
|
|
553
465
|
var semverVersion = userVersion ? userVersion : semver.coerce(DEFAULT_EMS_VERSION);
|
|
554
|
-
|
|
555
466
|
if (semverVersion) {
|
|
556
467
|
return "v".concat(semver.major(semverVersion), ".").concat(semver.minor(semverVersion));
|
|
557
468
|
} else {
|
|
@@ -562,12 +473,10 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
562
473
|
key: "_fetchWithTimeout",
|
|
563
474
|
value: function _fetchWithTimeout(url) {
|
|
564
475
|
var _this = this;
|
|
565
|
-
|
|
566
476
|
return new Promise(function (resolve, reject) {
|
|
567
477
|
var timer = setTimeout(function () {
|
|
568
478
|
return reject(new Error("Request to ".concat(url, " timed out")));
|
|
569
479
|
}, _this.EMS_LOAD_TIMEOUT);
|
|
570
|
-
|
|
571
480
|
_this._fetchFunction(url).then(function (response) {
|
|
572
481
|
clearTimeout(timer);
|
|
573
482
|
resolve(response);
|
|
@@ -580,211 +489,170 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
580
489
|
}, {
|
|
581
490
|
key: "_getManifestWithParams",
|
|
582
491
|
value: function () {
|
|
583
|
-
var _getManifestWithParams2 = _asyncToGenerator( /*#__PURE__*/
|
|
492
|
+
var _getManifestWithParams2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(url) {
|
|
584
493
|
var extendedUrl;
|
|
585
|
-
return
|
|
586
|
-
while (1) {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
case 4:
|
|
597
|
-
case "end":
|
|
598
|
-
return _context9.stop();
|
|
599
|
-
}
|
|
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();
|
|
600
505
|
}
|
|
601
506
|
}, _callee9, this);
|
|
602
507
|
}));
|
|
603
|
-
|
|
604
508
|
function _getManifestWithParams(_x4) {
|
|
605
509
|
return _getManifestWithParams2.apply(this, arguments);
|
|
606
510
|
}
|
|
607
|
-
|
|
608
511
|
return _getManifestWithParams;
|
|
609
512
|
}()
|
|
610
513
|
}, {
|
|
611
514
|
key: "_invalidateSettings",
|
|
612
515
|
value: function _invalidateSettings() {
|
|
613
516
|
var _this2 = this;
|
|
614
|
-
|
|
615
517
|
this._cache.reset();
|
|
616
|
-
|
|
617
|
-
this._getMainCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
|
|
518
|
+
this._getMainCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
618
519
|
var services;
|
|
619
|
-
return
|
|
620
|
-
while (1) {
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
if (_this2._tileApiUrl) {
|
|
639
|
-
services.push({
|
|
640
|
-
type: 'tms',
|
|
641
|
-
manifest: toAbsoluteUrl(_this2._tileApiUrl, "".concat(_this2._emsVersion, "/manifest"))
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
if (_this2._fileApiUrl) {
|
|
646
|
-
services.push({
|
|
647
|
-
type: 'file',
|
|
648
|
-
manifest: toAbsoluteUrl(_this2._fileApiUrl, "".concat(_this2._emsVersion, "/manifest"))
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
return _context10.abrupt("return", {
|
|
653
|
-
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"))
|
|
654
538
|
});
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
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();
|
|
660
552
|
}
|
|
661
553
|
}, _callee10);
|
|
662
554
|
})));
|
|
663
|
-
this._getDefaultTMSCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
555
|
+
this._getDefaultTMSCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
664
556
|
var catalogue, firstService, url;
|
|
665
|
-
return
|
|
666
|
-
while (1) {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
case 9:
|
|
693
|
-
return _context11.abrupt("return", _context11.sent);
|
|
694
|
-
|
|
695
|
-
case 10:
|
|
696
|
-
case "end":
|
|
697
|
-
return _context11.stop();
|
|
698
|
-
}
|
|
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();
|
|
699
583
|
}
|
|
700
584
|
}, _callee11);
|
|
701
585
|
})));
|
|
702
|
-
this._getDefaultFileCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
586
|
+
this._getDefaultFileCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
703
587
|
var catalogue, firstService, url;
|
|
704
|
-
return
|
|
705
|
-
while (1) {
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
case 9:
|
|
732
|
-
return _context12.abrupt("return", _context12.sent);
|
|
733
|
-
|
|
734
|
-
case 10:
|
|
735
|
-
case "end":
|
|
736
|
-
return _context12.stop();
|
|
737
|
-
}
|
|
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();
|
|
738
614
|
}
|
|
739
615
|
}, _callee12);
|
|
740
|
-
})));
|
|
616
|
+
})));
|
|
741
617
|
|
|
742
|
-
|
|
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() {
|
|
743
620
|
var tmsManifest;
|
|
744
|
-
return
|
|
745
|
-
while (1) {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
case 4:
|
|
758
|
-
case "end":
|
|
759
|
-
return _context13.stop();
|
|
760
|
-
}
|
|
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();
|
|
761
634
|
}
|
|
762
635
|
}, _callee13);
|
|
763
636
|
})));
|
|
764
|
-
this._loadFileLayers = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
637
|
+
this._loadFileLayers = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
765
638
|
var fileManifest;
|
|
766
|
-
return
|
|
767
|
-
while (1) {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
case 4:
|
|
780
|
-
case "end":
|
|
781
|
-
return _context14.stop();
|
|
782
|
-
}
|
|
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();
|
|
783
652
|
}
|
|
784
653
|
}, _callee14);
|
|
785
654
|
})));
|
|
786
655
|
}
|
|
787
656
|
}]);
|
|
788
|
-
|
|
789
657
|
return EMSClient;
|
|
790
658
|
}();
|