@elastic/ems-client 8.7.0 → 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.
@@ -1,4 +1,3 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
1
  /*
3
2
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4
3
  * or more contributor license agreements. Licensed under the Elastic License
@@ -6,7 +5,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
6
5
  * 2.0.
7
6
  */
8
7
 
9
- import chroma from 'chroma-js';
8
+ import chroma, { ChromaStatic, Color } from 'chroma-js';
9
+ import { ColorSpecification, DataDrivenPropertyValueSpecification, PropertyValueSpecification } from 'maplibre-gl';
10
+
10
11
  /**
11
12
  * Resolves a target URL path relative to the host.
12
13
  * This is specifically useed by the Kibana proxy re-routing.
@@ -16,8 +17,8 @@ export function toAbsoluteUrl(host, path) {
16
17
  if (!host) {
17
18
  return path;
18
19
  }
19
- var hostEndWithSlash = host[host.length - 1] === '/';
20
- var pathStartsWithSlash = path[0] === '/';
20
+ const hostEndWithSlash = host[host.length - 1] === '/';
21
+ const pathStartsWithSlash = path[0] === '/';
21
22
  if (hostEndWithSlash === true && pathStartsWithSlash === true) {
22
23
  return host + path.slice(1);
23
24
  } else if (hostEndWithSlash !== pathStartsWithSlash) {
@@ -41,15 +42,15 @@ Function to transform a maplibre color definition by a given function.
41
42
  */
42
43
  function transformColor(paintColor, func) {
43
44
  if (typeof paintColor == 'string') {
44
- var modifiedColor = func(paintColor);
45
- return "rgba(".concat(modifiedColor.rgba().join(','), ")");
46
- } else if (_typeof(paintColor) == 'object' && 'stops' in paintColor && Array.isArray(paintColor === null || paintColor === void 0 ? void 0 : paintColor.stops)) {
47
- var stops = paintColor['stops'].map(function (stop) {
48
- var newColor = transformColor(stop[1], func);
45
+ const modifiedColor = func(paintColor);
46
+ return `rgba(${modifiedColor.rgba().join(',')})`;
47
+ } else if (typeof paintColor == 'object' && 'stops' in paintColor && Array.isArray(paintColor?.stops)) {
48
+ const stops = paintColor['stops'].map(stop => {
49
+ const newColor = transformColor(stop[1], func);
49
50
  return [stop[0], newColor];
50
51
  });
51
- var newPaintColor = Object.assign({}, paintColor, {
52
- stops: stops
52
+ const newPaintColor = Object.assign({}, paintColor, {
53
+ stops
53
54
  });
54
55
  return newPaintColor;
55
56
  } else return paintColor;
@@ -59,7 +60,7 @@ function transformColor(paintColor, func) {
59
60
  This is the function used to generate the current EMS desaturated roadmap
60
61
  */
61
62
  export function desaturateColor(paintColor) {
62
- return transformColor(paintColor, function (color) {
63
+ return transformColor(paintColor, color => {
63
64
  return chroma(color).desaturate(1.1).brighten(0.33);
64
65
  });
65
66
  }
@@ -74,10 +75,8 @@ More details:
74
75
  https://gka.github.io/chroma.js/#chroma-blend
75
76
  https://gka.github.io/chroma.js/#chroma-mix
76
77
  */
77
- export function colorizeColor(sourceColor, destColor) {
78
- var operation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'screen';
79
- var percentage = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0.5;
80
- return transformColor(sourceColor, function (color) {
78
+ export function colorizeColor(sourceColor, destColor, operation = 'screen', percentage = 0.5) {
79
+ return transformColor(sourceColor, color => {
81
80
  if (operation !== 'mix') {
82
81
  return chroma.blend(chroma(color), destColor, operation);
83
82
  } else {
package/tsconfig.json CHANGED
@@ -14,7 +14,7 @@
14
14
  // "sourceMap": true, /* Generates corresponding '.map' file. */
15
15
  // "outFile": "./", /* Concatenate and emit output to single file. */
16
16
  "outDir": "./target", /* Redirect output structure to the directory. */
17
- //"rootDir": "", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
17
+ "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
18
18
  // "composite": true, /* Enable project compilation */
19
19
  // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
20
20
  // "removeComments": true, /* Do not emit comments to output. */
@@ -40,7 +40,7 @@
40
40
  // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
41
41
 
42
42
  /* Module Resolution Options */
43
- "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
43
+ "moduleResolution": "node10", /* Specify module resolution strategy: 'node10' (Node.js) or 'classic' (TypeScript pre-1.6). */
44
44
  // "baseUrl": "", /* Base directory to resolve non-absolute module names. */
45
45
  // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
46
46
  "rootDirs": [
@@ -65,7 +65,10 @@
65
65
  // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
66
66
 
67
67
  /* Advanced Options */
68
- "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
68
+ "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
69
+ "ignoreDeprecations": "6.0", /* Acknowledge deprecated options that will be removed in TypeScript 7.0. */
70
+ "skipLibCheck": true, /* TS 6.0: gl-matrix uses 'module' keyword for namespaces which TS 6.0 now rejects. */
71
+ "types": ["node", "jest"] /* TS 6.0: @types/node and @types/jest are transitive deps; must be explicit. */
69
72
  },
70
73
  "include": [
71
74
  "src/**/*.ts",