@elastic/ems-client 8.5.2 → 8.6.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 +9 -15
- package/.buildkite/build.sh +3 -0
- package/.buildkite/compare_dependencies.js +67 -0
- package/.buildkite/pipeline.yml +3 -1
- package/.github/workflows/backport.yml +24 -0
- package/CHANGELOG.md +13 -23
- package/eslint.config.mjs +1 -1
- package/package.json +38 -37
- package/renovate.json +21 -0
- package/src/ems_client.ts +10 -9
- package/src/tms_service.ts +3 -0
- package/src/utils.ts +5 -2
- package/target/ems_client.d.ts +4 -2
- package/target/node/tms_service.js +12 -0
- package/target/web/ems_client.js +13 -13
- package/target/web/file_layer.js +1 -1
- package/target/web/tms_service.js +27 -15
- package/test/ems_client_util.ts +1 -1
- package/target/ems_client.js +0 -318
- package/target/ems_service.js +0 -47
- package/target/file_layer.js +0 -176
- package/target/index.js +0 -16
- package/target/tms_service.js +0 -409
- package/target/utils.js +0 -86
package/.backportrc.json
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
],
|
|
13
|
-
"labels": [
|
|
14
|
-
"backport"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
2
|
+
"repoOwner": "elastic",
|
|
3
|
+
"repoName": "ems-file-service",
|
|
4
|
+
"targetBranches": ["7.17"],
|
|
5
|
+
"targetPRLabels": ["backport"],
|
|
6
|
+
"commitConflicts": true,
|
|
7
|
+
"autoMerge": true,
|
|
8
|
+
"autoMergeMethod": "squash",
|
|
9
|
+
"fork": false
|
|
10
|
+
}
|
package/.buildkite/build.sh
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
5
|
+
* 2.0.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* Script that will check the current package.json dependencies
|
|
9
|
+
against Kibana (using BUILDKITE_BRANCH to determine the branch)
|
|
10
|
+
and exits with a 1 status code if, for any shared dependency,
|
|
11
|
+
EMS Client is behind */
|
|
12
|
+
|
|
13
|
+
const fs = require('node:fs');
|
|
14
|
+
const semver = require('semver');
|
|
15
|
+
|
|
16
|
+
const DEFAULT_BRANCH = 'main';
|
|
17
|
+
const branch = process.env.KIBANA_BRANCH || DEFAULT_BRANCH;
|
|
18
|
+
const kibanaPackageUrl = `https://raw.githubusercontent.com/elastic/kibana/${branch}/package.json`;
|
|
19
|
+
|
|
20
|
+
const processDependency = function (dependency, srcDeps, dstDeps, dstDevDeps) {
|
|
21
|
+
if (!(dependency in dstDeps) && !(dependency in dstDevDeps)) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
const source = srcDeps[dependency].replace('^', '');
|
|
25
|
+
const destination = dstDeps[dependency] || dstDevDeps[dependency];
|
|
26
|
+
|
|
27
|
+
if (semver.satisfies(source, destination)) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if ( dependency in dstDevDeps){
|
|
32
|
+
console.log(`⚠ ${dependency}: ${source} vs ${destination}`);
|
|
33
|
+
return true
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
console.log(`🛑 ${dependency}: ${source} vs ${destination}`);
|
|
37
|
+
return false;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const main = async function () {
|
|
41
|
+
const kibanaPackage = await fetch(kibanaPackageUrl);
|
|
42
|
+
const kibanaPackageJson = await kibanaPackage.json();
|
|
43
|
+
const kibanaDeps = kibanaPackageJson['dependencies'];
|
|
44
|
+
const kibanaDevDeps = kibanaPackageJson['devDependencies'];
|
|
45
|
+
|
|
46
|
+
const emsClientPackageJson = JSON.parse(fs.readFileSync('package.json'));
|
|
47
|
+
const emsClientDeps = {
|
|
48
|
+
...emsClientPackageJson['dependencies'],
|
|
49
|
+
// ...emsClientPackageJson['devDependencies']
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
console.log(`ems-client@${emsClientPackageJson['version']}`);
|
|
53
|
+
console.log(`kibana@${kibanaPackageJson['version']}`);
|
|
54
|
+
|
|
55
|
+
const results = Object.keys(emsClientDeps).map((dep) =>
|
|
56
|
+
processDependency(dep, emsClientDeps, kibanaDeps, kibanaDevDeps)
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
process.exit(results.every(r => r) ? 0 : 1);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
main()
|
|
63
|
+
.then(console.log)
|
|
64
|
+
.catch((error) => {
|
|
65
|
+
console.error(error);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
});
|
package/.buildkite/pipeline.yml
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
agents:
|
|
2
|
-
image: "docker.elastic.co/ci-agent-images/ems/buildkite-agent-node20:0.
|
|
2
|
+
image: "docker.elastic.co/ci-agent-images/ems/buildkite-agent-node20:0.5@sha256:01d63c1c1e9895e410a8b50c0eb0ce8e986c354085a11ed1d00355a12935ac5e"
|
|
3
3
|
cpu: "2"
|
|
4
4
|
memory: "2G"
|
|
5
5
|
|
|
6
6
|
steps:
|
|
7
7
|
- label: ":hammer_and_wrench: Test and build"
|
|
8
8
|
command: ".buildkite/build.sh"
|
|
9
|
+
env:
|
|
10
|
+
KIBANA_BRANCH: "main"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Automatic backport action
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request_target:
|
|
5
|
+
types: ["labeled", "closed"]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
backport:
|
|
9
|
+
name: Backport PR
|
|
10
|
+
if: github.event.pull_request.merged == true && !(contains(github.event.pull_request.labels.*.name, 'backport'))
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Backport Action
|
|
14
|
+
uses: sorenlouv/backport-github-action@ad888e978060bc1b2798690dd9d03c4036560947 # v9.5.1
|
|
15
|
+
with:
|
|
16
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
17
|
+
|
|
18
|
+
- name: Info log
|
|
19
|
+
if: ${{ success() }}
|
|
20
|
+
run: cat ~/.backport/backport.info.log
|
|
21
|
+
|
|
22
|
+
- name: Debug log
|
|
23
|
+
if: ${{ failure() }}
|
|
24
|
+
run: cat ~/.backport/backport.debug.log
|
package/CHANGELOG.md
CHANGED
|
@@ -3,13 +3,23 @@ All notable changes to this project will be documented in this file.
|
|
|
3
3
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
5
5
|
|
|
6
|
-
## [8.
|
|
6
|
+
## [8.6.0] - 2024-12-13
|
|
7
|
+
### Added
|
|
8
|
+
- Include color options for new EMS styles #478
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Dependencies reorganization and validation against Kibana #289
|
|
12
|
+
- Update dependencies (search PRs for `is:pr label:8.5.4,dependencies`)
|
|
7
13
|
|
|
14
|
+
## [8.5.3] - 2024-07-10
|
|
15
|
+
### Changed
|
|
16
|
+
- Update dependencies #242
|
|
17
|
+
|
|
18
|
+
## [8.5.2] - 2024-07-05
|
|
8
19
|
## Changed
|
|
9
20
|
- Update dependencies #232 #233 #234 #235
|
|
10
21
|
|
|
11
22
|
## [8.5.1] - 2023-11-09
|
|
12
|
-
|
|
13
23
|
### Added
|
|
14
24
|
- Add a new `getEmsVersion` method #204
|
|
15
25
|
- Include OpenAPI specification #196 #197
|
|
@@ -21,83 +31,70 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
21
31
|
- Migration to Node 20 #208
|
|
22
32
|
|
|
23
33
|
## [8.5.0] - 2023-08-23
|
|
24
|
-
|
|
25
34
|
- Migration from Jenkins to Buildkite for automatic testing #145 #147
|
|
26
35
|
- Detached the releases of EMS Client from the services consumed #185
|
|
27
36
|
- Updated the client to support date based versions #185
|
|
28
37
|
- Update dependencies #159 #165 #173 #176 #181 #184
|
|
29
38
|
|
|
30
39
|
## [8.4.0] - 2023-01-11
|
|
31
|
-
|
|
32
40
|
- Default EMS version is 8.4
|
|
33
41
|
- Add types to colorOperationDefaults #123
|
|
34
42
|
- Update dependencies #131 #133 #134 #138
|
|
35
43
|
|
|
36
44
|
## [8.3.3] - 2022-05-24
|
|
37
|
-
|
|
38
45
|
- Make percentage an optional parameter #117
|
|
39
46
|
- Make color and operation optional parameters #118
|
|
40
47
|
|
|
41
48
|
## [8.3.2] - 2022-05-16
|
|
42
|
-
|
|
43
49
|
- Export `blendMode` type #111
|
|
44
50
|
- Fix transforming color definitions with stops #112
|
|
45
51
|
|
|
46
52
|
## [8.3.1] - 2022-05-06
|
|
47
|
-
|
|
48
53
|
- Added static methods to help translating basemap labels and blending colors to paint properties #105
|
|
49
54
|
- Add optional `format` argument to `getMinZoom` and `getMaxZoom` #90
|
|
50
55
|
|
|
51
56
|
## [8.3.0] - 2022-04-18
|
|
52
|
-
|
|
53
57
|
### Changed
|
|
54
58
|
- Default EMS version is 8.3 #104
|
|
55
59
|
- Bump maplibre-gl to 2.1.9 #103
|
|
56
60
|
|
|
57
61
|
## [8.2.0] - 2022-03-24
|
|
58
|
-
|
|
59
62
|
### Changed
|
|
60
63
|
- Default EMS version is 8.2
|
|
61
64
|
- Removed getOrigin method #91
|
|
62
65
|
|
|
63
66
|
## [8.1.0] - 2021-11-09
|
|
64
|
-
|
|
65
67
|
### Changed
|
|
66
68
|
- Default EMS version is 8.1
|
|
67
69
|
- Export EmsSprite and EmsSpritesheet types
|
|
68
70
|
- Inherit types from maplibre-gl
|
|
69
71
|
|
|
70
72
|
## [8.0.0] - 2021-10-20
|
|
71
|
-
|
|
72
73
|
### Changed
|
|
73
74
|
- Default EMS version is 8.0
|
|
74
75
|
- Remove unused API descriptors
|
|
75
76
|
|
|
76
77
|
## [7.16.0] - 2021-10-13
|
|
77
|
-
|
|
78
78
|
### Changed
|
|
79
79
|
- Default EMS version is 7.16
|
|
80
80
|
- Update dependencies using `yarn upgrade`
|
|
81
81
|
- Better error handling for HTTP responses
|
|
82
82
|
|
|
83
83
|
## [7.15.1] - 2021-09-01
|
|
84
|
-
|
|
85
84
|
### Changed
|
|
86
85
|
- Unpinned `semver` dependency [#77](https://github.com/elastic/ems-client/pull/77)
|
|
87
86
|
|
|
88
87
|
## [7.15.0] - 2021-08-12
|
|
89
|
-
|
|
90
88
|
### Changed
|
|
91
89
|
- Default EMS version is 7.15
|
|
92
90
|
- Updated dependencies via `yarn upgrade`
|
|
93
91
|
- Fix linting issues
|
|
92
|
+
|
|
94
93
|
## [7.14.0] - 2021-06-15
|
|
95
94
|
### Added
|
|
96
|
-
|
|
97
95
|
- New getters for optional field metadata `alias`, `regex`, and `values` #69
|
|
98
96
|
|
|
99
97
|
### Changed
|
|
100
|
-
|
|
101
98
|
- Default EMS version is 7.14
|
|
102
99
|
- **Breaking change** @elastic/ems-client is now licensed under the Elastic License v2. See the LICENSE.txt file in this repository #64
|
|
103
100
|
|
|
@@ -111,7 +108,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
111
108
|
- Updated dependencies using `yarn upgrade` and #44 #50
|
|
112
109
|
- Add functions to get specific file formats #53
|
|
113
110
|
|
|
114
|
-
|
|
115
111
|
## [7.10.0] - 2020-08-17
|
|
116
112
|
### Changed
|
|
117
113
|
- Default EMS version is 7.10
|
|
@@ -138,7 +134,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
138
134
|
- Convert source code to Typescript
|
|
139
135
|
- Added better linting with eslint and prettier
|
|
140
136
|
|
|
141
|
-
|
|
142
137
|
## [7.8.1] - 2020-04-06
|
|
143
138
|
### Fixed
|
|
144
139
|
- Correctly handle API urls that end in slashes
|
|
@@ -173,14 +168,11 @@ always needed and in fact breaks some client-side use of this lib
|
|
|
173
168
|
- Correctly handle API urls that end in slashes
|
|
174
169
|
|
|
175
170
|
## [7.6.0] - 2020-01-13
|
|
176
|
-
|
|
177
171
|
### Added
|
|
178
172
|
- Two new parameters were introduced, `tileApiUrl` and `fileApiUrl`. These should be used instead of `manifestServiceUrl`. These parameters should be set to their respective domains (e.g. `https://tiles.maps.elastic.co`, `https://vector.maps.elastic.co`). [#13](https://github.com/elastic/ems-client/pull/13)
|
|
179
173
|
|
|
180
174
|
### Changed
|
|
181
|
-
|
|
182
175
|
- Starting with v7.6, new Elastic Maps Service (EMS) versions will be released with every matching major and minor release of the Elastic Stack. New releases of ems-client will also be released to match the EMS versions.
|
|
183
|
-
|
|
184
176
|
- Handle relative URLs in EMS v7.6 manifests.
|
|
185
177
|
|
|
186
178
|
### Deprecated
|
|
@@ -202,7 +194,6 @@ Bump version to match the corresponding Elastic Maps Service version. This relea
|
|
|
202
194
|
### Fixed
|
|
203
195
|
- Update browser entry point that was pointing to an incorrect path, which fell back to the main entry
|
|
204
196
|
|
|
205
|
-
|
|
206
197
|
## [1.0.2] - 2019-10-15
|
|
207
198
|
|
|
208
199
|
### Fixed
|
|
@@ -214,5 +205,4 @@ Bump version to match the corresponding Elastic Maps Service version. This relea
|
|
|
214
205
|
- Downgrade node-fetch dependency to fix fetch error
|
|
215
206
|
|
|
216
207
|
## [1.0.0] - 2019-08-26
|
|
217
|
-
|
|
218
208
|
- Initial release. Compatible with Elastic Maps Service v7.2.0.
|
package/eslint.config.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/ems-client",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.6.0",
|
|
4
4
|
"description": "JavaScript client library for the Elastic Maps Service",
|
|
5
5
|
"main": "target/node/index.js",
|
|
6
6
|
"browser": "target/web/index.js",
|
|
@@ -31,45 +31,46 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/elastic/ems-client#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@types/geojson": "
|
|
35
|
-
"@types/topojson-client": "
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
34
|
+
"@types/geojson": "7946.0.15",
|
|
35
|
+
"@types/topojson-client": "3.1.5",
|
|
36
|
+
"chroma-js": "^2.6.0",
|
|
37
|
+
"lodash": "^4.17.21",
|
|
38
|
+
"lru-cache": "^4.1.5",
|
|
39
|
+
"maplibre-gl": "3.1.0",
|
|
40
|
+
"node-fetch": "2.7.0",
|
|
41
|
+
"semver": "^7.6.3",
|
|
41
42
|
"topojson-client": "^3.1.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@babel/cli": "
|
|
45
|
-
"@babel/core": "
|
|
46
|
-
"@babel/plugin-proposal-class-properties": "
|
|
47
|
-
"@babel/preset-env": "
|
|
48
|
-
"@babel/preset-typescript": "
|
|
49
|
-
"@eslint/
|
|
50
|
-
"@
|
|
51
|
-
"@types/
|
|
52
|
-
"@types/
|
|
53
|
-
"@types/
|
|
54
|
-
"@types/
|
|
55
|
-
"@types/
|
|
56
|
-
"@types/node
|
|
57
|
-
"@types/
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
61
|
-
"eslint": "
|
|
62
|
-
"
|
|
63
|
-
"eslint
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"prettier": "
|
|
70
|
-
"ts-jest": "
|
|
71
|
-
"typescript": "
|
|
72
|
-
"typescript-eslint": "
|
|
45
|
+
"@babel/cli": "7.26.4",
|
|
46
|
+
"@babel/core": "7.26.0",
|
|
47
|
+
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
48
|
+
"@babel/preset-env": "7.26.0",
|
|
49
|
+
"@babel/preset-typescript": "7.26.0",
|
|
50
|
+
"@eslint/core": "0.9.1",
|
|
51
|
+
"@eslint/js": "9.17.0",
|
|
52
|
+
"@types/chroma-js": "2.4.5",
|
|
53
|
+
"@types/eslint__js": "8.42.3",
|
|
54
|
+
"@types/jest": "29.5.14",
|
|
55
|
+
"@types/lodash": "4.17.13",
|
|
56
|
+
"@types/lru-cache": "5.1.1",
|
|
57
|
+
"@types/node": "20.17.10",
|
|
58
|
+
"@types/node-fetch": "2.6.12",
|
|
59
|
+
"@types/semver": "7.5.8",
|
|
60
|
+
"@types/topojson-specification": "1.0.5",
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "8.18.1",
|
|
62
|
+
"@typescript-eslint/parser": "8.18.1",
|
|
63
|
+
"babel-jest": "29.7.0",
|
|
64
|
+
"eslint": "9.17.0",
|
|
65
|
+
"eslint-config-prettier": "9.1.0",
|
|
66
|
+
"eslint-plugin-prettier": "5.2.1",
|
|
67
|
+
"globals": "15.14.0",
|
|
68
|
+
"husky": "9.1.7",
|
|
69
|
+
"jest": "29.7.0",
|
|
70
|
+
"prettier": "3.4.2",
|
|
71
|
+
"ts-jest": "29.2.5",
|
|
72
|
+
"typescript": "5.7.2",
|
|
73
|
+
"typescript-eslint": "8.18.1"
|
|
73
74
|
},
|
|
74
75
|
"engines": {
|
|
75
76
|
"node": ">=18 <=20"
|
package/renovate.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
+
"extends": [
|
|
4
|
+
"local>elastic/renovate-config"
|
|
5
|
+
],
|
|
6
|
+
"labels": [
|
|
7
|
+
"dependencies",
|
|
8
|
+
"v7.17.4",
|
|
9
|
+
"v8.6.0"
|
|
10
|
+
],
|
|
11
|
+
"packageRules": [
|
|
12
|
+
{
|
|
13
|
+
"matchUpdateTypes": ["minor", "patch"],
|
|
14
|
+
"automerge": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"matchDepTypes": ["devDependencies"],
|
|
18
|
+
"automerge": true
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
package/src/ems_client.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { format as formatUrl, parse as parseUrl, UrlObject } from 'url';
|
|
|
19
19
|
import { toAbsoluteUrl } from './utils';
|
|
20
20
|
import { ParsedUrlQueryInput } from 'querystring';
|
|
21
21
|
import LRUCache from 'lru-cache';
|
|
22
|
+
import { RequestInfo } from 'node-fetch';
|
|
22
23
|
|
|
23
24
|
const REST_API_REGEX = /\d{4}-\d{2}-\d{2}/;
|
|
24
25
|
export const LATEST_API_URL_PATH = 'latest';
|
|
@@ -101,10 +102,10 @@ type BaseClientConfig = {
|
|
|
101
102
|
tileApiUrl: string;
|
|
102
103
|
fileApiUrl: string;
|
|
103
104
|
emsVersion?: string;
|
|
104
|
-
htmlSanitizer?:
|
|
105
|
+
htmlSanitizer?: (x: string) => string;
|
|
105
106
|
language?: string;
|
|
106
107
|
landingPageUrl?: string;
|
|
107
|
-
fetchFunction:
|
|
108
|
+
fetchFunction: (url: RequestInfo) => Promise<Response>;
|
|
108
109
|
proxyPath?: string;
|
|
109
110
|
cacheSize?: number;
|
|
110
111
|
};
|
|
@@ -209,8 +210,8 @@ export class EMSClient {
|
|
|
209
210
|
readonly EMS_LOAD_TIMEOUT = 32000;
|
|
210
211
|
private _queryParams: QueryParams;
|
|
211
212
|
private readonly _appVersion: string;
|
|
212
|
-
private readonly _fetchFunction:
|
|
213
|
-
private readonly _sanitizer:
|
|
213
|
+
private readonly _fetchFunction: (url: RequestInfo) => Promise<Response>;
|
|
214
|
+
private readonly _sanitizer: (x: string) => string;
|
|
214
215
|
private readonly _fileApiUrl: string;
|
|
215
216
|
private readonly _tileApiUrl: string;
|
|
216
217
|
private readonly _emsVersion: string;
|
|
@@ -223,11 +224,11 @@ export class EMSClient {
|
|
|
223
224
|
/**
|
|
224
225
|
* these methods are assigned outside the constructor
|
|
225
226
|
*/
|
|
226
|
-
private _getMainCatalog!:
|
|
227
|
-
private _getDefaultTMSCatalog!:
|
|
228
|
-
private _getDefaultFileCatalog!:
|
|
229
|
-
private _loadTMSServices!:
|
|
230
|
-
private _loadFileLayers!:
|
|
227
|
+
private _getMainCatalog!: () => Promise<EmsCatalogManifest>;
|
|
228
|
+
private _getDefaultTMSCatalog!: () => Promise<EmsTmsCatalog>;
|
|
229
|
+
private _getDefaultFileCatalog!: () => Promise<EmsFileCatalog>;
|
|
230
|
+
private _loadTMSServices!: () => Promise<TMSService[]>;
|
|
231
|
+
private _loadFileLayers!: () => Promise<FileLayer[]>;
|
|
231
232
|
|
|
232
233
|
constructor(config: ClientConfig | DeprecatedClientConfig) {
|
|
233
234
|
// Remove kbnVersion in 8.0
|
package/src/tms_service.ts
CHANGED
|
@@ -132,6 +132,9 @@ export class TMSService extends AbstractEmsService {
|
|
|
132
132
|
{ style: 'road_map', operation: 'mix', percentage: 0.25 },
|
|
133
133
|
{ style: 'road_map_desaturated', operation: 'screen', percentage: 0.25 },
|
|
134
134
|
{ style: 'dark_map', operation: 'dodge', percentage: 0.25 },
|
|
135
|
+
{ style: 'high_contrast', operation: 'screen', percentage: 0.25 },
|
|
136
|
+
{ style: 'road_map_desaturated_v9', operation: 'screen', percentage: 0.25 },
|
|
137
|
+
{ style: 'dark_map_v9', operation: 'dodge', percentage: 0.25 },
|
|
135
138
|
];
|
|
136
139
|
|
|
137
140
|
protected readonly _config: TMSServiceConfig;
|
package/src/utils.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* 2.0.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import chroma, { ChromaStatic } from 'chroma-js';
|
|
8
|
+
import chroma, { ChromaStatic, Color } from 'chroma-js';
|
|
9
9
|
import {
|
|
10
10
|
ColorSpecification,
|
|
11
11
|
DataDrivenPropertyValueSpecification,
|
|
@@ -63,7 +63,10 @@ export type blendMode = Parameters<ChromaStatic['blend']>[2] | 'mix';
|
|
|
63
63
|
/*
|
|
64
64
|
Function to transform a maplibre color definition by a given function.
|
|
65
65
|
*/
|
|
66
|
-
function transformColor(
|
|
66
|
+
function transformColor(
|
|
67
|
+
paintColor: mbColorDefinition,
|
|
68
|
+
func: (color: string) => Color
|
|
69
|
+
): mbColorDefinition {
|
|
67
70
|
if (typeof paintColor == 'string') {
|
|
68
71
|
const modifiedColor = func(paintColor);
|
|
69
72
|
return `rgba(${modifiedColor.rgba().join(',')})`;
|
package/target/ems_client.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { TMSService } from './tms_service';
|
|
2
2
|
import { EMSFormatType, FileLayer } from './file_layer';
|
|
3
3
|
import { FeatureCollection } from 'geojson';
|
|
4
|
+
import { Response } from 'node-fetch';
|
|
5
|
+
import { RequestInfo } from 'node-fetch';
|
|
4
6
|
export declare const LATEST_API_URL_PATH = "latest";
|
|
5
7
|
type LocalizedStrings = {
|
|
6
8
|
[key: string]: string;
|
|
@@ -11,10 +13,10 @@ type BaseClientConfig = {
|
|
|
11
13
|
tileApiUrl: string;
|
|
12
14
|
fileApiUrl: string;
|
|
13
15
|
emsVersion?: string;
|
|
14
|
-
htmlSanitizer?:
|
|
16
|
+
htmlSanitizer?: (x: string) => string;
|
|
15
17
|
language?: string;
|
|
16
18
|
landingPageUrl?: string;
|
|
17
|
-
fetchFunction:
|
|
19
|
+
fetchFunction: (url: RequestInfo) => Promise<Response>;
|
|
18
20
|
proxyPath?: string;
|
|
19
21
|
cacheSize?: number;
|
|
20
22
|
};
|
|
@@ -499,4 +499,16 @@ _defineProperty(TMSService, "colorOperationDefaults", [{
|
|
|
499
499
|
style: 'dark_map',
|
|
500
500
|
operation: 'dodge',
|
|
501
501
|
percentage: 0.25
|
|
502
|
+
}, {
|
|
503
|
+
style: 'high_contrast',
|
|
504
|
+
operation: 'screen',
|
|
505
|
+
percentage: 0.25
|
|
506
|
+
}, {
|
|
507
|
+
style: 'road_map_desaturated_v9',
|
|
508
|
+
operation: 'screen',
|
|
509
|
+
percentage: 0.25
|
|
510
|
+
}, {
|
|
511
|
+
style: 'dark_map_v9',
|
|
512
|
+
operation: 'dodge',
|
|
513
|
+
percentage: 0.25
|
|
502
514
|
}]);
|
package/target/web/ems_client.js
CHANGED
|
@@ -164,7 +164,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
164
164
|
}, {
|
|
165
165
|
key: "getManifest",
|
|
166
166
|
value: (function () {
|
|
167
|
-
var _getManifest = _asyncToGenerator(
|
|
167
|
+
var _getManifest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(endpointUrl) {
|
|
168
168
|
var url, response;
|
|
169
169
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
170
170
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -240,7 +240,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
240
240
|
}, {
|
|
241
241
|
key: "getMainManifest",
|
|
242
242
|
value: function () {
|
|
243
|
-
var _getMainManifest = _asyncToGenerator(
|
|
243
|
+
var _getMainManifest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
244
244
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
245
245
|
while (1) switch (_context2.prev = _context2.next) {
|
|
246
246
|
case 0:
|
|
@@ -262,7 +262,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
262
262
|
}, {
|
|
263
263
|
key: "getDefaultFileManifest",
|
|
264
264
|
value: function () {
|
|
265
|
-
var _getDefaultFileManifest = _asyncToGenerator(
|
|
265
|
+
var _getDefaultFileManifest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
266
266
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
267
267
|
while (1) switch (_context3.prev = _context3.next) {
|
|
268
268
|
case 0:
|
|
@@ -284,7 +284,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
284
284
|
}, {
|
|
285
285
|
key: "getDefaultTMSManifest",
|
|
286
286
|
value: function () {
|
|
287
|
-
var _getDefaultTMSManifest = _asyncToGenerator(
|
|
287
|
+
var _getDefaultTMSManifest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
288
288
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
289
289
|
while (1) switch (_context4.prev = _context4.next) {
|
|
290
290
|
case 0:
|
|
@@ -306,7 +306,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
306
306
|
}, {
|
|
307
307
|
key: "getFileLayers",
|
|
308
308
|
value: function () {
|
|
309
|
-
var _getFileLayers = _asyncToGenerator(
|
|
309
|
+
var _getFileLayers = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
310
310
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
311
311
|
while (1) switch (_context5.prev = _context5.next) {
|
|
312
312
|
case 0:
|
|
@@ -328,7 +328,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
328
328
|
}, {
|
|
329
329
|
key: "getTMSServices",
|
|
330
330
|
value: function () {
|
|
331
|
-
var _getTMSServices = _asyncToGenerator(
|
|
331
|
+
var _getTMSServices = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
332
332
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
333
333
|
while (1) switch (_context6.prev = _context6.next) {
|
|
334
334
|
case 0:
|
|
@@ -393,7 +393,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
393
393
|
}, {
|
|
394
394
|
key: "findFileLayerById",
|
|
395
395
|
value: function () {
|
|
396
|
-
var _findFileLayerById = _asyncToGenerator(
|
|
396
|
+
var _findFileLayerById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(id) {
|
|
397
397
|
var fileLayers, i;
|
|
398
398
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
399
399
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -431,7 +431,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
431
431
|
}, {
|
|
432
432
|
key: "findTMSServiceById",
|
|
433
433
|
value: function () {
|
|
434
|
-
var _findTMSServiceById = _asyncToGenerator(
|
|
434
|
+
var _findTMSServiceById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(id) {
|
|
435
435
|
var tmsServices, i;
|
|
436
436
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
437
437
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -501,7 +501,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
501
501
|
value: function _invalidateSettings() {
|
|
502
502
|
var _this2 = this;
|
|
503
503
|
this._cache.reset();
|
|
504
|
-
this._getMainCatalog = _.once(
|
|
504
|
+
this._getMainCatalog = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
505
505
|
var services, version, _version;
|
|
506
506
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
507
507
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -530,7 +530,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
530
530
|
}
|
|
531
531
|
}, _callee9);
|
|
532
532
|
})));
|
|
533
|
-
this._getDefaultTMSCatalog = _.once(
|
|
533
|
+
this._getDefaultTMSCatalog = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
534
534
|
var catalogue, firstService, url;
|
|
535
535
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
536
536
|
while (1) switch (_context10.prev = _context10.next) {
|
|
@@ -561,7 +561,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
561
561
|
}
|
|
562
562
|
}, _callee10);
|
|
563
563
|
})));
|
|
564
|
-
this._getDefaultFileCatalog = _.once(
|
|
564
|
+
this._getDefaultFileCatalog = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
565
565
|
var catalogue, firstService, url;
|
|
566
566
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
567
567
|
while (1) switch (_context11.prev = _context11.next) {
|
|
@@ -594,7 +594,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
594
594
|
})));
|
|
595
595
|
|
|
596
596
|
//Cache the actual instances of TMSService as these in turn cache sub-manifests for the style-files
|
|
597
|
-
this._loadTMSServices = _.once(
|
|
597
|
+
this._loadTMSServices = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
598
598
|
var tmsManifest;
|
|
599
599
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
600
600
|
while (1) switch (_context12.prev = _context12.next) {
|
|
@@ -612,7 +612,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
612
612
|
}
|
|
613
613
|
}, _callee12);
|
|
614
614
|
})));
|
|
615
|
-
this._loadFileLayers = _.once(
|
|
615
|
+
this._loadFileLayers = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
616
616
|
var fileManifest;
|
|
617
617
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
618
618
|
while (1) switch (_context13.prev = _context13.next) {
|