@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/web/utils.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
2
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
2
|
/*
|
|
4
3
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
4
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
6
5
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
7
6
|
* 2.0.
|
|
8
7
|
*/
|
|
9
|
-
import chroma from 'chroma-js';
|
|
10
8
|
|
|
9
|
+
import chroma from 'chroma-js';
|
|
11
10
|
/**
|
|
12
11
|
* Resolves a target URL path relative to the host.
|
|
13
12
|
* This is specifically useed by the Kibana proxy re-routing.
|
|
@@ -17,10 +16,8 @@ export function toAbsoluteUrl(host, path) {
|
|
|
17
16
|
if (!host) {
|
|
18
17
|
return path;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
var hostEndWithSlash = host[host.length - 1] === '/';
|
|
22
20
|
var pathStartsWithSlash = path[0] === '/';
|
|
23
|
-
|
|
24
21
|
if (hostEndWithSlash === true && pathStartsWithSlash === true) {
|
|
25
22
|
return host + path.slice(1);
|
|
26
23
|
} else if (hostEndWithSlash !== pathStartsWithSlash) {
|
|
@@ -29,10 +26,16 @@ export function toAbsoluteUrl(host, path) {
|
|
|
29
26
|
return host + '/' + path;
|
|
30
27
|
}
|
|
31
28
|
}
|
|
29
|
+
|
|
32
30
|
/*
|
|
33
31
|
Type with the possible ways to define a color in maplibre
|
|
34
32
|
*/
|
|
35
33
|
|
|
34
|
+
/*
|
|
35
|
+
A selection of the different maplibre-gl-js properties that refer to a color.
|
|
36
|
+
Taken from maplibre https://github.com/maplibre/maplibre-gl-js/blob/main/src/style-spec/types.g.ts
|
|
37
|
+
*/
|
|
38
|
+
|
|
36
39
|
/*
|
|
37
40
|
Function to transform a maplibre color definition by a given function.
|
|
38
41
|
*/
|
|
@@ -51,16 +54,16 @@ function transformColor(paintColor, func) {
|
|
|
51
54
|
return newPaintColor;
|
|
52
55
|
} else return paintColor;
|
|
53
56
|
}
|
|
57
|
+
|
|
54
58
|
/*
|
|
55
59
|
This is the function used to generate the current EMS desaturated roadmap
|
|
56
60
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
61
|
export function desaturateColor(paintColor) {
|
|
60
62
|
return transformColor(paintColor, function (color) {
|
|
61
63
|
return chroma(color).desaturate(1.1).brighten(0.33);
|
|
62
64
|
});
|
|
63
65
|
}
|
|
66
|
+
|
|
64
67
|
/*
|
|
65
68
|
Blends an original maplibre color definition with a destination
|
|
66
69
|
color. Accepts different blending modes and an additional `mix`
|
|
@@ -71,7 +74,6 @@ More details:
|
|
|
71
74
|
https://gka.github.io/chroma.js/#chroma-blend
|
|
72
75
|
https://gka.github.io/chroma.js/#chroma-mix
|
|
73
76
|
*/
|
|
74
|
-
|
|
75
77
|
export function colorizeColor(sourceColor, destColor) {
|
|
76
78
|
var operation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'screen';
|
|
77
79
|
var percentage = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0.5;
|
package/test/ems_client.test.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { getEMSClient } from './ems_client_util';
|
|
9
9
|
import { FileLayer } from '../src/file_layer';
|
|
10
|
+
import { LATEST_API_URL_PATH } from '../src/ems_client';
|
|
10
11
|
|
|
11
12
|
it('should get api manifests', async () => {
|
|
12
13
|
const { emsClient, getManifestMock } = getEMSClient({
|
|
@@ -466,3 +467,35 @@ it('should retrieve vectorstylesheet with all sources inlined) (proxy)', async (
|
|
|
466
467
|
);
|
|
467
468
|
expect(styleSheet!.sources!.openmaptiles!.type).toBe('vector');
|
|
468
469
|
});
|
|
470
|
+
|
|
471
|
+
it('should use LATEST_API_URL_PATH for date based versions (serverless)', async () => {
|
|
472
|
+
const version = '2023-01-01';
|
|
473
|
+
const { emsClient } = getEMSClient({
|
|
474
|
+
appVersion: version,
|
|
475
|
+
emsVersion: version,
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
const { services } = await emsClient.getMainManifest();
|
|
479
|
+
|
|
480
|
+
expect(services.length).toBeGreaterThan(0);
|
|
481
|
+
|
|
482
|
+
['tms', 'file'].map((type) => {
|
|
483
|
+
const service = services.find((s) => s.type === type);
|
|
484
|
+
const manifestUrl = service?.manifest;
|
|
485
|
+
|
|
486
|
+
expect(manifestUrl).toBeDefined();
|
|
487
|
+
expect(manifestUrl?.match(LATEST_API_URL_PATH)).toBeTruthy();
|
|
488
|
+
});
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
it('should fail for non SemVer or Date based versions (serverless)', async () => {
|
|
492
|
+
const version = 'foo';
|
|
493
|
+
const t = () => {
|
|
494
|
+
getEMSClient({
|
|
495
|
+
appVersion: version,
|
|
496
|
+
emsVersion: version,
|
|
497
|
+
});
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
expect(t).toThrow(Error);
|
|
501
|
+
});
|
package/.ci/jobs/defaults.yml
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
##### GLOBAL METADATA
|
|
3
|
-
|
|
4
|
-
- meta:
|
|
5
|
-
cluster: kibana-ci
|
|
6
|
-
|
|
7
|
-
##### JOB DEFAULTS
|
|
8
|
-
|
|
9
|
-
- job:
|
|
10
|
-
project-type: freestyle
|
|
11
|
-
logrotate:
|
|
12
|
-
daysToKeep: 30
|
|
13
|
-
numToKeep: 100
|
|
14
|
-
properties:
|
|
15
|
-
- github:
|
|
16
|
-
url: https://github.com/elastic/ems-client/
|
|
17
|
-
- inject:
|
|
18
|
-
properties-content: HOME=$JENKINS_HOME
|
|
19
|
-
concurrent: false
|
|
20
|
-
node: linux && !oraclelinux
|
|
21
|
-
scm:
|
|
22
|
-
- git:
|
|
23
|
-
name: origin
|
|
24
|
-
credentials-id: f6c7695a-671e-4f4f-a331-acdce44ff9ba
|
|
25
|
-
reference-repo: /var/lib/jenkins/.git-references/ems-client.git
|
|
26
|
-
branches:
|
|
27
|
-
- ${ghprbActualCommit}
|
|
28
|
-
url: git@github.com:elastic/ems-client.git
|
|
29
|
-
wrappers:
|
|
30
|
-
- ansicolor
|
|
31
|
-
- timeout:
|
|
32
|
-
type: absolute
|
|
33
|
-
timeout: 180
|
|
34
|
-
fail: true
|
|
35
|
-
- timestamps
|
|
36
|
-
- workspace-cleanup
|
|
37
|
-
builders:
|
|
38
|
-
- shell: |-
|
|
39
|
-
#!/usr/local/bin/runbld
|
|
40
|
-
set -e
|
|
41
|
-
set +x
|
|
42
|
-
|
|
43
|
-
NODE_IMG="node:10"
|
|
44
|
-
|
|
45
|
-
docker pull $NODE_IMG
|
|
46
|
-
docker run --rm -i \
|
|
47
|
-
--env GIT_COMMITTER_NAME=test \
|
|
48
|
-
--env GIT_COMMITTER_EMAIL=test \
|
|
49
|
-
--env HOME=/tmp \
|
|
50
|
-
--user=$(id -u):$(id -g) \
|
|
51
|
-
--volume $PWD:/app \
|
|
52
|
-
--workdir /app \
|
|
53
|
-
$NODE_IMG \
|
|
54
|
-
bash -c 'npm config set spin false && /opt/yarn*/bin/yarn && yarn test && yarn run build'
|
|
55
|
-
|
|
56
|
-
publishers:
|
|
57
|
-
- email:
|
|
58
|
-
recipients: infra-root+build@elastic.co
|
|
59
|
-
- google-cloud-storage:
|
|
60
|
-
credentials-id: kibana-ci-gcs-plugin
|
|
61
|
-
uploads:
|
|
62
|
-
- classic:
|
|
63
|
-
file-pattern: integration/**/__diff_output__/**/*
|
|
64
|
-
storage-location: gs://kibana-ci-artifacts/jobs/$JOB_NAME/$BUILD_NUMBER
|
|
65
|
-
share-publicly: true
|
|
66
|
-
upload-for-failed-jobs: true
|
|
67
|
-
show-inline: true
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
- job:
|
|
3
|
-
name: elastic+ems-client+master
|
|
4
|
-
display-name: 'elastic / ems-client # master'
|
|
5
|
-
description: Testing the ems-client master branch.
|
|
6
|
-
parameters:
|
|
7
|
-
- string:
|
|
8
|
-
name: branch_specifier
|
|
9
|
-
default: refs/heads/master
|
|
10
|
-
description: the Git branch specifier to build (<branchName>, <tagName>,
|
|
11
|
-
<commitId>, etc.)
|
|
12
|
-
scm:
|
|
13
|
-
- git:
|
|
14
|
-
branches:
|
|
15
|
-
- ${branch_specifier}
|
|
16
|
-
triggers:
|
|
17
|
-
- github
|
|
18
|
-
- timed: '@daily'
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
- job:
|
|
3
|
-
name: elastic+ems-client+pull-request
|
|
4
|
-
display-name: 'elastic / ems-client # pull-request'
|
|
5
|
-
description: Testing of ems-client pull requests
|
|
6
|
-
scm:
|
|
7
|
-
- git:
|
|
8
|
-
branches:
|
|
9
|
-
- ${ghprbActualCommit}
|
|
10
|
-
refspec: +refs/pull/*:refs/remotes/origin/pr/*
|
|
11
|
-
triggers:
|
|
12
|
-
- github-pull-request:
|
|
13
|
-
org-list:
|
|
14
|
-
- elastic
|
|
15
|
-
allow-whitelist-orgs-as-admins: true
|
|
16
|
-
github-hooks: true
|
|
17
|
-
cancel-builds-on-update: true
|
|
18
|
-
status-context: ems-client
|
|
19
|
-
publishers: []
|