@elastic/ems-client
Advanced tools
Comparing version 7.6.0 to 7.6.1
{ | ||
"name": "@elastic/ems-client", | ||
"version": "7.6.0", | ||
"version": "7.6.1", | ||
"description": "JavaScript client library for the Elastic Maps Service", | ||
@@ -5,0 +5,0 @@ "main": "target/node/index.js", |
@@ -26,2 +26,3 @@ /* | ||
import { format as formatUrl, parse as parseUrl } from 'url'; | ||
import { toAbsoluteUrl } from './utils'; | ||
@@ -229,3 +230,3 @@ const DEFAULT_EMS_VERSION = '7.6'; | ||
type: 'tms', | ||
manifest: `${this._tileApiUrl}/${this._emsVersion}/manifest`, | ||
manifest: toAbsoluteUrl(this._tileApiUrl,`${this._emsVersion}/manifest`), | ||
}); | ||
@@ -236,3 +237,3 @@ } | ||
type: 'file', | ||
manifest: `${this._fileApiUrl}/${this._emsVersion}/manifest`, | ||
manifest: toAbsoluteUrl(this._fileApiUrl,`${this._emsVersion}/manifest`), | ||
}); | ||
@@ -239,0 +240,0 @@ } |
@@ -20,2 +20,4 @@ "use strict"; | ||
var _utils = require("./utils"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -224,3 +226,3 @@ | ||
type: 'tms', | ||
manifest: `${this._tileApiUrl}/${this._emsVersion}/manifest` | ||
manifest: (0, _utils.toAbsoluteUrl)(this._tileApiUrl, `${this._emsVersion}/manifest`) | ||
}); | ||
@@ -232,3 +234,3 @@ } | ||
type: 'file', | ||
manifest: `${this._fileApiUrl}/${this._emsVersion}/manifest` | ||
manifest: (0, _utils.toAbsoluteUrl)(this._fileApiUrl, `${this._emsVersion}/manifest`) | ||
}); | ||
@@ -235,0 +237,0 @@ } |
@@ -37,2 +37,3 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
import { format as formatUrl, parse as parseUrl } from 'url'; | ||
import { toAbsoluteUrl } from './utils'; | ||
var DEFAULT_EMS_VERSION = '7.6'; | ||
@@ -102,5 +103,3 @@ | ||
var DEFAULT_LANGUAGE = 'en'; | ||
export var EMSClient = | ||
/*#__PURE__*/ | ||
function () { | ||
export var EMSClient = /*#__PURE__*/function () { | ||
function EMSClient(_ref) { | ||
@@ -182,5 +181,3 @@ var kbnVersion = _ref.kbnVersion, | ||
value: function () { | ||
var _getManifest = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee(manifestUrl) { | ||
var _getManifest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(manifestUrl) { | ||
var url, result; | ||
@@ -292,5 +289,3 @@ return regeneratorRuntime.wrap(function _callee$(_context) { | ||
value: function () { | ||
var _getManifestWithParams2 = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee2(url) { | ||
var _getManifestWithParams2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(url) { | ||
var extendedUrl; | ||
@@ -327,7 +322,3 @@ return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
this._getMainCatalog = _.once( | ||
/*#__PURE__*/ | ||
_asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee3() { | ||
this._getMainCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { | ||
var services; | ||
@@ -356,3 +347,3 @@ return regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
type: 'tms', | ||
manifest: "".concat(_this2._tileApiUrl, "/").concat(_this2._emsVersion, "/manifest") | ||
manifest: toAbsoluteUrl(_this2._tileApiUrl, "".concat(_this2._emsVersion, "/manifest")) | ||
}); | ||
@@ -364,3 +355,3 @@ } | ||
type: 'file', | ||
manifest: "".concat(_this2._fileApiUrl, "/").concat(_this2._emsVersion, "/manifest") | ||
manifest: toAbsoluteUrl(_this2._fileApiUrl, "".concat(_this2._emsVersion, "/manifest")) | ||
}); | ||
@@ -380,7 +371,3 @@ } | ||
}))); | ||
this._getDefaultTMSCatalog = _.once( | ||
/*#__PURE__*/ | ||
_asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee4() { | ||
this._getDefaultTMSCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { | ||
var catalogue, firstService, url; | ||
@@ -424,7 +411,3 @@ return regeneratorRuntime.wrap(function _callee4$(_context4) { | ||
}))); | ||
this._getDefaultFileCatalog = _.once( | ||
/*#__PURE__*/ | ||
_asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee5() { | ||
this._getDefaultFileCatalog = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() { | ||
var catalogue, firstService, url; | ||
@@ -469,7 +452,3 @@ return regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
this._loadTMSServices = _.once( | ||
/*#__PURE__*/ | ||
_asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee6() { | ||
this._loadTMSServices = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() { | ||
var tmsManifest; | ||
@@ -496,7 +475,3 @@ return regeneratorRuntime.wrap(function _callee6$(_context6) { | ||
}))); | ||
this._loadFileLayers = _.once( | ||
/*#__PURE__*/ | ||
_asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee7() { | ||
this._loadFileLayers = _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() { | ||
var fileManifest; | ||
@@ -527,5 +502,3 @@ return regeneratorRuntime.wrap(function _callee7$(_context7) { | ||
value: function () { | ||
var _getMainManifest = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee8() { | ||
var _getMainManifest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() { | ||
return regeneratorRuntime.wrap(function _callee8$(_context8) { | ||
@@ -558,5 +531,3 @@ while (1) { | ||
value: function () { | ||
var _getDefaultFileManifest = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee9() { | ||
var _getDefaultFileManifest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() { | ||
return regeneratorRuntime.wrap(function _callee9$(_context9) { | ||
@@ -589,5 +560,3 @@ while (1) { | ||
value: function () { | ||
var _getDefaultTMSManifest = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee10() { | ||
var _getDefaultTMSManifest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() { | ||
return regeneratorRuntime.wrap(function _callee10$(_context10) { | ||
@@ -620,5 +589,3 @@ while (1) { | ||
value: function () { | ||
var _getFileLayers = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee11() { | ||
var _getFileLayers = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() { | ||
return regeneratorRuntime.wrap(function _callee11$(_context11) { | ||
@@ -651,5 +618,3 @@ while (1) { | ||
value: function () { | ||
var _getTMSServices = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee12() { | ||
var _getTMSServices = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() { | ||
return regeneratorRuntime.wrap(function _callee12$(_context12) { | ||
@@ -709,5 +674,3 @@ while (1) { | ||
value: function () { | ||
var _findFileLayerById = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee13(id) { | ||
var _findFileLayerById = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(id) { | ||
var fileLayers, i; | ||
@@ -760,5 +723,3 @@ return regeneratorRuntime.wrap(function _callee13$(_context13) { | ||
value: function () { | ||
var _findTMSServiceById = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee14(id) { | ||
var _findTMSServiceById = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(id) { | ||
var tmsServices, i; | ||
@@ -765,0 +726,0 @@ return regeneratorRuntime.wrap(function _callee14$(_context14) { |
@@ -34,5 +34,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; } | ||
import { toAbsoluteUrl } from './utils'; | ||
export var FileLayer = | ||
/*#__PURE__*/ | ||
function () { | ||
export var FileLayer = /*#__PURE__*/function () { | ||
/** | ||
@@ -39,0 +37,0 @@ * Checks if url is absolute. If not, prepend the basePath. |
@@ -0,1 +1,7 @@ | ||
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { 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 it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, 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; } } }; } | ||
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(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
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; } | ||
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; } | ||
@@ -38,5 +44,3 @@ | ||
import { toAbsoluteUrl } from './utils'; | ||
export var TMSService = | ||
/*#__PURE__*/ | ||
function () { | ||
export var TMSService = /*#__PURE__*/function () { | ||
function TMSService(config, emsClient, proxyPath) { | ||
@@ -55,7 +59,3 @@ var _this = this; | ||
_defineProperty(this, "_getRasterStyleJson", _.once( | ||
/*#__PURE__*/ | ||
_asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee() { | ||
_defineProperty(this, "_getRasterStyleJson", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { | ||
var rasterUrl, url; | ||
@@ -78,7 +78,3 @@ return regeneratorRuntime.wrap(function _callee$(_context) { | ||
_defineProperty(this, "_getVectorStyleJsonRaw", _.once( | ||
/*#__PURE__*/ | ||
_asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee2() { | ||
_defineProperty(this, "_getVectorStyleJsonRaw", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { | ||
var vectorUrl, url, vectorJson; | ||
@@ -106,8 +102,4 @@ return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
_defineProperty(this, "_getVectorStyleJsonInlined", _.once( | ||
/*#__PURE__*/ | ||
_asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee3() { | ||
var vectorJson, inlinedSources, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, sourceName, sourceUrl, extendedUrl, sourceJson, extendedTileUrls, htmlAttribution; | ||
_defineProperty(this, "_getVectorStyleJsonInlined", _.once( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { | ||
var vectorJson, inlinedSources, _iterator, _step, sourceName, sourceUrl, extendedUrl, sourceJson, extendedTileUrls, htmlAttribution; | ||
@@ -124,11 +116,10 @@ return regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
inlinedSources = {}; | ||
_iteratorNormalCompletion = true; | ||
_didIteratorError = false; | ||
_iteratorError = undefined; | ||
_context3.prev = 7; | ||
_iterator = Object.getOwnPropertyNames(vectorJson.sources)[Symbol.iterator](); | ||
_iterator = _createForOfIteratorHelper(Object.getOwnPropertyNames(vectorJson.sources)); | ||
_context3.prev = 5; | ||
case 9: | ||
if (_iteratorNormalCompletion = (_step = _iterator.next()).done) { | ||
_context3.next = 24; | ||
_iterator.s(); | ||
case 7: | ||
if ((_step = _iterator.n()).done) { | ||
_context3.next = 21; | ||
break; | ||
@@ -140,6 +131,6 @@ } | ||
extendedUrl = _this._emsClient.extendUrlWithParams(sourceUrl); | ||
_context3.next = 15; | ||
_context3.next = 13; | ||
return _this._emsClient.getManifest(extendedUrl); | ||
case 15: | ||
case 13: | ||
sourceJson = _context3.sent; | ||
@@ -152,6 +143,6 @@ extendedTileUrls = sourceJson.tiles.map(function (tileUrl) { | ||
_context3.next = 19; | ||
_context3.next = 17; | ||
return _this.getHTMLAttribution(); | ||
case 19: | ||
case 17: | ||
htmlAttribution = _context3.sent; | ||
@@ -165,42 +156,24 @@ inlinedSources[sourceName] = _objectSpread({ | ||
case 21: | ||
_iteratorNormalCompletion = true; | ||
_context3.next = 9; | ||
case 19: | ||
_context3.next = 7; | ||
break; | ||
case 24: | ||
_context3.next = 30; | ||
case 21: | ||
_context3.next = 26; | ||
break; | ||
case 23: | ||
_context3.prev = 23; | ||
_context3.t0 = _context3["catch"](5); | ||
_iterator.e(_context3.t0); | ||
case 26: | ||
_context3.prev = 26; | ||
_context3.t0 = _context3["catch"](7); | ||
_didIteratorError = true; | ||
_iteratorError = _context3.t0; | ||
case 30: | ||
_context3.prev = 30; | ||
_context3.prev = 31; | ||
_iterator.f(); | ||
if (!_iteratorNormalCompletion && _iterator["return"] != null) { | ||
_iterator["return"](); | ||
} | ||
return _context3.finish(26); | ||
case 33: | ||
_context3.prev = 33; | ||
if (!_didIteratorError) { | ||
_context3.next = 36; | ||
break; | ||
} | ||
throw _iteratorError; | ||
case 36: | ||
return _context3.finish(33); | ||
case 37: | ||
return _context3.finish(30); | ||
case 38: | ||
case 29: | ||
_context3.t1 = _objectSpread; | ||
@@ -210,11 +183,11 @@ _context3.t2 = {}; | ||
_context3.t4 = inlinedSources; | ||
_context3.next = 44; | ||
_context3.next = 35; | ||
return _this._getSpriteSheetRootPath(); | ||
case 44: | ||
case 35: | ||
_context3.t5 = _context3.sent; | ||
_context3.next = 47; | ||
_context3.next = 38; | ||
return _this._getUrlTemplateForGlyphs(); | ||
case 47: | ||
case 38: | ||
_context3.t6 = _context3.sent; | ||
@@ -228,3 +201,3 @@ _context3.t7 = { | ||
case 50: | ||
case 41: | ||
case "end": | ||
@@ -234,3 +207,3 @@ return _context3.stop(); | ||
} | ||
}, _callee3, null, [[7, 26, 30, 38], [31,, 33, 37]]); | ||
}, _callee3, null, [[5, 23, 26, 29]]); | ||
})))); | ||
@@ -274,5 +247,3 @@ | ||
value: function () { | ||
var _getDefaultRasterStyle = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee4() { | ||
var _getDefaultRasterStyle = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { | ||
var _this2 = this; | ||
@@ -314,5 +285,3 @@ | ||
value: function () { | ||
var _getUrlTemplate = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee5() { | ||
var _getUrlTemplate = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() { | ||
var tileJson, directUrl; | ||
@@ -348,5 +317,3 @@ return regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
value: function () { | ||
var _getUrlTemplateForVector = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee6(sourceId) { | ||
var _getUrlTemplateForVector = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(sourceId) { | ||
var tileJson, directUrl; | ||
@@ -391,5 +358,3 @@ return regeneratorRuntime.wrap(function _callee6$(_context6) { | ||
value: function () { | ||
var _getVectorStyleSheet = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee7() { | ||
var _getVectorStyleSheet = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() { | ||
return regeneratorRuntime.wrap(function _callee7$(_context7) { | ||
@@ -422,5 +387,3 @@ while (1) { | ||
value: function () { | ||
var _getVectorStyleSheetRaw = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee8() { | ||
var _getVectorStyleSheetRaw = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() { | ||
return regeneratorRuntime.wrap(function _callee8$(_context8) { | ||
@@ -453,5 +416,3 @@ while (1) { | ||
value: function () { | ||
var _getSpriteSheetMeta = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee9() { | ||
var _getSpriteSheetMeta = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() { | ||
var isRetina, | ||
@@ -506,5 +467,3 @@ metaUrl, | ||
value: function () { | ||
var _getSpriteSheetRootPath2 = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee10() { | ||
var _getSpriteSheetRootPath2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() { | ||
var vectorStyleJson; | ||
@@ -539,5 +498,3 @@ return regeneratorRuntime.wrap(function _callee10$(_context10) { | ||
value: function () { | ||
var _getUrlTemplateForGlyphs2 = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee11() { | ||
var _getUrlTemplateForGlyphs2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() { | ||
var vectorStyleJson; | ||
@@ -572,5 +529,3 @@ return regeneratorRuntime.wrap(function _callee11$(_context11) { | ||
value: function () { | ||
var _getSpriteSheetJsonPath = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee12() { | ||
var _getSpriteSheetJsonPath = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() { | ||
var isRetina, | ||
@@ -610,5 +565,3 @@ spriteSheetRootPath, | ||
value: function () { | ||
var _getSpriteSheetPngPath = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee13() { | ||
var _getSpriteSheetPngPath = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13() { | ||
var isRetina, | ||
@@ -700,5 +653,3 @@ spriteSheetRootPath, | ||
value: function () { | ||
var _getMinZoom = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee14() { | ||
var _getMinZoom = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14() { | ||
var tileJson; | ||
@@ -733,5 +684,3 @@ return regeneratorRuntime.wrap(function _callee14$(_context14) { | ||
value: function () { | ||
var _getMaxZoom = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee15() { | ||
var _getMaxZoom = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15() { | ||
var tileJson; | ||
@@ -738,0 +687,0 @@ return regeneratorRuntime.wrap(function _callee15$(_context15) { |
@@ -26,3 +26,32 @@ /* | ||
it('should get api manifests', async () => { | ||
const emsClient = getEMSClient({ | ||
language: 'zz', | ||
tileApiUrl: 'https://tiles.foobar', | ||
fileApiUrl: 'https://files.foobar', | ||
emsVersion: '7.6', | ||
}); | ||
const spy = jest.spyOn(emsClient, 'getManifest'); | ||
await emsClient.getTMSServices(); | ||
await emsClient.getFileLayers(); | ||
expect(spy).toHaveBeenNthCalledWith(1, 'https://tiles.foobar/v7.6/manifest'); | ||
expect(spy).toHaveBeenNthCalledWith(2, 'https://files.foobar/v7.6/manifest'); | ||
}); | ||
it('should handle end slashes in api urls correctly', async () => { | ||
const emsClient = getEMSClient({ | ||
language: 'zz', | ||
tileApiUrl: 'https://tiles.foobar/', | ||
fileApiUrl: 'https://files.foobar/', | ||
emsVersion: '7.6', | ||
}); | ||
const spy = jest.spyOn(emsClient, 'getManifest'); | ||
await emsClient.getTMSServices(); | ||
await emsClient.getFileLayers(); | ||
expect(spy).toHaveBeenNthCalledWith(1, 'https://tiles.foobar/v7.6/manifest'); | ||
expect(spy).toHaveBeenNthCalledWith(2, 'https://files.foobar/v7.6/manifest'); | ||
}); | ||
it('should get the tile service', async () => { | ||
@@ -298,2 +327,1 @@ | ||
}); | ||
import { EMSClient } from '../src'; | ||
import fetch from 'node-fetch'; | ||
// describe('7.6 client - file', () => { | ||
// const emsClient = new EMSClient({ | ||
// kbnVersion: 'v7.6.0', | ||
// tileApiUrl: 'https://tiles.maps.elastic.co', | ||
// fileApiUrl: 'http://localhost:8000', | ||
// language: 'en', | ||
// }); | ||
describe.skip(() => true) | ||
describe.skip('7.6 client - file', () => { | ||
const emsClient = new EMSClient({ | ||
appVersion: 'v7.7.0', | ||
tileApiUrl: 'http://ems.local:8085/tile', | ||
fileApiUrl: 'http://ems.local:8085/file', | ||
language: 'en', | ||
fetchFunction: fetch, | ||
}); | ||
it('connects', async () => { | ||
const tms = await emsClient.getTMSServices(); | ||
const roadMapService = tms[0]; | ||
const stylesheet = await roadMapService.getVectorStyleSheet(); | ||
debugger; | ||
}); | ||
}); | ||
// it('layer', async() => { | ||
@@ -29,3 +42,3 @@ // const layers = await emsClient.getFileLayers(); | ||
// expect(layer.getDefaultFormatUrl()).toBe('http://localhost:8000/files/world_countries_v1.geo.json?elastic_tile_service_tos=agree&my_app_name=kibana&my_app_version=v7.6.0'); | ||
// expect(layer.getDefaultFormatUrl()).toBe('http://localhost:8000/files/world_countries_v1.geo.json?elastic_tile_service_tos=agree&my_app_name=tester&my_app_version=v7.6.0'); | ||
// }); | ||
@@ -37,3 +50,3 @@ // }); | ||
// const emsClient = new EMSClient({ | ||
// kbnVersion: 'v7.2.0', | ||
// appVersion: 'v7.2.0', | ||
// manifestServiceUrl: 'https://catalogue.maps.elastic.co/v7.2/manifest', | ||
@@ -61,3 +74,3 @@ // language: 'en', | ||
// expect(layer.getDefaultFormatUrl()).toBe('https://vector.maps.elastic.co/files/world_countries_v1.geo.json?elastic_tile_service_tos=agree&my_app_name=kibana&my_app_version=v7.2.0'); | ||
// expect(layer.getDefaultFormatUrl()).toBe('https://vector.maps.elastic.co/files/world_countries_v1.geo.json?elastic_tile_service_tos=agree&my_app_name=tester&my_app_version=v7.2.0'); | ||
@@ -70,3 +83,3 @@ // }); | ||
// const emsClient = new EMSClient({ | ||
// kbnVersion: 'v7.2.0', | ||
// appVersion: 'v7.2.0', | ||
// language: 'en', | ||
@@ -84,3 +97,3 @@ // }); | ||
// const emsClient = new EMSClient({ | ||
// kbnVersion: 'v7.2.0', | ||
// appVersion: 'v7.2.0', | ||
// manifestServiceUrl: 'https://catalogue.maps.elastic.co/v7.2/manifest', | ||
@@ -109,3 +122,3 @@ // fileApiUrl: 'https://localhost:8000', | ||
// expect(layer.getDefaultFormatUrl()).toBe('https://vector.maps.elastic.co/files/world_countries_v1.geo.json?elastic_tile_service_tos=agree&my_app_name=kibana&my_app_version=v7.2.0'); | ||
// expect(layer.getDefaultFormatUrl()).toBe('https://vector.maps.elastic.co/files/world_countries_v1.geo.json?elastic_tile_service_tos=agree&my_app_name=tester&my_app_version=v7.2.0'); | ||
@@ -117,3 +130,3 @@ // }); | ||
// const emsClient = new EMSClient({ | ||
// kbnVersion: 'v7.2.2', | ||
// appVersion: 'v7.2.2', | ||
// manifestServiceUrl: 'https://catalogue.maps.elastic.co/v7.2/manifest', | ||
@@ -145,37 +158,37 @@ // language: 'en', | ||
describe('7.6 client - tile', () => { | ||
const emsClient = new EMSClient({ | ||
kbnVersion: 'v7.6.0', | ||
tileApiUrl: 'https://tiles.maps.elastic.co', | ||
fileApiUrl: 'https://vector-staging.maps.elastic.co', | ||
language: 'en', | ||
emsVersion: 'v7.6', | ||
}); | ||
// describe('7.6 client - tile', () => { | ||
// const emsClient = new EMSClient({ | ||
// appVersion: 'v7.6.0', | ||
// tileApiUrl: 'https://tiles.maps.elastic.co', | ||
// fileApiUrl: 'https://vector-staging.maps.elastic.co', | ||
// language: 'en', | ||
// emsVersion: 'v7.6', | ||
// }); | ||
it('expands url to relative host', async () => { | ||
const services = await emsClient.getTMSServices(); | ||
const service = services[0]; | ||
debugger; | ||
const defaultRaster = await service.getDefaultRasterStyle(); | ||
const urlTemplate = await service.getUrlTemplate(); | ||
const vectorStyleSheet = await service.getVectorStyleSheet(); | ||
const vectorStyleSheetRaw = await service.getVectorStyleSheetRaw(); | ||
const spriteSheetMeta = await service.getSpriteSheetMeta(); | ||
const spriteSheetJsonPath = await service.getSpriteSheetJsonPath(); | ||
const spriteSheetPngPath = await service.getSpriteSheetPngPath(); | ||
const displayName = service.getDisplayName(); | ||
const attributions = service.getAttributions(); | ||
const htmlAttribution = service.getHTMLAttribution(); | ||
const markdownAttribution = service.getMarkdownAttribution(); | ||
const minZoom = await service.getMinZoom(); | ||
const maxZoom = await service.getMaxZoom(); | ||
const id = service.getId(); | ||
const origin = service.getOrigin(); | ||
debugger; | ||
}); | ||
}); | ||
// it('expands url to relative host', async () => { | ||
// const services = await emsClient.getTMSServices(); | ||
// const service = services[0]; | ||
// debugger; | ||
// const defaultRaster = await service.getDefaultRasterStyle(); | ||
// const urlTemplate = await service.getUrlTemplate(); | ||
// const vectorStyleSheet = await service.getVectorStyleSheet(); | ||
// const vectorStyleSheetRaw = await service.getVectorStyleSheetRaw(); | ||
// const spriteSheetMeta = await service.getSpriteSheetMeta(); | ||
// const spriteSheetJsonPath = await service.getSpriteSheetJsonPath(); | ||
// const spriteSheetPngPath = await service.getSpriteSheetPngPath(); | ||
// const displayName = service.getDisplayName(); | ||
// const attributions = service.getAttributions(); | ||
// const htmlAttribution = service.getHTMLAttribution(); | ||
// const markdownAttribution = service.getMarkdownAttribution(); | ||
// const minZoom = await service.getMinZoom(); | ||
// const maxZoom = await service.getMaxZoom(); | ||
// const id = service.getId(); | ||
// const origin = service.getOrigin(); | ||
// debugger; | ||
// }); | ||
// }); | ||
// describe('7.6 client - tile', () => { | ||
// const emsClient = new EMSClient({ | ||
// kbnVersion: 'v7.6.0', | ||
// appVersion: 'v7.6.0', | ||
// tileApiUrl: '/api/maps/ems/tiles', | ||
@@ -182,0 +195,0 @@ // fileApiUrl: '/api/maps/ems/files', |
606364
45
21272
3