@elastic/ems-client 8.3.3 → 8.5.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 +5 -17
- package/.buildkite/build.sh +16 -0
- package/.buildkite/pipeline.yml +6 -0
- package/.buildkite/pull-requests.json +30 -0
- package/.nvmrc +1 -0
- package/CHANGELOG.md +13 -0
- package/CONTRIBUTING.md +18 -0
- package/catalog-info.yaml +68 -0
- package/package.json +7 -4
- package/src/ems_client.ts +33 -33
- package/src/index.ts +1 -1
- package/src/tms_service.ts +5 -1
- package/target/ems_client.d.ts +2 -2
- package/target/index.d.ts +1 -1
- package/target/node/ems_client.js +55 -125
- package/target/node/ems_service.js +11 -21
- package/target/node/file_layer.js +16 -60
- package/target/node/index.js +6 -4
- package/target/node/tms_service.js +33 -99
- package/target/node/utils.js +8 -10
- package/target/origin.d.ts +4 -0
- package/target/tms_service.d.ts +1 -1
- package/target/web/ems_client.js +295 -462
- package/target/web/ems_service.js +10 -26
- package/target/web/file_layer.js +62 -117
- package/target/web/index.js +2 -1
- package/target/web/tms_service.js +447 -650
- package/target/web/utils.js +10 -8
- package/test/ems_client.test.ts +33 -0
- package/.ci/jobs/defaults.yml +0 -67
- package/.ci/jobs/elastic+ems-client+master.yml +0 -18
- package/.ci/jobs/elastic+ems-client+pull-request.yml +0 -19
|
@@ -1,590 +1,443 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
2
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
2
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
-
|
|
5
3
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
|
|
7
4
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
-
|
|
9
5
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
-
|
|
11
6
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
12
|
-
|
|
13
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
-
|
|
19
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
20
|
-
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
+
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
21
12
|
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); } }
|
|
22
|
-
|
|
23
13
|
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); }); }; }
|
|
24
|
-
|
|
25
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
26
|
-
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
32
|
-
|
|
33
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
34
|
-
|
|
15
|
+
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); } }
|
|
16
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
18
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
19
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
36
|
-
|
|
37
20
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
38
|
-
|
|
39
21
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
40
|
-
|
|
41
22
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
42
|
-
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
function
|
|
46
|
-
|
|
23
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
|
+
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; }
|
|
25
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
26
|
+
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); }
|
|
47
27
|
/*
|
|
48
28
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
49
29
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
50
30
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
51
31
|
* 2.0.
|
|
52
32
|
*/
|
|
33
|
+
|
|
53
34
|
import _ from 'lodash';
|
|
54
35
|
import { AbstractEmsService } from './ems_service';
|
|
55
36
|
import { colorizeColor } from './utils';
|
|
56
37
|
export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
57
38
|
_inherits(TMSService, _AbstractEmsService);
|
|
58
|
-
|
|
59
39
|
var _super = _createSuper(TMSService);
|
|
60
|
-
|
|
61
|
-
/*
|
|
62
|
-
List of supported languages with labels and OMT codes extracted
|
|
63
|
-
from https://openmaptiles.org/languages
|
|
64
|
-
Keys are values for i18.locale from Kibana settings
|
|
65
|
-
and OMT codes for the rest.
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
/*
|
|
69
|
-
Suggested default operations for the different EMS styles
|
|
70
|
-
*/
|
|
71
40
|
function TMSService(config, emsClient, proxyPath) {
|
|
72
41
|
var _this;
|
|
73
|
-
|
|
74
42
|
_classCallCheck(this, TMSService);
|
|
75
|
-
|
|
76
43
|
_this = _super.call(this, config, emsClient, proxyPath);
|
|
77
|
-
|
|
78
44
|
_defineProperty(_assertThisInitialized(_this), "_config", void 0);
|
|
79
|
-
|
|
80
|
-
_defineProperty(_assertThisInitialized(_this), "_getRasterStyleJson", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "_getRasterStyleJson", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
81
46
|
var rasterUrl, url;
|
|
82
|
-
return
|
|
83
|
-
while (1) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return _context.abrupt("return");
|
|
98
|
-
|
|
99
|
-
case 7:
|
|
100
|
-
case "end":
|
|
101
|
-
return _context.stop();
|
|
102
|
-
}
|
|
47
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
48
|
+
while (1) switch (_context.prev = _context.next) {
|
|
49
|
+
case 0:
|
|
50
|
+
rasterUrl = _this._getStyleUrlForLocale('raster');
|
|
51
|
+
if (!rasterUrl) {
|
|
52
|
+
_context.next = 6;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
url = _this._proxyPath + _this._getAbsoluteUrl(rasterUrl);
|
|
56
|
+
return _context.abrupt("return", _this._emsClient.getManifest(_this._emsClient.extendUrlWithParams(url)));
|
|
57
|
+
case 6:
|
|
58
|
+
return _context.abrupt("return");
|
|
59
|
+
case 7:
|
|
60
|
+
case "end":
|
|
61
|
+
return _context.stop();
|
|
103
62
|
}
|
|
104
63
|
}, _callee);
|
|
105
64
|
}))));
|
|
106
|
-
|
|
107
|
-
_defineProperty(_assertThisInitialized(_this), "_getVectorStyleJsonRaw", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
65
|
+
_defineProperty(_assertThisInitialized(_this), "_getVectorStyleJsonRaw", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
108
66
|
var vectorUrl, url, vectorJson;
|
|
109
|
-
return
|
|
110
|
-
while (1) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
case 9:
|
|
129
|
-
return _context2.abrupt("return");
|
|
130
|
-
|
|
131
|
-
case 10:
|
|
132
|
-
case "end":
|
|
133
|
-
return _context2.stop();
|
|
134
|
-
}
|
|
67
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
68
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
69
|
+
case 0:
|
|
70
|
+
vectorUrl = _this._getStyleUrlForLocale('vector');
|
|
71
|
+
if (!vectorUrl) {
|
|
72
|
+
_context2.next = 9;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
url = _this._proxyPath + _this._getAbsoluteUrl(vectorUrl);
|
|
76
|
+
_context2.next = 5;
|
|
77
|
+
return _this._emsClient.getManifest(_this._emsClient.extendUrlWithParams(url));
|
|
78
|
+
case 5:
|
|
79
|
+
vectorJson = _context2.sent;
|
|
80
|
+
return _context2.abrupt("return", _objectSpread({}, vectorJson));
|
|
81
|
+
case 9:
|
|
82
|
+
return _context2.abrupt("return");
|
|
83
|
+
case 10:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context2.stop();
|
|
135
86
|
}
|
|
136
87
|
}, _callee2);
|
|
137
88
|
}))));
|
|
138
|
-
|
|
139
|
-
_defineProperty(_assertThisInitialized(_this), "_getVectorStyleJsonInlined", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
89
|
+
_defineProperty(_assertThisInitialized(_this), "_getVectorStyleJsonInlined", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
140
90
|
var vectorJson, inlinedSources, sources, _iterator, _step, _sourceName, url, _sourceJson$tiles, sourceUrl, extendedUrl, sourceJson, tiles;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
vectorJson = _context3.sent;
|
|
151
|
-
|
|
152
|
-
if (!vectorJson) {
|
|
153
|
-
_context3.next = 44;
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
inlinedSources = {};
|
|
158
|
-
sources = vectorJson.sources;
|
|
159
|
-
_iterator = _createForOfIteratorHelper(Object.getOwnPropertyNames(sources));
|
|
160
|
-
_context3.prev = 7;
|
|
161
|
-
|
|
162
|
-
_iterator.s();
|
|
163
|
-
|
|
164
|
-
case 9:
|
|
165
|
-
if ((_step = _iterator.n()).done) {
|
|
166
|
-
_context3.next = 22;
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
_sourceName = _step.value;
|
|
171
|
-
url = sources[_sourceName].url;
|
|
172
|
-
|
|
173
|
-
if (!url) {
|
|
174
|
-
_context3.next = 20;
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
sourceUrl = _this._proxyPath + _this._getAbsoluteUrl(url);
|
|
179
|
-
extendedUrl = _this._emsClient.extendUrlWithParams(sourceUrl);
|
|
180
|
-
_context3.next = 17;
|
|
181
|
-
return _this._emsClient.getManifest(extendedUrl);
|
|
182
|
-
|
|
183
|
-
case 17:
|
|
184
|
-
sourceJson = _context3.sent;
|
|
185
|
-
tiles = sourceJson === null || sourceJson === void 0 ? void 0 : (_sourceJson$tiles = sourceJson.tiles) === null || _sourceJson$tiles === void 0 ? void 0 : _sourceJson$tiles.map(function (tileUrl) {
|
|
186
|
-
var directUrl = _this._proxyPath + _this._getAbsoluteUrl(tileUrl);
|
|
187
|
-
|
|
188
|
-
return _this._emsClient.extendUrlWithParams(directUrl);
|
|
189
|
-
});
|
|
190
|
-
inlinedSources[_sourceName] = _objectSpread(_objectSpread({}, sourceJson), {}, {
|
|
191
|
-
type: 'vector',
|
|
192
|
-
tiles: tiles
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
case 20:
|
|
196
|
-
_context3.next = 9;
|
|
91
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
92
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
93
|
+
case 0:
|
|
94
|
+
_context3.next = 2;
|
|
95
|
+
return _this._getVectorStyleJsonRaw();
|
|
96
|
+
case 2:
|
|
97
|
+
vectorJson = _context3.sent;
|
|
98
|
+
if (!vectorJson) {
|
|
99
|
+
_context3.next = 44;
|
|
197
100
|
break;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
101
|
+
}
|
|
102
|
+
inlinedSources = {};
|
|
103
|
+
sources = vectorJson.sources;
|
|
104
|
+
_iterator = _createForOfIteratorHelper(Object.getOwnPropertyNames(sources));
|
|
105
|
+
_context3.prev = 7;
|
|
106
|
+
_iterator.s();
|
|
107
|
+
case 9:
|
|
108
|
+
if ((_step = _iterator.n()).done) {
|
|
109
|
+
_context3.next = 22;
|
|
201
110
|
break;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
111
|
+
}
|
|
112
|
+
_sourceName = _step.value;
|
|
113
|
+
url = sources[_sourceName].url;
|
|
114
|
+
if (!url) {
|
|
115
|
+
_context3.next = 20;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
sourceUrl = _this._proxyPath + _this._getAbsoluteUrl(url);
|
|
119
|
+
extendedUrl = _this._emsClient.extendUrlWithParams(sourceUrl);
|
|
120
|
+
_context3.next = 17;
|
|
121
|
+
return _this._emsClient.getManifest(extendedUrl);
|
|
122
|
+
case 17:
|
|
123
|
+
sourceJson = _context3.sent;
|
|
124
|
+
tiles = sourceJson === null || sourceJson === void 0 ? void 0 : (_sourceJson$tiles = sourceJson.tiles) === null || _sourceJson$tiles === void 0 ? void 0 : _sourceJson$tiles.map(function (tileUrl) {
|
|
125
|
+
var directUrl = _this._proxyPath + _this._getAbsoluteUrl(tileUrl);
|
|
126
|
+
return _this._emsClient.extendUrlWithParams(directUrl);
|
|
127
|
+
});
|
|
128
|
+
inlinedSources[_sourceName] = _objectSpread(_objectSpread({}, sourceJson), {}, {
|
|
129
|
+
type: 'vector',
|
|
130
|
+
tiles: tiles
|
|
131
|
+
});
|
|
132
|
+
case 20:
|
|
133
|
+
_context3.next = 9;
|
|
134
|
+
break;
|
|
135
|
+
case 22:
|
|
136
|
+
_context3.next = 27;
|
|
137
|
+
break;
|
|
138
|
+
case 24:
|
|
139
|
+
_context3.prev = 24;
|
|
140
|
+
_context3.t0 = _context3["catch"](7);
|
|
141
|
+
_iterator.e(_context3.t0);
|
|
142
|
+
case 27:
|
|
143
|
+
_context3.prev = 27;
|
|
144
|
+
_iterator.f();
|
|
145
|
+
return _context3.finish(27);
|
|
146
|
+
case 30:
|
|
147
|
+
_context3.t1 = _objectSpread;
|
|
148
|
+
_context3.t2 = _objectSpread({}, vectorJson);
|
|
149
|
+
_context3.t3 = {};
|
|
150
|
+
_context3.t4 = inlinedSources;
|
|
151
|
+
_context3.next = 36;
|
|
152
|
+
return _this._getSpriteSheetRootPath();
|
|
153
|
+
case 36:
|
|
154
|
+
_context3.t5 = _context3.sent;
|
|
155
|
+
_context3.next = 39;
|
|
156
|
+
return _this._getUrlTemplateForGlyphs();
|
|
157
|
+
case 39:
|
|
158
|
+
_context3.t6 = _context3.sent;
|
|
159
|
+
_context3.t7 = {
|
|
160
|
+
sources: _context3.t4,
|
|
161
|
+
sprite: _context3.t5,
|
|
162
|
+
glyphs: _context3.t6
|
|
163
|
+
};
|
|
164
|
+
return _context3.abrupt("return", (0, _context3.t1)(_context3.t2, _context3.t3, _context3.t7));
|
|
165
|
+
case 44:
|
|
166
|
+
return _context3.abrupt("return");
|
|
167
|
+
case 45:
|
|
168
|
+
case "end":
|
|
169
|
+
return _context3.stop();
|
|
245
170
|
}
|
|
246
171
|
}, _callee3, null, [[7, 24, 27, 30]]);
|
|
247
172
|
}))));
|
|
248
|
-
|
|
249
173
|
_this._config = config;
|
|
250
174
|
return _this;
|
|
251
175
|
}
|
|
176
|
+
|
|
252
177
|
/*
|
|
253
178
|
This method returns an array of objects with the layers and the new
|
|
254
179
|
layout['text-field'] to apply using map.setLayoutProperty
|
|
255
180
|
*/
|
|
256
|
-
|
|
257
|
-
|
|
258
181
|
_createClass(TMSService, [{
|
|
259
182
|
key: "getDefaultRasterStyle",
|
|
260
183
|
value: function () {
|
|
261
|
-
var _getDefaultRasterStyle = _asyncToGenerator( /*#__PURE__*/
|
|
184
|
+
var _getDefaultRasterStyle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
262
185
|
var _this2 = this;
|
|
263
|
-
|
|
264
186
|
var tileJson, tiles;
|
|
265
|
-
return
|
|
266
|
-
while (1) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
tiles
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
case 8:
|
|
288
|
-
return _context4.abrupt("return");
|
|
289
|
-
|
|
290
|
-
case 9:
|
|
291
|
-
case "end":
|
|
292
|
-
return _context4.stop();
|
|
293
|
-
}
|
|
187
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
188
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
189
|
+
case 0:
|
|
190
|
+
_context4.next = 2;
|
|
191
|
+
return this._getRasterStyleJson();
|
|
192
|
+
case 2:
|
|
193
|
+
tileJson = _context4.sent;
|
|
194
|
+
if (!tileJson) {
|
|
195
|
+
_context4.next = 8;
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
tiles = tileJson.tiles.map(function (tile) {
|
|
199
|
+
return _this2._proxyPath + _this2._getAbsoluteUrl(tile);
|
|
200
|
+
});
|
|
201
|
+
return _context4.abrupt("return", _objectSpread(_objectSpread({}, tileJson), {
|
|
202
|
+
tiles: tiles
|
|
203
|
+
}));
|
|
204
|
+
case 8:
|
|
205
|
+
return _context4.abrupt("return");
|
|
206
|
+
case 9:
|
|
207
|
+
case "end":
|
|
208
|
+
return _context4.stop();
|
|
294
209
|
}
|
|
295
210
|
}, _callee4, this);
|
|
296
211
|
}));
|
|
297
|
-
|
|
298
212
|
function getDefaultRasterStyle() {
|
|
299
213
|
return _getDefaultRasterStyle.apply(this, arguments);
|
|
300
214
|
}
|
|
301
|
-
|
|
302
215
|
return getDefaultRasterStyle;
|
|
303
216
|
}()
|
|
304
217
|
}, {
|
|
305
218
|
key: "getUrlTemplate",
|
|
306
219
|
value: function () {
|
|
307
|
-
var _getUrlTemplate = _asyncToGenerator( /*#__PURE__*/
|
|
220
|
+
var _getUrlTemplate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
308
221
|
var tileJson, directUrl;
|
|
309
|
-
return
|
|
310
|
-
while (1) {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
case 8:
|
|
328
|
-
return _context5.abrupt("return", '');
|
|
329
|
-
|
|
330
|
-
case 9:
|
|
331
|
-
case "end":
|
|
332
|
-
return _context5.stop();
|
|
333
|
-
}
|
|
222
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
223
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
224
|
+
case 0:
|
|
225
|
+
_context5.next = 2;
|
|
226
|
+
return this._getRasterStyleJson();
|
|
227
|
+
case 2:
|
|
228
|
+
tileJson = _context5.sent;
|
|
229
|
+
if (!tileJson) {
|
|
230
|
+
_context5.next = 8;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
directUrl = this._proxyPath + this._getAbsoluteUrl(tileJson.tiles[0]);
|
|
234
|
+
return _context5.abrupt("return", this._emsClient.extendUrlWithParams(directUrl));
|
|
235
|
+
case 8:
|
|
236
|
+
return _context5.abrupt("return", '');
|
|
237
|
+
case 9:
|
|
238
|
+
case "end":
|
|
239
|
+
return _context5.stop();
|
|
334
240
|
}
|
|
335
241
|
}, _callee5, this);
|
|
336
242
|
}));
|
|
337
|
-
|
|
338
243
|
function getUrlTemplate() {
|
|
339
244
|
return _getUrlTemplate.apply(this, arguments);
|
|
340
245
|
}
|
|
341
|
-
|
|
342
246
|
return getUrlTemplate;
|
|
343
247
|
}()
|
|
344
248
|
}, {
|
|
345
249
|
key: "getUrlTemplateForVector",
|
|
346
250
|
value: function () {
|
|
347
|
-
var _getUrlTemplateForVector = _asyncToGenerator( /*#__PURE__*/
|
|
251
|
+
var _getUrlTemplateForVector = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(sourceId) {
|
|
348
252
|
var _tileJson$sources$sou, _tileJson$sources$sou2;
|
|
349
|
-
|
|
350
253
|
var tileJson, url, directUrl;
|
|
351
|
-
return
|
|
352
|
-
while (1) {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
case 9:
|
|
371
|
-
return _context6.abrupt("return", '');
|
|
372
|
-
|
|
373
|
-
case 10:
|
|
374
|
-
case "end":
|
|
375
|
-
return _context6.stop();
|
|
376
|
-
}
|
|
254
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
255
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
256
|
+
case 0:
|
|
257
|
+
_context6.next = 2;
|
|
258
|
+
return this._getVectorStyleJsonInlined();
|
|
259
|
+
case 2:
|
|
260
|
+
tileJson = _context6.sent;
|
|
261
|
+
url = tileJson === null || tileJson === void 0 ? void 0 : (_tileJson$sources$sou = tileJson.sources[sourceId]) === null || _tileJson$sources$sou === void 0 ? void 0 : (_tileJson$sources$sou2 = _tileJson$sources$sou.tiles) === null || _tileJson$sources$sou2 === void 0 ? void 0 : _tileJson$sources$sou2.pop();
|
|
262
|
+
if (!url) {
|
|
263
|
+
_context6.next = 9;
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
directUrl = this._proxyPath + this._getAbsoluteUrl(url);
|
|
267
|
+
return _context6.abrupt("return", this._emsClient.extendUrlWithParams(directUrl));
|
|
268
|
+
case 9:
|
|
269
|
+
return _context6.abrupt("return", '');
|
|
270
|
+
case 10:
|
|
271
|
+
case "end":
|
|
272
|
+
return _context6.stop();
|
|
377
273
|
}
|
|
378
274
|
}, _callee6, this);
|
|
379
275
|
}));
|
|
380
|
-
|
|
381
276
|
function getUrlTemplateForVector(_x) {
|
|
382
277
|
return _getUrlTemplateForVector.apply(this, arguments);
|
|
383
278
|
}
|
|
384
|
-
|
|
385
279
|
return getUrlTemplateForVector;
|
|
386
280
|
}()
|
|
387
281
|
}, {
|
|
388
282
|
key: "getVectorStyleSheet",
|
|
389
283
|
value: function () {
|
|
390
|
-
var _getVectorStyleSheet = _asyncToGenerator( /*#__PURE__*/
|
|
391
|
-
return
|
|
392
|
-
while (1) {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
case 3:
|
|
402
|
-
case "end":
|
|
403
|
-
return _context7.stop();
|
|
404
|
-
}
|
|
284
|
+
var _getVectorStyleSheet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
285
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
286
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
287
|
+
case 0:
|
|
288
|
+
_context7.next = 2;
|
|
289
|
+
return this._getVectorStyleJsonInlined();
|
|
290
|
+
case 2:
|
|
291
|
+
return _context7.abrupt("return", _context7.sent);
|
|
292
|
+
case 3:
|
|
293
|
+
case "end":
|
|
294
|
+
return _context7.stop();
|
|
405
295
|
}
|
|
406
296
|
}, _callee7, this);
|
|
407
297
|
}));
|
|
408
|
-
|
|
409
298
|
function getVectorStyleSheet() {
|
|
410
299
|
return _getVectorStyleSheet.apply(this, arguments);
|
|
411
300
|
}
|
|
412
|
-
|
|
413
301
|
return getVectorStyleSheet;
|
|
414
302
|
}()
|
|
415
303
|
}, {
|
|
416
304
|
key: "getVectorStyleSheetRaw",
|
|
417
305
|
value: function () {
|
|
418
|
-
var _getVectorStyleSheetRaw = _asyncToGenerator( /*#__PURE__*/
|
|
419
|
-
return
|
|
420
|
-
while (1) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
case 3:
|
|
430
|
-
case "end":
|
|
431
|
-
return _context8.stop();
|
|
432
|
-
}
|
|
306
|
+
var _getVectorStyleSheetRaw = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
307
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
308
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
309
|
+
case 0:
|
|
310
|
+
_context8.next = 2;
|
|
311
|
+
return this._getVectorStyleJsonRaw();
|
|
312
|
+
case 2:
|
|
313
|
+
return _context8.abrupt("return", _context8.sent);
|
|
314
|
+
case 3:
|
|
315
|
+
case "end":
|
|
316
|
+
return _context8.stop();
|
|
433
317
|
}
|
|
434
318
|
}, _callee8, this);
|
|
435
319
|
}));
|
|
436
|
-
|
|
437
320
|
function getVectorStyleSheetRaw() {
|
|
438
321
|
return _getVectorStyleSheetRaw.apply(this, arguments);
|
|
439
322
|
}
|
|
440
|
-
|
|
441
323
|
return getVectorStyleSheetRaw;
|
|
442
324
|
}()
|
|
443
325
|
}, {
|
|
444
326
|
key: "getSpriteSheetMeta",
|
|
445
327
|
value: function () {
|
|
446
|
-
var _getSpriteSheetMeta = _asyncToGenerator( /*#__PURE__*/
|
|
328
|
+
var _getSpriteSheetMeta = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
447
329
|
var isRetina,
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
return
|
|
454
|
-
while (1) {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
});
|
|
484
|
-
|
|
485
|
-
case 15:
|
|
486
|
-
return _context9.abrupt("return");
|
|
487
|
-
|
|
488
|
-
case 16:
|
|
489
|
-
case "end":
|
|
490
|
-
return _context9.stop();
|
|
491
|
-
}
|
|
330
|
+
metaUrl,
|
|
331
|
+
spritePngs,
|
|
332
|
+
metaUrlExtended,
|
|
333
|
+
jsonMeta,
|
|
334
|
+
_args9 = arguments;
|
|
335
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
336
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
337
|
+
case 0:
|
|
338
|
+
isRetina = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : false;
|
|
339
|
+
_context9.next = 3;
|
|
340
|
+
return this.getSpriteSheetJsonPath(isRetina);
|
|
341
|
+
case 3:
|
|
342
|
+
metaUrl = _context9.sent;
|
|
343
|
+
_context9.next = 6;
|
|
344
|
+
return this.getSpriteSheetPngPath(isRetina);
|
|
345
|
+
case 6:
|
|
346
|
+
spritePngs = _context9.sent;
|
|
347
|
+
if (!(metaUrl && spritePngs)) {
|
|
348
|
+
_context9.next = 15;
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
metaUrlExtended = this._emsClient.extendUrlWithParams(metaUrl);
|
|
352
|
+
_context9.next = 11;
|
|
353
|
+
return this._emsClient.getManifest(metaUrlExtended);
|
|
354
|
+
case 11:
|
|
355
|
+
jsonMeta = _context9.sent;
|
|
356
|
+
return _context9.abrupt("return", {
|
|
357
|
+
png: spritePngs,
|
|
358
|
+
json: jsonMeta
|
|
359
|
+
});
|
|
360
|
+
case 15:
|
|
361
|
+
return _context9.abrupt("return");
|
|
362
|
+
case 16:
|
|
363
|
+
case "end":
|
|
364
|
+
return _context9.stop();
|
|
492
365
|
}
|
|
493
366
|
}, _callee9, this);
|
|
494
367
|
}));
|
|
495
|
-
|
|
496
368
|
function getSpriteSheetMeta() {
|
|
497
369
|
return _getSpriteSheetMeta.apply(this, arguments);
|
|
498
370
|
}
|
|
499
|
-
|
|
500
371
|
return getSpriteSheetMeta;
|
|
501
372
|
}()
|
|
502
373
|
}, {
|
|
503
374
|
key: "getSpriteSheetJsonPath",
|
|
504
375
|
value: function () {
|
|
505
|
-
var _getSpriteSheetJsonPath = _asyncToGenerator( /*#__PURE__*/
|
|
376
|
+
var _getSpriteSheetJsonPath = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
506
377
|
var isRetina,
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
return
|
|
511
|
-
while (1) {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
case 9:
|
|
530
|
-
return _context10.abrupt("return", '');
|
|
531
|
-
|
|
532
|
-
case 10:
|
|
533
|
-
case "end":
|
|
534
|
-
return _context10.stop();
|
|
535
|
-
}
|
|
378
|
+
spriteSheetRootPath,
|
|
379
|
+
suffix,
|
|
380
|
+
_args10 = arguments;
|
|
381
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
382
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
383
|
+
case 0:
|
|
384
|
+
isRetina = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : false;
|
|
385
|
+
_context10.next = 3;
|
|
386
|
+
return this._getSpriteSheetRootPath();
|
|
387
|
+
case 3:
|
|
388
|
+
spriteSheetRootPath = _context10.sent;
|
|
389
|
+
if (!spriteSheetRootPath) {
|
|
390
|
+
_context10.next = 9;
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
suffix = isRetina ? '@2x' : '';
|
|
394
|
+
return _context10.abrupt("return", spriteSheetRootPath + suffix + '.json');
|
|
395
|
+
case 9:
|
|
396
|
+
return _context10.abrupt("return", '');
|
|
397
|
+
case 10:
|
|
398
|
+
case "end":
|
|
399
|
+
return _context10.stop();
|
|
536
400
|
}
|
|
537
401
|
}, _callee10, this);
|
|
538
402
|
}));
|
|
539
|
-
|
|
540
403
|
function getSpriteSheetJsonPath() {
|
|
541
404
|
return _getSpriteSheetJsonPath.apply(this, arguments);
|
|
542
405
|
}
|
|
543
|
-
|
|
544
406
|
return getSpriteSheetJsonPath;
|
|
545
407
|
}()
|
|
546
408
|
}, {
|
|
547
409
|
key: "getSpriteSheetPngPath",
|
|
548
410
|
value: function () {
|
|
549
|
-
var _getSpriteSheetPngPath = _asyncToGenerator( /*#__PURE__*/
|
|
411
|
+
var _getSpriteSheetPngPath = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
550
412
|
var isRetina,
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
return
|
|
555
|
-
while (1) {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
case 9:
|
|
574
|
-
return _context11.abrupt("return", '');
|
|
575
|
-
|
|
576
|
-
case 10:
|
|
577
|
-
case "end":
|
|
578
|
-
return _context11.stop();
|
|
579
|
-
}
|
|
413
|
+
spriteSheetRootPath,
|
|
414
|
+
suffix,
|
|
415
|
+
_args11 = arguments;
|
|
416
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
417
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
418
|
+
case 0:
|
|
419
|
+
isRetina = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : false;
|
|
420
|
+
_context11.next = 3;
|
|
421
|
+
return this._getSpriteSheetRootPath();
|
|
422
|
+
case 3:
|
|
423
|
+
spriteSheetRootPath = _context11.sent;
|
|
424
|
+
if (!spriteSheetRootPath) {
|
|
425
|
+
_context11.next = 9;
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
suffix = isRetina ? '@2x' : '';
|
|
429
|
+
return _context11.abrupt("return", spriteSheetRootPath + suffix + '.png');
|
|
430
|
+
case 9:
|
|
431
|
+
return _context11.abrupt("return", '');
|
|
432
|
+
case 10:
|
|
433
|
+
case "end":
|
|
434
|
+
return _context11.stop();
|
|
580
435
|
}
|
|
581
436
|
}, _callee11, this);
|
|
582
437
|
}));
|
|
583
|
-
|
|
584
438
|
function getSpriteSheetPngPath() {
|
|
585
439
|
return _getSpriteSheetPngPath.apply(this, arguments);
|
|
586
440
|
}
|
|
587
|
-
|
|
588
441
|
return getSpriteSheetPngPath;
|
|
589
442
|
}()
|
|
590
443
|
}, {
|
|
@@ -595,165 +448,131 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
595
448
|
}, {
|
|
596
449
|
key: "getMinZoom",
|
|
597
450
|
value: function () {
|
|
598
|
-
var _getMinZoom = _asyncToGenerator( /*#__PURE__*/
|
|
451
|
+
var _getMinZoom = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
599
452
|
var format,
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
453
|
+
_ref4,
|
|
454
|
+
sources,
|
|
455
|
+
_ref6,
|
|
456
|
+
minzoom,
|
|
457
|
+
_args12 = arguments;
|
|
458
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
459
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
460
|
+
case 0:
|
|
461
|
+
format = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : 'vector';
|
|
462
|
+
_context12.t0 = format;
|
|
463
|
+
_context12.next = _context12.t0 === 'vector' ? 4 : _context12.t0 === 'raster' ? 12 : 20;
|
|
464
|
+
break;
|
|
465
|
+
case 4:
|
|
466
|
+
_context12.next = 6;
|
|
467
|
+
return this._getVectorStyleJsonInlined();
|
|
468
|
+
case 6:
|
|
469
|
+
_context12.t1 = _context12.sent;
|
|
470
|
+
if (_context12.t1) {
|
|
471
|
+
_context12.next = 9;
|
|
613
472
|
break;
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
_context12.t2 = _context12.sent;
|
|
647
|
-
|
|
648
|
-
if (_context12.t2) {
|
|
649
|
-
_context12.next = 17;
|
|
650
|
-
break;
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
_context12.t2 = {};
|
|
654
|
-
|
|
655
|
-
case 17:
|
|
656
|
-
_ref6 = _context12.t2;
|
|
657
|
-
minzoom = _ref6.minzoom;
|
|
658
|
-
return _context12.abrupt("return", minzoom);
|
|
659
|
-
|
|
660
|
-
case 20:
|
|
661
|
-
return _context12.abrupt("return");
|
|
662
|
-
|
|
663
|
-
case 21:
|
|
664
|
-
case "end":
|
|
665
|
-
return _context12.stop();
|
|
666
|
-
}
|
|
473
|
+
}
|
|
474
|
+
_context12.t1 = {
|
|
475
|
+
sources: {}
|
|
476
|
+
};
|
|
477
|
+
case 9:
|
|
478
|
+
_ref4 = _context12.t1;
|
|
479
|
+
sources = _ref4.sources;
|
|
480
|
+
return _context12.abrupt("return", Math.min.apply(Math, _toConsumableArray(Object.values(sources).map(function (_ref5) {
|
|
481
|
+
var minzoom = _ref5.minzoom;
|
|
482
|
+
return minzoom;
|
|
483
|
+
}).filter(function (minzoom) {
|
|
484
|
+
return Number.isFinite(minzoom);
|
|
485
|
+
}))));
|
|
486
|
+
case 12:
|
|
487
|
+
_context12.next = 14;
|
|
488
|
+
return this._getRasterStyleJson();
|
|
489
|
+
case 14:
|
|
490
|
+
_context12.t2 = _context12.sent;
|
|
491
|
+
if (_context12.t2) {
|
|
492
|
+
_context12.next = 17;
|
|
493
|
+
break;
|
|
494
|
+
}
|
|
495
|
+
_context12.t2 = {};
|
|
496
|
+
case 17:
|
|
497
|
+
_ref6 = _context12.t2;
|
|
498
|
+
minzoom = _ref6.minzoom;
|
|
499
|
+
return _context12.abrupt("return", minzoom);
|
|
500
|
+
case 20:
|
|
501
|
+
return _context12.abrupt("return");
|
|
502
|
+
case 21:
|
|
503
|
+
case "end":
|
|
504
|
+
return _context12.stop();
|
|
667
505
|
}
|
|
668
506
|
}, _callee12, this);
|
|
669
507
|
}));
|
|
670
|
-
|
|
671
508
|
function getMinZoom() {
|
|
672
509
|
return _getMinZoom.apply(this, arguments);
|
|
673
510
|
}
|
|
674
|
-
|
|
675
511
|
return getMinZoom;
|
|
676
512
|
}()
|
|
677
513
|
}, {
|
|
678
514
|
key: "getMaxZoom",
|
|
679
515
|
value: function () {
|
|
680
|
-
var _getMaxZoom = _asyncToGenerator( /*#__PURE__*/
|
|
516
|
+
var _getMaxZoom = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
681
517
|
var format,
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
518
|
+
_ref7,
|
|
519
|
+
sources,
|
|
520
|
+
_ref9,
|
|
521
|
+
maxzoom,
|
|
522
|
+
_args13 = arguments;
|
|
523
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
524
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
525
|
+
case 0:
|
|
526
|
+
format = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : 'vector';
|
|
527
|
+
_context13.t0 = format;
|
|
528
|
+
_context13.next = _context13.t0 === 'vector' ? 4 : _context13.t0 === 'raster' ? 12 : 20;
|
|
529
|
+
break;
|
|
530
|
+
case 4:
|
|
531
|
+
_context13.next = 6;
|
|
532
|
+
return this._getVectorStyleJsonInlined();
|
|
533
|
+
case 6:
|
|
534
|
+
_context13.t1 = _context13.sent;
|
|
535
|
+
if (_context13.t1) {
|
|
536
|
+
_context13.next = 9;
|
|
695
537
|
break;
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
_context13.t2 = _context13.sent;
|
|
729
|
-
|
|
730
|
-
if (_context13.t2) {
|
|
731
|
-
_context13.next = 17;
|
|
732
|
-
break;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
_context13.t2 = {};
|
|
736
|
-
|
|
737
|
-
case 17:
|
|
738
|
-
_ref9 = _context13.t2;
|
|
739
|
-
maxzoom = _ref9.maxzoom;
|
|
740
|
-
return _context13.abrupt("return", maxzoom);
|
|
741
|
-
|
|
742
|
-
case 20:
|
|
743
|
-
return _context13.abrupt("return");
|
|
744
|
-
|
|
745
|
-
case 21:
|
|
746
|
-
case "end":
|
|
747
|
-
return _context13.stop();
|
|
748
|
-
}
|
|
538
|
+
}
|
|
539
|
+
_context13.t1 = {
|
|
540
|
+
sources: {}
|
|
541
|
+
};
|
|
542
|
+
case 9:
|
|
543
|
+
_ref7 = _context13.t1;
|
|
544
|
+
sources = _ref7.sources;
|
|
545
|
+
return _context13.abrupt("return", Math.max.apply(Math, _toConsumableArray(Object.values(sources).map(function (_ref8) {
|
|
546
|
+
var maxzoom = _ref8.maxzoom;
|
|
547
|
+
return maxzoom;
|
|
548
|
+
}).filter(function (maxzoom) {
|
|
549
|
+
return Number.isFinite(maxzoom);
|
|
550
|
+
}))));
|
|
551
|
+
case 12:
|
|
552
|
+
_context13.next = 14;
|
|
553
|
+
return this._getRasterStyleJson();
|
|
554
|
+
case 14:
|
|
555
|
+
_context13.t2 = _context13.sent;
|
|
556
|
+
if (_context13.t2) {
|
|
557
|
+
_context13.next = 17;
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
_context13.t2 = {};
|
|
561
|
+
case 17:
|
|
562
|
+
_ref9 = _context13.t2;
|
|
563
|
+
maxzoom = _ref9.maxzoom;
|
|
564
|
+
return _context13.abrupt("return", maxzoom);
|
|
565
|
+
case 20:
|
|
566
|
+
return _context13.abrupt("return");
|
|
567
|
+
case 21:
|
|
568
|
+
case "end":
|
|
569
|
+
return _context13.stop();
|
|
749
570
|
}
|
|
750
571
|
}, _callee13, this);
|
|
751
572
|
}));
|
|
752
|
-
|
|
753
573
|
function getMaxZoom() {
|
|
754
574
|
return _getMaxZoom.apply(this, arguments);
|
|
755
575
|
}
|
|
756
|
-
|
|
757
576
|
return getMaxZoom;
|
|
758
577
|
}()
|
|
759
578
|
}, {
|
|
@@ -775,19 +594,15 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
775
594
|
key: "_getStyleUrlForLocale",
|
|
776
595
|
value: function _getStyleUrlForLocale(formatType) {
|
|
777
596
|
var vectorFormats = this._getFormats(formatType, this._emsClient.getLocale());
|
|
778
|
-
|
|
779
597
|
if (!vectorFormats.length) {
|
|
780
598
|
//fallback to default locale
|
|
781
599
|
vectorFormats = this._getFormats(formatType, this._emsClient.getDefaultLocale());
|
|
782
600
|
}
|
|
783
|
-
|
|
784
601
|
if (!vectorFormats.length) {
|
|
785
602
|
// eslint-disable-next-line max-len
|
|
786
603
|
throw new Error("Cannot find ".concat(formatType, " tile layer for locale ").concat(this._emsClient.getLocale(), " or ").concat(this._emsClient.getDefaultLocale()));
|
|
787
604
|
}
|
|
788
|
-
|
|
789
605
|
var defaultStyle = vectorFormats[0];
|
|
790
|
-
|
|
791
606
|
if (defaultStyle && defaultStyle.hasOwnProperty('url')) {
|
|
792
607
|
return defaultStyle.url;
|
|
793
608
|
}
|
|
@@ -802,79 +617,61 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
802
617
|
}, {
|
|
803
618
|
key: "_getSpriteSheetRootPath",
|
|
804
619
|
value: function () {
|
|
805
|
-
var _getSpriteSheetRootPath2 = _asyncToGenerator( /*#__PURE__*/
|
|
620
|
+
var _getSpriteSheetRootPath2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
806
621
|
var vectorStyleJson;
|
|
807
|
-
return
|
|
808
|
-
while (1) {
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
case 7:
|
|
825
|
-
return _context14.abrupt("return", '');
|
|
826
|
-
|
|
827
|
-
case 8:
|
|
828
|
-
case "end":
|
|
829
|
-
return _context14.stop();
|
|
830
|
-
}
|
|
622
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
623
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
624
|
+
case 0:
|
|
625
|
+
_context14.next = 2;
|
|
626
|
+
return this._getVectorStyleJsonRaw();
|
|
627
|
+
case 2:
|
|
628
|
+
vectorStyleJson = _context14.sent;
|
|
629
|
+
if (!(vectorStyleJson !== null && vectorStyleJson !== void 0 && vectorStyleJson.sprite)) {
|
|
630
|
+
_context14.next = 7;
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
return _context14.abrupt("return", this._proxyPath + this._getAbsoluteUrl(vectorStyleJson.sprite));
|
|
634
|
+
case 7:
|
|
635
|
+
return _context14.abrupt("return", '');
|
|
636
|
+
case 8:
|
|
637
|
+
case "end":
|
|
638
|
+
return _context14.stop();
|
|
831
639
|
}
|
|
832
640
|
}, _callee14, this);
|
|
833
641
|
}));
|
|
834
|
-
|
|
835
642
|
function _getSpriteSheetRootPath() {
|
|
836
643
|
return _getSpriteSheetRootPath2.apply(this, arguments);
|
|
837
644
|
}
|
|
838
|
-
|
|
839
645
|
return _getSpriteSheetRootPath;
|
|
840
646
|
}()
|
|
841
647
|
}, {
|
|
842
648
|
key: "_getUrlTemplateForGlyphs",
|
|
843
649
|
value: function () {
|
|
844
|
-
var _getUrlTemplateForGlyphs2 = _asyncToGenerator( /*#__PURE__*/
|
|
650
|
+
var _getUrlTemplateForGlyphs2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
845
651
|
var vectorStyleJson;
|
|
846
|
-
return
|
|
847
|
-
while (1) {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
case 7:
|
|
864
|
-
return _context15.abrupt("return", '');
|
|
865
|
-
|
|
866
|
-
case 8:
|
|
867
|
-
case "end":
|
|
868
|
-
return _context15.stop();
|
|
869
|
-
}
|
|
652
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
653
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
654
|
+
case 0:
|
|
655
|
+
_context15.next = 2;
|
|
656
|
+
return this._getVectorStyleJsonRaw();
|
|
657
|
+
case 2:
|
|
658
|
+
vectorStyleJson = _context15.sent;
|
|
659
|
+
if (!(vectorStyleJson !== null && vectorStyleJson !== void 0 && vectorStyleJson.glyphs)) {
|
|
660
|
+
_context15.next = 7;
|
|
661
|
+
break;
|
|
662
|
+
}
|
|
663
|
+
return _context15.abrupt("return", this._proxyPath + this._getAbsoluteUrl(vectorStyleJson.glyphs));
|
|
664
|
+
case 7:
|
|
665
|
+
return _context15.abrupt("return", '');
|
|
666
|
+
case 8:
|
|
667
|
+
case "end":
|
|
668
|
+
return _context15.stop();
|
|
870
669
|
}
|
|
871
670
|
}, _callee15, this);
|
|
872
671
|
}));
|
|
873
|
-
|
|
874
672
|
function _getUrlTemplateForGlyphs() {
|
|
875
673
|
return _getUrlTemplateForGlyphs2.apply(this, arguments);
|
|
876
674
|
}
|
|
877
|
-
|
|
878
675
|
return _getUrlTemplateForGlyphs;
|
|
879
676
|
}()
|
|
880
677
|
}], [{
|
|
@@ -883,33 +680,28 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
883
680
|
var supportedLang = this.SupportedLanguages.find(function (l) {
|
|
884
681
|
return l.key === lang;
|
|
885
682
|
});
|
|
886
|
-
|
|
887
683
|
if (layer.type === 'symbol' && layer.layout !== undefined && supportedLang !== undefined) {
|
|
888
684
|
var omtLang = supportedLang.omt;
|
|
889
685
|
var textField = layer.layout['text-field'];
|
|
890
|
-
|
|
891
686
|
if (textField && typeof textField === 'string') {
|
|
892
687
|
return TMSService._getTextField(textField, omtLang);
|
|
893
688
|
}
|
|
894
689
|
}
|
|
895
|
-
|
|
896
690
|
return;
|
|
897
691
|
}
|
|
692
|
+
|
|
898
693
|
/*
|
|
899
694
|
This method returns an array of objects per layer, containing a list of
|
|
900
695
|
properties with new colors to apply using map.setPaintProperty
|
|
901
696
|
*/
|
|
902
|
-
|
|
903
697
|
}, {
|
|
904
698
|
key: "transformColorProperties",
|
|
905
699
|
value: function transformColorProperties(layer, color, operation, percentage) {
|
|
906
700
|
if (['background', 'fill', 'line', 'symbol'].indexOf(layer.type) !== -1 && layer.paint) {
|
|
907
701
|
var paint = layer.paint;
|
|
908
|
-
|
|
909
702
|
if (layer.type === 'symbol' && Object.keys(paint).length === 0) {
|
|
910
703
|
paint['text-color'] = 'rgb(0,0,0)';
|
|
911
704
|
}
|
|
912
|
-
|
|
913
705
|
var types = Object.keys(paint).filter(function (key) {
|
|
914
706
|
return ['background-color', 'circle-color', 'circle-stroke-color', 'fill-color', 'fill-extrusion-color', 'fill-outline-color', 'icon-color', 'icon-halo-color', 'line-color', 'text-color', 'text-halo-color'].indexOf(key) !== -1;
|
|
915
707
|
});
|
|
@@ -929,23 +721,26 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
929
721
|
value: function _getTextField(label, lang) {
|
|
930
722
|
// Capture {name:xx} labels
|
|
931
723
|
var labelMatch = label.match(/\{name([:_])(.{2})\}/);
|
|
932
|
-
|
|
933
724
|
if (labelMatch && labelMatch[1] != lang) {
|
|
934
725
|
// Only apply if the languages are different
|
|
935
726
|
return ['coalesce', ['get', "name:".concat(lang)], ['get', "name".concat(labelMatch[1]).concat(labelMatch[2])]];
|
|
936
727
|
} else if (label.includes('latin') && label.includes('nonlatin')) {
|
|
937
728
|
// Capture the common pattern {name:latin}\n{name:nonlatin}
|
|
938
729
|
return ['coalesce', ['get', "name:".concat(lang)], ['concat', ['get', 'name:latin'], '\n', ['get', 'name:nonlatin']]];
|
|
939
|
-
}
|
|
940
|
-
|
|
730
|
+
}
|
|
941
731
|
|
|
732
|
+
// If no case is found, return the input label
|
|
942
733
|
return label;
|
|
943
734
|
}
|
|
944
735
|
}]);
|
|
945
|
-
|
|
946
736
|
return TMSService;
|
|
947
737
|
}(AbstractEmsService);
|
|
948
|
-
|
|
738
|
+
/*
|
|
739
|
+
List of supported languages with labels and OMT codes extracted
|
|
740
|
+
from https://openmaptiles.org/languages
|
|
741
|
+
Keys are values for i18.locale from Kibana settings
|
|
742
|
+
and OMT codes for the rest.
|
|
743
|
+
*/
|
|
949
744
|
_defineProperty(TMSService, "SupportedLanguages", [{
|
|
950
745
|
key: 'ar',
|
|
951
746
|
omt: 'ar'
|
|
@@ -1124,7 +919,9 @@ _defineProperty(TMSService, "SupportedLanguages", [{
|
|
|
1124
919
|
key: 'zh-cn',
|
|
1125
920
|
omt: 'zh'
|
|
1126
921
|
}]);
|
|
1127
|
-
|
|
922
|
+
/*
|
|
923
|
+
Suggested default operations for the different EMS styles
|
|
924
|
+
*/
|
|
1128
925
|
_defineProperty(TMSService, "colorOperationDefaults", [{
|
|
1129
926
|
style: 'road_map',
|
|
1130
927
|
operation: 'mix',
|