@elastic/ems-client 8.6.3 → 8.8.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 +2 -4
- package/.buildkite/compare_dependencies.js +15 -0
- package/.buildkite/pipeline.yml +1 -1
- package/.github/workflows/backport.yml +2 -2
- package/.github/workflows/publish.yml +30 -0
- package/.nvmrc +1 -1
- package/CHANGELOG.md +14 -0
- package/CONTRIBUTING.md +4 -6
- package/babel.config.js +2 -3
- package/eslint.config.mjs +2 -4
- package/package.json +35 -32
- package/renovate.json +15 -8
- package/src/ems_client.ts +4 -4
- package/src/file_layer.ts +1 -1
- package/target/ems_client.d.ts +1 -1
- package/target/file_layer.d.ts +1 -1
- package/target/node/ems_client.js +31 -28
- package/target/node/ems_service.js +17 -16
- package/target/node/file_layer.js +5 -6
- package/target/node/tms_service.js +275 -273
- package/target/node/utils.js +4 -2
- package/target/web/ems_client.js +217 -533
- package/target/web/ems_service.js +35 -49
- package/target/web/file_layer.js +118 -212
- package/target/web/tms_service.js +478 -914
- package/target/web/utils.js +15 -16
- package/test/__snapshots__/ems_client.test.ts.snap +1 -1
- package/tsconfig.json +8 -5
- package/target/origin.d.ts +0 -4
package/.backportrc.json
CHANGED
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
"repoOwner": "elastic",
|
|
3
3
|
"repoName": "ems-client",
|
|
4
4
|
"targetBranchChoices": [
|
|
5
|
-
"master"
|
|
6
|
-
"7.17"
|
|
5
|
+
"master"
|
|
7
6
|
],
|
|
8
7
|
"branchLabelMapping": {
|
|
9
|
-
"^v8.\\d+.\\d+$": "master"
|
|
10
|
-
"^v7.\\d+.\\d+$": "7.17"
|
|
8
|
+
"^v8.\\d+.\\d+$": "master"
|
|
11
9
|
},
|
|
12
10
|
"targetPRLabels": ["backport"],
|
|
13
11
|
"commitConflicts": true,
|
|
@@ -17,10 +17,25 @@ const DEFAULT_BRANCH = 'main';
|
|
|
17
17
|
const branch = process.env.KIBANA_BRANCH || DEFAULT_BRANCH;
|
|
18
18
|
const kibanaPackageUrl = `https://raw.githubusercontent.com/elastic/kibana/${branch}/package.json`;
|
|
19
19
|
|
|
20
|
+
// Dependencies that are allowed to be ahead of Kibana, with the reason.
|
|
21
|
+
// Remove an entry once Kibana catches up.
|
|
22
|
+
const IGNORED_DEPENDENCIES = {
|
|
23
|
+
'maplibre-gl':
|
|
24
|
+
'Kibana upgrades to 6.4.1 in https://github.com/elastic/kibana/pull/301722 and overrides the ems-client version meanwhile',
|
|
25
|
+
};
|
|
26
|
+
|
|
20
27
|
const processDependency = function (dependency, srcDeps, dstDeps, dstDevDeps) {
|
|
21
28
|
if (!(dependency in dstDeps) && !(dependency in dstDevDeps)) {
|
|
22
29
|
return true;
|
|
23
30
|
}
|
|
31
|
+
|
|
32
|
+
if (dependency in IGNORED_DEPENDENCIES) {
|
|
33
|
+
const destination = dstDeps[dependency] || dstDevDeps[dependency];
|
|
34
|
+
console.log(
|
|
35
|
+
`⏭ ${dependency}: ${srcDeps[dependency]} vs ${destination} (ignored: ${IGNORED_DEPENDENCIES[dependency]})`
|
|
36
|
+
);
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
24
39
|
const source = srcDeps[dependency].replace('^', '');
|
|
25
40
|
const destination = dstDeps[dependency] || dstDevDeps[dependency];
|
|
26
41
|
|
package/.buildkite/pipeline.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
agents:
|
|
2
|
-
image: "docker.elastic.co/ci-agent-images/ems/buildkite-agent-
|
|
2
|
+
image: "docker.elastic.co/ci-agent-images/ems/buildkite-agent-node24:1783438567@sha256:24f8a6deec508b11e4e0748df2af4439f888d9d616eabd3beb0891b9184c8edf"
|
|
3
3
|
cpu: "2"
|
|
4
4
|
memory: "2G"
|
|
5
5
|
|
|
@@ -11,9 +11,9 @@ jobs:
|
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
steps:
|
|
13
13
|
- name: Backport Action
|
|
14
|
-
uses: sorenlouv/backport-github-action@
|
|
14
|
+
uses: sorenlouv/backport-github-action@8a6c0381851f43f9f1fddc7303f0e9015eb57b62 # v12.0.4
|
|
15
15
|
with:
|
|
16
|
-
github_token: ${{ secrets.
|
|
16
|
+
github_token: ${{ secrets.BACKPORT_TOKEN }}
|
|
17
17
|
|
|
18
18
|
- name: Info log
|
|
19
19
|
if: ${{ success() }}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
id-token: write
|
|
14
|
+
env:
|
|
15
|
+
# setup-node v7 no longer exports a placeholder token (v6 did), and every yarn
|
|
16
|
+
# command fails on ${NODE_AUTH_TOKEN} in the generated .npmrc. Publishing uses OIDC.
|
|
17
|
+
NODE_AUTH_TOKEN: XXXXX-XXXXX-XXXXX-XXXXX
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
20
|
+
|
|
21
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
22
|
+
with:
|
|
23
|
+
node-version: "24"
|
|
24
|
+
registry-url: "https://registry.npmjs.org"
|
|
25
|
+
|
|
26
|
+
- run: yarn install --frozen-lockfile
|
|
27
|
+
|
|
28
|
+
- run: yarn build
|
|
29
|
+
|
|
30
|
+
- run: npm publish --provenance --access public
|
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
24
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@ 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.8.0] - 2026-10-29
|
|
7
|
+
### Changed
|
|
8
|
+
- Upgraded maplibre-gl from v5 to v6.4.1, the version Kibana upgrades to in elastic/kibana#301722 #1243
|
|
9
|
+
- Require Node.js 24 (`engines.node` is now `>=24`) #1236
|
|
10
|
+
- Ignore maplibre-gl in the Kibana dependencies check and hold it at 6.4.1 in Renovate until Kibana moves on #1243
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [8.7.0] - 2026-04-09
|
|
14
|
+
### Changed
|
|
15
|
+
- Upgraded maplibre-gl from v3 to v5 #650 #693
|
|
16
|
+
- Upgraded lru-cache from v4 to v11 #663
|
|
17
|
+
- Added Node.js 24 support #1012
|
|
18
|
+
- Update dependencies (search PRs for `is:pr label:v8.6.4 label:dependencies `)
|
|
19
|
+
|
|
6
20
|
## [8.6.3] - 2025-01-15
|
|
7
21
|
### Changed
|
|
8
22
|
- Upgrade to Node 22 #552
|
package/CONTRIBUTING.md
CHANGED
|
@@ -9,16 +9,14 @@
|
|
|
9
9
|
|
|
10
10
|
If you have access to make releases, the process is as follows:
|
|
11
11
|
|
|
12
|
-
1. Be sure you have checked out the `master`
|
|
12
|
+
1. Be sure you have checked out the `master` branch and have pulled latest changes
|
|
13
13
|
1. Update the version in `package.json` accordingly.
|
|
14
14
|
1. Update the CHANGELOG.md
|
|
15
15
|
1. Commit changes with message "bump to x.y.z" where x.y.z is the version in package.json
|
|
16
|
-
1. Tag the commit with `git tag vx.y.
|
|
16
|
+
1. Tag the commit with `git tag vx.y.z`, for example `git tag v7.2.1`
|
|
17
17
|
1. Push commits and tags upstream with `git push upstream master && git push upstream --tags` (and optionally to your own fork as well)
|
|
18
|
-
1.
|
|
19
|
-
1.
|
|
20
|
-
1. Publish to npm with `npm publish --access public`
|
|
21
|
-
1. If necessary, push the new branch upstream and create/archive Snyk targets
|
|
18
|
+
1. The [publish workflow](.github/workflows/publish.yml) will automatically build and publish to npm via [npm Trusted Publishers](https://docs.npmjs.com/trusted-publishers) when the tag is pushed
|
|
19
|
+
1. Monitor the publish run in the repository's [Actions tab](https://github.com/elastic/ems-client/actions/workflows/publish.yml)
|
|
22
20
|
|
|
23
21
|
## Continuous Integration
|
|
24
22
|
|
package/babel.config.js
CHANGED
|
@@ -5,9 +5,7 @@ module.exports = {
|
|
|
5
5
|
[
|
|
6
6
|
'@babel/preset-env',
|
|
7
7
|
{
|
|
8
|
-
useBuiltIns: 'entry',
|
|
9
8
|
modules: false,
|
|
10
|
-
corejs: 3,
|
|
11
9
|
},
|
|
12
10
|
],
|
|
13
11
|
],
|
|
@@ -20,6 +18,7 @@ module.exports = {
|
|
|
20
18
|
targets: {
|
|
21
19
|
node: 'current',
|
|
22
20
|
},
|
|
21
|
+
modules: 'commonjs',
|
|
23
22
|
},
|
|
24
23
|
],
|
|
25
24
|
],
|
|
@@ -32,11 +31,11 @@ module.exports = {
|
|
|
32
31
|
targets: {
|
|
33
32
|
node: 'current',
|
|
34
33
|
},
|
|
34
|
+
modules: 'commonjs',
|
|
35
35
|
},
|
|
36
36
|
],
|
|
37
37
|
],
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
presets: ['@babel/preset-typescript'],
|
|
41
|
-
plugins: ['@babel/plugin-proposal-class-properties'],
|
|
42
41
|
};
|
package/eslint.config.mjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
1
|
import eslint from '@eslint/js';
|
|
4
2
|
import tseslint from 'typescript-eslint';
|
|
5
3
|
import globals from 'globals';
|
|
6
4
|
|
|
7
|
-
export default
|
|
5
|
+
export default [
|
|
8
6
|
eslint.configs.recommended,
|
|
9
7
|
...tseslint.configs.recommended,
|
|
10
8
|
{
|
|
@@ -22,4 +20,4 @@ export default tseslint.config(
|
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
},
|
|
25
|
-
|
|
23
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/ems-client",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.8.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,46 +31,49 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/elastic/ems-client#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@types/geojson": "7946.0.
|
|
34
|
+
"@types/geojson": "7946.0.16",
|
|
35
35
|
"@types/topojson-client": "3.1.5",
|
|
36
36
|
"chroma-js": "2.4.2",
|
|
37
|
-
"lodash": "^4.
|
|
38
|
-
"lru-cache": "
|
|
39
|
-
"maplibre-gl": "
|
|
40
|
-
"semver": "
|
|
37
|
+
"lodash": "^4.18.1",
|
|
38
|
+
"lru-cache": "11.5.3",
|
|
39
|
+
"maplibre-gl": "6.4.1",
|
|
40
|
+
"semver": "7.8.5",
|
|
41
41
|
"topojson-client": "^3.1.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@babel/cli": "
|
|
45
|
-
"@babel/core": "
|
|
46
|
-
"@babel/
|
|
47
|
-
"@babel/preset-
|
|
48
|
-
"@
|
|
49
|
-
"@eslint/
|
|
50
|
-
"@eslint/js": "9.18.0",
|
|
44
|
+
"@babel/cli": "8.0.6",
|
|
45
|
+
"@babel/core": "8.0.7",
|
|
46
|
+
"@babel/preset-env": "8.0.7",
|
|
47
|
+
"@babel/preset-typescript": "8.0.7",
|
|
48
|
+
"@eslint/core": "1.2.1",
|
|
49
|
+
"@eslint/js": "10.0.1",
|
|
51
50
|
"@types/chroma-js": "2.4.5",
|
|
52
|
-
"@types/
|
|
53
|
-
"@types/
|
|
54
|
-
"@types/
|
|
55
|
-
"@types/
|
|
56
|
-
"@types/
|
|
57
|
-
"@types/semver": "7.5.8",
|
|
51
|
+
"@types/jest": "30.0.0",
|
|
52
|
+
"@types/lodash": "4.17.27",
|
|
53
|
+
"@types/lru-cache": "7.10.10",
|
|
54
|
+
"@types/node": "24.19.2",
|
|
55
|
+
"@types/semver": "7.8.0",
|
|
58
56
|
"@types/topojson-specification": "1.0.5",
|
|
59
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
60
|
-
"@typescript-eslint/parser": "8.
|
|
61
|
-
"babel-jest": "
|
|
62
|
-
"eslint": "
|
|
63
|
-
"eslint-config-prettier": "10.
|
|
64
|
-
"eslint-plugin-prettier": "5.
|
|
65
|
-
"globals": "
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "8.72.0",
|
|
58
|
+
"@typescript-eslint/parser": "8.72.0",
|
|
59
|
+
"babel-jest": "30.5.2",
|
|
60
|
+
"eslint": "10.13.0",
|
|
61
|
+
"eslint-config-prettier": "10.1.8",
|
|
62
|
+
"eslint-plugin-prettier": "5.5.7",
|
|
63
|
+
"globals": "17.13.0",
|
|
66
64
|
"husky": "9.1.7",
|
|
67
|
-
"jest": "
|
|
68
|
-
"prettier": "3.
|
|
69
|
-
"ts-jest": "29.
|
|
70
|
-
"typescript": "
|
|
71
|
-
"typescript-eslint": "8.
|
|
65
|
+
"jest": "30.5.2",
|
|
66
|
+
"prettier": "3.9.10",
|
|
67
|
+
"ts-jest": "29.4.15",
|
|
68
|
+
"typescript": "6.0.3",
|
|
69
|
+
"typescript-eslint": "8.72.0"
|
|
70
|
+
},
|
|
71
|
+
"resolutions": {
|
|
72
|
+
"**/glob": "^13.0.6",
|
|
73
|
+
"**/minimatch": "^10.2.5",
|
|
74
|
+
"**/protocol-buffers-schema": "^3.6.1"
|
|
72
75
|
},
|
|
73
76
|
"engines": {
|
|
74
|
-
"node": ">=
|
|
77
|
+
"node": ">=24"
|
|
75
78
|
}
|
|
76
79
|
}
|
package/renovate.json
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
],
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"v7.17.6",
|
|
9
|
-
"v8.6.3"
|
|
10
|
-
],
|
|
3
|
+
"enabled": true,
|
|
4
|
+
"minimumReleaseAge": "14 days",
|
|
5
|
+
"extends": ["github>elastic/renovate-config"],
|
|
6
|
+
"baseBranchPatterns": ["master"],
|
|
7
|
+
"labels": ["dependencies"],
|
|
11
8
|
"packageRules": [
|
|
12
9
|
{
|
|
13
10
|
"matchUpdateTypes": ["minor", "patch"],
|
|
@@ -16,6 +13,16 @@
|
|
|
16
13
|
{
|
|
17
14
|
"matchDepTypes": ["devDependencies"],
|
|
18
15
|
"automerge": true
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"description": "Hold maplibre-gl at the version Kibana uses (elastic/kibana#301722). Remove once Kibana moves on.",
|
|
19
|
+
"matchPackageNames": ["maplibre-gl"],
|
|
20
|
+
"allowedVersions": "6.4.1"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"description": "Master branch specific rules",
|
|
24
|
+
"matchBaseBranches": ["master"],
|
|
25
|
+
"labels": ["dependencies", "v8.8.0"]
|
|
19
26
|
}
|
|
20
27
|
]
|
|
21
28
|
}
|
package/src/ems_client.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import _ from 'lodash';
|
|
8
8
|
import { TMSService } from './tms_service';
|
|
9
9
|
import { EMSFormatType, FileLayer } from './file_layer';
|
|
10
|
-
import { FeatureCollection } from 'geojson';
|
|
10
|
+
import type { FeatureCollection } from 'geojson';
|
|
11
11
|
|
|
12
12
|
import semverCoerce from 'semver/functions/coerce';
|
|
13
13
|
import semverValid from 'semver/functions/valid';
|
|
@@ -17,7 +17,7 @@ import semverMinor from 'semver/functions/minor';
|
|
|
17
17
|
import { format as formatUrl, parse as parseUrl, UrlObject } from 'url';
|
|
18
18
|
import { toAbsoluteUrl } from './utils';
|
|
19
19
|
import { ParsedUrlQueryInput } from 'querystring';
|
|
20
|
-
import LRUCache from 'lru-cache';
|
|
20
|
+
import { LRUCache } from 'lru-cache';
|
|
21
21
|
|
|
22
22
|
const REST_API_REGEX = /\d{4}-\d{2}-\d{2}/;
|
|
23
23
|
export const LATEST_API_URL_PATH = 'latest';
|
|
@@ -298,7 +298,7 @@ export class EMSClient {
|
|
|
298
298
|
if (e instanceof Error) {
|
|
299
299
|
throw e;
|
|
300
300
|
} else {
|
|
301
|
-
throw new Error('Unknown error');
|
|
301
|
+
throw new Error('Unknown error', { cause: e });
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
}
|
|
@@ -429,7 +429,7 @@ export class EMSClient {
|
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
private _invalidateSettings(): void {
|
|
432
|
-
this._cache.
|
|
432
|
+
this._cache.clear();
|
|
433
433
|
this._getMainCatalog = _.once(async (): Promise<EmsCatalogManifest> => {
|
|
434
434
|
const services = [];
|
|
435
435
|
if (this._tileApiUrl) {
|
package/src/file_layer.ts
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
FileLayerField,
|
|
15
15
|
} from './ems_client';
|
|
16
16
|
import { AbstractEmsService } from './ems_service';
|
|
17
|
-
import { FeatureCollection } from 'geojson';
|
|
17
|
+
import type { FeatureCollection } from 'geojson';
|
|
18
18
|
import * as topojson from 'topojson-client';
|
|
19
19
|
|
|
20
20
|
export enum EMSFormatType {
|
package/target/ems_client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TMSService } from './tms_service';
|
|
2
2
|
import { EMSFormatType, FileLayer } from './file_layer';
|
|
3
|
-
import { FeatureCollection } from 'geojson';
|
|
3
|
+
import type { FeatureCollection } from 'geojson';
|
|
4
4
|
export declare const LATEST_API_URL_PATH = "latest";
|
|
5
5
|
type LocalizedStrings = {
|
|
6
6
|
[key: string]: string;
|
package/target/file_layer.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EMSClient, FileLayerConfig, FileLayerField } from './ems_client';
|
|
2
2
|
import { AbstractEmsService } from './ems_service';
|
|
3
|
-
import { FeatureCollection } from 'geojson';
|
|
3
|
+
import type { FeatureCollection } from 'geojson';
|
|
4
4
|
export declare enum EMSFormatType {
|
|
5
5
|
geojson = "geojson",
|
|
6
6
|
topojson = "topojson"
|
|
@@ -13,16 +13,16 @@ var _major = _interopRequireDefault(require("semver/functions/major"));
|
|
|
13
13
|
var _minor = _interopRequireDefault(require("semver/functions/minor"));
|
|
14
14
|
var _url = require("url");
|
|
15
15
|
var _utils = require("./utils");
|
|
16
|
-
var
|
|
16
|
+
var _querystring = require("querystring");
|
|
17
|
+
var _lruCache = require("lru-cache");
|
|
17
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
-
|
|
19
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
|
-
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); } /*
|
|
19
|
+
/*
|
|
21
20
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
21
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
23
22
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
24
23
|
* 2.0.
|
|
25
24
|
*/
|
|
25
|
+
|
|
26
26
|
const REST_API_REGEX = /\d{4}-\d{2}-\d{2}/;
|
|
27
27
|
const LATEST_API_URL_PATH = exports.LATEST_API_URL_PATH = 'latest';
|
|
28
28
|
/**
|
|
@@ -81,28 +81,29 @@ const unescapeTemplateVars = url => {
|
|
|
81
81
|
//this is not the default locale from Kibana, but the default locale supported by the Elastic Maps Service
|
|
82
82
|
const DEFAULT_LANGUAGE = 'en';
|
|
83
83
|
class EMSClient {
|
|
84
|
+
EMS_LOAD_TIMEOUT = 32000;
|
|
85
|
+
_queryParams;
|
|
86
|
+
_appVersion;
|
|
87
|
+
_fetchFunction;
|
|
88
|
+
_sanitizer;
|
|
89
|
+
_fileApiUrl;
|
|
90
|
+
_tileApiUrl;
|
|
91
|
+
_emsVersion;
|
|
92
|
+
_emsLandingPageUrl;
|
|
93
|
+
_language;
|
|
94
|
+
_proxyPath;
|
|
95
|
+
_cache;
|
|
96
|
+
_isRestApi = false;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* these methods are assigned outside the constructor
|
|
100
|
+
*/
|
|
101
|
+
_getMainCatalog;
|
|
102
|
+
_getDefaultTMSCatalog;
|
|
103
|
+
_getDefaultFileCatalog;
|
|
104
|
+
_loadTMSServices;
|
|
105
|
+
_loadFileLayers;
|
|
84
106
|
constructor(config) {
|
|
85
|
-
_defineProperty(this, "EMS_LOAD_TIMEOUT", 32000);
|
|
86
|
-
_defineProperty(this, "_queryParams", void 0);
|
|
87
|
-
_defineProperty(this, "_appVersion", void 0);
|
|
88
|
-
_defineProperty(this, "_fetchFunction", void 0);
|
|
89
|
-
_defineProperty(this, "_sanitizer", void 0);
|
|
90
|
-
_defineProperty(this, "_fileApiUrl", void 0);
|
|
91
|
-
_defineProperty(this, "_tileApiUrl", void 0);
|
|
92
|
-
_defineProperty(this, "_emsVersion", void 0);
|
|
93
|
-
_defineProperty(this, "_emsLandingPageUrl", void 0);
|
|
94
|
-
_defineProperty(this, "_language", void 0);
|
|
95
|
-
_defineProperty(this, "_proxyPath", void 0);
|
|
96
|
-
_defineProperty(this, "_cache", void 0);
|
|
97
|
-
_defineProperty(this, "_isRestApi", false);
|
|
98
|
-
/**
|
|
99
|
-
* these methods are assigned outside the constructor
|
|
100
|
-
*/
|
|
101
|
-
_defineProperty(this, "_getMainCatalog", void 0);
|
|
102
|
-
_defineProperty(this, "_getDefaultTMSCatalog", void 0);
|
|
103
|
-
_defineProperty(this, "_getDefaultFileCatalog", void 0);
|
|
104
|
-
_defineProperty(this, "_loadTMSServices", void 0);
|
|
105
|
-
_defineProperty(this, "_loadFileLayers", void 0);
|
|
106
107
|
// Remove kbnVersion in 8.0
|
|
107
108
|
if ('kbnVersion' in config) {
|
|
108
109
|
console.warn('The "kbnVersion" parameter for ems-client is deprecated. Please use "appVersion" instead.');
|
|
@@ -124,7 +125,7 @@ class EMSClient {
|
|
|
124
125
|
this._language = config.language || DEFAULT_LANGUAGE;
|
|
125
126
|
this._fetchFunction = config.fetchFunction;
|
|
126
127
|
this._proxyPath = config.proxyPath || '';
|
|
127
|
-
this._cache = new _lruCache.
|
|
128
|
+
this._cache = new _lruCache.LRUCache({
|
|
128
129
|
max: config.cacheSize || 10
|
|
129
130
|
});
|
|
130
131
|
this._invalidateSettings();
|
|
@@ -163,7 +164,9 @@ class EMSClient {
|
|
|
163
164
|
if (e instanceof Error) {
|
|
164
165
|
throw e;
|
|
165
166
|
} else {
|
|
166
|
-
throw new Error('Unknown error'
|
|
167
|
+
throw new Error('Unknown error', {
|
|
168
|
+
cause: e
|
|
169
|
+
});
|
|
167
170
|
}
|
|
168
171
|
}
|
|
169
172
|
}
|
|
@@ -267,7 +270,7 @@ class EMSClient {
|
|
|
267
270
|
});
|
|
268
271
|
}
|
|
269
272
|
_invalidateSettings() {
|
|
270
|
-
this._cache.
|
|
273
|
+
this._cache.clear();
|
|
271
274
|
this._getMainCatalog = _lodash.default.once(async () => {
|
|
272
275
|
const services = [];
|
|
273
276
|
if (this._tileApiUrl) {
|
|
@@ -4,30 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AbstractEmsService = void 0;
|
|
7
|
+
var _ems_client = require("./ems_client");
|
|
7
8
|
var _utils = require("./utils");
|
|
8
|
-
|
|
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); } /*
|
|
9
|
+
/*
|
|
11
10
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
11
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
13
12
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
14
13
|
* 2.0.
|
|
15
14
|
*/
|
|
15
|
+
|
|
16
16
|
class AbstractEmsService {
|
|
17
|
+
_emsClient;
|
|
18
|
+
_config;
|
|
19
|
+
_proxyPath;
|
|
17
20
|
constructor(config, emsClient, proxyPath) {
|
|
18
|
-
_defineProperty(this, "_emsClient", void 0);
|
|
19
|
-
_defineProperty(this, "_config", void 0);
|
|
20
|
-
_defineProperty(this, "_proxyPath", void 0);
|
|
21
|
-
/**
|
|
22
|
-
* Checks if url is absolute. If not, prepend the basePath.
|
|
23
|
-
*/
|
|
24
|
-
_defineProperty(this, "_getAbsoluteUrl", url => {
|
|
25
|
-
if (/^https?:\/\//.test(url)) {
|
|
26
|
-
return url;
|
|
27
|
-
} else {
|
|
28
|
-
return (0, _utils.toAbsoluteUrl)(this.getApiUrl(), url);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
21
|
this._config = config;
|
|
32
22
|
this._emsClient = emsClient;
|
|
33
23
|
this._proxyPath = proxyPath;
|
|
@@ -50,5 +40,16 @@ class AbstractEmsService {
|
|
|
50
40
|
});
|
|
51
41
|
return attributions.join('|');
|
|
52
42
|
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Checks if url is absolute. If not, prepend the basePath.
|
|
46
|
+
*/
|
|
47
|
+
_getAbsoluteUrl = url => {
|
|
48
|
+
if (/^https?:\/\//.test(url)) {
|
|
49
|
+
return url;
|
|
50
|
+
} else {
|
|
51
|
+
return (0, _utils.toAbsoluteUrl)(this.getApiUrl(), url);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
53
54
|
}
|
|
54
55
|
exports.AbstractEmsService = AbstractEmsService;
|
|
@@ -5,14 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.FileLayer = exports.EMSFormatType = void 0;
|
|
7
7
|
var _url = _interopRequireDefault(require("url"));
|
|
8
|
+
var _ems_client = require("./ems_client");
|
|
8
9
|
var _ems_service = require("./ems_service");
|
|
9
10
|
var topojson = _interopRequireWildcard(require("topojson-client"));
|
|
10
|
-
|
|
11
|
-
function _interopRequireWildcard(e,
|
|
11
|
+
var cache;
|
|
12
|
+
function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
|
|
14
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
|
-
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); } /*
|
|
14
|
+
/*
|
|
16
15
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
17
16
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
18
17
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
@@ -24,9 +23,9 @@ let EMSFormatType = exports.EMSFormatType = /*#__PURE__*/function (EMSFormatType
|
|
|
24
23
|
return EMSFormatType;
|
|
25
24
|
}({});
|
|
26
25
|
class FileLayer extends _ems_service.AbstractEmsService {
|
|
26
|
+
_config;
|
|
27
27
|
constructor(config, emsClient, proxyPath) {
|
|
28
28
|
super(config, emsClient, proxyPath);
|
|
29
|
-
_defineProperty(this, "_config", void 0);
|
|
30
29
|
this._config = config;
|
|
31
30
|
}
|
|
32
31
|
async getGeoJson() {
|