@elastic/ems-client 8.3.3 → 8.4.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.
@@ -1,30 +1,25 @@
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); }
1
2
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
-
3
- 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, descriptor.key, descriptor); } }
4
-
5
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
6
-
7
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
-
3
+ 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); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ 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; }
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ 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); }
9
8
  /*
10
9
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
11
10
  * or more contributor license agreements. Licensed under the Elastic License
12
11
  * 2.0; you may not use this file except in compliance with the Elastic License
13
12
  * 2.0.
14
13
  */
14
+
15
15
  import { toAbsoluteUrl } from './utils';
16
16
  export var AbstractEmsService = /*#__PURE__*/function () {
17
17
  function AbstractEmsService(config, emsClient, proxyPath) {
18
18
  var _this = this;
19
-
20
19
  _classCallCheck(this, AbstractEmsService);
21
-
22
20
  _defineProperty(this, "_emsClient", void 0);
23
-
24
21
  _defineProperty(this, "_config", void 0);
25
-
26
22
  _defineProperty(this, "_proxyPath", void 0);
27
-
28
23
  _defineProperty(this, "_getAbsoluteUrl", function (url) {
29
24
  if (/^https?:\/\//.test(url)) {
30
25
  return url;
@@ -32,22 +27,17 @@ export var AbstractEmsService = /*#__PURE__*/function () {
32
27
  return toAbsoluteUrl(_this.getApiUrl(), url);
33
28
  }
34
29
  });
35
-
36
30
  this._config = config;
37
31
  this._emsClient = emsClient;
38
32
  this._proxyPath = proxyPath;
39
33
  }
40
-
41
34
  _createClass(AbstractEmsService, [{
42
35
  key: "getAttributions",
43
36
  value: function getAttributions() {
44
37
  var _this2 = this;
45
-
46
38
  return this._config.attribution.map(function (attribution) {
47
39
  var url = _this2._emsClient.getValueInLanguage(attribution.url);
48
-
49
40
  var label = _this2._emsClient.getValueInLanguage(attribution.label);
50
-
51
41
  return {
52
42
  url: url,
53
43
  label: label
@@ -58,22 +48,17 @@ export var AbstractEmsService = /*#__PURE__*/function () {
58
48
  key: "getMarkdownAttribution",
59
49
  value: function getMarkdownAttribution() {
60
50
  var _this3 = this;
61
-
62
51
  var attributions = this._config.attribution.map(function (attribution) {
63
52
  var url = _this3._emsClient.getValueInLanguage(attribution.url);
64
-
65
53
  var label = _this3._emsClient.getValueInLanguage(attribution.label);
66
-
67
54
  return "[".concat(label, "](").concat(url, ")");
68
55
  });
69
-
70
56
  return attributions.join('|');
71
57
  }
58
+
72
59
  /**
73
60
  * Checks if url is absolute. If not, prepend the basePath.
74
61
  */
75
-
76
62
  }]);
77
-
78
63
  return AbstractEmsService;
79
64
  }();
@@ -1,135 +1,98 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
-
3
- 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; }
4
-
5
- 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; }
6
-
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); }
2
+ 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; }
3
+ 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; }
4
+ 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; }
7
5
  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); } }
8
-
9
6
  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); }); }; }
10
-
11
7
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
-
13
- 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, descriptor.key, descriptor); } }
14
-
15
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
16
-
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
18
-
19
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
20
-
8
+ 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); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ 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); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
12
  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); }; }
22
-
23
13
  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); }
24
-
25
14
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
26
-
27
15
  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; } }
28
-
29
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
30
-
31
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
32
-
16
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
17
+ 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; }
18
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
19
+ 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); }
33
20
  /*
34
21
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
35
22
  * or more contributor license agreements. Licensed under the Elastic License
36
23
  * 2.0; you may not use this file except in compliance with the Elastic License
37
24
  * 2.0.
38
25
  */
26
+
39
27
  import url from 'url';
40
28
  import { AbstractEmsService } from './ems_service';
41
29
  import * as topojson from 'topojson-client';
42
30
  export var EMSFormatType;
43
-
44
31
  (function (EMSFormatType) {
45
32
  EMSFormatType["geojson"] = "geojson";
46
33
  EMSFormatType["topojson"] = "topojson";
47
34
  })(EMSFormatType || (EMSFormatType = {}));
48
-
49
35
  export var FileLayer = /*#__PURE__*/function (_AbstractEmsService) {
50
36
  _inherits(FileLayer, _AbstractEmsService);
51
-
52
37
  var _super = _createSuper(FileLayer);
53
-
54
38
  function FileLayer(config, emsClient, proxyPath) {
55
39
  var _this;
56
-
57
40
  _classCallCheck(this, FileLayer);
58
-
59
41
  _this = _super.call(this, config, emsClient, proxyPath);
60
-
61
42
  _defineProperty(_assertThisInitialized(_this), "_config", void 0);
62
-
63
43
  _this._config = config;
64
44
  return _this;
65
45
  }
66
-
67
46
  _createClass(FileLayer, [{
68
47
  key: "getGeoJson",
69
48
  value: function () {
70
- var _getGeoJson = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
49
+ var _getGeoJson = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
71
50
  var cachedGeoJson, format, fetchUrl, geojson, fetchedJson, _meta$feature_collect, meta, featureCollectionPath;
72
-
73
- return regeneratorRuntime.wrap(function _callee$(_context) {
51
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
74
52
  while (1) {
75
53
  switch (_context.prev = _context.next) {
76
54
  case 0:
77
55
  cachedGeoJson = this._emsClient.getCachedGeoJson(this.getId());
78
-
79
56
  if (!cachedGeoJson) {
80
57
  _context.next = 3;
81
58
  break;
82
59
  }
83
-
84
60
  return _context.abrupt("return", cachedGeoJson);
85
-
86
61
  case 3:
87
62
  format = this.getDefaultFormatType();
88
63
  fetchUrl = this.getDefaultFormatUrl();
89
64
  _context.next = 7;
90
65
  return this._emsClient.getManifest(fetchUrl);
91
-
92
66
  case 7:
93
67
  fetchedJson = _context.sent;
94
-
95
68
  if (!fetchedJson) {
96
69
  _context.next = 22;
97
70
  break;
98
71
  }
99
-
100
72
  if (!(format === 'geojson')) {
101
73
  _context.next = 13;
102
74
  break;
103
75
  }
104
-
105
76
  geojson = fetchedJson;
106
77
  _context.next = 20;
107
78
  break;
108
-
109
79
  case 13:
110
80
  if (!(format === 'topojson')) {
111
81
  _context.next = 19;
112
82
  break;
113
83
  }
114
-
115
84
  meta = this.getDefaultFormatMeta();
116
85
  featureCollectionPath = (_meta$feature_collect = meta === null || meta === void 0 ? void 0 : meta.feature_collection_path) !== null && _meta$feature_collect !== void 0 ? _meta$feature_collect : 'data'; // @ts-expect-error see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/52156
117
-
118
86
  geojson = topojson.feature(fetchedJson, featureCollectionPath);
119
87
  _context.next = 20;
120
88
  break;
121
-
122
89
  case 19:
123
90
  return _context.abrupt("return");
124
-
125
91
  case 20:
126
92
  this._emsClient.cacheGeoJson(this.getId(), geojson);
127
-
128
93
  return _context.abrupt("return", geojson);
129
-
130
94
  case 22:
131
95
  return _context.abrupt("return");
132
-
133
96
  case 23:
134
97
  case "end":
135
98
  return _context.stop();
@@ -137,11 +100,9 @@ export var FileLayer = /*#__PURE__*/function (_AbstractEmsService) {
137
100
  }
138
101
  }, _callee, this);
139
102
  }));
140
-
141
103
  function getGeoJson() {
142
104
  return _getGeoJson.apply(this, arguments);
143
105
  }
144
-
145
106
  return getGeoJson;
146
107
  }()
147
108
  }, {
@@ -153,7 +114,6 @@ export var FileLayer = /*#__PURE__*/function (_AbstractEmsService) {
153
114
  key: "getFieldsInLanguage",
154
115
  value: function getFieldsInLanguage() {
155
116
  var _this2 = this;
156
-
157
117
  return this.getFields().map(function (field) {
158
118
  return {
159
119
  type: field.type,
@@ -166,7 +126,6 @@ export var FileLayer = /*#__PURE__*/function (_AbstractEmsService) {
166
126
  key: "getDisplayName",
167
127
  value: function getDisplayName() {
168
128
  var layerName = this._emsClient.getValueInLanguage(this._config.layer_name);
169
-
170
129
  return layerName ? layerName : '';
171
130
  }
172
131
  }, {
@@ -184,7 +143,6 @@ export var FileLayer = /*#__PURE__*/function (_AbstractEmsService) {
184
143
  key: "getEMSHotLink",
185
144
  value: function getEMSHotLink() {
186
145
  var landingPageString = this._emsClient.getLandingPageUrl();
187
-
188
146
  var urlObject = url.parse(landingPageString, true);
189
147
  urlObject.hash = "file/".concat(this.getId());
190
148
  urlObject.query = _objectSpread(_objectSpread({}, urlObject.query), {}, {
@@ -196,42 +154,36 @@ export var FileLayer = /*#__PURE__*/function (_AbstractEmsService) {
196
154
  key: "getDefaultFormatType",
197
155
  value: function getDefaultFormatType() {
198
156
  var format = this._getDefaultFormat();
199
-
200
157
  return format.type;
201
158
  }
202
159
  }, {
203
160
  key: "getFormatOfType",
204
161
  value: function getFormatOfType(type) {
205
162
  var format = this._getFormatOfType(type);
206
-
207
163
  return format.type;
208
164
  }
209
165
  }, {
210
166
  key: "getDefaultFormatMeta",
211
167
  value: function getDefaultFormatMeta() {
212
168
  var format = this._getDefaultFormat();
213
-
214
169
  return this._getFormatMeta(format);
215
170
  }
216
171
  }, {
217
172
  key: "getFormatOfTypeMeta",
218
173
  value: function getFormatOfTypeMeta(type) {
219
174
  var format = this._getFormatOfType(type);
220
-
221
175
  return this._getFormatMeta(format);
222
176
  }
223
177
  }, {
224
178
  key: "getDefaultFormatUrl",
225
179
  value: function getDefaultFormatUrl() {
226
180
  var format = this._getDefaultFormat();
227
-
228
181
  return this._getFormatUrl(format);
229
182
  }
230
183
  }, {
231
184
  key: "getFormatOfTypeUrl",
232
185
  value: function getFormatOfTypeUrl(type) {
233
186
  var format = this._getFormatOfType(type);
234
-
235
187
  return this._getFormatUrl(format);
236
188
  }
237
189
  }, {
@@ -248,7 +200,6 @@ export var FileLayer = /*#__PURE__*/function (_AbstractEmsService) {
248
200
  key: "_getFormatUrl",
249
201
  value: function _getFormatUrl(format) {
250
202
  var url = this._proxyPath + this._getAbsoluteUrl(format.url);
251
-
252
203
  return this._emsClient.extendUrlWithParams(url);
253
204
  }
254
205
  }, {
@@ -266,11 +217,9 @@ export var FileLayer = /*#__PURE__*/function (_AbstractEmsService) {
266
217
  var defaultFormat = this._config.formats.find(function (format) {
267
218
  return format.legacy_default;
268
219
  });
269
-
270
220
  if (defaultFormat) {
271
221
  return defaultFormat;
272
222
  }
273
-
274
223
  return this._config.formats[0];
275
224
  }
276
225
  }, {
@@ -279,10 +228,8 @@ export var FileLayer = /*#__PURE__*/function (_AbstractEmsService) {
279
228
  var requestedFormat = this._config.formats.find(function (format) {
280
229
  return format.type === type;
281
230
  });
282
-
283
231
  return requestedFormat || this._getDefaultFormat();
284
232
  }
285
233
  }]);
286
-
287
234
  return FileLayer;
288
235
  }(AbstractEmsService);
@@ -4,6 +4,7 @@
4
4
  * 2.0; you may not use this file except in compliance with the Elastic License
5
5
  * 2.0.
6
6
  */
7
+
7
8
  export { EMSClient, FileLayerField } from './ems_client';
8
9
  export { FileLayer } from './file_layer';
9
10
  export { TMSService, EmsSprite, EmsSpriteSheet } from './tms_service';