@elastic/ems-client 8.6.3 → 8.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.backportrc.json +2 -4
- package/.buildkite/compare_dependencies.js +15 -0
- package/.buildkite/pipeline.yml +1 -1
- package/.github/workflows/backport.yml +2 -2
- package/.github/workflows/publish.yml +30 -0
- package/.nvmrc +1 -1
- package/CHANGELOG.md +14 -0
- package/CONTRIBUTING.md +4 -6
- package/babel.config.js +2 -3
- package/eslint.config.mjs +2 -4
- package/package.json +35 -32
- package/renovate.json +15 -8
- package/src/ems_client.ts +4 -4
- package/src/file_layer.ts +1 -1
- package/target/ems_client.d.ts +1 -1
- package/target/file_layer.d.ts +1 -1
- package/target/node/ems_client.js +31 -28
- package/target/node/ems_service.js +17 -16
- package/target/node/file_layer.js +5 -6
- package/target/node/tms_service.js +275 -273
- package/target/node/utils.js +4 -2
- package/target/web/ems_client.js +217 -533
- package/target/web/ems_service.js +35 -49
- package/target/web/file_layer.js +118 -212
- package/target/web/tms_service.js +478 -914
- package/target/web/utils.js +15 -16
- package/test/__snapshots__/ems_client.test.ts.snap +1 -1
- package/tsconfig.json +8 -5
- package/target/origin.d.ts +0 -4
package/target/web/ems_client.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
4
|
-
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
5
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
6
|
-
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
9
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
10
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
1
|
/*
|
|
12
2
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
13
3
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -16,16 +6,17 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
16
6
|
*/
|
|
17
7
|
import _ from 'lodash';
|
|
18
8
|
import { TMSService } from './tms_service';
|
|
19
|
-
import { FileLayer } from './file_layer';
|
|
9
|
+
import { EMSFormatType, FileLayer } from './file_layer';
|
|
20
10
|
import semverCoerce from 'semver/functions/coerce';
|
|
21
11
|
import semverValid from 'semver/functions/valid';
|
|
22
12
|
import semverMajor from 'semver/functions/major';
|
|
23
13
|
import semverMinor from 'semver/functions/minor';
|
|
24
|
-
import { format as formatUrl, parse as parseUrl } from 'url';
|
|
14
|
+
import { format as formatUrl, parse as parseUrl, UrlObject } from 'url';
|
|
25
15
|
import { toAbsoluteUrl } from './utils';
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
import { ParsedUrlQueryInput } from 'querystring';
|
|
17
|
+
import { LRUCache } from 'lru-cache';
|
|
18
|
+
const REST_API_REGEX = /\d{4}-\d{2}-\d{2}/;
|
|
19
|
+
export const LATEST_API_URL_PATH = 'latest';
|
|
29
20
|
/**
|
|
30
21
|
* plugins cannot have upstream dependencies on core/*-kibana.
|
|
31
22
|
* Work-around by copy-pasting modifyUrl routine here.
|
|
@@ -33,7 +24,7 @@ export var LATEST_API_URL_PATH = 'latest';
|
|
|
33
24
|
* @param block
|
|
34
25
|
*/
|
|
35
26
|
function modifyUrlLocal(url, block) {
|
|
36
|
-
|
|
27
|
+
const parsed = parseUrl(url, true);
|
|
37
28
|
|
|
38
29
|
// copy over the most specific version of each
|
|
39
30
|
// property. By default, the parsed url includes
|
|
@@ -41,7 +32,7 @@ function modifyUrlLocal(url, block) {
|
|
|
41
32
|
// pathname + search, or search and query) and keeping
|
|
42
33
|
// track of which property is actually used when they
|
|
43
34
|
// are formatted is harder than necessary
|
|
44
|
-
|
|
35
|
+
const meaningfulParts = {
|
|
45
36
|
protocol: parsed.protocol,
|
|
46
37
|
slashes: parsed.slashes,
|
|
47
38
|
auth: parsed.auth,
|
|
@@ -53,7 +44,7 @@ function modifyUrlLocal(url, block) {
|
|
|
53
44
|
};
|
|
54
45
|
|
|
55
46
|
// the block modifies the meaningfulParts object, or returns a new one
|
|
56
|
-
|
|
47
|
+
const modifiedParts = block(meaningfulParts) || meaningfulParts;
|
|
57
48
|
|
|
58
49
|
// format the modified/replaced meaningfulParts back into a url
|
|
59
50
|
return formatUrl({
|
|
@@ -67,11 +58,7 @@ function modifyUrlLocal(url, block) {
|
|
|
67
58
|
hash: modifiedParts.hash
|
|
68
59
|
});
|
|
69
60
|
}
|
|
70
|
-
|
|
71
|
-
return modifyUrlLocal(url, function (parsed) {
|
|
72
|
-
return _.merge(parsed, props);
|
|
73
|
-
});
|
|
74
|
-
};
|
|
61
|
+
const extendUrl = (url, props) => modifyUrlLocal(url, parsed => _.merge(parsed, props));
|
|
75
62
|
|
|
76
63
|
/**
|
|
77
64
|
* Unescape a url template that was escaped by encodeURI() so leaflet
|
|
@@ -79,38 +66,36 @@ var extendUrl = function extendUrl(url, props) {
|
|
|
79
66
|
* @param {String} url
|
|
80
67
|
* @return {String}
|
|
81
68
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return url.replace(ENCODED_TEMPLATE_VARS_RE,
|
|
85
|
-
return "{".concat(varName, "}");
|
|
86
|
-
});
|
|
69
|
+
const unescapeTemplateVars = url => {
|
|
70
|
+
const ENCODED_TEMPLATE_VARS_RE = /%7B(\w+?)%7D/g;
|
|
71
|
+
return url.replace(ENCODED_TEMPLATE_VARS_RE, (total, varName) => `{${varName}}`);
|
|
87
72
|
};
|
|
88
73
|
//this is not the default locale from Kibana, but the default locale supported by the Elastic Maps Service
|
|
89
|
-
|
|
90
|
-
export
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
74
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
75
|
+
export class EMSClient {
|
|
76
|
+
EMS_LOAD_TIMEOUT = 32000;
|
|
77
|
+
_queryParams;
|
|
78
|
+
_appVersion;
|
|
79
|
+
_fetchFunction;
|
|
80
|
+
_sanitizer;
|
|
81
|
+
_fileApiUrl;
|
|
82
|
+
_tileApiUrl;
|
|
83
|
+
_emsVersion;
|
|
84
|
+
_emsLandingPageUrl;
|
|
85
|
+
_language;
|
|
86
|
+
_proxyPath;
|
|
87
|
+
_cache;
|
|
88
|
+
_isRestApi = false;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* these methods are assigned outside the constructor
|
|
92
|
+
*/
|
|
93
|
+
_getMainCatalog;
|
|
94
|
+
_getDefaultTMSCatalog;
|
|
95
|
+
_getDefaultFileCatalog;
|
|
96
|
+
_loadTMSServices;
|
|
97
|
+
_loadFileLayers;
|
|
98
|
+
constructor(config) {
|
|
114
99
|
// Remove kbnVersion in 8.0
|
|
115
100
|
if ('kbnVersion' in config) {
|
|
116
101
|
console.warn('The "kbnVersion" parameter for ems-client is deprecated. Please use "appVersion" instead.');
|
|
@@ -123,9 +108,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
123
108
|
my_app_name: config.appName || 'kibana',
|
|
124
109
|
my_app_version: this._appVersion
|
|
125
110
|
};
|
|
126
|
-
this._sanitizer = config.htmlSanitizer ? config.htmlSanitizer :
|
|
127
|
-
return x;
|
|
128
|
-
};
|
|
111
|
+
this._sanitizer = config.htmlSanitizer ? config.htmlSanitizer : x => x;
|
|
129
112
|
this._tileApiUrl = config.tileApiUrl;
|
|
130
113
|
this._fileApiUrl = config.fileApiUrl;
|
|
131
114
|
this._emsVersion = this._getEmsVersion(config.emsVersion);
|
|
@@ -139,497 +122,198 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
139
122
|
});
|
|
140
123
|
this._invalidateSettings();
|
|
141
124
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return
|
|
125
|
+
getDefaultLocale() {
|
|
126
|
+
return DEFAULT_LANGUAGE;
|
|
127
|
+
}
|
|
128
|
+
getLocale() {
|
|
129
|
+
return this._language;
|
|
130
|
+
}
|
|
131
|
+
getValueInLanguage(i18nObject) {
|
|
132
|
+
if (!i18nObject) {
|
|
133
|
+
return '';
|
|
151
134
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
135
|
+
return i18nObject[this._language] ? i18nObject[this._language] : i18nObject[DEFAULT_LANGUAGE];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* this internal method is overridden by the tests to simulate custom manifest.
|
|
140
|
+
*/
|
|
141
|
+
async getManifest(endpointUrl) {
|
|
142
|
+
try {
|
|
143
|
+
const url = extendUrl(endpointUrl, {
|
|
144
|
+
query: this._queryParams
|
|
145
|
+
});
|
|
146
|
+
const response = await this._fetchWithTimeout(url);
|
|
147
|
+
if (!response.ok) {
|
|
148
|
+
throw new Error(response.statusText);
|
|
149
|
+
}
|
|
150
|
+
if (response) {
|
|
151
|
+
return await response.json();
|
|
152
|
+
} else {
|
|
153
|
+
throw new Error('Response not found');
|
|
154
|
+
}
|
|
155
|
+
} catch (e) {
|
|
156
|
+
if (e instanceof Error) {
|
|
157
|
+
throw e;
|
|
158
|
+
} else {
|
|
159
|
+
throw new Error('Unknown error', {
|
|
160
|
+
cause: e
|
|
161
|
+
});
|
|
157
162
|
}
|
|
158
|
-
return i18nObject[this._language] ? i18nObject[this._language] : i18nObject[DEFAULT_LANGUAGE];
|
|
159
163
|
}
|
|
164
|
+
}
|
|
160
165
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
query: this._queryParams
|
|
175
|
-
});
|
|
176
|
-
_context.next = 4;
|
|
177
|
-
return this._fetchWithTimeout(url);
|
|
178
|
-
case 4:
|
|
179
|
-
response = _context.sent;
|
|
180
|
-
if (response.ok) {
|
|
181
|
-
_context.next = 7;
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
throw new Error(response.statusText);
|
|
185
|
-
case 7:
|
|
186
|
-
if (!response) {
|
|
187
|
-
_context.next = 13;
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
_context.next = 10;
|
|
191
|
-
return response.json();
|
|
192
|
-
case 10:
|
|
193
|
-
return _context.abrupt("return", _context.sent);
|
|
194
|
-
case 13:
|
|
195
|
-
throw new Error('Response not found');
|
|
196
|
-
case 14:
|
|
197
|
-
_context.next = 23;
|
|
198
|
-
break;
|
|
199
|
-
case 16:
|
|
200
|
-
_context.prev = 16;
|
|
201
|
-
_context.t0 = _context["catch"](0);
|
|
202
|
-
if (!(_context.t0 instanceof Error)) {
|
|
203
|
-
_context.next = 22;
|
|
204
|
-
break;
|
|
205
|
-
}
|
|
206
|
-
throw _context.t0;
|
|
207
|
-
case 22:
|
|
208
|
-
throw new Error('Unknown error');
|
|
209
|
-
case 23:
|
|
210
|
-
case "end":
|
|
211
|
-
return _context.stop();
|
|
212
|
-
}
|
|
213
|
-
}, _callee, this, [[0, 16]]);
|
|
214
|
-
}));
|
|
215
|
-
function getManifest(_x) {
|
|
216
|
-
return _getManifest.apply(this, arguments);
|
|
217
|
-
}
|
|
218
|
-
return getManifest;
|
|
219
|
-
}()
|
|
220
|
-
/**
|
|
221
|
-
* Add optional query-parameters to all requests
|
|
222
|
-
*
|
|
223
|
-
* @param additionalQueryParams
|
|
224
|
-
*/
|
|
225
|
-
)
|
|
226
|
-
}, {
|
|
227
|
-
key: "addQueryParams",
|
|
228
|
-
value: function addQueryParams(additionalQueryParams) {
|
|
229
|
-
for (var _key in additionalQueryParams) {
|
|
230
|
-
if (Object.prototype.hasOwnProperty.call(additionalQueryParams, _key)) {
|
|
231
|
-
if (additionalQueryParams[_key] !== this._queryParams[_key]) {
|
|
232
|
-
//changes detected.
|
|
233
|
-
this._queryParams = _.assign({}, this._queryParams, additionalQueryParams);
|
|
234
|
-
this._invalidateSettings();
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
166
|
+
/**
|
|
167
|
+
* Add optional query-parameters to all requests
|
|
168
|
+
*
|
|
169
|
+
* @param additionalQueryParams
|
|
170
|
+
*/
|
|
171
|
+
addQueryParams(additionalQueryParams) {
|
|
172
|
+
for (const key in additionalQueryParams) {
|
|
173
|
+
if (Object.prototype.hasOwnProperty.call(additionalQueryParams, key)) {
|
|
174
|
+
if (additionalQueryParams[key] !== this._queryParams[key]) {
|
|
175
|
+
//changes detected.
|
|
176
|
+
this._queryParams = _.assign({}, this._queryParams, additionalQueryParams);
|
|
177
|
+
this._invalidateSettings();
|
|
178
|
+
break;
|
|
237
179
|
}
|
|
238
180
|
}
|
|
239
181
|
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
289
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
290
|
-
case 0:
|
|
291
|
-
_context4.next = 2;
|
|
292
|
-
return this._getDefaultTMSCatalog();
|
|
293
|
-
case 2:
|
|
294
|
-
return _context4.abrupt("return", _context4.sent);
|
|
295
|
-
case 3:
|
|
296
|
-
case "end":
|
|
297
|
-
return _context4.stop();
|
|
298
|
-
}
|
|
299
|
-
}, _callee4, this);
|
|
300
|
-
}));
|
|
301
|
-
function getDefaultTMSManifest() {
|
|
302
|
-
return _getDefaultTMSManifest.apply(this, arguments);
|
|
303
|
-
}
|
|
304
|
-
return getDefaultTMSManifest;
|
|
305
|
-
}()
|
|
306
|
-
}, {
|
|
307
|
-
key: "getFileLayers",
|
|
308
|
-
value: function () {
|
|
309
|
-
var _getFileLayers = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
310
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
311
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
312
|
-
case 0:
|
|
313
|
-
_context5.next = 2;
|
|
314
|
-
return this._loadFileLayers();
|
|
315
|
-
case 2:
|
|
316
|
-
return _context5.abrupt("return", _context5.sent);
|
|
317
|
-
case 3:
|
|
318
|
-
case "end":
|
|
319
|
-
return _context5.stop();
|
|
320
|
-
}
|
|
321
|
-
}, _callee5, this);
|
|
322
|
-
}));
|
|
323
|
-
function getFileLayers() {
|
|
324
|
-
return _getFileLayers.apply(this, arguments);
|
|
325
|
-
}
|
|
326
|
-
return getFileLayers;
|
|
327
|
-
}()
|
|
328
|
-
}, {
|
|
329
|
-
key: "getTMSServices",
|
|
330
|
-
value: function () {
|
|
331
|
-
var _getTMSServices = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
332
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
333
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
334
|
-
case 0:
|
|
335
|
-
_context6.next = 2;
|
|
336
|
-
return this._loadTMSServices();
|
|
337
|
-
case 2:
|
|
338
|
-
return _context6.abrupt("return", _context6.sent);
|
|
339
|
-
case 3:
|
|
340
|
-
case "end":
|
|
341
|
-
return _context6.stop();
|
|
342
|
-
}
|
|
343
|
-
}, _callee6, this);
|
|
344
|
-
}));
|
|
345
|
-
function getTMSServices() {
|
|
346
|
-
return _getTMSServices.apply(this, arguments);
|
|
182
|
+
}
|
|
183
|
+
async getMainManifest() {
|
|
184
|
+
return await this._getMainCatalog();
|
|
185
|
+
}
|
|
186
|
+
async getDefaultFileManifest() {
|
|
187
|
+
return await this._getDefaultFileCatalog();
|
|
188
|
+
}
|
|
189
|
+
async getDefaultTMSManifest() {
|
|
190
|
+
return await this._getDefaultTMSCatalog();
|
|
191
|
+
}
|
|
192
|
+
async getFileLayers() {
|
|
193
|
+
return await this._loadFileLayers();
|
|
194
|
+
}
|
|
195
|
+
async getTMSServices() {
|
|
196
|
+
return await this._loadTMSServices();
|
|
197
|
+
}
|
|
198
|
+
cacheGeoJson(layerId, geoJson) {
|
|
199
|
+
this._cache.set(layerId, geoJson);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
getCachedGeoJson(layerId) {
|
|
203
|
+
return this._cache.get(layerId);
|
|
204
|
+
}
|
|
205
|
+
getEmsVersion() {
|
|
206
|
+
return this._emsVersion;
|
|
207
|
+
}
|
|
208
|
+
getTileApiUrl() {
|
|
209
|
+
return this._tileApiUrl;
|
|
210
|
+
}
|
|
211
|
+
getFileApiUrl() {
|
|
212
|
+
return this._fileApiUrl;
|
|
213
|
+
}
|
|
214
|
+
getLandingPageUrl() {
|
|
215
|
+
return this._emsLandingPageUrl;
|
|
216
|
+
}
|
|
217
|
+
sanitizeHtml(html) {
|
|
218
|
+
return this._sanitizer(html);
|
|
219
|
+
}
|
|
220
|
+
extendUrlWithParams(url) {
|
|
221
|
+
return unescapeTemplateVars(extendUrl(url, {
|
|
222
|
+
query: this._queryParams
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
async findFileLayerById(id) {
|
|
226
|
+
const fileLayers = await this.getFileLayers();
|
|
227
|
+
for (let i = 0; i < fileLayers.length; i++) {
|
|
228
|
+
if (fileLayers[i].hasId(id)) {
|
|
229
|
+
return fileLayers[i];
|
|
347
230
|
}
|
|
348
|
-
return getTMSServices;
|
|
349
|
-
}()
|
|
350
|
-
}, {
|
|
351
|
-
key: "cacheGeoJson",
|
|
352
|
-
value: function cacheGeoJson(layerId, geoJson) {
|
|
353
|
-
this._cache.set(layerId, geoJson);
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
}, {
|
|
357
|
-
key: "getCachedGeoJson",
|
|
358
|
-
value: function getCachedGeoJson(layerId) {
|
|
359
|
-
return this._cache.get(layerId);
|
|
360
|
-
}
|
|
361
|
-
}, {
|
|
362
|
-
key: "getEmsVersion",
|
|
363
|
-
value: function getEmsVersion() {
|
|
364
|
-
return this._emsVersion;
|
|
365
|
-
}
|
|
366
|
-
}, {
|
|
367
|
-
key: "getTileApiUrl",
|
|
368
|
-
value: function getTileApiUrl() {
|
|
369
|
-
return this._tileApiUrl;
|
|
370
231
|
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
value: function getLandingPageUrl() {
|
|
379
|
-
return this._emsLandingPageUrl;
|
|
232
|
+
}
|
|
233
|
+
async findTMSServiceById(id) {
|
|
234
|
+
const tmsServices = await this.getTMSServices();
|
|
235
|
+
for (let i = 0; i < tmsServices.length; i++) {
|
|
236
|
+
if (tmsServices[i].hasId(id)) {
|
|
237
|
+
return tmsServices[i];
|
|
238
|
+
}
|
|
380
239
|
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
return
|
|
240
|
+
}
|
|
241
|
+
_getEmsVersion(version) {
|
|
242
|
+
if (version?.match(REST_API_REGEX)) {
|
|
243
|
+
return version;
|
|
385
244
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}));
|
|
245
|
+
const semverVersion = semverValid(semverCoerce(version));
|
|
246
|
+
if (semverVersion) {
|
|
247
|
+
return `v${semverMajor(semverVersion)}.${semverMinor(semverVersion)}`;
|
|
248
|
+
} else {
|
|
249
|
+
throw new Error(`Invalid version: ${version}`);
|
|
392
250
|
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
case 7:
|
|
417
|
-
i++;
|
|
418
|
-
_context7.next = 4;
|
|
419
|
-
break;
|
|
420
|
-
case 10:
|
|
421
|
-
case "end":
|
|
422
|
-
return _context7.stop();
|
|
423
|
-
}
|
|
424
|
-
}, _callee7, this);
|
|
425
|
-
}));
|
|
426
|
-
function findFileLayerById(_x2) {
|
|
427
|
-
return _findFileLayerById.apply(this, arguments);
|
|
251
|
+
}
|
|
252
|
+
_fetchWithTimeout(url) {
|
|
253
|
+
return new Promise((resolve, reject) => {
|
|
254
|
+
const timer = setTimeout(() => reject(new Error(`Request to ${url} timed out`)), this.EMS_LOAD_TIMEOUT);
|
|
255
|
+
this._fetchFunction(url).then(response => {
|
|
256
|
+
clearTimeout(timer);
|
|
257
|
+
resolve(response);
|
|
258
|
+
}, err => {
|
|
259
|
+
clearTimeout(timer);
|
|
260
|
+
reject(err);
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
_invalidateSettings() {
|
|
265
|
+
this._cache.clear();
|
|
266
|
+
this._getMainCatalog = _.once(async () => {
|
|
267
|
+
const services = [];
|
|
268
|
+
if (this._tileApiUrl) {
|
|
269
|
+
const version = this._isRestApi ? LATEST_API_URL_PATH : this._emsVersion;
|
|
270
|
+
services.push({
|
|
271
|
+
type: 'tms',
|
|
272
|
+
manifest: toAbsoluteUrl(this._tileApiUrl, `${version}/manifest`)
|
|
273
|
+
});
|
|
428
274
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
var tmsServices, i;
|
|
436
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
437
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
438
|
-
case 0:
|
|
439
|
-
_context8.next = 2;
|
|
440
|
-
return this.getTMSServices();
|
|
441
|
-
case 2:
|
|
442
|
-
tmsServices = _context8.sent;
|
|
443
|
-
i = 0;
|
|
444
|
-
case 4:
|
|
445
|
-
if (!(i < tmsServices.length)) {
|
|
446
|
-
_context8.next = 10;
|
|
447
|
-
break;
|
|
448
|
-
}
|
|
449
|
-
if (!tmsServices[i].hasId(id)) {
|
|
450
|
-
_context8.next = 7;
|
|
451
|
-
break;
|
|
452
|
-
}
|
|
453
|
-
return _context8.abrupt("return", tmsServices[i]);
|
|
454
|
-
case 7:
|
|
455
|
-
i++;
|
|
456
|
-
_context8.next = 4;
|
|
457
|
-
break;
|
|
458
|
-
case 10:
|
|
459
|
-
case "end":
|
|
460
|
-
return _context8.stop();
|
|
461
|
-
}
|
|
462
|
-
}, _callee8, this);
|
|
463
|
-
}));
|
|
464
|
-
function findTMSServiceById(_x3) {
|
|
465
|
-
return _findTMSServiceById.apply(this, arguments);
|
|
275
|
+
if (this._fileApiUrl) {
|
|
276
|
+
const version = this._isRestApi ? LATEST_API_URL_PATH : this._emsVersion;
|
|
277
|
+
services.push({
|
|
278
|
+
type: 'file',
|
|
279
|
+
manifest: toAbsoluteUrl(this._fileApiUrl, `${version}/manifest`)
|
|
280
|
+
});
|
|
466
281
|
}
|
|
467
|
-
return
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
282
|
+
return {
|
|
283
|
+
services: services
|
|
284
|
+
};
|
|
285
|
+
});
|
|
286
|
+
this._getDefaultTMSCatalog = _.once(async () => {
|
|
287
|
+
const catalogue = await this._getMainCatalog();
|
|
288
|
+
const firstService = catalogue.services.find(service => service.type === 'tms');
|
|
289
|
+
if (!firstService) {
|
|
290
|
+
return {
|
|
291
|
+
services: []
|
|
292
|
+
};
|
|
474
293
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
294
|
+
const url = this._proxyPath + firstService.manifest;
|
|
295
|
+
return await this.getManifest(url);
|
|
296
|
+
});
|
|
297
|
+
this._getDefaultFileCatalog = _.once(async () => {
|
|
298
|
+
const catalogue = await this._getMainCatalog();
|
|
299
|
+
const firstService = catalogue.services.find(service => service.type === 'file');
|
|
300
|
+
if (!firstService) {
|
|
301
|
+
return {
|
|
302
|
+
layers: []
|
|
303
|
+
};
|
|
480
304
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
value: function _fetchWithTimeout(url) {
|
|
485
|
-
var _this = this;
|
|
486
|
-
return new Promise(function (resolve, reject) {
|
|
487
|
-
var timer = setTimeout(function () {
|
|
488
|
-
return reject(new Error("Request to ".concat(url, " timed out")));
|
|
489
|
-
}, _this.EMS_LOAD_TIMEOUT);
|
|
490
|
-
_this._fetchFunction(url).then(function (response) {
|
|
491
|
-
clearTimeout(timer);
|
|
492
|
-
resolve(response);
|
|
493
|
-
}, function (err) {
|
|
494
|
-
clearTimeout(timer);
|
|
495
|
-
reject(err);
|
|
496
|
-
});
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
}, {
|
|
500
|
-
key: "_invalidateSettings",
|
|
501
|
-
value: function _invalidateSettings() {
|
|
502
|
-
var _this2 = this;
|
|
503
|
-
this._cache.reset();
|
|
504
|
-
this._getMainCatalog = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
505
|
-
var services, version, _version;
|
|
506
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
507
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
508
|
-
case 0:
|
|
509
|
-
services = [];
|
|
510
|
-
if (_this2._tileApiUrl) {
|
|
511
|
-
version = _this2._isRestApi ? LATEST_API_URL_PATH : _this2._emsVersion;
|
|
512
|
-
services.push({
|
|
513
|
-
type: 'tms',
|
|
514
|
-
manifest: toAbsoluteUrl(_this2._tileApiUrl, "".concat(version, "/manifest"))
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
if (_this2._fileApiUrl) {
|
|
518
|
-
_version = _this2._isRestApi ? LATEST_API_URL_PATH : _this2._emsVersion;
|
|
519
|
-
services.push({
|
|
520
|
-
type: 'file',
|
|
521
|
-
manifest: toAbsoluteUrl(_this2._fileApiUrl, "".concat(_version, "/manifest"))
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
return _context9.abrupt("return", {
|
|
525
|
-
services: services
|
|
526
|
-
});
|
|
527
|
-
case 4:
|
|
528
|
-
case "end":
|
|
529
|
-
return _context9.stop();
|
|
530
|
-
}
|
|
531
|
-
}, _callee9);
|
|
532
|
-
})));
|
|
533
|
-
this._getDefaultTMSCatalog = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
534
|
-
var catalogue, firstService, url;
|
|
535
|
-
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
536
|
-
while (1) switch (_context10.prev = _context10.next) {
|
|
537
|
-
case 0:
|
|
538
|
-
_context10.next = 2;
|
|
539
|
-
return _this2._getMainCatalog();
|
|
540
|
-
case 2:
|
|
541
|
-
catalogue = _context10.sent;
|
|
542
|
-
firstService = catalogue.services.find(function (service) {
|
|
543
|
-
return service.type === 'tms';
|
|
544
|
-
});
|
|
545
|
-
if (firstService) {
|
|
546
|
-
_context10.next = 6;
|
|
547
|
-
break;
|
|
548
|
-
}
|
|
549
|
-
return _context10.abrupt("return", {
|
|
550
|
-
services: []
|
|
551
|
-
});
|
|
552
|
-
case 6:
|
|
553
|
-
url = _this2._proxyPath + firstService.manifest;
|
|
554
|
-
_context10.next = 9;
|
|
555
|
-
return _this2.getManifest(url);
|
|
556
|
-
case 9:
|
|
557
|
-
return _context10.abrupt("return", _context10.sent);
|
|
558
|
-
case 10:
|
|
559
|
-
case "end":
|
|
560
|
-
return _context10.stop();
|
|
561
|
-
}
|
|
562
|
-
}, _callee10);
|
|
563
|
-
})));
|
|
564
|
-
this._getDefaultFileCatalog = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
565
|
-
var catalogue, firstService, url;
|
|
566
|
-
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
567
|
-
while (1) switch (_context11.prev = _context11.next) {
|
|
568
|
-
case 0:
|
|
569
|
-
_context11.next = 2;
|
|
570
|
-
return _this2._getMainCatalog();
|
|
571
|
-
case 2:
|
|
572
|
-
catalogue = _context11.sent;
|
|
573
|
-
firstService = catalogue.services.find(function (service) {
|
|
574
|
-
return service.type === 'file';
|
|
575
|
-
});
|
|
576
|
-
if (firstService) {
|
|
577
|
-
_context11.next = 6;
|
|
578
|
-
break;
|
|
579
|
-
}
|
|
580
|
-
return _context11.abrupt("return", {
|
|
581
|
-
layers: []
|
|
582
|
-
});
|
|
583
|
-
case 6:
|
|
584
|
-
url = _this2._proxyPath + firstService.manifest;
|
|
585
|
-
_context11.next = 9;
|
|
586
|
-
return _this2.getManifest(url);
|
|
587
|
-
case 9:
|
|
588
|
-
return _context11.abrupt("return", _context11.sent);
|
|
589
|
-
case 10:
|
|
590
|
-
case "end":
|
|
591
|
-
return _context11.stop();
|
|
592
|
-
}
|
|
593
|
-
}, _callee11);
|
|
594
|
-
})));
|
|
305
|
+
const url = this._proxyPath + firstService.manifest;
|
|
306
|
+
return await this.getManifest(url);
|
|
307
|
+
});
|
|
595
308
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
return new TMSService(serviceConfig, _this2, _this2._proxyPath);
|
|
608
|
-
}));
|
|
609
|
-
case 4:
|
|
610
|
-
case "end":
|
|
611
|
-
return _context12.stop();
|
|
612
|
-
}
|
|
613
|
-
}, _callee12);
|
|
614
|
-
})));
|
|
615
|
-
this._loadFileLayers = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
616
|
-
var fileManifest;
|
|
617
|
-
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
618
|
-
while (1) switch (_context13.prev = _context13.next) {
|
|
619
|
-
case 0:
|
|
620
|
-
_context13.next = 2;
|
|
621
|
-
return _this2._getDefaultFileCatalog();
|
|
622
|
-
case 2:
|
|
623
|
-
fileManifest = _context13.sent;
|
|
624
|
-
return _context13.abrupt("return", fileManifest.layers.map(function (layerConfig) {
|
|
625
|
-
return new FileLayer(layerConfig, _this2, _this2._proxyPath);
|
|
626
|
-
}));
|
|
627
|
-
case 4:
|
|
628
|
-
case "end":
|
|
629
|
-
return _context13.stop();
|
|
630
|
-
}
|
|
631
|
-
}, _callee13);
|
|
632
|
-
})));
|
|
633
|
-
}
|
|
634
|
-
}]);
|
|
635
|
-
}();
|
|
309
|
+
//Cache the actual instances of TMSService as these in turn cache sub-manifests for the style-files
|
|
310
|
+
this._loadTMSServices = _.once(async () => {
|
|
311
|
+
const tmsManifest = await this._getDefaultTMSCatalog();
|
|
312
|
+
return tmsManifest.services.map(serviceConfig => new TMSService(serviceConfig, this, this._proxyPath));
|
|
313
|
+
});
|
|
314
|
+
this._loadFileLayers = _.once(async () => {
|
|
315
|
+
const fileManifest = await this._getDefaultFileCatalog();
|
|
316
|
+
return fileManifest.layers.map(layerConfig => new FileLayer(layerConfig, this, this._proxyPath));
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
}
|