@elastic/ems-client
Advanced tools
Comparing version 7.7.1 to 7.7.2
{ | ||
"name": "@elastic/ems-client", | ||
"version": "7.7.1", | ||
"version": "7.7.2", | ||
"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'; | ||
@@ -236,3 +237,3 @@ const DEFAULT_EMS_VERSION = '7.7'; | ||
type: 'tms', | ||
manifest: `${this._tileApiUrl}/${this._emsVersion}/manifest`, | ||
manifest: toAbsoluteUrl(this._tileApiUrl,`${this._emsVersion}/manifest`), | ||
}); | ||
@@ -243,3 +244,3 @@ } | ||
type: 'file', | ||
manifest: `${this._fileApiUrl}/${this._emsVersion}/manifest`, | ||
manifest: toAbsoluteUrl(this._fileApiUrl,`${this._emsVersion}/manifest`), | ||
}); | ||
@@ -246,0 +247,0 @@ } |
@@ -20,2 +20,4 @@ "use strict"; | ||
var _utils = require("./utils"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -232,3 +234,3 @@ | ||
type: 'tms', | ||
manifest: `${this._tileApiUrl}/${this._emsVersion}/manifest` | ||
manifest: (0, _utils.toAbsoluteUrl)(this._tileApiUrl, `${this._emsVersion}/manifest`) | ||
}); | ||
@@ -240,3 +242,3 @@ } | ||
type: 'file', | ||
manifest: `${this._fileApiUrl}/${this._emsVersion}/manifest` | ||
manifest: (0, _utils.toAbsoluteUrl)(this._fileApiUrl, `${this._emsVersion}/manifest`) | ||
}); | ||
@@ -243,0 +245,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.7'; | ||
@@ -350,3 +351,3 @@ | ||
type: 'tms', | ||
manifest: "".concat(_this2._tileApiUrl, "/").concat(_this2._emsVersion, "/manifest") | ||
manifest: toAbsoluteUrl(_this2._tileApiUrl, "".concat(_this2._emsVersion, "/manifest")) | ||
}); | ||
@@ -358,3 +359,3 @@ } | ||
type: 'file', | ||
manifest: "".concat(_this2._fileApiUrl, "/").concat(_this2._emsVersion, "/manifest") | ||
manifest: toAbsoluteUrl(_this2._fileApiUrl, "".concat(_this2._emsVersion, "/manifest")) | ||
}); | ||
@@ -361,0 +362,0 @@ } |
@@ -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({ | ||
// appVersion: '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() => { | ||
@@ -138,33 +151,33 @@ // const layers = await emsClient.getFileLayers(); | ||
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', | ||
}); | ||
// 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; | ||
// }); | ||
// }); | ||
@@ -171,0 +184,0 @@ // describe('7.6 client - tile', () => { |
607941
21299
3