@splunk/visualization-migrations 27.4.0 → 28.0.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/index.js CHANGED
@@ -168,9 +168,7 @@ var translateDataReference = (encodingDataReference) => {
168
168
  return null;
169
169
  }
170
170
  if (isNameBasedRef) {
171
- const { dataSourceName, fieldName, columnIndex } = (0, parserUtils_exports.parseNameBasedFieldReference)(
172
- encodingDataReference
173
- );
171
+ const { dataSourceName, fieldName, columnIndex } = (0, parserUtils_exports.parseNameBasedFieldReference)(encodingDataReference);
174
172
  let returnString = `> ${dataSourceName} | seriesByName("${fieldName}")`;
175
173
  if (columnIndex) {
176
174
  returnString += ` | pointByIndex(${columnIndex})`;
@@ -178,14 +176,7 @@ var translateDataReference = (encodingDataReference) => {
178
176
  return returnString;
179
177
  }
180
178
  if (isIndexBasedRef) {
181
- const {
182
- dataSourceName,
183
- fieldIndex,
184
- columnIndex,
185
- isFieldIndexRange,
186
- fromFieldIndex,
187
- toFieldIndex
188
- } = (0, parserUtils_exports.parseIndexBasedFieldReference)(encodingDataReference);
179
+ const { dataSourceName, fieldIndex, columnIndex, isFieldIndexRange, fromFieldIndex, toFieldIndex } = (0, parserUtils_exports.parseIndexBasedFieldReference)(encodingDataReference);
189
180
  if (isFieldIndexRange) {
190
181
  let dslToIndexString;
191
182
  if (toFieldIndex === -1) {
@@ -679,7 +670,12 @@ var migrateVizToSplunkLine = (vizDefinition) => migrateBaseChartingVizDefinition
679
670
  // src/visualizations/image.ts
680
671
  var migrateVizToSplunkImage = (vizDefinition) => {
681
672
  const _a = vizDefinition, { options = {} } = _a, otherDefinitionParts = __objRest(_a, ["options"]);
682
- const migratedVisualization = __spreadProps(__spreadValues({ options }, otherDefinitionParts), { type: "splunk.image", context: {} });
673
+ const migratedVisualization = __spreadProps(__spreadValues({
674
+ options
675
+ }, otherDefinitionParts), {
676
+ type: "splunk.image",
677
+ context: {}
678
+ });
683
679
  removeInvalidOptions(migratedVisualization.options, visualization_schemas_exports.imageOptionsSchema);
684
680
  return migratedVisualization;
685
681
  };
@@ -687,7 +683,12 @@ var migrateVizToSplunkImage = (vizDefinition) => {
687
683
  // src/visualizations/markdown.ts
688
684
  var migrateVizToSplunkMarkdown = (vizDefinition) => {
689
685
  const _a = vizDefinition, { options = {} } = _a, otherDefinitionParts = __objRest(_a, ["options"]);
690
- const migratedVisualization = __spreadProps(__spreadValues({ options }, otherDefinitionParts), { type: "splunk.markdown", context: {} });
686
+ const migratedVisualization = __spreadProps(__spreadValues({
687
+ options
688
+ }, otherDefinitionParts), {
689
+ type: "splunk.markdown",
690
+ context: {}
691
+ });
691
692
  removeInvalidOptions(migratedVisualization.options, visualization_schemas_exports.markdownOptionsSchema);
692
693
  return migratedVisualization;
693
694
  };
@@ -734,7 +735,9 @@ var migratePieChartLabelAndPercent = (options) => {
734
735
  return {};
735
736
  }
736
737
  if (!("chart.showLabels" in options) && "chart.showPercent" in options) {
737
- return { labelDisplay: options["chart.showPercent"] ? "valuesAndPercentage" : "values" };
738
+ return {
739
+ labelDisplay: options["chart.showPercent"] ? "valuesAndPercentage" : "values"
740
+ };
738
741
  }
739
742
  if ("chart.showLabels" in options && !("chart.showPercent" in options)) {
740
743
  return { labelDisplay: options["chart.showLabels"] ? "values" : "off" };
@@ -1105,7 +1108,10 @@ var migrateToTableFormat = (oldOptions = {}) => {
1105
1108
  tableFormat.rowColors = rowColorsDSL;
1106
1109
  }
1107
1110
  const { context: rowBackgroundColorsContext, dsl: rowBackgroundColorsDSL } = migrateAlternatingColors(
1108
- { oddColor: rowBackgroundColorOdd, evenColor: rowBackgroundColorEven },
1111
+ {
1112
+ oddColor: rowBackgroundColorOdd,
1113
+ evenColor: rowBackgroundColorEven
1114
+ },
1109
1115
  "rowBackgroundColors",
1110
1116
  "rowBackgroundColorsConfig"
1111
1117
  );
@@ -1204,7 +1210,12 @@ var migrateVizTextToSplunkMarkdown = (vizDefinition) => {
1204
1210
  fontFamily = "Splunk Platform Sans",
1205
1211
  rotation = 0
1206
1212
  } = options;
1207
- const migratedVisualization = __spreadProps(__spreadValues({ options }, otherDefinitionParts), { type: "splunk.markdown", context: {} });
1213
+ const migratedVisualization = __spreadProps(__spreadValues({
1214
+ options
1215
+ }, otherDefinitionParts), {
1216
+ type: "splunk.markdown",
1217
+ context: {}
1218
+ });
1208
1219
  migratedVisualization.options = renameVizOptions(migratedVisualization.options, optionsToRename4);
1209
1220
  const migratedVizOptions = migratedVisualization.options;
1210
1221
  migratedVizOptions.markdown = convertTextContentToMarkDown(
@@ -1290,13 +1301,20 @@ var convertColorModeOption = (visualizationDefinition) => {
1290
1301
  defaultContext.bubbleColorConfig
1291
1302
  );
1292
1303
  if (bubbleColorConfig) {
1293
- visualizationDef.context = __spreadProps(__spreadValues({}, visualizationDef.context), { bubbleColorConfig });
1304
+ visualizationDef.context = __spreadProps(__spreadValues({}, visualizationDef.context), {
1305
+ bubbleColorConfig
1306
+ });
1294
1307
  }
1295
1308
  }
1296
1309
  };
1297
1310
  var migrateVizToSplunkPunchcard = (vizDefinition) => {
1298
1311
  const _a = vizDefinition, { options = {}, encoding = {} } = _a, otherDefinitionParts = __objRest(_a, ["options", "encoding"]);
1299
- const migratedVisualization = __spreadProps(__spreadValues({ options }, otherDefinitionParts), { type: "splunk.punchcard", context: {} });
1312
+ const migratedVisualization = __spreadProps(__spreadValues({
1313
+ options
1314
+ }, otherDefinitionParts), {
1315
+ type: "splunk.punchcard",
1316
+ context: {}
1317
+ });
1300
1318
  const { options: dataOptions, context: dataContext } = encodingToDynamicOptionsDSL(
1301
1319
  encoding
1302
1320
  );
@@ -1352,7 +1370,7 @@ var migrateVizToSplunkMapChoropleth = (vizDefinition) => {
1352
1370
  if (choroplethStrokeColor === defaultStrokeColor && choroplethEmptyAreaColor !== "transparent") {
1353
1371
  if ("backgroundColor" in renamedOptionsFiltered) {
1354
1372
  if (renamedOptionsFiltered["backgroundColor"] !== "transparent") {
1355
- choroplethStrokeColor = renamedOptionsFiltered["backgroundColor"];
1373
+ choroplethStrokeColor = renamedOptionsFiltered.backgroundColor;
1356
1374
  } else {
1357
1375
  choroplethStrokeColor = "> themes.defaultBackgroundColor";
1358
1376
  }