@elastic/ems-client 7.17.3 → 7.17.5
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 +14 -13
- package/.buildkite/compare_dependencies.js +1 -1
- package/.buildkite/pipeline.yml +2 -2
- package/.github/workflows/backport.yml +24 -0
- package/CHANGELOG.md +9 -19
- package/eslint.config.mjs +25 -0
- package/package.json +35 -32
- package/src/ems_client.ts +10 -11
- package/src/tms_service.ts +1 -2
- package/target/ems_client.d.ts +18 -18
- package/target/file_layer.d.ts +1 -1
- package/target/node/ems_client.js +1 -1
- package/target/node/tms_service.js +1 -2
- package/target/tms_service.d.ts +6 -6
- package/target/web/ems_client.js +15 -15
- package/target/web/file_layer.js +1 -1
- package/target/web/tms_service.js +16 -17
- package/test/__snapshots__/ems_client.test.ts.snap +24 -24
- package/test/ems_client_util.ts +1 -2
- package/.eslintignore +0 -1
- package/.eslintrc +0 -18
package/.backportrc.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"name": "7.17",
|
|
10
|
-
"checked": true
|
|
11
|
-
}
|
|
2
|
+
"repoOwner": "elastic",
|
|
3
|
+
"repoName": "ems-client",
|
|
4
|
+
"targetBranchChoices": [
|
|
5
|
+
"master",
|
|
6
|
+
"7.17"
|
|
12
7
|
],
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
8
|
+
"branchLabelMapping": {
|
|
9
|
+
"^v8.\\d+.\\d+$": "master",
|
|
10
|
+
"^v7.\\d+.\\d+$": "v7.17"
|
|
11
|
+
},
|
|
12
|
+
"targetPRLabels": ["backport"],
|
|
13
|
+
"commitConflicts": true,
|
|
14
|
+
"autoMerge": false,
|
|
15
|
+
"autoMergeMethod": "squash",
|
|
16
|
+
"fork": false
|
|
16
17
|
}
|
|
@@ -46,7 +46,7 @@ const main = async function () {
|
|
|
46
46
|
const emsClientPackageJson = JSON.parse(fs.readFileSync('package.json'));
|
|
47
47
|
const emsClientDeps = {
|
|
48
48
|
...emsClientPackageJson['dependencies'],
|
|
49
|
-
...emsClientPackageJson['devDependencies']
|
|
49
|
+
// ...emsClientPackageJson['devDependencies']
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
console.log(`ems-client@${emsClientPackageJson['version']}`);
|
package/.buildkite/pipeline.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
|
|
@@ -7,4 +7,4 @@ steps:
|
|
|
7
7
|
- label: ":hammer_and_wrench: Test and build"
|
|
8
8
|
command: ".buildkite/build.sh"
|
|
9
9
|
env:
|
|
10
|
-
KIBANA_BRANCH: "
|
|
10
|
+
KIBANA_BRANCH: "7.17"
|
|
@@ -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,52 +3,51 @@ 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
|
-
## [7.17.
|
|
6
|
+
## [7.17.5] - 2024-12-23
|
|
7
|
+
## Changed
|
|
8
|
+
- Removed node-fetch #519
|
|
7
9
|
|
|
10
|
+
## [7.17.4] - 2024-12-16
|
|
8
11
|
### Changed
|
|
12
|
+
- Update dependencies (search PRs for `is:pr label:7.17.4,dependencies`)
|
|
13
|
+
|
|
9
14
|
|
|
15
|
+
## [7.17.3] - 2024-07-10
|
|
16
|
+
### Changed
|
|
10
17
|
- Update dependencies #243
|
|
11
18
|
|
|
12
19
|
## [7.17.2] - 2024-07-05
|
|
13
|
-
|
|
14
20
|
## Changed
|
|
15
|
-
|
|
16
21
|
- Update dependencies #218 #219 #220 #221 #236 #237
|
|
17
22
|
|
|
18
23
|
## [7.17.1] - 2023-11-09
|
|
19
|
-
|
|
20
24
|
### Changed
|
|
21
|
-
|
|
22
25
|
- Default EMS version is 7.17
|
|
23
26
|
- Upgrade dependencies #138 #162 #165 #169 #172 #173 !76 #184 #191 #198 #205
|
|
24
27
|
- Migration from Jenkins to Buildkite for automatic testing #163 #199
|
|
25
28
|
- Upgrade to Node 20 #208
|
|
26
29
|
|
|
27
30
|
## [7.16.0] - 2021-10-13
|
|
28
|
-
|
|
29
31
|
### Changed
|
|
30
32
|
- Default EMS version is 7.16
|
|
31
33
|
- Update dependencies using `yarn upgrade`
|
|
32
34
|
- Better error handling for HTTP responses
|
|
33
35
|
|
|
34
36
|
## [7.15.1] - 2021-09-01
|
|
35
|
-
|
|
36
37
|
### Changed
|
|
37
38
|
- Unpinned `semver` dependency [#77](https://github.com/elastic/ems-client/pull/77)
|
|
38
39
|
|
|
39
40
|
## [7.15.0] - 2021-08-12
|
|
40
|
-
|
|
41
41
|
### Changed
|
|
42
42
|
- Default EMS version is 7.15
|
|
43
43
|
- Updated dependencies via `yarn upgrade`
|
|
44
44
|
- Fix linting issues
|
|
45
|
+
|
|
45
46
|
## [7.14.0] - 2021-06-15
|
|
46
47
|
### Added
|
|
47
|
-
|
|
48
48
|
- New getters for optional field metadata `alias`, `regex`, and `values` #69
|
|
49
49
|
|
|
50
50
|
### Changed
|
|
51
|
-
|
|
52
51
|
- Default EMS version is 7.14
|
|
53
52
|
- **Breaking change** @elastic/ems-client is now licensed under the Elastic License v2. See the LICENSE.txt file in this repository #64
|
|
54
53
|
|
|
@@ -62,7 +61,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
62
61
|
- Updated dependencies using `yarn upgrade` and #44 #50
|
|
63
62
|
- Add functions to get specific file formats #53
|
|
64
63
|
|
|
65
|
-
|
|
66
64
|
## [7.10.0] - 2020-08-17
|
|
67
65
|
### Changed
|
|
68
66
|
- Default EMS version is 7.10
|
|
@@ -89,7 +87,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
89
87
|
- Convert source code to Typescript
|
|
90
88
|
- Added better linting with eslint and prettier
|
|
91
89
|
|
|
92
|
-
|
|
93
90
|
## [7.8.1] - 2020-04-06
|
|
94
91
|
### Fixed
|
|
95
92
|
- Correctly handle API urls that end in slashes
|
|
@@ -124,12 +121,10 @@ always needed and in fact breaks some client-side use of this lib
|
|
|
124
121
|
- Correctly handle API urls that end in slashes
|
|
125
122
|
|
|
126
123
|
## [7.6.0] - 2020-01-13
|
|
127
|
-
|
|
128
124
|
### Added
|
|
129
125
|
- 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)
|
|
130
126
|
|
|
131
127
|
### Changed
|
|
132
|
-
|
|
133
128
|
- 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.
|
|
134
129
|
|
|
135
130
|
- Handle relative URLs in EMS v7.6 manifests.
|
|
@@ -142,7 +137,6 @@ always needed and in fact breaks some client-side use of this lib
|
|
|
142
137
|
- Remove paragraph element from html attribution [#15](https://github.com/elastic/ems-client/pull/15)
|
|
143
138
|
|
|
144
139
|
## [7.2.1] - 2019-12-11
|
|
145
|
-
|
|
146
140
|
### Fixed
|
|
147
141
|
- Inject correct attribution into vector tile sources [#14](https://github.com/elastic/ems-client/pull/14/files)
|
|
148
142
|
|
|
@@ -153,17 +147,13 @@ Bump version to match the corresponding Elastic Maps Service version. This relea
|
|
|
153
147
|
### Fixed
|
|
154
148
|
- Update browser entry point that was pointing to an incorrect path, which fell back to the main entry
|
|
155
149
|
|
|
156
|
-
|
|
157
150
|
## [1.0.2] - 2019-10-15
|
|
158
|
-
|
|
159
151
|
### Fixed
|
|
160
152
|
- Transpile the browser-side assets to be IE compatible.
|
|
161
153
|
|
|
162
154
|
## [1.0.1] - 2019-08-27
|
|
163
|
-
|
|
164
155
|
### Fixed
|
|
165
156
|
- Downgrade node-fetch dependency to fix fetch error
|
|
166
157
|
|
|
167
158
|
## [1.0.0] - 2019-08-26
|
|
168
|
-
|
|
169
159
|
- Initial release. Compatible with Elastic Maps Service v7.2.0.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import eslint from '@eslint/js';
|
|
4
|
+
import tseslint from 'typescript-eslint';
|
|
5
|
+
import globals from 'globals';
|
|
6
|
+
|
|
7
|
+
export default tseslint.config(
|
|
8
|
+
eslint.configs.recommended,
|
|
9
|
+
...tseslint.configs.recommended,
|
|
10
|
+
{
|
|
11
|
+
ignores: ["target","*.config.js",".buildkite"]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
files: ['**/*.{ts,tsx,mts,cts}'],
|
|
15
|
+
rules: {
|
|
16
|
+
'no-undef': 'off',
|
|
17
|
+
'@typescript-eslint/ban-types': 'off'
|
|
18
|
+
},
|
|
19
|
+
"languageOptions": {
|
|
20
|
+
"globals": {
|
|
21
|
+
...globals.node
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
);
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/ems-client",
|
|
3
|
-
"version": "7.17.
|
|
3
|
+
"version": "7.17.5",
|
|
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",
|
|
7
7
|
"types": "target/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"prelint": "tsc --noEmit",
|
|
10
|
-
"lint": "
|
|
10
|
+
"lint": "prettier --check src/* && eslint .",
|
|
11
11
|
"pretest": "yarn lint",
|
|
12
12
|
"test": "jest",
|
|
13
13
|
"build": "tsc --emitDeclarationOnly && yarn build-web && yarn build-node",
|
|
@@ -35,38 +35,41 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@types/geojson": "
|
|
39
|
-
"@types/
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"semver": "7.6.2",
|
|
45
|
-
"topojson-client": "^3.1.0"
|
|
38
|
+
"@types/geojson": "7946.0.15",
|
|
39
|
+
"@types/topojson-client": "3.1.5",
|
|
40
|
+
"lodash": "4.17.21",
|
|
41
|
+
"lru-cache": "4.1.5",
|
|
42
|
+
"semver": "7.6.3",
|
|
43
|
+
"topojson-client": "3.1.0"
|
|
46
44
|
},
|
|
47
45
|
"devDependencies": {
|
|
48
|
-
"@babel/cli": "
|
|
49
|
-
"@babel/core": "
|
|
50
|
-
"@babel/plugin-proposal-class-properties": "
|
|
51
|
-
"@babel/preset-env": "
|
|
52
|
-
"@babel/preset-typescript": "
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@types/
|
|
56
|
-
"@types/
|
|
57
|
-
"@types/
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"eslint-
|
|
63
|
-
"eslint
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"prettier": "
|
|
68
|
-
"
|
|
69
|
-
"
|
|
46
|
+
"@babel/cli": "7.26.4",
|
|
47
|
+
"@babel/core": "7.26.0",
|
|
48
|
+
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
49
|
+
"@babel/preset-env": "7.26.0",
|
|
50
|
+
"@babel/preset-typescript": "7.26.0",
|
|
51
|
+
"@eslint/core": "0.9.1",
|
|
52
|
+
"@eslint/js": "9.17.0",
|
|
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/semver": "7.5.8",
|
|
59
|
+
"@types/topojson-specification": "1.0.5",
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "8.18.1",
|
|
61
|
+
"@typescript-eslint/parser": "8.18.1",
|
|
62
|
+
"babel-jest": "29.7.0",
|
|
63
|
+
"eslint": "9.17.0",
|
|
64
|
+
"eslint-config-prettier": "9.1.0",
|
|
65
|
+
"eslint-plugin-prettier": "5.2.1",
|
|
66
|
+
"globals": "15.14.0",
|
|
67
|
+
"husky": "9.1.7",
|
|
68
|
+
"jest": "29.7.0",
|
|
69
|
+
"prettier": "3.4.2",
|
|
70
|
+
"ts-jest": "29.2.5",
|
|
71
|
+
"typescript": "5.7.2",
|
|
72
|
+
"typescript-eslint": "8.18.1"
|
|
70
73
|
},
|
|
71
74
|
"engines": {
|
|
72
75
|
"node": ">=18 <=20"
|
package/src/ems_client.ts
CHANGED
|
@@ -9,7 +9,6 @@ import _ from 'lodash';
|
|
|
9
9
|
import { TMSService } from './tms_service';
|
|
10
10
|
import { EMSFormatType, FileLayer } from './file_layer';
|
|
11
11
|
import { FeatureCollection } from 'geojson';
|
|
12
|
-
import { Response } from 'node-fetch';
|
|
13
12
|
import semver from 'semver';
|
|
14
13
|
import { format as formatUrl, parse as parseUrl, UrlObject } from 'url';
|
|
15
14
|
import { toAbsoluteUrl } from './utils';
|
|
@@ -96,10 +95,10 @@ type BaseClientConfig = {
|
|
|
96
95
|
tileApiUrl: string;
|
|
97
96
|
fileApiUrl: string;
|
|
98
97
|
emsVersion?: string;
|
|
99
|
-
htmlSanitizer?:
|
|
98
|
+
htmlSanitizer?: (x: string) => string;
|
|
100
99
|
language?: string;
|
|
101
100
|
landingPageUrl?: string;
|
|
102
|
-
fetchFunction:
|
|
101
|
+
fetchFunction: (url: RequestInfo) => Promise<Response>;
|
|
103
102
|
proxyPath?: string;
|
|
104
103
|
cacheSize?: number;
|
|
105
104
|
};
|
|
@@ -204,8 +203,8 @@ export class EMSClient {
|
|
|
204
203
|
readonly EMS_LOAD_TIMEOUT = 32000;
|
|
205
204
|
private _queryParams: QueryParams;
|
|
206
205
|
private readonly _appVersion: string;
|
|
207
|
-
private readonly _fetchFunction:
|
|
208
|
-
private readonly _sanitizer:
|
|
206
|
+
private readonly _fetchFunction: (url: RequestInfo) => Promise<Response>;
|
|
207
|
+
private readonly _sanitizer: (x: string) => string;
|
|
209
208
|
private readonly _manifestServiceUrl?: string;
|
|
210
209
|
private readonly _fileApiUrl: string;
|
|
211
210
|
private readonly _tileApiUrl: string;
|
|
@@ -218,11 +217,11 @@ export class EMSClient {
|
|
|
218
217
|
/**
|
|
219
218
|
* these methods are assigned outside the constructor
|
|
220
219
|
*/
|
|
221
|
-
private _getMainCatalog!:
|
|
222
|
-
private _getDefaultTMSCatalog!:
|
|
223
|
-
private _getDefaultFileCatalog!:
|
|
224
|
-
private _loadTMSServices!:
|
|
225
|
-
private _loadFileLayers!:
|
|
220
|
+
private _getMainCatalog!: () => Promise<EmsCatalogManifest>;
|
|
221
|
+
private _getDefaultTMSCatalog!: () => Promise<EmsTmsCatalog>;
|
|
222
|
+
private _getDefaultFileCatalog!: () => Promise<EmsFileCatalog>;
|
|
223
|
+
private _loadTMSServices!: () => Promise<TMSService[]>;
|
|
224
|
+
private _loadFileLayers!: () => Promise<FileLayer[]>;
|
|
226
225
|
|
|
227
226
|
constructor(config: ClientConfig | DeprecatedClientConfig) {
|
|
228
227
|
// Remove kbnVersion in 8.0
|
|
@@ -300,7 +299,7 @@ export class EMSClient {
|
|
|
300
299
|
*/
|
|
301
300
|
addQueryParams(additionalQueryParams: { [key: string]: string }): void {
|
|
302
301
|
for (const key in additionalQueryParams) {
|
|
303
|
-
if (
|
|
302
|
+
if (Object.prototype.hasOwnProperty.call(additionalQueryParams, key)) {
|
|
304
303
|
if (additionalQueryParams[key] !== this._queryParams[key]) {
|
|
305
304
|
//changes detected.
|
|
306
305
|
this._queryParams = _.assign({}, this._queryParams, additionalQueryParams);
|
package/src/tms_service.ts
CHANGED
|
@@ -252,13 +252,12 @@ export class TMSService extends AbstractEmsService {
|
|
|
252
252
|
vectorFormats = this._getFormats(formatType, this._emsClient.getDefaultLocale());
|
|
253
253
|
}
|
|
254
254
|
if (!vectorFormats.length) {
|
|
255
|
-
// eslint-disable-next-line max-len
|
|
256
255
|
throw new Error(
|
|
257
256
|
`Cannot find ${formatType} tile layer for locale ${this._emsClient.getLocale()} or ${this._emsClient.getDefaultLocale()}`
|
|
258
257
|
);
|
|
259
258
|
}
|
|
260
259
|
const defaultStyle = vectorFormats[0];
|
|
261
|
-
if (defaultStyle &&
|
|
260
|
+
if (defaultStyle && Object.prototype.hasOwnProperty.call(defaultStyle, 'url')) {
|
|
262
261
|
return defaultStyle.url;
|
|
263
262
|
}
|
|
264
263
|
}
|
package/target/ems_client.d.ts
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
import { TMSService } from './tms_service';
|
|
2
2
|
import { EMSFormatType, FileLayer } from './file_layer';
|
|
3
3
|
import { FeatureCollection } from 'geojson';
|
|
4
|
-
|
|
4
|
+
type LocalizedStrings = {
|
|
5
5
|
[key: string]: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type BaseClientConfig = {
|
|
8
8
|
appName?: string;
|
|
9
9
|
manifestServiceUrl?: string;
|
|
10
10
|
tileApiUrl: string;
|
|
11
11
|
fileApiUrl: string;
|
|
12
12
|
emsVersion?: string;
|
|
13
|
-
htmlSanitizer?:
|
|
13
|
+
htmlSanitizer?: (x: string) => string;
|
|
14
14
|
language?: string;
|
|
15
15
|
landingPageUrl?: string;
|
|
16
|
-
fetchFunction:
|
|
16
|
+
fetchFunction: (url: RequestInfo) => Promise<Response>;
|
|
17
17
|
proxyPath?: string;
|
|
18
18
|
cacheSize?: number;
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
type DeprecatedClientConfig = BaseClientConfig & {
|
|
21
21
|
kbnVersion: string;
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
type ClientConfig = BaseClientConfig & {
|
|
24
24
|
appVersion: string;
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
type EmsCatalogService = {
|
|
27
27
|
id?: string;
|
|
28
28
|
name?: string;
|
|
29
29
|
manifest: string;
|
|
30
30
|
type: string;
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
type EmsCatalogManifest = {
|
|
33
33
|
version?: string;
|
|
34
34
|
services: EmsCatalogService[];
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
type EmsTmsCatalog = {
|
|
37
37
|
version?: string;
|
|
38
38
|
services: TMSServiceConfig[];
|
|
39
39
|
};
|
|
40
|
-
export
|
|
40
|
+
export type EmsTmsFormat = {
|
|
41
41
|
locale: string;
|
|
42
42
|
format: string;
|
|
43
43
|
url: string;
|
|
44
44
|
};
|
|
45
|
-
export
|
|
45
|
+
export type BaseEmsServiceConfig = {
|
|
46
46
|
attribution: EmsLayerAttribution[];
|
|
47
47
|
};
|
|
48
|
-
export
|
|
48
|
+
export type FileLayerConfig = BaseEmsServiceConfig & {
|
|
49
49
|
layer_id: string;
|
|
50
50
|
created_at: string;
|
|
51
51
|
formats: (EmsFileLayerFormatGeoJson | EmsFileLayerFormatTopoJson)[];
|
|
@@ -53,7 +53,7 @@ export declare type FileLayerConfig = BaseEmsServiceConfig & {
|
|
|
53
53
|
legacy_ids: string[];
|
|
54
54
|
layer_name: LocalizedStrings;
|
|
55
55
|
};
|
|
56
|
-
export
|
|
56
|
+
export type FileLayerField = {
|
|
57
57
|
type: string;
|
|
58
58
|
id: string;
|
|
59
59
|
label: LocalizedStrings;
|
|
@@ -61,27 +61,27 @@ export declare type FileLayerField = {
|
|
|
61
61
|
regex?: string;
|
|
62
62
|
alias?: string[];
|
|
63
63
|
};
|
|
64
|
-
export
|
|
64
|
+
export type TMSServiceConfig = BaseEmsServiceConfig & {
|
|
65
65
|
id: string;
|
|
66
66
|
name: {
|
|
67
67
|
en: string;
|
|
68
68
|
};
|
|
69
69
|
formats: EmsTmsFormat[];
|
|
70
70
|
};
|
|
71
|
-
|
|
71
|
+
type EmsFileCatalog = {
|
|
72
72
|
version?: string;
|
|
73
73
|
layers: FileLayerConfig[];
|
|
74
74
|
};
|
|
75
|
-
export
|
|
75
|
+
export type EmsLayerAttribution = {
|
|
76
76
|
label: LocalizedStrings;
|
|
77
77
|
url: LocalizedStrings;
|
|
78
78
|
};
|
|
79
|
-
export
|
|
79
|
+
export type EmsFileLayerFormatGeoJson = {
|
|
80
80
|
type: EMSFormatType.geojson;
|
|
81
81
|
url: string;
|
|
82
82
|
legacy_default: boolean;
|
|
83
83
|
};
|
|
84
|
-
export
|
|
84
|
+
export type EmsFileLayerFormatTopoJson = {
|
|
85
85
|
type: EMSFormatType.topojson;
|
|
86
86
|
url: string;
|
|
87
87
|
legacy_default: boolean;
|
package/target/file_layer.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare enum EMSFormatType {
|
|
|
5
5
|
geojson = "geojson",
|
|
6
6
|
topojson = "topojson"
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type EMSFormatTypeStrings = keyof typeof EMSFormatType;
|
|
9
9
|
export declare class FileLayer extends AbstractEmsService {
|
|
10
10
|
protected readonly _config: FileLayerConfig;
|
|
11
11
|
constructor(config: FileLayerConfig, emsClient: EMSClient, proxyPath: string);
|
|
@@ -167,7 +167,7 @@ class EMSClient {
|
|
|
167
167
|
*/
|
|
168
168
|
addQueryParams(additionalQueryParams) {
|
|
169
169
|
for (const key in additionalQueryParams) {
|
|
170
|
-
if (
|
|
170
|
+
if (Object.prototype.hasOwnProperty.call(additionalQueryParams, key)) {
|
|
171
171
|
if (additionalQueryParams[key] !== this._queryParams[key]) {
|
|
172
172
|
//changes detected.
|
|
173
173
|
this._queryParams = _lodash.default.assign({}, this._queryParams, additionalQueryParams);
|
|
@@ -184,11 +184,10 @@ class TMSService extends _ems_service.AbstractEmsService {
|
|
|
184
184
|
vectorFormats = this._getFormats(formatType, this._emsClient.getDefaultLocale());
|
|
185
185
|
}
|
|
186
186
|
if (!vectorFormats.length) {
|
|
187
|
-
// eslint-disable-next-line max-len
|
|
188
187
|
throw new Error(`Cannot find ${formatType} tile layer for locale ${this._emsClient.getLocale()} or ${this._emsClient.getDefaultLocale()}`);
|
|
189
188
|
}
|
|
190
189
|
const defaultStyle = vectorFormats[0];
|
|
191
|
-
if (defaultStyle &&
|
|
190
|
+
if (defaultStyle && Object.prototype.hasOwnProperty.call(defaultStyle, 'url')) {
|
|
192
191
|
return defaultStyle.url;
|
|
193
192
|
}
|
|
194
193
|
}
|
package/target/tms_service.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EMSClient, TMSServiceConfig } from './ems_client';
|
|
2
2
|
import { AbstractEmsService } from './ems_service';
|
|
3
|
-
|
|
3
|
+
type EmsVectorSource = {
|
|
4
4
|
type: 'vector';
|
|
5
5
|
url: string;
|
|
6
6
|
tiles: string[];
|
|
@@ -10,10 +10,10 @@ declare type EmsVectorSource = {
|
|
|
10
10
|
maxzoom?: number;
|
|
11
11
|
attribution?: string;
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
type EmsVectorSources = {
|
|
14
14
|
[sourceName: string]: EmsVectorSource;
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
type EmsVectorStyle = {
|
|
17
17
|
sources: EmsVectorSources;
|
|
18
18
|
sprite: string;
|
|
19
19
|
glyphs: string;
|
|
@@ -28,17 +28,17 @@ declare type EmsVectorStyle = {
|
|
|
28
28
|
version: number;
|
|
29
29
|
zoom?: number;
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
type EmsSprite = {
|
|
32
32
|
height: number;
|
|
33
33
|
pixelRatio: number;
|
|
34
34
|
width: number;
|
|
35
35
|
x: number;
|
|
36
36
|
y: number;
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
type EmsSpriteSheet = {
|
|
39
39
|
[spriteName: string]: EmsSprite;
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
type EmsRasterStyle = {
|
|
42
42
|
tilejson: string;
|
|
43
43
|
name: string;
|
|
44
44
|
attribution: string;
|
package/target/web/ems_client.js
CHANGED
|
@@ -161,7 +161,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
161
161
|
}, {
|
|
162
162
|
key: "getManifest",
|
|
163
163
|
value: (function () {
|
|
164
|
-
var _getManifest = _asyncToGenerator(
|
|
164
|
+
var _getManifest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(endpointUrl) {
|
|
165
165
|
var url, response;
|
|
166
166
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
167
167
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -225,7 +225,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
225
225
|
key: "addQueryParams",
|
|
226
226
|
value: function addQueryParams(additionalQueryParams) {
|
|
227
227
|
for (var _key in additionalQueryParams) {
|
|
228
|
-
if (
|
|
228
|
+
if (Object.prototype.hasOwnProperty.call(additionalQueryParams, _key)) {
|
|
229
229
|
if (additionalQueryParams[_key] !== this._queryParams[_key]) {
|
|
230
230
|
//changes detected.
|
|
231
231
|
this._queryParams = _.assign({}, this._queryParams, additionalQueryParams);
|
|
@@ -238,7 +238,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
238
238
|
}, {
|
|
239
239
|
key: "getMainManifest",
|
|
240
240
|
value: function () {
|
|
241
|
-
var _getMainManifest = _asyncToGenerator(
|
|
241
|
+
var _getMainManifest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
242
242
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
243
243
|
while (1) switch (_context2.prev = _context2.next) {
|
|
244
244
|
case 0:
|
|
@@ -260,7 +260,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
260
260
|
}, {
|
|
261
261
|
key: "getDefaultFileManifest",
|
|
262
262
|
value: function () {
|
|
263
|
-
var _getDefaultFileManifest = _asyncToGenerator(
|
|
263
|
+
var _getDefaultFileManifest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
264
264
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
265
265
|
while (1) switch (_context3.prev = _context3.next) {
|
|
266
266
|
case 0:
|
|
@@ -282,7 +282,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
282
282
|
}, {
|
|
283
283
|
key: "getDefaultTMSManifest",
|
|
284
284
|
value: function () {
|
|
285
|
-
var _getDefaultTMSManifest = _asyncToGenerator(
|
|
285
|
+
var _getDefaultTMSManifest = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
286
286
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
287
287
|
while (1) switch (_context4.prev = _context4.next) {
|
|
288
288
|
case 0:
|
|
@@ -304,7 +304,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
304
304
|
}, {
|
|
305
305
|
key: "getFileLayers",
|
|
306
306
|
value: function () {
|
|
307
|
-
var _getFileLayers = _asyncToGenerator(
|
|
307
|
+
var _getFileLayers = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
308
308
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
309
309
|
while (1) switch (_context5.prev = _context5.next) {
|
|
310
310
|
case 0:
|
|
@@ -326,7 +326,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
326
326
|
}, {
|
|
327
327
|
key: "getTMSServices",
|
|
328
328
|
value: function () {
|
|
329
|
-
var _getTMSServices = _asyncToGenerator(
|
|
329
|
+
var _getTMSServices = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
330
330
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
331
331
|
while (1) switch (_context6.prev = _context6.next) {
|
|
332
332
|
case 0:
|
|
@@ -386,7 +386,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
386
386
|
}, {
|
|
387
387
|
key: "findFileLayerById",
|
|
388
388
|
value: function () {
|
|
389
|
-
var _findFileLayerById = _asyncToGenerator(
|
|
389
|
+
var _findFileLayerById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(id) {
|
|
390
390
|
var fileLayers, i;
|
|
391
391
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
392
392
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -424,7 +424,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
424
424
|
}, {
|
|
425
425
|
key: "findTMSServiceById",
|
|
426
426
|
value: function () {
|
|
427
|
-
var _findTMSServiceById = _asyncToGenerator(
|
|
427
|
+
var _findTMSServiceById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(id) {
|
|
428
428
|
var tmsServices, i;
|
|
429
429
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
430
430
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -490,7 +490,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
490
490
|
}, {
|
|
491
491
|
key: "_getManifestWithParams",
|
|
492
492
|
value: function () {
|
|
493
|
-
var _getManifestWithParams2 = _asyncToGenerator(
|
|
493
|
+
var _getManifestWithParams2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(url) {
|
|
494
494
|
var extendedUrl;
|
|
495
495
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
496
496
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -516,7 +516,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
516
516
|
value: function _invalidateSettings() {
|
|
517
517
|
var _this2 = this;
|
|
518
518
|
this._cache.reset();
|
|
519
|
-
this._getMainCatalog = _.once(
|
|
519
|
+
this._getMainCatalog = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
520
520
|
var services;
|
|
521
521
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
522
522
|
while (1) switch (_context10.prev = _context10.next) {
|
|
@@ -553,7 +553,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
553
553
|
}
|
|
554
554
|
}, _callee10);
|
|
555
555
|
})));
|
|
556
|
-
this._getDefaultTMSCatalog = _.once(
|
|
556
|
+
this._getDefaultTMSCatalog = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
557
557
|
var catalogue, firstService, url;
|
|
558
558
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
559
559
|
while (1) switch (_context11.prev = _context11.next) {
|
|
@@ -584,7 +584,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
584
584
|
}
|
|
585
585
|
}, _callee11);
|
|
586
586
|
})));
|
|
587
|
-
this._getDefaultFileCatalog = _.once(
|
|
587
|
+
this._getDefaultFileCatalog = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
588
588
|
var catalogue, firstService, url;
|
|
589
589
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
590
590
|
while (1) switch (_context12.prev = _context12.next) {
|
|
@@ -617,7 +617,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
617
617
|
})));
|
|
618
618
|
|
|
619
619
|
//Cache the actual instances of TMSService as these in turn cache sub-manifests for the style-files
|
|
620
|
-
this._loadTMSServices = _.once(
|
|
620
|
+
this._loadTMSServices = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
621
621
|
var tmsManifest;
|
|
622
622
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
623
623
|
while (1) switch (_context13.prev = _context13.next) {
|
|
@@ -635,7 +635,7 @@ export var EMSClient = /*#__PURE__*/function () {
|
|
|
635
635
|
}
|
|
636
636
|
}, _callee13);
|
|
637
637
|
})));
|
|
638
|
-
this._loadFileLayers = _.once(
|
|
638
|
+
this._loadFileLayers = _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
639
639
|
var fileManifest;
|
|
640
640
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
641
641
|
while (1) switch (_context14.prev = _context14.next) {
|
package/target/web/file_layer.js
CHANGED
|
@@ -45,7 +45,7 @@ export var FileLayer = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
45
45
|
return _createClass(FileLayer, [{
|
|
46
46
|
key: "getGeoJson",
|
|
47
47
|
value: function () {
|
|
48
|
-
var _getGeoJson = _asyncToGenerator(
|
|
48
|
+
var _getGeoJson = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
49
49
|
var cachedGeoJson, format, fetchUrl, geojson, fetchedJson, _meta$feature_collect, meta, featureCollectionPath;
|
|
50
50
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
51
51
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -35,7 +35,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
35
35
|
_classCallCheck(this, TMSService);
|
|
36
36
|
_this = _callSuper(this, TMSService, [config, emsClient, proxyPath]);
|
|
37
37
|
_defineProperty(_this, "_config", void 0);
|
|
38
|
-
_defineProperty(_this, "_getRasterStyleJson", _.once(
|
|
38
|
+
_defineProperty(_this, "_getRasterStyleJson", _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
39
39
|
var rasterUrl, url;
|
|
40
40
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
41
41
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -55,7 +55,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
55
55
|
}
|
|
56
56
|
}, _callee);
|
|
57
57
|
}))));
|
|
58
|
-
_defineProperty(_this, "_getVectorStyleJsonRaw", _.once(
|
|
58
|
+
_defineProperty(_this, "_getVectorStyleJsonRaw", _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
59
59
|
var vectorUrl, url, vectorJson;
|
|
60
60
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
61
61
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -79,7 +79,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
79
79
|
}
|
|
80
80
|
}, _callee2);
|
|
81
81
|
}))));
|
|
82
|
-
_defineProperty(_this, "_getVectorStyleJsonInlined", _.once(
|
|
82
|
+
_defineProperty(_this, "_getVectorStyleJsonInlined", _.once(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
83
83
|
var vectorJson, inlinedSources, sources, _iterator, _step, _sourceName, url, sourceUrl, extendedUrl, sourceJson, extendedTileUrls;
|
|
84
84
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
85
85
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -166,7 +166,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
166
166
|
return _createClass(TMSService, [{
|
|
167
167
|
key: "getDefaultRasterStyle",
|
|
168
168
|
value: function () {
|
|
169
|
-
var _getDefaultRasterStyle = _asyncToGenerator(
|
|
169
|
+
var _getDefaultRasterStyle = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
170
170
|
var _this2 = this;
|
|
171
171
|
var tileJson, tiles;
|
|
172
172
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
@@ -202,7 +202,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
202
202
|
}, {
|
|
203
203
|
key: "getUrlTemplate",
|
|
204
204
|
value: function () {
|
|
205
|
-
var _getUrlTemplate = _asyncToGenerator(
|
|
205
|
+
var _getUrlTemplate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
206
206
|
var tileJson, directUrl;
|
|
207
207
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
208
208
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -233,7 +233,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
233
233
|
}, {
|
|
234
234
|
key: "getUrlTemplateForVector",
|
|
235
235
|
value: function () {
|
|
236
|
-
var _getUrlTemplateForVector = _asyncToGenerator(
|
|
236
|
+
var _getUrlTemplateForVector = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(sourceId) {
|
|
237
237
|
var tileJson, directUrl;
|
|
238
238
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
239
239
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -270,7 +270,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
270
270
|
}, {
|
|
271
271
|
key: "getVectorStyleSheet",
|
|
272
272
|
value: function () {
|
|
273
|
-
var _getVectorStyleSheet = _asyncToGenerator(
|
|
273
|
+
var _getVectorStyleSheet = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
274
274
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
275
275
|
while (1) switch (_context7.prev = _context7.next) {
|
|
276
276
|
case 0:
|
|
@@ -292,7 +292,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
292
292
|
}, {
|
|
293
293
|
key: "getVectorStyleSheetRaw",
|
|
294
294
|
value: function () {
|
|
295
|
-
var _getVectorStyleSheetRaw = _asyncToGenerator(
|
|
295
|
+
var _getVectorStyleSheetRaw = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
296
296
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
297
297
|
while (1) switch (_context8.prev = _context8.next) {
|
|
298
298
|
case 0:
|
|
@@ -314,7 +314,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
314
314
|
}, {
|
|
315
315
|
key: "getSpriteSheetMeta",
|
|
316
316
|
value: function () {
|
|
317
|
-
var _getSpriteSheetMeta = _asyncToGenerator(
|
|
317
|
+
var _getSpriteSheetMeta = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
318
318
|
var isRetina,
|
|
319
319
|
metaUrl,
|
|
320
320
|
spritePngs,
|
|
@@ -362,7 +362,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
362
362
|
}, {
|
|
363
363
|
key: "getSpriteSheetJsonPath",
|
|
364
364
|
value: function () {
|
|
365
|
-
var _getSpriteSheetJsonPath = _asyncToGenerator(
|
|
365
|
+
var _getSpriteSheetJsonPath = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
366
366
|
var isRetina,
|
|
367
367
|
spriteSheetRootPath,
|
|
368
368
|
suffix,
|
|
@@ -397,7 +397,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
397
397
|
}, {
|
|
398
398
|
key: "getSpriteSheetPngPath",
|
|
399
399
|
value: function () {
|
|
400
|
-
var _getSpriteSheetPngPath = _asyncToGenerator(
|
|
400
|
+
var _getSpriteSheetPngPath = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
401
401
|
var isRetina,
|
|
402
402
|
spriteSheetRootPath,
|
|
403
403
|
suffix,
|
|
@@ -437,7 +437,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
437
437
|
}, {
|
|
438
438
|
key: "getMinZoom",
|
|
439
439
|
value: function () {
|
|
440
|
-
var _getMinZoom = _asyncToGenerator(
|
|
440
|
+
var _getMinZoom = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
441
441
|
var tileJson;
|
|
442
442
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
443
443
|
while (1) switch (_context12.prev = _context12.next) {
|
|
@@ -467,7 +467,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
467
467
|
}, {
|
|
468
468
|
key: "getMaxZoom",
|
|
469
469
|
value: function () {
|
|
470
|
-
var _getMaxZoom = _asyncToGenerator(
|
|
470
|
+
var _getMaxZoom = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
471
471
|
var tileJson;
|
|
472
472
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
473
473
|
while (1) switch (_context13.prev = _context13.next) {
|
|
@@ -518,11 +518,10 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
518
518
|
vectorFormats = this._getFormats(formatType, this._emsClient.getDefaultLocale());
|
|
519
519
|
}
|
|
520
520
|
if (!vectorFormats.length) {
|
|
521
|
-
// eslint-disable-next-line max-len
|
|
522
521
|
throw new Error("Cannot find ".concat(formatType, " tile layer for locale ").concat(this._emsClient.getLocale(), " or ").concat(this._emsClient.getDefaultLocale()));
|
|
523
522
|
}
|
|
524
523
|
var defaultStyle = vectorFormats[0];
|
|
525
|
-
if (defaultStyle &&
|
|
524
|
+
if (defaultStyle && Object.prototype.hasOwnProperty.call(defaultStyle, 'url')) {
|
|
526
525
|
return defaultStyle.url;
|
|
527
526
|
}
|
|
528
527
|
}
|
|
@@ -536,7 +535,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
536
535
|
}, {
|
|
537
536
|
key: "_getSpriteSheetRootPath",
|
|
538
537
|
value: function () {
|
|
539
|
-
var _getSpriteSheetRootPath2 = _asyncToGenerator(
|
|
538
|
+
var _getSpriteSheetRootPath2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
540
539
|
var vectorStyleJson;
|
|
541
540
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
542
541
|
while (1) switch (_context14.prev = _context14.next) {
|
|
@@ -566,7 +565,7 @@ export var TMSService = /*#__PURE__*/function (_AbstractEmsService) {
|
|
|
566
565
|
}, {
|
|
567
566
|
key: "_getUrlTemplateForGlyphs",
|
|
568
567
|
value: function () {
|
|
569
|
-
var _getUrlTemplateForGlyphs2 = _asyncToGenerator(
|
|
568
|
+
var _getUrlTemplateForGlyphs2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
570
569
|
var vectorStyleJson;
|
|
571
570
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
572
571
|
while (1) switch (_context15.prev = _context15.next) {
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`.getFileLayers[1] - getGeoJson defaults should convert topojson to geojson 1`] = `
|
|
4
|
-
|
|
5
|
-
"features":
|
|
6
|
-
|
|
7
|
-
"geometry":
|
|
8
|
-
"coordinates":
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
{
|
|
5
|
+
"features": [
|
|
6
|
+
{
|
|
7
|
+
"geometry": {
|
|
8
|
+
"coordinates": [
|
|
9
|
+
[
|
|
10
|
+
[
|
|
11
11
|
72.77144284428442,
|
|
12
12
|
62.593,
|
|
13
13
|
],
|
|
14
|
-
|
|
14
|
+
[
|
|
15
15
|
50.625,
|
|
16
16
|
50.06444104410441,
|
|
17
17
|
],
|
|
18
|
-
|
|
18
|
+
[
|
|
19
19
|
91.7565793579358,
|
|
20
20
|
35.46,
|
|
21
21
|
],
|
|
22
|
-
|
|
22
|
+
[
|
|
23
23
|
93.867,
|
|
24
24
|
58.2621401140114,
|
|
25
25
|
],
|
|
26
|
-
|
|
26
|
+
[
|
|
27
27
|
72.77144284428442,
|
|
28
28
|
62.593,
|
|
29
29
|
],
|
|
@@ -31,7 +31,7 @@ Object {
|
|
|
31
31
|
],
|
|
32
32
|
"type": "Polygon",
|
|
33
33
|
},
|
|
34
|
-
"properties":
|
|
34
|
+
"properties": {
|
|
35
35
|
"foo": "bar",
|
|
36
36
|
},
|
|
37
37
|
"type": "Feature",
|
|
@@ -42,29 +42,29 @@ Object {
|
|
|
42
42
|
`;
|
|
43
43
|
|
|
44
44
|
exports[`.getFileLayers[1] - getGeoJson limited cache 1`] = `
|
|
45
|
-
|
|
46
|
-
"features":
|
|
47
|
-
|
|
48
|
-
"geometry":
|
|
49
|
-
"coordinates":
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
{
|
|
46
|
+
"features": [
|
|
47
|
+
{
|
|
48
|
+
"geometry": {
|
|
49
|
+
"coordinates": [
|
|
50
|
+
[
|
|
51
|
+
[
|
|
52
52
|
72.77144284428442,
|
|
53
53
|
62.593,
|
|
54
54
|
],
|
|
55
|
-
|
|
55
|
+
[
|
|
56
56
|
50.625,
|
|
57
57
|
50.06444104410441,
|
|
58
58
|
],
|
|
59
|
-
|
|
59
|
+
[
|
|
60
60
|
91.7565793579358,
|
|
61
61
|
35.46,
|
|
62
62
|
],
|
|
63
|
-
|
|
63
|
+
[
|
|
64
64
|
93.867,
|
|
65
65
|
58.2621401140114,
|
|
66
66
|
],
|
|
67
|
-
|
|
67
|
+
[
|
|
68
68
|
72.77144284428442,
|
|
69
69
|
62.593,
|
|
70
70
|
],
|
|
@@ -72,7 +72,7 @@ Object {
|
|
|
72
72
|
],
|
|
73
73
|
"type": "Polygon",
|
|
74
74
|
},
|
|
75
|
-
"properties":
|
|
75
|
+
"properties": {
|
|
76
76
|
"foo": "bar",
|
|
77
77
|
},
|
|
78
78
|
"type": "Feature",
|
package/test/ems_client_util.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { EMSClient } from '../src';
|
|
9
|
-
import fetch from 'node-fetch';
|
|
10
9
|
|
|
11
10
|
import EMS_CATALOGUE from './ems_mocks/sample_manifest.json';
|
|
12
11
|
import EMS_FILES from './ems_mocks/sample_files.json';
|
|
@@ -42,7 +41,7 @@ export function getEMSClient(options = {}) {
|
|
|
42
41
|
|
|
43
42
|
const getManifestMock = jest
|
|
44
43
|
.spyOn(emsClient, 'getManifest')
|
|
45
|
-
.mockImplementation(async (url: string): Promise<
|
|
44
|
+
.mockImplementation(async (url: string): Promise<object | unknown> => {
|
|
46
45
|
//simulate network calls
|
|
47
46
|
if (url.startsWith('https://foobar')) {
|
|
48
47
|
return EMS_CATALOGUE;
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/target
|
package/.eslintrc
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"parser": "@typescript-eslint/parser",
|
|
3
|
-
"plugins": ["@typescript-eslint"],
|
|
4
|
-
"extends": [
|
|
5
|
-
"plugin:@typescript-eslint/recommended",
|
|
6
|
-
"prettier/@typescript-eslint",
|
|
7
|
-
"plugin:prettier/recommended"
|
|
8
|
-
],
|
|
9
|
-
"rules": {
|
|
10
|
-
"@typescript-eslint/member-ordering": 2,
|
|
11
|
-
"@typescript-eslint/camelcase": 0,
|
|
12
|
-
"@typescript-eslint/no-explicit-any": 0,
|
|
13
|
-
"@typescript-eslint/no-inferrable-types": 0,
|
|
14
|
-
"@typescript-eslint/explicit-function-return-type": 0,
|
|
15
|
-
"@typescript-eslint/no-non-null-assertion": 0,
|
|
16
|
-
"@typescript-eslint/interface-name-prefix": 0
|
|
17
|
-
}
|
|
18
|
-
}
|