@elastic/ems-client 8.4.0 → 8.4.1

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 CHANGED
@@ -2,25 +2,13 @@
2
2
  "upstream": "elastic/ems-client",
3
3
  "branches": [
4
4
  {
5
- "name": "8.3",
5
+ "name": "8.4",
6
6
  "checked": true
7
7
  },
8
- "8.2",
9
- "8.1",
10
- "8.0",
11
- "7.17",
12
- "7.16",
13
- "7.16",
14
- "7.15",
15
- "7.14",
16
- "7.12",
17
- "7.11",
18
- "7.10",
19
- "7.9",
20
- "7.8",
21
- "7.7",
22
- "7.6",
23
- "7.2"
8
+ {
9
+ "name": "7.17",
10
+ "checked": true
11
+ }
24
12
  ],
25
13
  "labels": [
26
14
  "backport"
@@ -0,0 +1,16 @@
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
+ # you may not use this file except in compliance with the Elastic License.
5
+ #
6
+
7
+ set -eu
8
+
9
+ echo "--- :yarn: Installing dependencies"
10
+ yarn install
11
+
12
+ echo "--- :alembic: Running tests"
13
+ yarn test
14
+
15
+ echo "--- :gear: Building"
16
+ yarn build
@@ -0,0 +1,8 @@
1
+ agents:
2
+ image: "docker.elastic.co/ci-agent-images/ems/buildkite-agent-node20:0.1"
3
+ cpu: "2"
4
+ memory: "2G"
5
+
6
+ steps:
7
+ - label: ":hammer_and_wrench: Test and build"
8
+ command: ".buildkite/build.sh"
@@ -0,0 +1,30 @@
1
+ {
2
+ "jobs": [
3
+ {
4
+ "repoOwner": "elastic",
5
+ "repoName": "ems-client",
6
+ "enabled": true,
7
+ "pipeline_slug": "ems-client",
8
+ "allow_org_users": true,
9
+ "allowed_repo_permissions": [
10
+ "admin",
11
+ "write"
12
+ ],
13
+ "allowed_list": [
14
+ "dependabot"
15
+ ],
16
+ "build_on_commit": true,
17
+ "build_on_comment": true,
18
+ "trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))",
19
+ "always_trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))",
20
+ "skip_ci_labels": [
21
+ "skip-ci"
22
+ ],
23
+ "skip_ci_on_only_changed": [
24
+ "\\.md$",
25
+ "^.ci/.+\\.yml$",
26
+ "^\\.buildkite/pull_requests\\.json$"
27
+ ]
28
+ }
29
+ ]
30
+ }
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ lts/iron
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@ 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.4.1] - 2023-11-09
7
+
8
+ - Migration from Jenkins to Buildkite for automatic testing #145 #147 #199
9
+ - Dependencies updates #165 #173 #176 #183 #181 #184 #191 #198 #205
10
+ - Upgrade to Node 20 #208
11
+
6
12
  ## [8.4.0] - 2023-01-11
7
13
 
8
14
  - Default EMS version is 8.4
package/CONTRIBUTING.md CHANGED
@@ -19,3 +19,21 @@ If you have access to make releases, the process is as follows:
19
19
  1. Update the latest major branch on upstream with `git push upstream <major_branch>`
20
20
  1. Build the targets with `yarn build`
21
21
  1. Publish to npm with `npm publish --access public`
22
+
23
+
24
+ ## Continuous Integration
25
+
26
+ This repository is tracked by Elastic [Buildkite infrastructure](https://buildkite.com/elastic) to ensure the tests suite passes and a build is successfully generated. The pipeline is located at [`.buildkite/pipeline.yml`](.buildkite/pipeline.yml), and defines the execution of the `test` and `build` scripts from `package.json`.
27
+
28
+ Builds are **triggered** on the following conditions:
29
+
30
+ * Any push to `master`
31
+ * Any Pull Request coming from a branch in the `elastic/ems-client` repository
32
+ * It will run automatically on `master` on a weekly basis
33
+ * Comments from Elastic team members on a Pull Request like: `buildkite test this`
34
+
35
+ Builds will be **skipped** on:
36
+
37
+ * Pull Requests from forks from users that don't have write/admin permissions on the upstream repository (`elastic/ems-client`) or are not part of the Elastic GitHub organization.
38
+ * Pull Requests with the `skip-ci` label
39
+ * Pull Requests with all files modified matching any of the regular expressions in `.buildkite/pull-requests.json => skip_ci_on_only_changed`
@@ -0,0 +1,68 @@
1
+ ---
2
+ # yaml-language-server: $schema=https://json.schemastore.org/catalog-info.json
3
+ apiVersion: backstage.io/v1alpha1
4
+ kind: Component
5
+ metadata:
6
+ name: ems-client
7
+ description: JavaScript library to interact with the Elastic Maps Service
8
+
9
+ annotations:
10
+ backstage.io/source-location: url:https://github.com/elastic/ems-client/
11
+ github.com/project-slug: elastic/ems-client
12
+ github.com/team-slug: elastic/ems
13
+ buildkite.com/project-slug: elastic/ems-client
14
+
15
+ tags:
16
+ - nodejs
17
+ - ems
18
+ - kibana
19
+
20
+ links:
21
+ - title: Releases (npm)
22
+ url: https://www.npmjs.com/@elastic/ems-client
23
+ - title: Documentation
24
+ url: https://github.com/elastic/ems-client/blob/master/README.md
25
+ - title: EMS License
26
+ url: https://www.elastic.co/elastic-maps-service-terms
27
+
28
+ spec:
29
+ type: library
30
+ owner: group:ems
31
+ lifecycle: production
32
+ ---
33
+ # yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json
34
+ apiVersion: backstage.io/v1alpha1
35
+ kind: Resource
36
+ metadata:
37
+ name: buildkite-pipeline-ems-client
38
+ description: Buildkite Pipeline for ems-client
39
+ links:
40
+ - title: Pipeline
41
+ url: https://buildkite.com/elastic/ems-client
42
+
43
+ spec:
44
+ type: buildkite-pipeline
45
+ owner: group:ems
46
+ system: buildkite
47
+ implementation:
48
+ apiVersion: buildkite.elastic.dev/v1
49
+ kind: Pipeline
50
+ metadata:
51
+ name: EMS Client
52
+ description: Pipeline to run the EMS Client tests suite on
53
+ spec:
54
+ repository: elastic/ems-client
55
+ pipeline_file: ".buildkite/pipeline.yml"
56
+ default_branch: master
57
+ env:
58
+ ELASTIC_PR_COMMENTS_ENABLED: 'true'
59
+ teams: # Who has access to the pipeline.
60
+ ems: {}
61
+ everyone:
62
+ access_level: READ_ONLY
63
+ provider_settings:
64
+ publish_commit_status: true
65
+ schedules:
66
+ Weekly build on master branch:
67
+ cronline: "@weekly"
68
+ message: "Weekly tests and build"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elastic/ems-client",
3
- "version": "8.4.0",
3
+ "version": "8.4.1",
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",
@@ -42,7 +42,7 @@
42
42
  "chroma-js": "^2.1.0",
43
43
  "lodash": "^4.17.15",
44
44
  "lru-cache": "^6.0.0",
45
- "semver": "^7.3.8",
45
+ "semver": "7.5.4",
46
46
  "topojson-client": "^3.1.0"
47
47
  },
48
48
  "devDependencies": {
@@ -70,5 +70,8 @@
70
70
  "prettier": "^2.0.5",
71
71
  "ts-jest": "^26.2.0",
72
72
  "typescript": "4.6.3"
73
+ },
74
+ "engines": {
75
+ "node": ">=18 <=20"
73
76
  }
74
77
  }
@@ -14,7 +14,12 @@ var _lruCache = _interopRequireDefault(require("lru-cache"));
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
16
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
17
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
17
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /*
18
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
19
+ * or more contributor license agreements. Licensed under the Elastic License
20
+ * 2.0; you may not use this file except in compliance with the Elastic License
21
+ * 2.0.
22
+ */
18
23
  const DEFAULT_EMS_VERSION = '8.4';
19
24
  /**
20
25
  * plugins cannot have upstream dependencies on core/*-kibana.
@@ -72,10 +77,6 @@ const unescapeTemplateVars = url => {
72
77
  //this is not the default locale from Kibana, but the default locale supported by the Elastic Maps Service
73
78
  const DEFAULT_LANGUAGE = 'en';
74
79
  class EMSClient {
75
- /**
76
- * these methods are assigned outside the constructor
77
- */
78
-
79
80
  constructor(config) {
80
81
  _defineProperty(this, "EMS_LOAD_TIMEOUT", 32000);
81
82
  _defineProperty(this, "_queryParams", void 0);
@@ -90,6 +91,9 @@ class EMSClient {
90
91
  _defineProperty(this, "_language", void 0);
91
92
  _defineProperty(this, "_proxyPath", void 0);
92
93
  _defineProperty(this, "_cache", void 0);
94
+ /**
95
+ * these methods are assigned outside the constructor
96
+ */
93
97
  _defineProperty(this, "_getMainCatalog", void 0);
94
98
  _defineProperty(this, "_getDefaultTMSCatalog", void 0);
95
99
  _defineProperty(this, "_getDefaultFileCatalog", void 0);
@@ -7,12 +7,20 @@ exports.AbstractEmsService = void 0;
7
7
  var _utils = require("./utils");
8
8
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
9
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
10
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /*
11
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
+ * or more contributor license agreements. Licensed under the Elastic License
13
+ * 2.0; you may not use this file except in compliance with the Elastic License
14
+ * 2.0.
15
+ */
11
16
  class AbstractEmsService {
12
17
  constructor(config, emsClient, proxyPath) {
13
18
  _defineProperty(this, "_emsClient", void 0);
14
19
  _defineProperty(this, "_config", void 0);
15
20
  _defineProperty(this, "_proxyPath", void 0);
21
+ /**
22
+ * Checks if url is absolute. If not, prepend the basePath.
23
+ */
16
24
  _defineProperty(this, "_getAbsoluteUrl", url => {
17
25
  if (/^https?:\/\//.test(url)) {
18
26
  return url;
@@ -42,9 +50,5 @@ class AbstractEmsService {
42
50
  });
43
51
  return attributions.join('|');
44
52
  }
45
-
46
- /**
47
- * Checks if url is absolute. If not, prepend the basePath.
48
- */
49
53
  }
50
54
  exports.AbstractEmsService = AbstractEmsService;
@@ -7,18 +7,22 @@ exports.FileLayer = exports.EMSFormatType = void 0;
7
7
  var _url = _interopRequireDefault(require("url"));
8
8
  var _ems_service = require("./ems_service");
9
9
  var topojson = _interopRequireWildcard(require("topojson-client"));
10
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
14
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
15
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
- let EMSFormatType;
17
- exports.EMSFormatType = EMSFormatType;
18
- (function (EMSFormatType) {
15
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /*
16
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
17
+ * or more contributor license agreements. Licensed under the Elastic License
18
+ * 2.0; you may not use this file except in compliance with the Elastic License
19
+ * 2.0.
20
+ */
21
+ let EMSFormatType = exports.EMSFormatType = /*#__PURE__*/function (EMSFormatType) {
19
22
  EMSFormatType["geojson"] = "geojson";
20
23
  EMSFormatType["topojson"] = "topojson";
21
- })(EMSFormatType || (exports.EMSFormatType = EMSFormatType = {}));
24
+ return EMSFormatType;
25
+ }({});
22
26
  class FileLayer extends _ems_service.AbstractEmsService {
23
27
  constructor(config, emsClient, proxyPath) {
24
28
  super(config, emsClient, proxyPath);
@@ -10,19 +10,13 @@ var _utils = require("./utils");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
12
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
13
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /*
14
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
+ * or more contributor license agreements. Licensed under the Elastic License
16
+ * 2.0; you may not use this file except in compliance with the Elastic License
17
+ * 2.0.
18
+ */
14
19
  class TMSService extends _ems_service.AbstractEmsService {
15
- /*
16
- List of supported languages with labels and OMT codes extracted
17
- from https://openmaptiles.org/languages
18
- Keys are values for i18.locale from Kibana settings
19
- and OMT codes for the rest.
20
- */
21
-
22
- /*
23
- Suggested default operations for the different EMS styles
24
- */
25
-
26
20
  constructor(config, emsClient, proxyPath) {
27
21
  super(config, emsClient, proxyPath);
28
22
  _defineProperty(this, "_config", void 0);
@@ -299,6 +293,12 @@ class TMSService extends _ems_service.AbstractEmsService {
299
293
  }
300
294
  }
301
295
  exports.TMSService = TMSService;
296
+ /*
297
+ List of supported languages with labels and OMT codes extracted
298
+ from https://openmaptiles.org/languages
299
+ Keys are values for i18.locale from Kibana settings
300
+ and OMT codes for the rest.
301
+ */
302
302
  _defineProperty(TMSService, "SupportedLanguages", [{
303
303
  key: 'ar',
304
304
  omt: 'ar'
@@ -477,6 +477,9 @@ _defineProperty(TMSService, "SupportedLanguages", [{
477
477
  key: 'zh-cn',
478
478
  omt: 'zh'
479
479
  }]);
480
+ /*
481
+ Suggested default operations for the different EMS styles
482
+ */
480
483
  _defineProperty(TMSService, "colorOperationDefaults", [{
481
484
  style: 'road_map',
482
485
  operation: 'mix',
@@ -39,6 +39,11 @@ function toAbsoluteUrl(host, path) {
39
39
  Type with the possible ways to define a color in maplibre
40
40
  */
41
41
 
42
+ /*
43
+ A selection of the different maplibre-gl-js properties that refer to a color.
44
+ Taken from maplibre https://github.com/maplibre/maplibre-gl-js/blob/main/src/style-spec/types.g.ts
45
+ */
46
+
42
47
  /*
43
48
  Function to transform a maplibre color definition by a given function.
44
49
  */