@elastic/ems-client 8.3.3 → 8.5.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.
- package/.backportrc.json +5 -17
- package/.buildkite/build.sh +16 -0
- package/.buildkite/pipeline.yml +6 -0
- package/.buildkite/pull-requests.json +30 -0
- package/.nvmrc +1 -0
- package/CHANGELOG.md +13 -0
- package/CONTRIBUTING.md +18 -0
- package/catalog-info.yaml +68 -0
- package/package.json +7 -4
- package/src/ems_client.ts +33 -33
- package/src/index.ts +1 -1
- package/src/tms_service.ts +5 -1
- package/target/ems_client.d.ts +2 -2
- package/target/index.d.ts +1 -1
- package/target/node/ems_client.js +55 -125
- package/target/node/ems_service.js +11 -21
- package/target/node/file_layer.js +16 -60
- package/target/node/index.js +6 -4
- package/target/node/tms_service.js +33 -99
- package/target/node/utils.js +8 -10
- package/target/origin.d.ts +4 -0
- package/target/tms_service.d.ts +1 -1
- package/target/web/ems_client.js +295 -462
- package/target/web/ems_service.js +10 -26
- package/target/web/file_layer.js +62 -117
- package/target/web/index.js +2 -1
- package/target/web/tms_service.js +447 -650
- package/target/web/utils.js +10 -8
- package/test/ems_client.test.ts +33 -0
- package/.ci/jobs/defaults.yml +0 -67
- package/.ci/jobs/elastic+ems-client+master.yml +0 -18
- package/.ci/jobs/elastic+ems-client+pull-request.yml +0 -19
package/target/node/utils.js
CHANGED
|
@@ -6,11 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.colorizeColor = colorizeColor;
|
|
7
7
|
exports.desaturateColor = desaturateColor;
|
|
8
8
|
exports.toAbsoluteUrl = toAbsoluteUrl;
|
|
9
|
-
|
|
10
9
|
var _chromaJs = _interopRequireDefault(require("chroma-js"));
|
|
11
|
-
|
|
12
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
11
|
/*
|
|
15
12
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
16
13
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -27,10 +24,8 @@ function toAbsoluteUrl(host, path) {
|
|
|
27
24
|
if (!host) {
|
|
28
25
|
return path;
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
const hostEndWithSlash = host[host.length - 1] === '/';
|
|
32
28
|
const pathStartsWithSlash = path[0] === '/';
|
|
33
|
-
|
|
34
29
|
if (hostEndWithSlash === true && pathStartsWithSlash === true) {
|
|
35
30
|
return host + path.slice(1);
|
|
36
31
|
} else if (hostEndWithSlash !== pathStartsWithSlash) {
|
|
@@ -39,10 +34,15 @@ function toAbsoluteUrl(host, path) {
|
|
|
39
34
|
return host + '/' + path;
|
|
40
35
|
}
|
|
41
36
|
}
|
|
37
|
+
|
|
42
38
|
/*
|
|
43
39
|
Type with the possible ways to define a color in maplibre
|
|
44
40
|
*/
|
|
45
41
|
|
|
42
|
+
/*
|
|
43
|
+
A selection of the different maplibre-gl-js properties that refer to a color.
|
|
44
|
+
Taken from maplibre https://github.com/maplibre/maplibre-gl-js/blob/main/src/style-spec/types.g.ts
|
|
45
|
+
*/
|
|
46
46
|
|
|
47
47
|
/*
|
|
48
48
|
Function to transform a maplibre color definition by a given function.
|
|
@@ -51,7 +51,7 @@ function transformColor(paintColor, func) {
|
|
|
51
51
|
if (typeof paintColor == 'string') {
|
|
52
52
|
const modifiedColor = func(paintColor);
|
|
53
53
|
return `rgba(${modifiedColor.rgba().join(',')})`;
|
|
54
|
-
} else if (typeof paintColor == 'object' && 'stops' in paintColor && Array.isArray(paintColor
|
|
54
|
+
} else if (typeof paintColor == 'object' && 'stops' in paintColor && Array.isArray(paintColor?.stops)) {
|
|
55
55
|
const stops = paintColor['stops'].map(stop => {
|
|
56
56
|
const newColor = transformColor(stop[1], func);
|
|
57
57
|
return [stop[0], newColor];
|
|
@@ -62,16 +62,16 @@ function transformColor(paintColor, func) {
|
|
|
62
62
|
return newPaintColor;
|
|
63
63
|
} else return paintColor;
|
|
64
64
|
}
|
|
65
|
+
|
|
65
66
|
/*
|
|
66
67
|
This is the function used to generate the current EMS desaturated roadmap
|
|
67
68
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
69
|
function desaturateColor(paintColor) {
|
|
71
70
|
return transformColor(paintColor, color => {
|
|
72
71
|
return (0, _chromaJs.default)(color).desaturate(1.1).brighten(0.33);
|
|
73
72
|
});
|
|
74
73
|
}
|
|
74
|
+
|
|
75
75
|
/*
|
|
76
76
|
Blends an original maplibre color definition with a destination
|
|
77
77
|
color. Accepts different blending modes and an additional `mix`
|
|
@@ -82,8 +82,6 @@ More details:
|
|
|
82
82
|
https://gka.github.io/chroma.js/#chroma-blend
|
|
83
83
|
https://gka.github.io/chroma.js/#chroma-mix
|
|
84
84
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
85
|
function colorizeColor(sourceColor, destColor, operation = 'screen', percentage = 0.5) {
|
|
88
86
|
return transformColor(sourceColor, color => {
|
|
89
87
|
if (operation !== 'mix') {
|
package/target/tms_service.d.ts
CHANGED