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