@splunk/visualization-migrations 28.7.0 → 28.9.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/migrate.js CHANGED
@@ -97,7 +97,7 @@ var serializeForDslLiteral = (value) => {
97
97
  }
98
98
  try {
99
99
  return JSON.stringify(value);
100
- } catch (err) {
100
+ } catch (e) {
101
101
  return String(value);
102
102
  }
103
103
  };
@@ -370,12 +370,24 @@ var parseObjects = (oldValue) => {
370
370
  }
371
371
  return nuValue;
372
372
  };
373
+ var replaceNumericBoolean = (oldValue) => {
374
+ if (oldValue === 0) return false;
375
+ if (oldValue === 1) return true;
376
+ return oldValue;
377
+ };
378
+ var replaceInheritedScale = (oldValue) => oldValue === "inherit" ? "linear" : oldValue;
373
379
  var otherValueReplacements = {
374
380
  y2Fields: splitValue,
375
381
  overlayFields: splitValue,
376
382
  legendLabels: splitValue,
377
383
  seriesColorsByField: parseObjects,
378
384
  lineDashStylesByField: parseObjects,
385
+ showIndependentYRanges: replaceNumericBoolean,
386
+ showOverlayY2Axis: replaceNumericBoolean,
387
+ showRoundedY2AxisLabels: replaceNumericBoolean,
388
+ showSplitSeries: replaceNumericBoolean,
389
+ yAxisScale: replaceInheritedScale,
390
+ y2AxisScale: replaceInheritedScale,
379
391
  /**
380
392
  * the original markerDisplay was only exposed as `chart.showMarkers`
381
393
  * setting chart.showMarkers to true is the equivalent of `markerDisplay: 'outlined'`
@@ -1031,11 +1043,11 @@ var migrateAlternatingColors = (colors, optionToConvert, contextConfigName) => {
1031
1043
  const colorsContext = [];
1032
1044
  const { oddColor, evenColor } = colors;
1033
1045
  if (oddColor && evenColor) {
1034
- colorsContext.push(...[oddColor, evenColor]);
1046
+ colorsContext.push(oddColor, evenColor);
1035
1047
  } else if (oddColor) {
1036
- colorsContext.push(...[oddColor, themedAlternatingColors[optionToConvert].even]);
1048
+ colorsContext.push(oddColor, themedAlternatingColors[optionToConvert].even);
1037
1049
  } else if (evenColor) {
1038
- colorsContext.push(...[themedAlternatingColors[optionToConvert].odd, evenColor]);
1050
+ colorsContext.push(themedAlternatingColors[optionToConvert].odd, evenColor);
1039
1051
  }
1040
1052
  if (colorsContext.length) {
1041
1053
  return {
@@ -1206,7 +1218,7 @@ var convertTextContentToMarkDown = (fontWeight, fontSize, textContent = "") => {
1206
1218
  }
1207
1219
  return stringsTrimmed.join("\\\n");
1208
1220
  }
1209
- markdownContent = markdownContent.replace(regex, "\\\n");
1221
+ markdownContent = markdownContent.replaceAll(regex, "\\\n");
1210
1222
  return markdownContent;
1211
1223
  };
1212
1224
  var convertFontSize = (fontSize) => {
@@ -1376,17 +1388,17 @@ var migrateVizToSplunkMapChoropleth = (vizDefinition) => {
1376
1388
  }
1377
1389
  let { choroplethEmptyAreaColor, choroplethStrokeColor } = renamedOptions;
1378
1390
  const { source } = renamedOptions;
1379
- const layerOptions = ["choroplethEmptyAreaColor", "choroplethStrokeColor", "source"];
1380
- const renamedOptionsFiltered = Object.keys(renamedOptions).filter((key) => !layerOptions.includes(key)).reduce((obj, key) => {
1391
+ const layerOptions = /* @__PURE__ */ new Set(["choroplethEmptyAreaColor", "choroplethStrokeColor", "source"]);
1392
+ const renamedOptionsFiltered = Object.keys(renamedOptions).filter((key) => !layerOptions.has(key)).reduce((obj, key) => {
1381
1393
  obj[key] = renamedOptions[key];
1382
1394
  return obj;
1383
1395
  }, {});
1384
1396
  if (choroplethStrokeColor === defaultStrokeColor && choroplethEmptyAreaColor !== "transparent") {
1385
1397
  if ("backgroundColor" in renamedOptionsFiltered) {
1386
- if (renamedOptionsFiltered["backgroundColor"] !== "transparent") {
1387
- choroplethStrokeColor = renamedOptionsFiltered.backgroundColor;
1388
- } else {
1398
+ if (renamedOptionsFiltered["backgroundColor"] === "transparent") {
1389
1399
  choroplethStrokeColor = "> themes.defaultBackgroundColor";
1400
+ } else {
1401
+ choroplethStrokeColor = renamedOptionsFiltered.backgroundColor;
1390
1402
  }
1391
1403
  } else {
1392
1404
  choroplethStrokeColor = "> themes.defaultBackgroundColor";