@elastic/ems-client 8.5.1 → 8.5.2
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/.buildkite/pipeline.yml +1 -1
- package/.husky/pre-commit +1 -0
- package/CHANGELOG.md +5 -0
- package/eslint.config.mjs +25 -0
- package/package.json +28 -28
- package/src/ems_client.ts +6 -2
- package/src/tms_service.ts +18 -12
- package/target/ems_client.d.ts +16 -16
- package/target/ems_client.js +318 -0
- package/target/ems_service.js +47 -0
- package/target/file_layer.d.ts +1 -1
- package/target/file_layer.js +176 -0
- package/target/index.js +16 -0
- package/target/node/ems_client.js +15 -11
- package/target/node/ems_service.js +8 -8
- package/target/node/file_layer.js +10 -10
- package/target/node/tms_service.js +43 -36
- package/target/node/utils.js +1 -1
- package/target/origin.d.ts +4 -0
- package/target/tms_service.d.ts +5 -5
- package/target/tms_service.js +409 -0
- package/target/utils.d.ts +3 -3
- package/target/utils.js +86 -0
- package/target/web/ems_client.js +26 -27
- package/target/web/ems_service.js +7 -8
- package/target/web/file_layer.js +20 -22
- package/target/web/tms_service.js +44 -49
- package/test/__snapshots__/ems_client.test.ts.snap +24 -24
- package/test/ems_client_util.ts +1 -1
- package/.eslintignore +0 -1
- package/.eslintrc +0 -18
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
6
|
+
* 2.0.
|
|
7
|
+
*/
|
|
8
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.TMSService = void 0;
|
|
22
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
23
|
+
const ems_service_1 = require("./ems_service");
|
|
24
|
+
const utils_1 = require("./utils");
|
|
25
|
+
class TMSService extends ems_service_1.AbstractEmsService {
|
|
26
|
+
constructor(config, emsClient, proxyPath) {
|
|
27
|
+
super(config, emsClient, proxyPath);
|
|
28
|
+
this._getRasterStyleJson = lodash_1.default.once(() => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const rasterUrl = this._getStyleUrlForLocale('raster');
|
|
30
|
+
if (rasterUrl) {
|
|
31
|
+
const url = this._proxyPath + this._getAbsoluteUrl(rasterUrl);
|
|
32
|
+
return this._emsClient.getManifest(this._emsClient.extendUrlWithParams(url));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
this._getVectorStyleJsonRaw = lodash_1.default.once(() => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const vectorUrl = this._getStyleUrlForLocale('vector');
|
|
40
|
+
if (vectorUrl) {
|
|
41
|
+
const url = this._proxyPath + this._getAbsoluteUrl(vectorUrl);
|
|
42
|
+
const vectorJson = yield this._emsClient.getManifest(this._emsClient.extendUrlWithParams(url));
|
|
43
|
+
return Object.assign({}, vectorJson);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
this._getVectorStyleJsonInlined = lodash_1.default.once(() => __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
51
|
+
const vectorJson = yield this._getVectorStyleJsonRaw();
|
|
52
|
+
if (vectorJson) {
|
|
53
|
+
const inlinedSources = {};
|
|
54
|
+
const { sources } = vectorJson;
|
|
55
|
+
for (const sourceName of Object.getOwnPropertyNames(sources)) {
|
|
56
|
+
const { url } = sources[sourceName];
|
|
57
|
+
if (url) {
|
|
58
|
+
const sourceUrl = this._proxyPath + this._getAbsoluteUrl(url);
|
|
59
|
+
const extendedUrl = this._emsClient.extendUrlWithParams(sourceUrl);
|
|
60
|
+
const sourceJson = yield this._emsClient.getManifest(extendedUrl);
|
|
61
|
+
const tiles = (_a = sourceJson === null || sourceJson === void 0 ? void 0 : sourceJson.tiles) === null || _a === void 0 ? void 0 : _a.map((tileUrl) => {
|
|
62
|
+
const directUrl = this._proxyPath + this._getAbsoluteUrl(tileUrl);
|
|
63
|
+
return this._emsClient.extendUrlWithParams(directUrl);
|
|
64
|
+
});
|
|
65
|
+
inlinedSources[sourceName] = Object.assign(Object.assign({}, sourceJson), { type: 'vector', tiles });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return Object.assign(Object.assign({}, vectorJson), { sources: inlinedSources, sprite: yield this._getSpriteSheetRootPath(), glyphs: yield this._getUrlTemplateForGlyphs() });
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
this._config = config;
|
|
75
|
+
}
|
|
76
|
+
/*
|
|
77
|
+
This method returns an array of objects with the layers and the new
|
|
78
|
+
layout['text-field'] to apply using map.setLayoutProperty
|
|
79
|
+
*/
|
|
80
|
+
static transformLanguageProperty(layer, lang) {
|
|
81
|
+
const supportedLang = this.SupportedLanguages.find((l) => l.key === lang);
|
|
82
|
+
if (layer.type === 'symbol' && layer.layout !== undefined && supportedLang !== undefined) {
|
|
83
|
+
const omtLang = supportedLang.omt;
|
|
84
|
+
const textField = layer.layout['text-field'];
|
|
85
|
+
if (textField && typeof textField === 'string') {
|
|
86
|
+
return TMSService._getTextField(textField, omtLang);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
/*
|
|
92
|
+
This method returns an array of objects per layer, containing a list of
|
|
93
|
+
properties with new colors to apply using map.setPaintProperty
|
|
94
|
+
*/
|
|
95
|
+
static transformColorProperties(layer, color, operation, percentage) {
|
|
96
|
+
if (['background', 'fill', 'line', 'symbol'].indexOf(layer.type) !== -1 && layer.paint) {
|
|
97
|
+
const paint = layer.paint;
|
|
98
|
+
if (layer.type === 'symbol' && Object.keys(paint).length === 0) {
|
|
99
|
+
paint['text-color'] = 'rgb(0,0,0)';
|
|
100
|
+
}
|
|
101
|
+
const types = Object.keys(paint).filter((key) => {
|
|
102
|
+
return ([
|
|
103
|
+
'background-color',
|
|
104
|
+
'circle-color',
|
|
105
|
+
'circle-stroke-color',
|
|
106
|
+
'fill-color',
|
|
107
|
+
'fill-extrusion-color',
|
|
108
|
+
'fill-outline-color',
|
|
109
|
+
'icon-color',
|
|
110
|
+
'icon-halo-color',
|
|
111
|
+
'line-color',
|
|
112
|
+
'text-color',
|
|
113
|
+
'text-halo-color',
|
|
114
|
+
].indexOf(key) !== -1);
|
|
115
|
+
});
|
|
116
|
+
return types.map((type) => {
|
|
117
|
+
const paintColor = paint[type];
|
|
118
|
+
return {
|
|
119
|
+
property: type,
|
|
120
|
+
color: paintColor && color
|
|
121
|
+
? (0, utils_1.colorizeColor)(paintColor, color, operation, percentage)
|
|
122
|
+
: paintColor,
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
static _getTextField(label, lang) {
|
|
131
|
+
// Capture {name:xx} labels
|
|
132
|
+
const labelMatch = label.match(/\{name([:_])(.{2})\}/);
|
|
133
|
+
if (labelMatch && labelMatch[1] != lang) {
|
|
134
|
+
// Only apply if the languages are different
|
|
135
|
+
return ['coalesce', ['get', `name:${lang}`], ['get', `name${labelMatch[1]}${labelMatch[2]}`]];
|
|
136
|
+
}
|
|
137
|
+
else if (label.includes('latin') && label.includes('nonlatin')) {
|
|
138
|
+
// Capture the common pattern {name:latin}\n{name:nonlatin}
|
|
139
|
+
return [
|
|
140
|
+
'coalesce',
|
|
141
|
+
['get', `name:${lang}`],
|
|
142
|
+
['concat', ['get', 'name:latin'], '\n', ['get', 'name:nonlatin']],
|
|
143
|
+
];
|
|
144
|
+
}
|
|
145
|
+
// If no case is found, return the input label
|
|
146
|
+
return label;
|
|
147
|
+
}
|
|
148
|
+
getDefaultRasterStyle() {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
const tileJson = yield this._getRasterStyleJson();
|
|
151
|
+
if (tileJson) {
|
|
152
|
+
const tiles = tileJson.tiles.map((tile) => this._proxyPath + this._getAbsoluteUrl(tile));
|
|
153
|
+
return Object.assign(Object.assign({}, tileJson), { tiles });
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
getUrlTemplate() {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
const tileJson = yield this._getRasterStyleJson();
|
|
163
|
+
if (tileJson) {
|
|
164
|
+
const directUrl = this._proxyPath + this._getAbsoluteUrl(tileJson.tiles[0]);
|
|
165
|
+
return this._emsClient.extendUrlWithParams(directUrl);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
return '';
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
getUrlTemplateForVector(sourceId) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
+
var _a, _b;
|
|
175
|
+
const tileJson = yield this._getVectorStyleJsonInlined();
|
|
176
|
+
const url = (_b = (_a = tileJson === null || tileJson === void 0 ? void 0 : tileJson.sources[sourceId]) === null || _a === void 0 ? void 0 : _a.tiles) === null || _b === void 0 ? void 0 : _b.pop();
|
|
177
|
+
if (url) {
|
|
178
|
+
const directUrl = this._proxyPath + this._getAbsoluteUrl(url);
|
|
179
|
+
return this._emsClient.extendUrlWithParams(directUrl);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
return '';
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
getVectorStyleSheet() {
|
|
187
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
+
return yield this._getVectorStyleJsonInlined();
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
getVectorStyleSheetRaw() {
|
|
192
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
return yield this._getVectorStyleJsonRaw();
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
getSpriteSheetMeta() {
|
|
197
|
+
return __awaiter(this, arguments, void 0, function* (isRetina = false) {
|
|
198
|
+
const metaUrl = yield this.getSpriteSheetJsonPath(isRetina);
|
|
199
|
+
const spritePngs = yield this.getSpriteSheetPngPath(isRetina);
|
|
200
|
+
if (metaUrl && spritePngs) {
|
|
201
|
+
const metaUrlExtended = this._emsClient.extendUrlWithParams(metaUrl);
|
|
202
|
+
const jsonMeta = yield this._emsClient.getManifest(metaUrlExtended);
|
|
203
|
+
return {
|
|
204
|
+
png: spritePngs,
|
|
205
|
+
json: jsonMeta,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
getSpriteSheetJsonPath() {
|
|
214
|
+
return __awaiter(this, arguments, void 0, function* (isRetina = false) {
|
|
215
|
+
const spriteSheetRootPath = yield this._getSpriteSheetRootPath();
|
|
216
|
+
if (spriteSheetRootPath) {
|
|
217
|
+
const suffix = isRetina ? '@2x' : '';
|
|
218
|
+
return spriteSheetRootPath + suffix + '.json';
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
return '';
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
getSpriteSheetPngPath() {
|
|
226
|
+
return __awaiter(this, arguments, void 0, function* (isRetina = false) {
|
|
227
|
+
const spriteSheetRootPath = yield this._getSpriteSheetRootPath();
|
|
228
|
+
if (spriteSheetRootPath) {
|
|
229
|
+
const suffix = isRetina ? '@2x' : '';
|
|
230
|
+
return spriteSheetRootPath + suffix + '.png';
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
return '';
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
getDisplayName() {
|
|
238
|
+
return this._emsClient.getValueInLanguage(this._config.name);
|
|
239
|
+
}
|
|
240
|
+
getMinZoom() {
|
|
241
|
+
return __awaiter(this, arguments, void 0, function* (format = 'vector') {
|
|
242
|
+
switch (format) {
|
|
243
|
+
case 'vector': {
|
|
244
|
+
const { sources } = (yield this._getVectorStyleJsonInlined()) || { sources: {} };
|
|
245
|
+
return Math.min(...Object.values(sources)
|
|
246
|
+
.map((s) => {
|
|
247
|
+
return s && s instanceof Object && 'minzoom' in s ?
|
|
248
|
+
s['minzoom'] :
|
|
249
|
+
null;
|
|
250
|
+
})
|
|
251
|
+
.filter((minzoom) => Number.isFinite(minzoom)));
|
|
252
|
+
}
|
|
253
|
+
case 'raster': {
|
|
254
|
+
const { minzoom } = (yield this._getRasterStyleJson()) || {};
|
|
255
|
+
return minzoom;
|
|
256
|
+
}
|
|
257
|
+
default:
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
getMaxZoom() {
|
|
263
|
+
return __awaiter(this, arguments, void 0, function* (format = 'vector') {
|
|
264
|
+
switch (format) {
|
|
265
|
+
case 'vector': {
|
|
266
|
+
const { sources } = (yield this._getVectorStyleJsonInlined()) || { sources: {} };
|
|
267
|
+
return Math.max(...Object.values(sources)
|
|
268
|
+
.map((s) => {
|
|
269
|
+
return s && s instanceof Object && 'maxzoom' in s ?
|
|
270
|
+
s['maxzoom'] :
|
|
271
|
+
null;
|
|
272
|
+
})
|
|
273
|
+
.filter((maxzoom) => Number.isFinite(maxzoom)));
|
|
274
|
+
}
|
|
275
|
+
case 'raster': {
|
|
276
|
+
const { maxzoom } = (yield this._getRasterStyleJson()) || {};
|
|
277
|
+
return maxzoom;
|
|
278
|
+
}
|
|
279
|
+
default:
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
getId() {
|
|
285
|
+
return this._config.id;
|
|
286
|
+
}
|
|
287
|
+
hasId(id) {
|
|
288
|
+
return this._config.id === id;
|
|
289
|
+
}
|
|
290
|
+
getApiUrl() {
|
|
291
|
+
return this._emsClient.getTileApiUrl();
|
|
292
|
+
}
|
|
293
|
+
_getStyleUrlForLocale(formatType) {
|
|
294
|
+
let vectorFormats = this._getFormats(formatType, this._emsClient.getLocale());
|
|
295
|
+
if (!vectorFormats.length) {
|
|
296
|
+
//fallback to default locale
|
|
297
|
+
vectorFormats = this._getFormats(formatType, this._emsClient.getDefaultLocale());
|
|
298
|
+
}
|
|
299
|
+
if (!vectorFormats.length) {
|
|
300
|
+
throw new Error(`Cannot find ${formatType} tile layer for locale ${this._emsClient.getLocale()} or ${this._emsClient.getDefaultLocale()}`);
|
|
301
|
+
}
|
|
302
|
+
const defaultStyle = vectorFormats[0];
|
|
303
|
+
if (defaultStyle && Object.prototype.hasOwnProperty.call(defaultStyle, 'url')) {
|
|
304
|
+
return defaultStyle.url;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
_getFormats(formatType, locale) {
|
|
308
|
+
return this._config.formats.filter((format) => format.locale === locale && format.format === formatType);
|
|
309
|
+
}
|
|
310
|
+
_getSpriteSheetRootPath() {
|
|
311
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
312
|
+
const vectorStyleJson = yield this._getVectorStyleJsonRaw();
|
|
313
|
+
if (vectorStyleJson === null || vectorStyleJson === void 0 ? void 0 : vectorStyleJson.sprite) {
|
|
314
|
+
return this._proxyPath + this._getAbsoluteUrl(vectorStyleJson.sprite);
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
return '';
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
_getUrlTemplateForGlyphs() {
|
|
322
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
323
|
+
const vectorStyleJson = yield this._getVectorStyleJsonRaw();
|
|
324
|
+
if (vectorStyleJson === null || vectorStyleJson === void 0 ? void 0 : vectorStyleJson.glyphs) {
|
|
325
|
+
return this._proxyPath + this._getAbsoluteUrl(vectorStyleJson.glyphs);
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
return '';
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
exports.TMSService = TMSService;
|
|
334
|
+
/*
|
|
335
|
+
List of supported languages with labels and OMT codes extracted
|
|
336
|
+
from https://openmaptiles.org/languages
|
|
337
|
+
|
|
338
|
+
Keys are values for i18.locale from Kibana settings
|
|
339
|
+
and OMT codes for the rest.
|
|
340
|
+
*/
|
|
341
|
+
TMSService.SupportedLanguages = [
|
|
342
|
+
{ key: 'ar', omt: 'ar' },
|
|
343
|
+
{ key: 'az', omt: 'az' },
|
|
344
|
+
{ key: 'be', omt: 'be' },
|
|
345
|
+
{ key: 'bg', omt: 'bg' },
|
|
346
|
+
{ key: 'br', omt: 'br' },
|
|
347
|
+
{ key: 'bs', omt: 'bs' },
|
|
348
|
+
{ key: 'ca', omt: 'ca' },
|
|
349
|
+
{ key: 'cs', omt: 'cs' },
|
|
350
|
+
{ key: 'cy', omt: 'cy' },
|
|
351
|
+
{ key: 'da', omt: 'da' },
|
|
352
|
+
{ key: 'de', omt: 'de' },
|
|
353
|
+
{ key: 'el', omt: 'el' },
|
|
354
|
+
{ key: 'en', omt: 'en' },
|
|
355
|
+
{ key: 'eo', omt: 'eo' },
|
|
356
|
+
{ key: 'es', omt: 'es' },
|
|
357
|
+
{ key: 'et', omt: 'et' },
|
|
358
|
+
{ key: 'fi', omt: 'fi' },
|
|
359
|
+
{ key: 'fr-fr', omt: 'fr' },
|
|
360
|
+
{ key: 'fy', omt: 'fy' },
|
|
361
|
+
{ key: 'ga', omt: 'ga' },
|
|
362
|
+
{ key: 'gd', omt: 'gd' },
|
|
363
|
+
{ key: 'he', omt: 'he' },
|
|
364
|
+
{ key: 'hi-in', omt: 'hi' },
|
|
365
|
+
{ key: 'hr', omt: 'hr' },
|
|
366
|
+
{ key: 'hu', omt: 'hu' },
|
|
367
|
+
{ key: 'hy', omt: 'hy' },
|
|
368
|
+
{ key: 'is', omt: 'is' },
|
|
369
|
+
{ key: 'it', omt: 'it' },
|
|
370
|
+
{ key: 'ja_kana', omt: 'ja_kana' },
|
|
371
|
+
{ key: 'ja_rm', omt: 'ja_rm' },
|
|
372
|
+
{ key: 'ja-jp', omt: 'ja' },
|
|
373
|
+
{ key: 'ka', omt: 'ka' },
|
|
374
|
+
{ key: 'kk', omt: 'kk' },
|
|
375
|
+
{ key: 'kn', omt: 'kn' },
|
|
376
|
+
{ key: 'ko_rm', omt: 'ko_rm' },
|
|
377
|
+
{ key: 'ko', omt: 'ko' },
|
|
378
|
+
{ key: 'la', omt: 'la' },
|
|
379
|
+
{ key: 'lb', omt: 'lb' },
|
|
380
|
+
{ key: 'lt', omt: 'lt' },
|
|
381
|
+
{ key: 'lv', omt: 'lv' },
|
|
382
|
+
{ key: 'mk', omt: 'mk' },
|
|
383
|
+
{ key: 'mt', omt: 'mt' },
|
|
384
|
+
{ key: 'nl', omt: 'nl' },
|
|
385
|
+
{ key: 'no', omt: 'no' },
|
|
386
|
+
{ key: 'pl', omt: 'pl' },
|
|
387
|
+
{ key: 'pt-pt', omt: 'pt' },
|
|
388
|
+
{ key: 'rm', omt: 'rm' },
|
|
389
|
+
{ key: 'ro', omt: 'ro' },
|
|
390
|
+
{ key: 'ru-ru', omt: 'ru' },
|
|
391
|
+
{ key: 'sk', omt: 'sk' },
|
|
392
|
+
{ key: 'sl', omt: 'sl' },
|
|
393
|
+
{ key: 'sq', omt: 'sq' },
|
|
394
|
+
{ key: 'sr-Ltn', omt: 'sr-Ltn' },
|
|
395
|
+
{ key: 'sr', omt: 'sr' },
|
|
396
|
+
{ key: 'sv', omt: 'sv' },
|
|
397
|
+
{ key: 'th', omt: 'th' },
|
|
398
|
+
{ key: 'tr', omt: 'tr' },
|
|
399
|
+
{ key: 'uk', omt: 'uk' },
|
|
400
|
+
{ key: 'zh-cn', omt: 'zh' },
|
|
401
|
+
];
|
|
402
|
+
/*
|
|
403
|
+
Suggested default operations for the different EMS styles
|
|
404
|
+
*/
|
|
405
|
+
TMSService.colorOperationDefaults = [
|
|
406
|
+
{ style: 'road_map', operation: 'mix', percentage: 0.25 },
|
|
407
|
+
{ style: 'road_map_desaturated', operation: 'screen', percentage: 0.25 },
|
|
408
|
+
{ style: 'dark_map', operation: 'dodge', percentage: 0.25 },
|
|
409
|
+
];
|
package/target/utils.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { ColorSpecification, DataDrivenPropertyValueSpecification, PropertyValue
|
|
|
6
6
|
* It also handles trailing slashes in tileApiUrl and fileApiUrl parameters.
|
|
7
7
|
*/
|
|
8
8
|
export declare function toAbsoluteUrl(host: string | undefined, path: string): string;
|
|
9
|
-
export
|
|
10
|
-
export
|
|
9
|
+
export type mbColorDefinition = PropertyValueSpecification<ColorSpecification> | DataDrivenPropertyValueSpecification<ColorSpecification>;
|
|
10
|
+
export type layerPaintProperty = {
|
|
11
11
|
'background-color'?: PropertyValueSpecification<ColorSpecification>;
|
|
12
12
|
'circle-color'?: DataDrivenPropertyValueSpecification<ColorSpecification>;
|
|
13
13
|
'circle-stroke-color'?: DataDrivenPropertyValueSpecification<ColorSpecification>;
|
|
@@ -20,6 +20,6 @@ export declare type layerPaintProperty = {
|
|
|
20
20
|
'text-color'?: DataDrivenPropertyValueSpecification<ColorSpecification>;
|
|
21
21
|
'text-halo-color'?: DataDrivenPropertyValueSpecification<ColorSpecification>;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type blendMode = Parameters<ChromaStatic['blend']>[2] | 'mix';
|
|
24
24
|
export declare function desaturateColor(paintColor: mbColorDefinition): mbColorDefinition;
|
|
25
25
|
export declare function colorizeColor(sourceColor: mbColorDefinition, destColor: string, operation?: blendMode, percentage?: number): mbColorDefinition;
|
package/target/utils.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
6
|
+
* 2.0.
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.colorizeColor = exports.desaturateColor = exports.toAbsoluteUrl = void 0;
|
|
13
|
+
const chroma_js_1 = __importDefault(require("chroma-js"));
|
|
14
|
+
/**
|
|
15
|
+
* Resolves a target URL path relative to the host.
|
|
16
|
+
* This is specifically useed by the Kibana proxy re-routing.
|
|
17
|
+
* It also handles trailing slashes in tileApiUrl and fileApiUrl parameters.
|
|
18
|
+
*/
|
|
19
|
+
function toAbsoluteUrl(host, path) {
|
|
20
|
+
if (!host) {
|
|
21
|
+
return path;
|
|
22
|
+
}
|
|
23
|
+
const hostEndWithSlash = host[host.length - 1] === '/';
|
|
24
|
+
const pathStartsWithSlash = path[0] === '/';
|
|
25
|
+
if (hostEndWithSlash === true && pathStartsWithSlash === true) {
|
|
26
|
+
return host + path.slice(1);
|
|
27
|
+
}
|
|
28
|
+
else if (hostEndWithSlash !== pathStartsWithSlash) {
|
|
29
|
+
return host + path;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return host + '/' + path;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.toAbsoluteUrl = toAbsoluteUrl;
|
|
36
|
+
/*
|
|
37
|
+
Function to transform a maplibre color definition by a given function.
|
|
38
|
+
*/
|
|
39
|
+
function transformColor(paintColor, func) {
|
|
40
|
+
if (typeof paintColor == 'string') {
|
|
41
|
+
const modifiedColor = func(paintColor);
|
|
42
|
+
return `rgba(${modifiedColor.rgba().join(',')})`;
|
|
43
|
+
}
|
|
44
|
+
else if (typeof paintColor == 'object' &&
|
|
45
|
+
'stops' in paintColor &&
|
|
46
|
+
Array.isArray(paintColor === null || paintColor === void 0 ? void 0 : paintColor.stops)) {
|
|
47
|
+
const stops = paintColor['stops'].map((stop) => {
|
|
48
|
+
const newColor = transformColor(stop[1], func);
|
|
49
|
+
return [stop[0], newColor];
|
|
50
|
+
});
|
|
51
|
+
const newPaintColor = Object.assign({}, paintColor, { stops });
|
|
52
|
+
return newPaintColor;
|
|
53
|
+
}
|
|
54
|
+
else
|
|
55
|
+
return paintColor;
|
|
56
|
+
}
|
|
57
|
+
/*
|
|
58
|
+
This is the function used to generate the current EMS desaturated roadmap
|
|
59
|
+
*/
|
|
60
|
+
function desaturateColor(paintColor) {
|
|
61
|
+
return transformColor(paintColor, (color) => {
|
|
62
|
+
return (0, chroma_js_1.default)(color).desaturate(1.1).brighten(0.33);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
exports.desaturateColor = desaturateColor;
|
|
66
|
+
/*
|
|
67
|
+
Blends an original maplibre color definition with a destination
|
|
68
|
+
color. Accepts different blending modes and an additional `mix`
|
|
69
|
+
option that needs a percentage.
|
|
70
|
+
|
|
71
|
+
More details:
|
|
72
|
+
|
|
73
|
+
https://gka.github.io/chroma.js/#chroma-blend
|
|
74
|
+
https://gka.github.io/chroma.js/#chroma-mix
|
|
75
|
+
*/
|
|
76
|
+
function colorizeColor(sourceColor, destColor, operation = 'screen', percentage = 0.5) {
|
|
77
|
+
return transformColor(sourceColor, (color) => {
|
|
78
|
+
if (operation !== 'mix') {
|
|
79
|
+
return chroma_js_1.default.blend((0, chroma_js_1.default)(color), destColor, operation);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return chroma_js_1.default.mix((0, chroma_js_1.default)(color), destColor, percentage);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
exports.colorizeColor = colorizeColor;
|
package/target/web/ems_client.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw
|
|
3
|
-
function asyncGeneratorStep(
|
|
4
|
-
function _asyncToGenerator(
|
|
5
|
-
function _classCallCheck(
|
|
6
|
-
function _defineProperties(
|
|
7
|
-
function _createClass(
|
|
8
|
-
function _defineProperty(
|
|
9
|
-
function _toPropertyKey(
|
|
10
|
-
function _toPrimitive(
|
|
2
|
+
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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
4
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
5
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
6
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
11
|
/*
|
|
12
12
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
13
13
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -139,7 +139,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
139
139
|
});
|
|
140
140
|
this._invalidateSettings();
|
|
141
141
|
}
|
|
142
|
-
_createClass(EMSClient, [{
|
|
142
|
+
return _createClass(EMSClient, [{
|
|
143
143
|
key: "getDefaultLocale",
|
|
144
144
|
value: function getDefaultLocale() {
|
|
145
145
|
return DEFAULT_LANGUAGE;
|
|
@@ -163,7 +163,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
163
163
|
*/
|
|
164
164
|
}, {
|
|
165
165
|
key: "getManifest",
|
|
166
|
-
value: function () {
|
|
166
|
+
value: (function () {
|
|
167
167
|
var _getManifest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(endpointUrl) {
|
|
168
168
|
var url, response;
|
|
169
169
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -190,28 +190,27 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
190
190
|
_context.next = 10;
|
|
191
191
|
return response.json();
|
|
192
192
|
case 10:
|
|
193
|
-
_context.
|
|
194
|
-
_context.next = 14;
|
|
195
|
-
break;
|
|
193
|
+
return _context.abrupt("return", _context.sent);
|
|
196
194
|
case 13:
|
|
197
|
-
|
|
195
|
+
throw new Error('Response not found');
|
|
198
196
|
case 14:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
_context.
|
|
203
|
-
|
|
204
|
-
|
|
197
|
+
_context.next = 23;
|
|
198
|
+
break;
|
|
199
|
+
case 16:
|
|
200
|
+
_context.prev = 16;
|
|
201
|
+
_context.t0 = _context["catch"](0);
|
|
202
|
+
if (!(_context.t0 instanceof Error)) {
|
|
203
|
+
_context.next = 22;
|
|
205
204
|
break;
|
|
206
205
|
}
|
|
207
|
-
throw _context.
|
|
208
|
-
case
|
|
206
|
+
throw _context.t0;
|
|
207
|
+
case 22:
|
|
209
208
|
throw new Error('Unknown error');
|
|
210
|
-
case
|
|
209
|
+
case 23:
|
|
211
210
|
case "end":
|
|
212
211
|
return _context.stop();
|
|
213
212
|
}
|
|
214
|
-
}, _callee, this, [[0,
|
|
213
|
+
}, _callee, this, [[0, 16]]);
|
|
215
214
|
}));
|
|
216
215
|
function getManifest(_x) {
|
|
217
216
|
return _getManifest.apply(this, arguments);
|
|
@@ -223,11 +222,12 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
223
222
|
*
|
|
224
223
|
* @param additionalQueryParams
|
|
225
224
|
*/
|
|
225
|
+
)
|
|
226
226
|
}, {
|
|
227
227
|
key: "addQueryParams",
|
|
228
228
|
value: function addQueryParams(additionalQueryParams) {
|
|
229
229
|
for (var _key in additionalQueryParams) {
|
|
230
|
-
if (
|
|
230
|
+
if (Object.prototype.hasOwnProperty.call(additionalQueryParams, _key)) {
|
|
231
231
|
if (additionalQueryParams[_key] !== this._queryParams[_key]) {
|
|
232
232
|
//changes detected.
|
|
233
233
|
this._queryParams = _.assign({}, this._queryParams, additionalQueryParams);
|
|
@@ -632,5 +632,4 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
632
632
|
})));
|
|
633
633
|
}
|
|
634
634
|
}]);
|
|
635
|
-
return EMSClient;
|
|
636
635
|
}();
|