@elastic/ems-client
Advanced tools
Comparing version 7.9.3 to 7.9.4
@@ -6,2 +6,6 @@ # Changelog | ||
## [7.9.4] - 2020-08-14 | ||
### Removed | ||
- **Breaking change** The `getHTMLAttribution` method has been removed as clients should be responsible for creating HTML links. | ||
## [7.9.3] - 2020-06-09 | ||
@@ -8,0 +12,0 @@ ### Fixed |
{ | ||
"name": "@elastic/ems-client", | ||
"version": "7.9.3", | ||
"version": "7.9.4", | ||
"description": "JavaScript client library for the Elastic Maps Service", | ||
@@ -5,0 +5,0 @@ "main": "target/node/index.js", |
@@ -26,3 +26,2 @@ /* | ||
getAttributions(): { url: string; label: string }[]; | ||
getHTMLAttribution(): string; | ||
getMarkdownAttribution(): string; | ||
@@ -58,12 +57,2 @@ getDisplayName(): string; | ||
getHTMLAttribution(): string { | ||
const attributions = this._config.attribution.map((attribution) => { | ||
const url = this._emsClient.getValueInLanguage(attribution.url); | ||
const label = this._emsClient.getValueInLanguage(attribution.label); | ||
const html = url ? `<a rel="noreferrer noopener" href="${url}">${label}</a>` : label; | ||
return this._emsClient.sanitizeHtml(html); | ||
}); | ||
return attributions.join(' | '); //!!!this is the current convention used in Kibana | ||
} | ||
getMarkdownAttribution(): string { | ||
@@ -70,0 +59,0 @@ const attributions = this._config.attribution.map((attribution) => { |
@@ -128,8 +128,5 @@ /* | ||
}); | ||
// Override the attribution in the sources with the localized attribution | ||
const htmlAttribution = await this.getHTMLAttribution(); | ||
inlinedSources[sourceName] = { | ||
...sourceJson, | ||
type: 'vector', | ||
attribution: htmlAttribution, | ||
tiles: extendedTileUrls, | ||
@@ -136,0 +133,0 @@ }; |
@@ -7,3 +7,2 @@ import { EMSClient, BaseEmsServiceConfig } from './ems_client'; | ||
}[]; | ||
getHTMLAttribution(): string; | ||
getMarkdownAttribution(): string; | ||
@@ -25,3 +24,2 @@ getDisplayName(): string; | ||
}[]; | ||
getHTMLAttribution(): string; | ||
getMarkdownAttribution(): string; | ||
@@ -28,0 +26,0 @@ getOrigin(): string; |
@@ -48,15 +48,2 @@ "use strict"; | ||
getHTMLAttribution() { | ||
const attributions = this._config.attribution.map(attribution => { | ||
const url = this._emsClient.getValueInLanguage(attribution.url); | ||
const label = this._emsClient.getValueInLanguage(attribution.label); | ||
const html = url ? `<a rel="noreferrer noopener" href="${url}">${label}</a>` : label; | ||
return this._emsClient.sanitizeHtml(html); | ||
}); | ||
return attributions.join(' | '); //!!!this is the current convention used in Kibana | ||
} | ||
getMarkdownAttribution() { | ||
@@ -63,0 +50,0 @@ const attributions = this._config.attribution.map(attribution => { |
@@ -71,8 +71,5 @@ "use strict"; | ||
return this._emsClient.extendUrlWithParams(url); | ||
}); // Override the attribution in the sources with the localized attribution | ||
const htmlAttribution = await this.getHTMLAttribution(); | ||
}); | ||
inlinedSources[sourceName] = { ...sourceJson, | ||
type: 'vector', | ||
attribution: htmlAttribution, | ||
tiles: extendedTileUrls | ||
@@ -79,0 +76,0 @@ }; |
@@ -71,4 +71,4 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
}, { | ||
key: "getHTMLAttribution", | ||
value: function getHTMLAttribution() { | ||
key: "getMarkdownAttribution", | ||
value: function getMarkdownAttribution() { | ||
var _this3 = this; | ||
@@ -81,18 +81,2 @@ | ||
var html = url ? "<a rel=\"noreferrer noopener\" href=\"".concat(url, "\">").concat(label, "</a>") : label; | ||
return _this3._emsClient.sanitizeHtml(html); | ||
}); | ||
return attributions.join(' | '); //!!!this is the current convention used in Kibana | ||
} | ||
}, { | ||
key: "getMarkdownAttribution", | ||
value: function getMarkdownAttribution() { | ||
var _this4 = this; | ||
var attributions = this._config.attribution.map(function (attribution) { | ||
var url = _this4._emsClient.getValueInLanguage(attribution.url); | ||
var label = _this4._emsClient.getValueInLanguage(attribution.label); | ||
return "[".concat(label, "](").concat(url, ")"); | ||
@@ -99,0 +83,0 @@ }); |
@@ -133,3 +133,3 @@ 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); } | ||
_defineProperty(_assertThisInitialized(_this), "_getVectorStyleJsonInlined", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { | ||
var vectorJson, inlinedSources, sources, _iterator, _step, _sourceName, url, sourceUrl, extendedUrl, sourceJson, extendedTileUrls, htmlAttribution; | ||
var vectorJson, inlinedSources, sources, _iterator, _step, _sourceName, url, sourceUrl, extendedUrl, sourceJson, extendedTileUrls; | ||
@@ -147,3 +147,3 @@ return regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
if (!vectorJson) { | ||
_context3.next = 46; | ||
_context3.next = 43; | ||
break; | ||
@@ -161,3 +161,3 @@ } | ||
if ((_step = _iterator.n()).done) { | ||
_context3.next = 24; | ||
_context3.next = 21; | ||
break; | ||
@@ -179,25 +179,18 @@ } | ||
return _this._emsClient.extendUrlWithParams(url); | ||
}); // Override the attribution in the sources with the localized attribution | ||
_context3.next = 20; | ||
return _this.getHTMLAttribution(); | ||
case 20: | ||
htmlAttribution = _context3.sent; | ||
}); | ||
inlinedSources[_sourceName] = _objectSpread({}, sourceJson, { | ||
type: 'vector', | ||
attribution: htmlAttribution, | ||
tiles: extendedTileUrls | ||
}); | ||
case 22: | ||
case 19: | ||
_context3.next = 9; | ||
break; | ||
case 24: | ||
_context3.next = 29; | ||
case 21: | ||
_context3.next = 26; | ||
break; | ||
case 26: | ||
_context3.prev = 26; | ||
case 23: | ||
_context3.prev = 23; | ||
_context3.t0 = _context3["catch"](7); | ||
@@ -207,10 +200,10 @@ | ||
case 29: | ||
_context3.prev = 29; | ||
case 26: | ||
_context3.prev = 26; | ||
_iterator.f(); | ||
return _context3.finish(29); | ||
return _context3.finish(26); | ||
case 32: | ||
case 29: | ||
_context3.t1 = _objectSpread; | ||
@@ -220,11 +213,11 @@ _context3.t2 = {}; | ||
_context3.t4 = inlinedSources; | ||
_context3.next = 38; | ||
_context3.next = 35; | ||
return _this._getSpriteSheetRootPath(); | ||
case 38: | ||
case 35: | ||
_context3.t5 = _context3.sent; | ||
_context3.next = 41; | ||
_context3.next = 38; | ||
return _this._getUrlTemplateForGlyphs(); | ||
case 41: | ||
case 38: | ||
_context3.t6 = _context3.sent; | ||
@@ -238,6 +231,6 @@ _context3.t7 = { | ||
case 46: | ||
case 43: | ||
return _context3.abrupt("return"); | ||
case 47: | ||
case 44: | ||
case "end": | ||
@@ -247,3 +240,3 @@ return _context3.stop(); | ||
} | ||
}, _callee3, null, [[7, 26, 29, 32]]); | ||
}, _callee3, null, [[7, 23, 26, 29]]); | ||
})))); | ||
@@ -250,0 +243,0 @@ |
@@ -68,5 +68,2 @@ /* | ||
expect(tileService.getHTMLAttribution()).toBe( | ||
'<a rel="noreferrer noopener" href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a> | <a rel="noreferrer noopener" href="https://openmaptiles.org">OpenMapTiles</a> | <a rel="noreferrer noopener" href="https://www.maptiler.com">MapTiler</a> | <a rel="noreferrer noopener" href="https://www.elastic.co/elastic-maps-service">Elastic Maps Service</a>' | ||
); | ||
expect(await tileService.getMinZoom()).toBe(0); | ||
@@ -93,5 +90,2 @@ expect(await tileService.getMaxZoom()).toBe(10); | ||
expect(tileService.getHTMLAttribution()).toBe( | ||
'<a rel="noreferrer noopener" href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a> | <a rel="noreferrer noopener" href="https://openmaptiles.org">OpenMapTiles</a> | <a rel="noreferrer noopener" href="https://www.maptiler.com">MapTiler</a> | <a rel="noreferrer noopener" href="https://www.elastic.co/elastic-maps-service">Elastic Maps Service</a>' | ||
); | ||
expect(await tileService.getMinZoom()).toBe(0); | ||
@@ -180,6 +174,2 @@ expect(await tileService.getMaxZoom()).toBe(10); | ||
expect(layer.getHTMLAttribution()).toBe( | ||
'<a rel="noreferrer noopener" href="http://www.naturalearthdata.com/about/terms-of-use">Made with NaturalEarth</a> | <a rel="noreferrer noopener" href="https://www.elastic.co/elastic-maps-service">Elastic Maps Service</a>' | ||
); | ||
expect(layer.getDisplayName()).toBe('World Countries'); | ||
@@ -203,6 +193,2 @@ }); | ||
expect(layer.hasId('world_countries')).toBe(true); | ||
expect(layer.getHTMLAttribution()).toBe( | ||
'<a rel="noreferrer noopener" href="http://www.naturalearthdata.com/about/terms-of-use">Made with NaturalEarth</a> | <a rel="noreferrer noopener" href="https://www.elastic.co/elastic-maps-service">Elastic Maps Service</a>' | ||
); | ||
expect(layer.getDisplayName()).toBe('pays'); | ||
@@ -235,6 +221,2 @@ | ||
expect(layer.hasId('world_countries')).toBe(true); | ||
expect(layer.getHTMLAttribution()).toBe( | ||
'<a rel="noreferrer noopener" href="http://www.naturalearthdata.com/about/terms-of-use">Made with NaturalEarth</a> | <a rel="noreferrer noopener" href="https://www.elastic.co/elastic-maps-service">Elastic Maps Service</a>' | ||
); | ||
expect(layer.getDisplayName()).toBe('World Countries'); | ||
@@ -241,0 +223,0 @@ |
Sorry, the diff of this file is too big to display
774444
72
25435