@splunk/visualization-migrations 23.4.1 → 24.2.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
@@ -87,7 +87,7 @@ module.exports =
87
87
  /******/
88
88
  /******/
89
89
  /******/ // Load entry module and return exports
90
- /******/ return __webpack_require__(__webpack_require__.s = 3);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 10);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ([
@@ -97,7 +97,148 @@ module.exports =
97
97
  "use strict";
98
98
 
99
99
 
100
- var _typeof = __webpack_require__(1);
100
+ var _slicedToArray = __webpack_require__(6);
101
+
102
+ Object.defineProperty(exports, "__esModule", {
103
+ value: true
104
+ });
105
+ exports.addsDataSelectorToOptions = exports.preserveDataSelectionForValueOption = exports.renameVizOptions = exports.removeInvalidOptions = void 0;
106
+
107
+ var dsl_1 = __webpack_require__(23);
108
+ /**
109
+ * Removes invalid keys in the options
110
+ * @param currentOptions - Current visualization options
111
+ * @param validOptions - Valid visualization option keys
112
+ * @returns void
113
+ */
114
+
115
+
116
+ var removeInvalidOptions = function removeInvalidOptions(currentOptions, validOptions) {
117
+ if (!currentOptions || !validOptions) {
118
+ return;
119
+ }
120
+
121
+ var copiedCurrOptions = currentOptions;
122
+ Object.keys(copiedCurrOptions).forEach(function (key) {
123
+ if (!(key in validOptions)) {
124
+ delete copiedCurrOptions[key];
125
+ }
126
+ });
127
+ };
128
+
129
+ exports.removeInvalidOptions = removeInvalidOptions;
130
+ /**
131
+ * Renames viz options by looking up their migration mapping
132
+ * @param oldOptions - Current visualization options
133
+ * @param optionRenames - Mapping of old options in viz.X to their migrated counterparts in splunk.X
134
+ * @returns updatedOptions
135
+ */
136
+
137
+ var renameVizOptions = function renameVizOptions(oldOptions, optionRenames) {
138
+ var updatedOptions = {};
139
+ if (!oldOptions) return {};
140
+ if (!optionRenames) return oldOptions;
141
+ Object.entries(oldOptions).forEach(function (_ref) {
142
+ var _ref2 = _slicedToArray(_ref, 2),
143
+ oldOptName = _ref2[0],
144
+ val = _ref2[1];
145
+
146
+ var _a;
147
+
148
+ var optionName = (_a = optionRenames[oldOptName]) !== null && _a !== void 0 ? _a : oldOptName;
149
+ updatedOptions[optionName] = val;
150
+ });
151
+ return updatedOptions;
152
+ };
153
+
154
+ exports.renameVizOptions = renameVizOptions;
155
+ /**
156
+ * Appends appropriate series selector to DSL string to add viz-specific implicit logic
157
+ * @param valueOption - the value of an option
158
+ * @param selector - the selector to append
159
+ * @returns string | void
160
+ */
161
+
162
+ var preserveDataSelectionForValueOption = function preserveDataSelectionForValueOption(valueOption, selector) {
163
+ if (valueOption) {
164
+ // if the last data selector starts with seriesBy, append appropriate selector to it
165
+ var dataSelectors = dsl_1.getDataSelectorsFromDSL(valueOption);
166
+ var lastDataSelector = dataSelectors[dataSelectors.length - 1];
167
+
168
+ if (lastDataSelector.includes('seriesByIndex') || lastDataSelector.includes('seriesByName')) {
169
+ return "".concat(valueOption, " | ").concat(selector);
170
+ }
171
+ }
172
+
173
+ return null;
174
+ };
175
+
176
+ exports.preserveDataSelectionForValueOption = preserveDataSelectionForValueOption;
177
+ /**
178
+ * For all data options, calls preserveDataSelectionForValueOption with relevant selector and
179
+ * updates dataOptions object
180
+ * @param dataOptions - an object reflecting all data options
181
+ * @param selector - the selector to append
182
+ * @returns void
183
+ */
184
+
185
+ var addsDataSelectorToOptions = function addsDataSelectorToOptions(dataOptions, selector) {
186
+ var updatedDataOptions = {};
187
+ Object.keys(dataOptions).forEach(function (key) {
188
+ var statement = dataOptions[key];
189
+ var updatedDSL = exports.preserveDataSelectionForValueOption(statement, selector);
190
+
191
+ if (updatedDSL) {
192
+ updatedDataOptions[key] = updatedDSL;
193
+ } else {
194
+ updatedDataOptions[key] = statement;
195
+ }
196
+ });
197
+ return updatedDataOptions;
198
+ };
199
+
200
+ exports.addsDataSelectorToOptions = addsDataSelectorToOptions;
201
+
202
+ /***/ }),
203
+ /* 1 */
204
+ /***/ (function(module, exports, __webpack_require__) {
205
+
206
+ "use strict";
207
+
208
+
209
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
210
+ if (k2 === undefined) k2 = k;
211
+ Object.defineProperty(o, k2, {
212
+ enumerable: true,
213
+ get: function get() {
214
+ return m[k];
215
+ }
216
+ });
217
+ } : function (o, m, k, k2) {
218
+ if (k2 === undefined) k2 = k;
219
+ o[k2] = m[k];
220
+ });
221
+
222
+ var __exportStar = this && this.__exportStar || function (m, exports) {
223
+ for (var p in m) {
224
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
225
+ }
226
+ };
227
+
228
+ Object.defineProperty(exports, "__esModule", {
229
+ value: true
230
+ });
231
+
232
+ __exportStar(__webpack_require__(15), exports);
233
+
234
+ /***/ }),
235
+ /* 2 */
236
+ /***/ (function(module, exports, __webpack_require__) {
237
+
238
+ "use strict";
239
+
240
+
241
+ var _typeof = __webpack_require__(4);
101
242
 
102
243
  var __rest = this && this.__rest || function (s, e) {
103
244
  var t = {};
@@ -117,7 +258,7 @@ Object.defineProperty(exports, "__esModule", {
117
258
  });
118
259
  exports.otherValueReplacements = exports.migrateChartingOptions = exports.migrateBaseChartingVizDefinition = void 0;
119
260
 
120
- var encoding_1 = __webpack_require__(2);
261
+ var encoding_1 = __webpack_require__(1);
121
262
  /**
122
263
  * map of splunk charting based @splunk/dashboard-visualization option names
123
264
  * to updated @splunk/visualization option names
@@ -219,6 +360,9 @@ var visibilityEnumReplacements = {
219
360
  var modeEnumReplacements = {
220
361
  none: 'off'
221
362
  };
363
+ var abbreviationEnumReplacements = {
364
+ none: 'auto'
365
+ };
222
366
  /**
223
367
  * for some options the valid values changed.
224
368
  * this maps enum values that need to be changed
@@ -229,8 +373,8 @@ var enumReplacements = {
229
373
  yAxisTitleVisibility: visibilityEnumReplacements,
230
374
  y2AxisTitleVisibility: visibilityEnumReplacements,
231
375
  xAxisAbbreviation: modeEnumReplacements,
232
- yAxisAbbreviation: modeEnumReplacements,
233
- y2AxisAbbreviation: modeEnumReplacements,
376
+ yAxisAbbreviation: abbreviationEnumReplacements,
377
+ y2AxisAbbreviation: abbreviationEnumReplacements,
234
378
  dataValuesDisplay: modeEnumReplacements,
235
379
  legendDisplay: modeEnumReplacements,
236
380
  legendTruncation: {
@@ -287,7 +431,8 @@ var otherValueReplacements = {
287
431
  * setting chart.showMarkers to true is the equivalent of `markerDisplay: 'outlined'`
288
432
  */
289
433
  markerDisplay: function markerDisplay(oldValue) {
290
- if (oldValue === false) return 'off';else if (oldValue === true) return 'outlined';
434
+ if (oldValue === false) return 'off';
435
+ if (oldValue === true) return 'outlined';
291
436
  return oldValue;
292
437
  }
293
438
  };
@@ -322,7 +467,7 @@ var migrateChartingOptions = function migrateChartingOptions(options) {
322
467
  exports.migrateChartingOptions = migrateChartingOptions;
323
468
  /**
324
469
  * helper that encapsulates shared migration logic across most charting-based viz
325
- * @param {Object} defaultChanges - map consistsing of default value changes from viz.* to splunk.*
470
+ * @param {Object} defaultChanges - map consisting of default value changes from viz.* to splunk.*
326
471
  * @param {Object} validOptions - the list of options that the new splunk.* viz supports
327
472
  * @param {VisualizationDefinition} vizDefinition - the viz definition to migrate
328
473
  * @param {String} vizType - the value of splunk.*
@@ -365,45 +510,115 @@ var migrateBaseChartingVizDefinition = function migrateBaseChartingVizDefinition
365
510
  exports.migrateBaseChartingVizDefinition = migrateBaseChartingVizDefinition;
366
511
 
367
512
  /***/ }),
368
- /* 1 */
513
+ /* 3 */
514
+ /***/ (function(module, exports, __webpack_require__) {
515
+
516
+ "use strict";
517
+
518
+
519
+ Object.defineProperty(exports, "__esModule", {
520
+ value: true
521
+ });
522
+ exports.consolidateTrendDisplay = void 0;
523
+ /**
524
+ * Helper function to consolidate `trendDisplayMode` - percent/absolute
525
+ * and `showTrendIndicator` - true/false into `trendDisplay` - off/percent/absolute for Single Value Variations
526
+ * 1. if `showTrendIndicator` is explicitly false, `trendDisplay` is off
527
+ * 2. if `showTrendIndicator` is undefined (defaults to true), return `trendDisplayMode` value if present
528
+ * 3. if `showTrendIndicator` is explicitly true, return 'absolute'
529
+ * 4. if both the old options are undefined, return nothing as their defaults (true and `absolute`)
530
+ * correspond to `trendDisplay` default - absolute
531
+ */
532
+
533
+ var consolidateTrendDisplay = function consolidateTrendDisplay(trendDisplayMode, showTrendIndicator) {
534
+ if (showTrendIndicator === false) {
535
+ return 'off';
536
+ }
537
+
538
+ if (['absolute', 'percent'].includes(trendDisplayMode)) {
539
+ return trendDisplayMode;
540
+ }
541
+
542
+ if (showTrendIndicator === true) {
543
+ return 'absolute';
544
+ }
545
+
546
+ return null;
547
+ };
548
+
549
+ exports.consolidateTrendDisplay = consolidateTrendDisplay;
550
+
551
+ /***/ }),
552
+ /* 4 */
369
553
  /***/ (function(module, exports) {
370
554
 
371
555
  module.exports = require("@babel/runtime/helpers/typeof");
372
556
 
373
557
  /***/ }),
374
- /* 2 */
558
+ /* 5 */
559
+ /***/ (function(module, exports) {
560
+
561
+ module.exports = require("@babel/runtime/helpers/toConsumableArray");
562
+
563
+ /***/ }),
564
+ /* 6 */
565
+ /***/ (function(module, exports) {
566
+
567
+ module.exports = require("@babel/runtime/helpers/slicedToArray");
568
+
569
+ /***/ }),
570
+ /* 7 */
375
571
  /***/ (function(module, exports, __webpack_require__) {
376
572
 
377
573
  "use strict";
378
574
 
379
575
 
380
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
381
- if (k2 === undefined) k2 = k;
382
- Object.defineProperty(o, k2, {
383
- enumerable: true,
384
- get: function get() {
385
- return m[k];
386
- }
387
- });
388
- } : function (o, m, k, k2) {
389
- if (k2 === undefined) k2 = k;
390
- o[k2] = m[k];
576
+ Object.defineProperty(exports, "__esModule", {
577
+ value: true
391
578
  });
579
+ exports.consolidateDisplayOption = void 0;
580
+ /**
581
+ * Helper to convert old label and value options into consolidated labelDisplay and valueDisplay
582
+ * If the `showOption` is explicitly false, then we return 'off'
583
+ * If the `showOption` is undefined (which corresponds to a default of `true`), we return nothing to avoid conflating the viz definition (since this corresponds to `number` in the new display)
584
+ * @param {Boolean} showOption - either one of `showLabel` or `showValue` in the old gauges
585
+ * @param {Boolean} percentageOption - either one of `usePercentageRange` or `usePercentageValue` in the old gauges
586
+ * @returns {String}
587
+ */
392
588
 
393
- var __exportStar = this && this.__exportStar || function (m, exports) {
394
- for (var p in m) {
395
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
589
+ var consolidateDisplayOption = function consolidateDisplayOption(showOption, percentageOption) {
590
+ if (showOption === false) {
591
+ return 'off';
396
592
  }
593
+
594
+ if (percentageOption === true) {
595
+ return 'percentage';
596
+ }
597
+
598
+ if (showOption === true) {
599
+ return 'number';
600
+ } // if showOption is undefined and percentageOption is false, we don't need to return an explicit value (since 'number' is passed in implicitly)
601
+
602
+
603
+ return null;
397
604
  };
398
605
 
399
- Object.defineProperty(exports, "__esModule", {
400
- value: true
401
- });
606
+ exports.consolidateDisplayOption = consolidateDisplayOption;
402
607
 
403
- __exportStar(__webpack_require__(7), exports);
608
+ /***/ }),
609
+ /* 8 */
610
+ /***/ (function(module, exports) {
611
+
612
+ module.exports = require("@splunk/visualizations/Markdown.config");
404
613
 
405
614
  /***/ }),
406
- /* 3 */
615
+ /* 9 */
616
+ /***/ (function(module, exports) {
617
+
618
+ module.exports = require("lodash");
619
+
620
+ /***/ }),
621
+ /* 10 */
407
622
  /***/ (function(module, exports, __webpack_require__) {
408
623
 
409
624
  "use strict";
@@ -432,10 +647,10 @@ Object.defineProperty(exports, "__esModule", {
432
647
  value: true
433
648
  });
434
649
 
435
- __exportStar(__webpack_require__(4), exports);
650
+ __exportStar(__webpack_require__(11), exports);
436
651
 
437
652
  /***/ }),
438
- /* 4 */
653
+ /* 11 */
439
654
  /***/ (function(module, exports, __webpack_require__) {
440
655
 
441
656
  "use strict";
@@ -446,7 +661,7 @@ Object.defineProperty(exports, "__esModule", {
446
661
  });
447
662
  exports.inferToType = exports.canMigrate = exports.migrate = void 0;
448
663
 
449
- var visualizations_1 = __webpack_require__(5);
664
+ var visualizations_1 = __webpack_require__(12);
450
665
 
451
666
  var supportedMigrations = {
452
667
  'viz.area': {
@@ -461,14 +676,53 @@ var supportedMigrations = {
461
676
  'viz.column': {
462
677
  'splunk.column': visualizations_1.migrateVizToSplunkColumn
463
678
  },
679
+ 'viz.choropleth.svg': {
680
+ 'splunk.choropleth.svg': visualizations_1.migrateVizToSplunkChoroplethSvg
681
+ },
682
+ 'viz.ellipse': {
683
+ 'splunk.ellipse': visualizations_1.migrateVizToSplunkEllipse
684
+ },
685
+ 'viz.fillergauge': {
686
+ 'splunk.fillergauge': visualizations_1.migrateVizToSplunkFillerGauge
687
+ },
464
688
  'viz.line': {
465
689
  'splunk.line': visualizations_1.migrateVizToSplunkLine
466
690
  },
691
+ 'viz.img': {
692
+ 'splunk.image': visualizations_1.migrateVizToSplunkImage
693
+ },
694
+ 'viz.markdown': {
695
+ 'splunk.markdown': visualizations_1.migrateVizToSplunkMarkdown
696
+ },
697
+ 'viz.markergauge': {
698
+ 'splunk.markergauge': visualizations_1.migrateVizToSplunkMarkerGauge
699
+ },
467
700
  'viz.pie': {
468
701
  'splunk.pie': visualizations_1.migrateVizToSplunkPie
469
702
  },
703
+ 'viz.rectangle': {
704
+ 'splunk.rectangle': visualizations_1.migrateVizToSplunkRectangle
705
+ },
706
+ 'viz.singlevalue': {
707
+ 'splunk.singlevalue': visualizations_1.migrateVizToSplunkSingleValue
708
+ },
709
+ 'viz.singlevalueicon': {
710
+ 'splunk.singlevalueicon': visualizations_1.migrateVizToSplunkSingleValueIcon
711
+ },
712
+ 'viz.singlevalueradial': {
713
+ 'splunk.singlevalueradial': visualizations_1.migrateVizToSplunkSingleValueRadial
714
+ },
470
715
  'viz.scatter': {
471
716
  'splunk.scatter': visualizations_1.migrateVizToSplunkScatter
717
+ },
718
+ 'viz.table': {
719
+ 'splunk.table': visualizations_1.migrateVizToSplunkTable
720
+ },
721
+ 'viz.text': {
722
+ 'splunk.markdown': visualizations_1.migrateVizTextToSplunkMarkdown
723
+ },
724
+ 'viz.punchcard': {
725
+ 'splunk.punchcard': visualizations_1.migrateVizToSplunkPunchcard
472
726
  }
473
727
  };
474
728
 
@@ -477,6 +731,10 @@ var inferToType = function inferToType(typeFromDefinition) {
477
731
  return 'splunk.image';
478
732
  }
479
733
 
734
+ if (typeFromDefinition === 'viz.text') {
735
+ return 'splunk.markdown';
736
+ }
737
+
480
738
  return typeFromDefinition.replace(/^viz\./, 'splunk.');
481
739
  };
482
740
 
@@ -515,7 +773,7 @@ var canMigrate = function canMigrate(_ref2) {
515
773
  exports.canMigrate = canMigrate;
516
774
 
517
775
  /***/ }),
518
- /* 5 */
776
+ /* 12 */
519
777
  /***/ (function(module, exports, __webpack_require__) {
520
778
 
521
779
  "use strict";
@@ -544,22 +802,48 @@ Object.defineProperty(exports, "__esModule", {
544
802
  value: true
545
803
  });
546
804
 
547
- __exportStar(__webpack_require__(6), exports);
805
+ __exportStar(__webpack_require__(13), exports);
806
+
807
+ __exportStar(__webpack_require__(17), exports);
808
+
809
+ __exportStar(__webpack_require__(19), exports);
548
810
 
549
- __exportStar(__webpack_require__(10), exports);
811
+ __exportStar(__webpack_require__(21), exports);
550
812
 
551
- __exportStar(__webpack_require__(12), exports);
813
+ __exportStar(__webpack_require__(24), exports);
552
814
 
553
- __exportStar(__webpack_require__(14), exports);
815
+ __exportStar(__webpack_require__(26), exports);
554
816
 
555
- __exportStar(__webpack_require__(16), exports);
817
+ __exportStar(__webpack_require__(28), exports);
556
818
 
557
- __exportStar(__webpack_require__(18), exports);
819
+ __exportStar(__webpack_require__(30), exports);
558
820
 
559
- __exportStar(__webpack_require__(20), exports);
821
+ __exportStar(__webpack_require__(32), exports);
822
+
823
+ __exportStar(__webpack_require__(34), exports);
824
+
825
+ __exportStar(__webpack_require__(35), exports);
826
+
827
+ __exportStar(__webpack_require__(37), exports);
828
+
829
+ __exportStar(__webpack_require__(39), exports);
830
+
831
+ __exportStar(__webpack_require__(41), exports);
832
+
833
+ __exportStar(__webpack_require__(43), exports);
834
+
835
+ __exportStar(__webpack_require__(45), exports);
836
+
837
+ __exportStar(__webpack_require__(47), exports);
838
+
839
+ __exportStar(__webpack_require__(49), exports);
840
+
841
+ __exportStar(__webpack_require__(52), exports);
842
+
843
+ __exportStar(__webpack_require__(53), exports);
560
844
 
561
845
  /***/ }),
562
- /* 6 */
846
+ /* 13 */
563
847
  /***/ (function(module, exports, __webpack_require__) {
564
848
 
565
849
  "use strict";
@@ -570,11 +854,11 @@ Object.defineProperty(exports, "__esModule", {
570
854
  });
571
855
  exports.migrateVizToSplunkArea = void 0;
572
856
 
573
- var splunk_charting_1 = __webpack_require__(0);
857
+ var Area_config_1 = __webpack_require__(14);
574
858
 
575
- var Area_1 = __webpack_require__(9);
859
+ var splunk_charting_1 = __webpack_require__(2);
576
860
 
577
- var validOptions = Object.assign({}, Area_1.config.optionsSchema); // old default configurations should be retained in migrated configuration
861
+ var validOptions = Object.assign({}, Area_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
578
862
 
579
863
  var defaultChanges = {
580
864
  yAxisAbbreviation: 'off',
@@ -596,20 +880,28 @@ var migrateVizToSplunkArea = function migrateVizToSplunkArea(vizDefinition) {
596
880
  exports.migrateVizToSplunkArea = migrateVizToSplunkArea;
597
881
 
598
882
  /***/ }),
599
- /* 7 */
883
+ /* 14 */
884
+ /***/ (function(module, exports) {
885
+
886
+ module.exports = require("@splunk/visualizations/Area.config");
887
+
888
+ /***/ }),
889
+ /* 15 */
600
890
  /***/ (function(module, exports, __webpack_require__) {
601
891
 
602
892
  "use strict";
603
893
 
604
894
 
605
- var _typeof = __webpack_require__(1);
895
+ var _typeof = __webpack_require__(4);
896
+
897
+ var _toConsumableArray = __webpack_require__(5);
606
898
 
607
899
  Object.defineProperty(exports, "__esModule", {
608
900
  value: true
609
901
  });
610
902
  exports.encodingToDynamicOptionsDSL = void 0;
611
903
 
612
- var Base_1 = __webpack_require__(8); // @TODO(pwied): move the parsing helpers so we can deprecate visualization-encoding-parsers package
904
+ var Base_1 = __webpack_require__(16); // @TODO(pwied): move the parsing helpers so we can deprecate visualization-encoding-parsers package
613
905
  // index based references are defined by <dataSource>[<index>]
614
906
  // this regex matches <text with numbers>[<anything>]
615
907
  // the "[" "]" part makes it an index based reference
@@ -627,6 +919,49 @@ var isIndexBasedReference = function isIndexBasedReference(ref) {
627
919
  var isNameBasedReference = function isNameBasedReference(ref) {
628
920
  return nameBasedRegx.test(ref);
629
921
  };
922
+
923
+ var convertFormatterToDSL = function convertFormatterToDSL(fieldReference, key, translatedValue) {
924
+ var _a, _b, _c, _d, _e, _f;
925
+
926
+ switch ((_a = fieldReference === null || fieldReference === void 0 ? void 0 : fieldReference.format) === null || _a === void 0 ? void 0 : _a.type) {
927
+ case 'gradient':
928
+ return {
929
+ contextConfig: Object.assign(Object.assign({}, Array.isArray((_b = fieldReference.format) === null || _b === void 0 ? void 0 : _b.ranges) && {
930
+ stops: _toConsumableArray(fieldReference.format.ranges)
931
+ }), Array.isArray((_c = fieldReference.format) === null || _c === void 0 ? void 0 : _c.values) && {
932
+ colors: _toConsumableArray(fieldReference.format.values)
933
+ }),
934
+ contextKey: "".concat(key, "GradientContext"),
935
+ dsl: "".concat(translatedValue, " | gradient(").concat(key, "GradientContext)")
936
+ };
937
+
938
+ case 'rangevalue':
939
+ {
940
+ var contextKey = "".concat(key, "RangeValueContext");
941
+ return {
942
+ contextConfig: ((_d = fieldReference.format) === null || _d === void 0 ? void 0 : _d.ranges) || [],
943
+ contextKey: contextKey,
944
+ dsl: "".concat(translatedValue, " | rangeValue(").concat(contextKey, ")")
945
+ };
946
+ }
947
+
948
+ case 'matchvalue':
949
+ {
950
+ var defaultValue = (_e = fieldReference.format) === null || _e === void 0 ? void 0 : _e.defaultValue;
951
+ var matchValueContextKey = "".concat(key, "MatchValueContext");
952
+ return {
953
+ contextConfig: ((_f = fieldReference.format) === null || _f === void 0 ? void 0 : _f.matches) || [],
954
+ contextKey: matchValueContextKey,
955
+ dsl: "".concat(translatedValue, " | matchValue(").concat(matchValueContextKey).concat(defaultValue !== null && defaultValue !== undefined ? ", ".concat(typeof defaultValue === 'string' ? "\"".concat(defaultValue, "\"") : defaultValue) : '', ")")
956
+ };
957
+ }
958
+
959
+ default:
960
+ break;
961
+ }
962
+
963
+ return null;
964
+ };
630
965
  /**
631
966
  * Translates encoding data selections in array format
632
967
  *
@@ -647,7 +982,7 @@ var isNameBasedReference = function isNameBasedReference(ref) {
647
982
 
648
983
  var translateArrayFormatDataReference = function translateArrayFormatDataReference(encodingDataReference) {
649
984
  if (encodingDataReference.length === 0) {
650
- return;
985
+ return null;
651
986
  }
652
987
 
653
988
  var allIndexBased = encodingDataReference.every(isIndexBasedReference);
@@ -655,39 +990,41 @@ var translateArrayFormatDataReference = function translateArrayFormatDataReferen
655
990
 
656
991
  if (allIndexBased) {
657
992
  var _Base_1$parseIndexBas = Base_1.parseIndexBasedFieldReference(encodingDataReference[0]),
658
- dataSourceName = _Base_1$parseIndexBas.dataSourceName;
993
+ _dataSourceName = _Base_1$parseIndexBas.dataSourceName;
659
994
 
660
995
  var indexesStr = encodingDataReference.map(function (ref) {
661
996
  var _a;
662
997
 
663
998
  return (_a = Base_1.parseIndexBasedFieldReference(ref)) === null || _a === void 0 ? void 0 : _a.fieldIndex;
664
999
  }).join(',');
665
- return "> ".concat(dataSourceName, " | frameBySeriesIndexes(").concat(indexesStr, ")");
666
- } else if (allNameBased) {
1000
+ return "> ".concat(_dataSourceName, " | frameBySeriesIndexes(").concat(indexesStr, ")");
1001
+ }
1002
+
1003
+ if (allNameBased) {
667
1004
  var _Base_1$parseNameBase = Base_1.parseNameBasedFieldReference(encodingDataReference[0]),
668
- _dataSourceName = _Base_1$parseNameBase.dataSourceName;
1005
+ _dataSourceName2 = _Base_1$parseNameBase.dataSourceName;
669
1006
 
670
1007
  var namesStr = encodingDataReference.map(function (ref) {
671
1008
  var _a;
672
1009
 
673
- return '"' + ((_a = Base_1.parseNameBasedFieldReference(ref)) === null || _a === void 0 ? void 0 : _a.fieldName) + '"';
1010
+ return "\"".concat((_a = Base_1.parseNameBasedFieldReference(ref)) === null || _a === void 0 ? void 0 : _a.fieldName, "\"");
674
1011
  }).join(',');
675
- return "> ".concat(_dataSourceName, " | frameBySeriesNames(").concat(namesStr, ")");
676
- } else {
677
- // it's a mix of name and index based references
678
- // get the first ref to extract the dataSource
679
- var firstEntry = encodingDataReference[0];
1012
+ return "> ".concat(_dataSourceName2, " | frameBySeriesNames(").concat(namesStr, ")");
1013
+ } // it's a mix of name and index based references
1014
+ // get the first ref to extract the dataSource
680
1015
 
681
- var _ref = isIndexBasedReference(firstEntry) ? Base_1.parseIndexBasedFieldReference(firstEntry) : Base_1.parseNameBasedFieldReference(firstEntry),
682
- _dataSourceName2 = _ref.dataSourceName;
683
1016
 
684
- var paramStr = encodingDataReference.map(function (ref) {
685
- var _a, _b;
1017
+ var firstEntry = encodingDataReference[0];
686
1018
 
687
- return isIndexBasedReference(ref) ? (_a = Base_1.parseIndexBasedFieldReference(ref)) === null || _a === void 0 ? void 0 : _a.fieldIndex : '"' + ((_b = Base_1.parseNameBasedFieldReference(ref)) === null || _b === void 0 ? void 0 : _b.fieldName) + '"';
688
- }).join(',');
689
- return "> ".concat(_dataSourceName2, " | frameBySeriesNamesOrIndexes(").concat(paramStr, ")");
690
- }
1019
+ var _ref = isIndexBasedReference(firstEntry) ? Base_1.parseIndexBasedFieldReference(firstEntry) : Base_1.parseNameBasedFieldReference(firstEntry),
1020
+ dataSourceName = _ref.dataSourceName;
1021
+
1022
+ var paramStr = encodingDataReference.map(function (ref) {
1023
+ var _a, _b;
1024
+
1025
+ return isIndexBasedReference(ref) ? (_a = Base_1.parseIndexBasedFieldReference(ref)) === null || _a === void 0 ? void 0 : _a.fieldIndex : "\"".concat((_b = Base_1.parseNameBasedFieldReference(ref)) === null || _b === void 0 ? void 0 : _b.fieldName, "\"");
1026
+ }).join(',');
1027
+ return "> ".concat(dataSourceName, " | frameBySeriesNamesOrIndexes(").concat(paramStr, ")");
691
1028
  };
692
1029
  /**
693
1030
  * Translates an encoding data selection string to a dynamic options data selection
@@ -717,7 +1054,7 @@ var translateDataReference = function translateDataReference(encodingDataReferen
717
1054
 
718
1055
  if (!isIndexBasedRef && !isNameBasedRef) {
719
1056
  console.warn('Unable to parse the encoding. Please verify the encoding format is correct');
720
- return;
1057
+ return null;
721
1058
  }
722
1059
 
723
1060
  if (isNameBasedRef) {
@@ -755,16 +1092,18 @@ var translateDataReference = function translateDataReference(encodingDataReferen
755
1092
  }
756
1093
 
757
1094
  return "> ".concat(_dataSourceName3, " | frameBySeriesIndexRange(").concat(fromFieldIndex).concat(dslToIndexString, ")");
758
- } else {
759
- var _returnString = "> ".concat(_dataSourceName3, " | seriesByIndex(").concat(fieldIndex, ")");
1095
+ }
760
1096
 
761
- if (_columnIndex) {
762
- _returnString += " | pointByIndex(".concat(_columnIndex, ")");
763
- }
1097
+ var _returnString = "> ".concat(_dataSourceName3, " | seriesByIndex(").concat(fieldIndex, ")");
764
1098
 
765
- return _returnString;
1099
+ if (_columnIndex) {
1100
+ _returnString += " | pointByIndex(".concat(_columnIndex, ")");
766
1101
  }
1102
+
1103
+ return _returnString;
767
1104
  }
1105
+
1106
+ return null;
768
1107
  };
769
1108
  /**
770
1109
  * An encoding configuration can come in various different forms:
@@ -800,7 +1139,8 @@ var encodingToDynamicOptionsDSL = function encodingToDynamicOptionsDSL(encoding)
800
1139
  context: {}
801
1140
  };
802
1141
  var translatedOptions = {};
803
- Object.keys(encoding).forEach(function (key) {
1142
+ var encodingObj = encoding !== null && encoding !== void 0 ? encoding : {};
1143
+ Object.keys(encodingObj).forEach(function (key) {
804
1144
  var fieldReference = encoding[key];
805
1145
  var fieldReferenceStr = fieldReference;
806
1146
 
@@ -823,6 +1163,12 @@ var encodingToDynamicOptionsDSL = function encodingToDynamicOptionsDSL(encoding)
823
1163
 
824
1164
  if (translatedValue) {
825
1165
  translatedOptions[key] = translatedValue;
1166
+ var convertedFormatterObject = convertFormatterToDSL(fieldReference, key, translatedValue);
1167
+
1168
+ if (convertedFormatterObject) {
1169
+ translatedOptions[key] = convertedFormatterObject.dsl;
1170
+ dynamicOptions.context[convertedFormatterObject.contextKey] = convertedFormatterObject.contextConfig;
1171
+ }
826
1172
  }
827
1173
  });
828
1174
  dynamicOptions.options = translatedOptions;
@@ -832,19 +1178,13 @@ var encodingToDynamicOptionsDSL = function encodingToDynamicOptionsDSL(encoding)
832
1178
  exports.encodingToDynamicOptionsDSL = encodingToDynamicOptionsDSL;
833
1179
 
834
1180
  /***/ }),
835
- /* 8 */
1181
+ /* 16 */
836
1182
  /***/ (function(module, exports) {
837
1183
 
838
1184
  module.exports = require("@splunk/visualization-encoding-parsers/Base");
839
1185
 
840
1186
  /***/ }),
841
- /* 9 */
842
- /***/ (function(module, exports) {
843
-
844
- module.exports = require("@splunk/visualizations/Area");
845
-
846
- /***/ }),
847
- /* 10 */
1187
+ /* 17 */
848
1188
  /***/ (function(module, exports, __webpack_require__) {
849
1189
 
850
1190
  "use strict";
@@ -855,11 +1195,11 @@ Object.defineProperty(exports, "__esModule", {
855
1195
  });
856
1196
  exports.migrateVizToSplunkBar = void 0;
857
1197
 
858
- var splunk_charting_1 = __webpack_require__(0);
1198
+ var Bar_config_1 = __webpack_require__(18);
859
1199
 
860
- var Bar_1 = __webpack_require__(11);
1200
+ var splunk_charting_1 = __webpack_require__(2);
861
1201
 
862
- var validOptions = Object.assign({}, Bar_1.config.optionsSchema); // old default configurations should be retained in migrated configuration
1202
+ var validOptions = Object.assign({}, Bar_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
863
1203
 
864
1204
  var defaultChanges = {
865
1205
  yAxisAbbreviation: 'off',
@@ -881,13 +1221,13 @@ var migrateVizToSplunkBar = function migrateVizToSplunkBar(vizDefinition) {
881
1221
  exports.migrateVizToSplunkBar = migrateVizToSplunkBar;
882
1222
 
883
1223
  /***/ }),
884
- /* 11 */
1224
+ /* 18 */
885
1225
  /***/ (function(module, exports) {
886
1226
 
887
- module.exports = require("@splunk/visualizations/Bar");
1227
+ module.exports = require("@splunk/visualizations/Bar.config");
888
1228
 
889
1229
  /***/ }),
890
- /* 12 */
1230
+ /* 19 */
891
1231
  /***/ (function(module, exports, __webpack_require__) {
892
1232
 
893
1233
  "use strict";
@@ -898,11 +1238,11 @@ Object.defineProperty(exports, "__esModule", {
898
1238
  });
899
1239
  exports.migrateVizToSplunkBubble = void 0;
900
1240
 
901
- var splunk_charting_1 = __webpack_require__(0);
1241
+ var Bubble_config_1 = __webpack_require__(20);
902
1242
 
903
- var Bubble_1 = __webpack_require__(13);
1243
+ var splunk_charting_1 = __webpack_require__(2);
904
1244
 
905
- var validOptions = Object.assign({}, Bubble_1.config.optionsSchema); // old default configurations should be retained in migrated configuration
1245
+ var validOptions = Object.assign({}, Bubble_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
906
1246
 
907
1247
  var defaultChanges = {
908
1248
  yAxisAbbreviation: 'off',
@@ -921,56 +1261,109 @@ var migrateVizToSplunkBubble = function migrateVizToSplunkBubble(vizDefinition)
921
1261
  exports.migrateVizToSplunkBubble = migrateVizToSplunkBubble;
922
1262
 
923
1263
  /***/ }),
924
- /* 13 */
1264
+ /* 20 */
925
1265
  /***/ (function(module, exports) {
926
1266
 
927
- module.exports = require("@splunk/visualizations/Bubble");
1267
+ module.exports = require("@splunk/visualizations/Bubble.config");
928
1268
 
929
1269
  /***/ }),
930
- /* 14 */
1270
+ /* 21 */
931
1271
  /***/ (function(module, exports, __webpack_require__) {
932
1272
 
933
1273
  "use strict";
934
1274
 
935
1275
 
1276
+ var __rest = this && this.__rest || function (s, e) {
1277
+ var t = {};
1278
+
1279
+ for (var p in s) {
1280
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1281
+ }
1282
+
1283
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1284
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1285
+ }
1286
+ return t;
1287
+ };
1288
+
936
1289
  Object.defineProperty(exports, "__esModule", {
937
1290
  value: true
938
1291
  });
939
- exports.migrateVizToSplunkColumn = void 0;
1292
+ exports.migrateVizToSplunkChoroplethSvg = void 0;
940
1293
 
941
- var splunk_charting_1 = __webpack_require__(0);
1294
+ var ChoroplethSvg_config_1 = __webpack_require__(22);
942
1295
 
943
- var Column_1 = __webpack_require__(15);
1296
+ var encoding_1 = __webpack_require__(1);
944
1297
 
945
- var validOptions = Object.assign({}, Column_1.config.optionsSchema); // old default configurations should be retained in migrated configuration
1298
+ var migrationUtils_1 = __webpack_require__(0);
946
1299
 
947
- var defaultChanges = {
948
- yAxisAbbreviation: 'off',
949
- y2AxisAbbreviation: 'off',
950
- showRoundedY2AxisLabels: false,
951
- legendTruncation: 'ellipsisMiddle',
952
- showY2MajorGridLines: true
1300
+ var validOptions = Object.assign({}, ChoroplethSvg_config_1.default.optionsSchema);
1301
+ var optionRenames = {
1302
+ featureId: 'areaIds',
1303
+ value: 'areaValues',
1304
+ fill: 'areaColors'
1305
+ }; // old default encoding configurations should be retained in migrated configuration
1306
+
1307
+ var defaultOptionChanges = {
1308
+ areaIds: '> primary | seriesByIndex(0)',
1309
+ areaValues: '> primary | seriesByIndex(1)',
1310
+ areaColors: '> primary | seriesByIndex(1) | gradient(fillGradientContext)'
1311
+ };
1312
+ var defaultContextChanges = {
1313
+ fillGradientContext: {
1314
+ colors: ['#7EEFDA', '#6484F6', '#C093F9', '#293873']
1315
+ }
953
1316
  };
954
1317
 
955
- var migrateVizToSplunkColumn = function migrateVizToSplunkColumn(vizDefinition) {
956
- return splunk_charting_1.migrateBaseChartingVizDefinition({
957
- defaultChanges: defaultChanges,
958
- validOptions: validOptions,
959
- vizDefinition: vizDefinition,
960
- vizType: 'splunk.column'
961
- });
1318
+ var migrateVizToSplunkChoroplethSvg = function migrateVizToSplunkChoroplethSvg(vizDefinition) {
1319
+ var _vizDefinition$encodi = vizDefinition.encoding,
1320
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1321
+ _vizDefinition$option = vizDefinition.options,
1322
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1323
+ otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]); // translate encoding to dynamic options equivalent
1324
+
1325
+
1326
+ var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
1327
+ dataOptions = _encoding_1$encodingT.options,
1328
+ dataContext = _encoding_1$encodingT.context;
1329
+
1330
+ var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
1331
+ type: 'splunk.choropleth.svg',
1332
+ options: {},
1333
+ context: {}
1334
+ }); // add migrated option names and values
1335
+
1336
+ var migratedOptions = Object.assign({}, options);
1337
+ Object.keys(dataOptions).forEach(function (key) {
1338
+ var _a;
1339
+
1340
+ var updatedKey = (_a = optionRenames[key]) !== null && _a !== void 0 ? _a : key;
1341
+ migratedOptions[updatedKey] = dataOptions[key];
1342
+ }); // update migrated options and context
1343
+
1344
+ migratedDefinition.options = Object.assign(Object.assign({}, defaultOptionChanges), migratedOptions);
1345
+ migratedDefinition.context = encoding.fill ? dataContext : defaultContextChanges; // remove invalid options
1346
+
1347
+ migrationUtils_1.removeInvalidOptions(migratedDefinition.options, validOptions);
1348
+ return migratedDefinition;
962
1349
  };
963
1350
 
964
- exports.migrateVizToSplunkColumn = migrateVizToSplunkColumn;
1351
+ exports.migrateVizToSplunkChoroplethSvg = migrateVizToSplunkChoroplethSvg;
965
1352
 
966
1353
  /***/ }),
967
- /* 15 */
1354
+ /* 22 */
968
1355
  /***/ (function(module, exports) {
969
1356
 
970
- module.exports = require("@splunk/visualizations/Column");
1357
+ module.exports = require("@splunk/visualizations/ChoroplethSvg.config");
971
1358
 
972
1359
  /***/ }),
973
- /* 16 */
1360
+ /* 23 */
1361
+ /***/ (function(module, exports) {
1362
+
1363
+ module.exports = require("@splunk/visualization-encoding/utils/dsl");
1364
+
1365
+ /***/ }),
1366
+ /* 24 */
974
1367
  /***/ (function(module, exports, __webpack_require__) {
975
1368
 
976
1369
  "use strict";
@@ -979,42 +1372,41 @@ module.exports = require("@splunk/visualizations/Column");
979
1372
  Object.defineProperty(exports, "__esModule", {
980
1373
  value: true
981
1374
  });
982
- exports.migrateVizToSplunkLine = void 0;
1375
+ exports.migrateVizToSplunkColumn = void 0;
983
1376
 
984
- var splunk_charting_1 = __webpack_require__(0);
1377
+ var Column_config_1 = __webpack_require__(25);
985
1378
 
986
- var Line_1 = __webpack_require__(17);
1379
+ var splunk_charting_1 = __webpack_require__(2);
987
1380
 
988
- var validOptions = Object.assign({}, Line_1.config.optionsSchema); // old default configurations should be retained in migrated configuration
1381
+ var validOptions = Object.assign({}, Column_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
989
1382
 
990
1383
  var defaultChanges = {
991
1384
  yAxisAbbreviation: 'off',
992
1385
  y2AxisAbbreviation: 'off',
993
1386
  showRoundedY2AxisLabels: false,
994
1387
  legendTruncation: 'ellipsisMiddle',
995
- showY2MajorGridLines: true,
996
- markerDisplay: 'outlined'
1388
+ showY2MajorGridLines: true
997
1389
  };
998
1390
 
999
- var migrateVizToSplunkLine = function migrateVizToSplunkLine(vizDefinition) {
1391
+ var migrateVizToSplunkColumn = function migrateVizToSplunkColumn(vizDefinition) {
1000
1392
  return splunk_charting_1.migrateBaseChartingVizDefinition({
1001
1393
  defaultChanges: defaultChanges,
1002
1394
  validOptions: validOptions,
1003
1395
  vizDefinition: vizDefinition,
1004
- vizType: 'splunk.line'
1396
+ vizType: 'splunk.column'
1005
1397
  });
1006
1398
  };
1007
1399
 
1008
- exports.migrateVizToSplunkLine = migrateVizToSplunkLine;
1400
+ exports.migrateVizToSplunkColumn = migrateVizToSplunkColumn;
1009
1401
 
1010
1402
  /***/ }),
1011
- /* 17 */
1403
+ /* 25 */
1012
1404
  /***/ (function(module, exports) {
1013
1405
 
1014
- module.exports = require("@splunk/visualizations/Line");
1406
+ module.exports = require("@splunk/visualizations/Column.config");
1015
1407
 
1016
1408
  /***/ }),
1017
- /* 18 */
1409
+ /* 26 */
1018
1410
  /***/ (function(module, exports, __webpack_require__) {
1019
1411
 
1020
1412
  "use strict";
@@ -1036,102 +1428,186 @@ var __rest = this && this.__rest || function (s, e) {
1036
1428
  Object.defineProperty(exports, "__esModule", {
1037
1429
  value: true
1038
1430
  });
1039
- exports.migrateVizToSplunkPie = void 0;
1431
+ exports.migrateVizToSplunkEllipse = void 0;
1040
1432
 
1041
- var encoding_1 = __webpack_require__(2);
1433
+ var Ellipse_config_1 = __webpack_require__(27);
1042
1434
 
1043
- var splunk_charting_1 = __webpack_require__(0);
1435
+ var encoding_1 = __webpack_require__(1);
1044
1436
 
1045
- var Pie_1 = __webpack_require__(19);
1437
+ var migrationUtils_1 = __webpack_require__(0);
1046
1438
 
1047
- var validOptions = Object.assign({}, Pie_1.config.optionsSchema);
1439
+ var validOptions = Object.assign({}, Ellipse_config_1.default.optionsSchema);
1440
+ var optionsToRename = {
1441
+ fill: 'fillColor',
1442
+ stroke: 'strokeColor',
1443
+ strokeDasharray: 'strokeDashStyle'
1444
+ };
1048
1445
 
1049
- var migratePieChartLabelAndPercent = function migratePieChartLabelAndPercent(options) {
1050
- // if neither chart.showLabels or chart.showPercent is specified in viz.pie,
1051
- // splunk.pie use the default labelDisplay value
1052
- if (!('chart.showLabels' in options) && !('chart.showPercent' in options)) {
1053
- return {};
1054
- } // if only chart.showPercent is specified in viz.pie
1446
+ var migrateVizToSplunkEllipse = function migrateVizToSplunkEllipse(vizDefinition) {
1447
+ var _vizDefinition$encodi = vizDefinition.encoding,
1448
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1449
+ _vizDefinition$option = vizDefinition.options,
1450
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1451
+ otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
1452
+
1453
+ var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
1454
+ type: 'splunk.ellipse',
1455
+ options: options,
1456
+ context: {}
1457
+ });
1055
1458
 
1459
+ var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
1460
+ dataOptions = _encoding_1$encodingT.options,
1461
+ dataContext = _encoding_1$encodingT.context; // To simulate the implicit logic in the shape parser that Ellipse utilizes, append
1462
+ // the lastPoint() DataSeries selector.
1056
1463
 
1057
- if (!('chart.showLabels' in options) && 'chart.showPercent' in options) {
1058
- return {
1059
- labelDisplay: options['chart.showPercent'] ? 'valuesAndPercentage' : 'values'
1060
- };
1061
- } // if only chart.showLabels is specified in viz.pie
1062
1464
 
1465
+ var updatedDataOptions = migrationUtils_1.addsDataSelectorToOptions(dataOptions, 'lastPoint()');
1466
+ migratedDefinition.options = Object.assign(Object.assign({}, options), updatedDataOptions); // perform any option renaming
1063
1467
 
1064
- if ('chart.showLabels' in options && !('chart.showPercent' in options)) {
1065
- return {
1066
- labelDisplay: options['chart.showLabels'] ? 'values' : 'off'
1067
- };
1068
- } // if both chart.showLabels and chart.showPercent are specified in viz.pie
1468
+ migratedDefinition.options = migrationUtils_1.renameVizOptions(migratedDefinition.options, optionsToRename); // remove invalid options from new definition
1469
+
1470
+ migrationUtils_1.removeInvalidOptions(migratedDefinition.options, validOptions);
1471
+ migratedDefinition.context = dataContext;
1472
+ return migratedDefinition;
1473
+ };
1069
1474
 
1475
+ exports.migrateVizToSplunkEllipse = migrateVizToSplunkEllipse;
1070
1476
 
1071
- var labelOption = {
1072
- labelDisplay: 'values'
1073
- };
1477
+ /***/ }),
1478
+ /* 27 */
1479
+ /***/ (function(module, exports) {
1074
1480
 
1075
- if (options['chart.showLabels'] && options['chart.showPercent']) {
1076
- labelOption.labelDisplay = 'valuesAndPercentage';
1077
- }
1481
+ module.exports = require("@splunk/visualizations/Ellipse.config");
1078
1482
 
1079
- if (!options['chart.showLabels']) {
1080
- labelOption.labelDisplay = 'off';
1483
+ /***/ }),
1484
+ /* 28 */
1485
+ /***/ (function(module, exports, __webpack_require__) {
1486
+
1487
+ "use strict";
1488
+
1489
+
1490
+ var __rest = this && this.__rest || function (s, e) {
1491
+ var t = {};
1492
+
1493
+ for (var p in s) {
1494
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1081
1495
  }
1082
1496
 
1083
- return labelOption;
1497
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1498
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1499
+ }
1500
+ return t;
1084
1501
  };
1085
1502
 
1086
- var migrateFieldColors = function migrateFieldColors(options) {
1087
- if ('fieldColors' in options) {
1088
- return {
1089
- seriesColorsByValue: splunk_charting_1.otherValueReplacements.seriesColorsByField(options.fieldColors)
1090
- };
1091
- } else {
1092
- return {};
1093
- }
1503
+ Object.defineProperty(exports, "__esModule", {
1504
+ value: true
1505
+ });
1506
+ exports.migrateVizToSplunkFillerGauge = void 0;
1507
+
1508
+ var FillerGauge_config_1 = __webpack_require__(29);
1509
+
1510
+ var encoding_1 = __webpack_require__(1);
1511
+
1512
+ var gauges_1 = __webpack_require__(7);
1513
+
1514
+ var migrationUtils_1 = __webpack_require__(0);
1515
+
1516
+ var validOptions = Object.assign({}, FillerGauge_config_1.default.optionsSchema);
1517
+ var optionRenames = {
1518
+ majorUnit: 'majorTickInterval'
1519
+ };
1520
+ var previousRangeValueConfig = [{
1521
+ to: 10,
1522
+ value: '#5fbcff'
1523
+ }, {
1524
+ from: 10,
1525
+ to: 30,
1526
+ value: '#4beba8'
1527
+ }, {
1528
+ from: 30,
1529
+ to: 50,
1530
+ value: '#f4df7a'
1531
+ }, {
1532
+ from: 50,
1533
+ to: 70,
1534
+ value: '#fc9850'
1535
+ }, {
1536
+ from: 70,
1537
+ to: 100,
1538
+ value: '#ff7152'
1539
+ }];
1540
+ var defaultChanges = {
1541
+ gaugeColor: '> value | rangeValue(gaugeColorRangeValueContext)',
1542
+ value: '> primary | seriesByIndex(0) | lastPoint()'
1094
1543
  };
1095
1544
 
1096
- var migrateVizToSplunkPie = function migrateVizToSplunkPie(vizDefinition) {
1097
- var _vizDefinition$encodi = vizDefinition.encoding,
1098
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1099
- _vizDefinition$option = vizDefinition.options,
1545
+ var migrateVizToSplunkFillerGauge = function migrateVizToSplunkFillerGauge(vizDefinition) {
1546
+ var _a;
1547
+
1548
+ var _vizDefinition$option = vizDefinition.options,
1100
1549
  options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1101
- otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
1550
+ _vizDefinition$encodi = vizDefinition.encoding,
1551
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1552
+ otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
1102
1553
 
1103
- var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
1104
- type: 'splunk.pie',
1105
- options: {},
1554
+ var migratedVisualization = Object.assign(Object.assign({
1555
+ options: options
1556
+ }, otherDefinitionParts), {
1557
+ type: 'splunk.fillergauge',
1106
1558
  context: {}
1107
- }); // translate encoding to dynamic options equivalent
1559
+ });
1560
+ var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
1108
1561
 
1109
1562
  var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
1110
- dataOptions = _encoding_1$encodingT.options,
1111
- dataContext = _encoding_1$encodingT.context;
1563
+ encodingOptions = _encoding_1$encodingT.options,
1564
+ gaugeColorContext = _encoding_1$encodingT.context; // if a viz.fillergauge receives an entire column for `value` (e.g. primary[0]), it will select the last value of the column
1565
+ // this contrasts with viz.markergauge (which takes the first point of the column)
1566
+ // this is due to differing behavior in the FillerGaugeParser, which explicitly retrieves the last point in a received array
1567
+ // https://cd.splunkdev.com/devplat/vision/-/blob/main/packages/visualization-encoding-parsers/src/FillerGaugeParser.js#L79
1112
1568
 
1113
- var migratedOptions = Object.assign(Object.assign(Object.assign(Object.assign({}, migratePieChartLabelAndPercent(options)), splunk_charting_1.migrateChartingOptions(options)), migrateFieldColors(options)), dataOptions); // remove invalid options
1114
1569
 
1115
- Object.keys(migratedOptions).forEach(function (key) {
1116
- if (!validOptions[key]) {
1117
- delete migratedOptions[key];
1118
- }
1119
- });
1120
- migratedDefinition.options = migratedOptions;
1121
- migratedDefinition.context = dataContext;
1122
- return migratedDefinition;
1570
+ var originalGaugeValue = encodingOptions.value;
1571
+
1572
+ if (typeof originalGaugeValue === 'string') {
1573
+ encodingOptions.value = (_a = migrationUtils_1.preserveDataSelectionForValueOption(originalGaugeValue, 'lastPoint()')) !== null && _a !== void 0 ? _a : originalGaugeValue;
1574
+ }
1575
+
1576
+ if (encodingOptions === null || encodingOptions === void 0 ? void 0 : encodingOptions.gaugeColor) {
1577
+ migratedVisualization.context = gaugeColorContext;
1578
+ } else {
1579
+ // preserve the default context if no gaugeColor encoding was configured
1580
+ migratedVisualization.context = {
1581
+ gaugeColorRangeValueContext: previousRangeValueConfig
1582
+ };
1583
+ }
1584
+
1585
+ var showLabels = options.showLabels,
1586
+ usePercentageRange = options.usePercentageRange,
1587
+ showValue = options.showValue,
1588
+ usePercentageValue = options.usePercentageValue;
1589
+ var labelDisplay = gauges_1.consolidateDisplayOption(showLabels, usePercentageRange);
1590
+ var valueDisplay = gauges_1.consolidateDisplayOption(showValue, usePercentageValue);
1591
+ migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultChanges), renamedOptions), encodingOptions), typeof labelDisplay === 'string' && {
1592
+ labelDisplay: labelDisplay
1593
+ }), typeof valueDisplay === 'string' && {
1594
+ valueDisplay: valueDisplay
1595
+ }); // remove invalid options using the optionsSchema for splunk.fillergauge as reference
1596
+
1597
+ migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
1598
+ return migratedVisualization;
1123
1599
  };
1124
1600
 
1125
- exports.migrateVizToSplunkPie = migrateVizToSplunkPie;
1601
+ exports.migrateVizToSplunkFillerGauge = migrateVizToSplunkFillerGauge;
1126
1602
 
1127
1603
  /***/ }),
1128
- /* 19 */
1604
+ /* 29 */
1129
1605
  /***/ (function(module, exports) {
1130
1606
 
1131
- module.exports = require("@splunk/visualizations/Pie");
1607
+ module.exports = require("@splunk/visualizations/FillerGauge.config");
1132
1608
 
1133
1609
  /***/ }),
1134
- /* 20 */
1610
+ /* 30 */
1135
1611
  /***/ (function(module, exports, __webpack_require__) {
1136
1612
 
1137
1613
  "use strict";
@@ -1140,35 +1616,1392 @@ module.exports = require("@splunk/visualizations/Pie");
1140
1616
  Object.defineProperty(exports, "__esModule", {
1141
1617
  value: true
1142
1618
  });
1143
- exports.migrateVizToSplunkScatter = void 0;
1619
+ exports.migrateVizToSplunkLine = void 0;
1144
1620
 
1145
- var splunk_charting_1 = __webpack_require__(0);
1621
+ var Line_config_1 = __webpack_require__(31);
1146
1622
 
1147
- var Scatter_1 = __webpack_require__(21);
1623
+ var splunk_charting_1 = __webpack_require__(2);
1148
1624
 
1149
- var validOptions = Object.assign({}, Scatter_1.config.optionsSchema); // old default configurations should be retained in migrated configuration
1625
+ var validOptions = Object.assign({}, Line_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
1626
+ // except for markerDisplay which migrates to the new default 'off'
1150
1627
 
1151
1628
  var defaultChanges = {
1152
1629
  yAxisAbbreviation: 'off',
1153
- legendTruncation: 'ellipsisMiddle'
1630
+ y2AxisAbbreviation: 'off',
1631
+ showRoundedY2AxisLabels: false,
1632
+ legendTruncation: 'ellipsisMiddle',
1633
+ showY2MajorGridLines: true
1154
1634
  };
1155
1635
 
1156
- var migrateVizToSplunkScatter = function migrateVizToSplunkScatter(vizDefinition) {
1636
+ var migrateVizToSplunkLine = function migrateVizToSplunkLine(vizDefinition) {
1157
1637
  return splunk_charting_1.migrateBaseChartingVizDefinition({
1158
1638
  defaultChanges: defaultChanges,
1159
1639
  validOptions: validOptions,
1160
1640
  vizDefinition: vizDefinition,
1161
- vizType: 'splunk.scatter'
1641
+ vizType: 'splunk.line'
1162
1642
  });
1163
1643
  };
1164
1644
 
1165
- exports.migrateVizToSplunkScatter = migrateVizToSplunkScatter;
1645
+ exports.migrateVizToSplunkLine = migrateVizToSplunkLine;
1166
1646
 
1167
1647
  /***/ }),
1168
- /* 21 */
1648
+ /* 31 */
1649
+ /***/ (function(module, exports) {
1650
+
1651
+ module.exports = require("@splunk/visualizations/Line.config");
1652
+
1653
+ /***/ }),
1654
+ /* 32 */
1655
+ /***/ (function(module, exports, __webpack_require__) {
1656
+
1657
+ "use strict";
1658
+
1659
+
1660
+ var __rest = this && this.__rest || function (s, e) {
1661
+ var t = {};
1662
+
1663
+ for (var p in s) {
1664
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1665
+ }
1666
+
1667
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1668
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1669
+ }
1670
+ return t;
1671
+ };
1672
+
1673
+ Object.defineProperty(exports, "__esModule", {
1674
+ value: true
1675
+ });
1676
+ exports.migrateVizToSplunkImage = void 0;
1677
+
1678
+ var Image_config_1 = __webpack_require__(33);
1679
+
1680
+ var migrationUtils_1 = __webpack_require__(0);
1681
+
1682
+ var validOptions = Object.assign({}, Image_config_1.default.optionsSchema);
1683
+
1684
+ var migrateVizToSplunkImage = function migrateVizToSplunkImage(vizDefinition) {
1685
+ var _vizDefinition$option = vizDefinition.options,
1686
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1687
+ otherDefinitionParts = __rest(vizDefinition, ["options"]);
1688
+
1689
+ var migratedVisualization = Object.assign(Object.assign({
1690
+ options: options
1691
+ }, otherDefinitionParts), {
1692
+ type: 'splunk.image',
1693
+ context: {}
1694
+ }); // remove invalid options using the optionsSchema for splunk.image as reference
1695
+
1696
+ migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
1697
+ return migratedVisualization;
1698
+ };
1699
+
1700
+ exports.migrateVizToSplunkImage = migrateVizToSplunkImage;
1701
+
1702
+ /***/ }),
1703
+ /* 33 */
1704
+ /***/ (function(module, exports) {
1705
+
1706
+ module.exports = require("@splunk/visualizations/Image.config");
1707
+
1708
+ /***/ }),
1709
+ /* 34 */
1710
+ /***/ (function(module, exports, __webpack_require__) {
1711
+
1712
+ "use strict";
1713
+
1714
+
1715
+ var __rest = this && this.__rest || function (s, e) {
1716
+ var t = {};
1717
+
1718
+ for (var p in s) {
1719
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1720
+ }
1721
+
1722
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1723
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1724
+ }
1725
+ return t;
1726
+ };
1727
+
1728
+ Object.defineProperty(exports, "__esModule", {
1729
+ value: true
1730
+ });
1731
+ exports.migrateVizToSplunkMarkdown = void 0;
1732
+
1733
+ var Markdown_config_1 = __webpack_require__(8);
1734
+
1735
+ var migrationUtils_1 = __webpack_require__(0);
1736
+
1737
+ var validOptions = Object.assign({}, Markdown_config_1.default.optionsSchema);
1738
+
1739
+ var migrateVizToSplunkMarkdown = function migrateVizToSplunkMarkdown(vizDefinition) {
1740
+ var _vizDefinition$option = vizDefinition.options,
1741
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1742
+ otherDefinitionParts = __rest(vizDefinition, ["options"]);
1743
+
1744
+ var migratedVisualization = Object.assign(Object.assign({
1745
+ options: options
1746
+ }, otherDefinitionParts), {
1747
+ type: 'splunk.markdown',
1748
+ context: {}
1749
+ }); // remove invalid options using the optionsSchema for splunk.markdown as reference
1750
+
1751
+ migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
1752
+ return migratedVisualization;
1753
+ };
1754
+
1755
+ exports.migrateVizToSplunkMarkdown = migrateVizToSplunkMarkdown;
1756
+
1757
+ /***/ }),
1758
+ /* 35 */
1759
+ /***/ (function(module, exports, __webpack_require__) {
1760
+
1761
+ "use strict";
1762
+
1763
+
1764
+ var __rest = this && this.__rest || function (s, e) {
1765
+ var t = {};
1766
+
1767
+ for (var p in s) {
1768
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1769
+ }
1770
+
1771
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1772
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1773
+ }
1774
+ return t;
1775
+ };
1776
+
1777
+ Object.defineProperty(exports, "__esModule", {
1778
+ value: true
1779
+ });
1780
+ exports.migrateVizToSplunkMarkerGauge = void 0;
1781
+
1782
+ var MarkerGauge_config_1 = __webpack_require__(36);
1783
+
1784
+ var encoding_1 = __webpack_require__(1);
1785
+
1786
+ var migrationUtils_1 = __webpack_require__(0);
1787
+
1788
+ var gauges_1 = __webpack_require__(7);
1789
+
1790
+ var validOptions = Object.assign({}, MarkerGauge_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
1791
+
1792
+ var defaultChanges = {
1793
+ gaugeRanges: [{
1794
+ from: 90,
1795
+ to: 100,
1796
+ value: '#CB3B43'
1797
+ }, {
1798
+ from: 50,
1799
+ to: 90,
1800
+ value: '#F4DF7A'
1801
+ }, {
1802
+ from: 0,
1803
+ to: 50,
1804
+ value: '#4BEBA8'
1805
+ }],
1806
+ value: '> primary | seriesByIndex(0) | lastPoint()'
1807
+ };
1808
+ var optionRenames = {
1809
+ majorUnit: 'majorTickInterval',
1810
+ ranges: 'gaugeRanges'
1811
+ };
1812
+
1813
+ var migrateVizToSplunkMarkerGauge = function migrateVizToSplunkMarkerGauge(vizDefinition) {
1814
+ var _a;
1815
+
1816
+ var _vizDefinition$option = vizDefinition.options,
1817
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1818
+ _vizDefinition$encodi = vizDefinition.encoding,
1819
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1820
+ otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
1821
+
1822
+ var migratedVisualization = Object.assign(Object.assign({
1823
+ options: options
1824
+ }, otherDefinitionParts), {
1825
+ type: 'splunk.markergauge',
1826
+ context: {}
1827
+ });
1828
+ var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
1829
+
1830
+ var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
1831
+ dataOptions = _encoding_1$encodingT.options; // viz.markergauge has behavior where if a column without a specific point (e.g. primary[1]) is selected,
1832
+ // the markerGauge will only display the first point of the column
1833
+ // the following logic accounts for this and appends firstPoint() to the DSL statement
1834
+
1835
+
1836
+ var originalGaugeValue = dataOptions.value;
1837
+
1838
+ if (typeof originalGaugeValue === 'string') {
1839
+ dataOptions.value = (_a = migrationUtils_1.preserveDataSelectionForValueOption(originalGaugeValue, 'firstPoint()')) !== null && _a !== void 0 ? _a : originalGaugeValue;
1840
+ }
1841
+
1842
+ var showLabels = renamedOptions.showLabels,
1843
+ usePercentageRange = renamedOptions.usePercentageRange,
1844
+ showValue = renamedOptions.showValue,
1845
+ usePercentageValue = renamedOptions.usePercentageValue;
1846
+ var labelDisplay = gauges_1.consolidateDisplayOption(showLabels, usePercentageRange);
1847
+ var valueDisplay = gauges_1.consolidateDisplayOption(showValue, usePercentageValue);
1848
+ migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultChanges), renamedOptions), dataOptions), typeof labelDisplay === 'string' && {
1849
+ labelDisplay: labelDisplay
1850
+ }), typeof valueDisplay === 'string' && {
1851
+ valueDisplay: valueDisplay
1852
+ }); // remove invalid options using the optionsSchema for splunk.markergauge as reference
1853
+
1854
+ migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
1855
+ return migratedVisualization;
1856
+ };
1857
+
1858
+ exports.migrateVizToSplunkMarkerGauge = migrateVizToSplunkMarkerGauge;
1859
+
1860
+ /***/ }),
1861
+ /* 36 */
1862
+ /***/ (function(module, exports) {
1863
+
1864
+ module.exports = require("@splunk/visualizations/MarkerGauge.config");
1865
+
1866
+ /***/ }),
1867
+ /* 37 */
1868
+ /***/ (function(module, exports, __webpack_require__) {
1869
+
1870
+ "use strict";
1871
+
1872
+
1873
+ var __rest = this && this.__rest || function (s, e) {
1874
+ var t = {};
1875
+
1876
+ for (var p in s) {
1877
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1878
+ }
1879
+
1880
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1881
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1882
+ }
1883
+ return t;
1884
+ };
1885
+
1886
+ Object.defineProperty(exports, "__esModule", {
1887
+ value: true
1888
+ });
1889
+ exports.migrateVizToSplunkPie = void 0;
1890
+
1891
+ var Pie_config_1 = __webpack_require__(38);
1892
+
1893
+ var encoding_1 = __webpack_require__(1);
1894
+
1895
+ var splunk_charting_1 = __webpack_require__(2);
1896
+
1897
+ var validOptions = Object.assign({}, Pie_config_1.default.optionsSchema);
1898
+
1899
+ var migratePieChartLabelAndPercent = function migratePieChartLabelAndPercent(options) {
1900
+ // if neither chart.showLabels or chart.showPercent is specified in viz.pie,
1901
+ // splunk.pie use the default labelDisplay value
1902
+ if (!('chart.showLabels' in options) && !('chart.showPercent' in options)) {
1903
+ return {};
1904
+ } // if only chart.showPercent is specified in viz.pie
1905
+
1906
+
1907
+ if (!('chart.showLabels' in options) && 'chart.showPercent' in options) {
1908
+ return {
1909
+ labelDisplay: options['chart.showPercent'] ? 'valuesAndPercentage' : 'values'
1910
+ };
1911
+ } // if only chart.showLabels is specified in viz.pie
1912
+
1913
+
1914
+ if ('chart.showLabels' in options && !('chart.showPercent' in options)) {
1915
+ return {
1916
+ labelDisplay: options['chart.showLabels'] ? 'values' : 'off'
1917
+ };
1918
+ } // if both chart.showLabels and chart.showPercent are specified in viz.pie
1919
+
1920
+
1921
+ var labelOption = {
1922
+ labelDisplay: 'values'
1923
+ };
1924
+
1925
+ if (options['chart.showLabels'] && options['chart.showPercent']) {
1926
+ labelOption.labelDisplay = 'valuesAndPercentage';
1927
+ }
1928
+
1929
+ if (!options['chart.showLabels']) {
1930
+ labelOption.labelDisplay = 'off';
1931
+ }
1932
+
1933
+ return labelOption;
1934
+ }; // retain the pie position when converting viz.pie to splunk.pie - SCP-48658
1935
+
1936
+
1937
+ var migrateDonutChart = function migrateDonutChart(options) {
1938
+ if (options.hasDonutHole) {
1939
+ if (options['legend.placement'] === 'none') {
1940
+ return {
1941
+ labelDisplay: 'off'
1942
+ };
1943
+ }
1944
+
1945
+ return {
1946
+ labelDisplay: 'values'
1947
+ };
1948
+ }
1949
+
1950
+ return {};
1951
+ };
1952
+
1953
+ var migrateFieldColors = function migrateFieldColors(options) {
1954
+ if ('fieldColors' in options) {
1955
+ return {
1956
+ seriesColorsByField: splunk_charting_1.otherValueReplacements.seriesColorsByField(options.fieldColors)
1957
+ };
1958
+ }
1959
+
1960
+ return {};
1961
+ };
1962
+
1963
+ var migrateVizToSplunkPie = function migrateVizToSplunkPie(vizDefinition) {
1964
+ var _vizDefinition$encodi = vizDefinition.encoding,
1965
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1966
+ _vizDefinition$option = vizDefinition.options,
1967
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1968
+ otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
1969
+
1970
+ var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
1971
+ type: 'splunk.pie',
1972
+ options: {},
1973
+ context: {}
1974
+ }); // translate encoding to dynamic options equivalent
1975
+
1976
+ var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
1977
+ dataOptions = _encoding_1$encodingT.options,
1978
+ dataContext = _encoding_1$encodingT.context;
1979
+
1980
+ var migratedOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, migratePieChartLabelAndPercent(options)), splunk_charting_1.migrateChartingOptions(options)), migrateFieldColors(options)), migrateDonutChart(options)), dataOptions); // remove invalid options
1981
+
1982
+ Object.keys(migratedOptions).forEach(function (key) {
1983
+ if (!validOptions[key]) {
1984
+ delete migratedOptions[key];
1985
+ }
1986
+ });
1987
+ migratedDefinition.options = migratedOptions;
1988
+ migratedDefinition.context = dataContext;
1989
+ return migratedDefinition;
1990
+ };
1991
+
1992
+ exports.migrateVizToSplunkPie = migrateVizToSplunkPie;
1993
+
1994
+ /***/ }),
1995
+ /* 38 */
1996
+ /***/ (function(module, exports) {
1997
+
1998
+ module.exports = require("@splunk/visualizations/Pie.config");
1999
+
2000
+ /***/ }),
2001
+ /* 39 */
2002
+ /***/ (function(module, exports, __webpack_require__) {
2003
+
2004
+ "use strict";
2005
+
2006
+
2007
+ Object.defineProperty(exports, "__esModule", {
2008
+ value: true
2009
+ });
2010
+ exports.migrateVizToSplunkScatter = void 0;
2011
+
2012
+ var Scatter_config_1 = __webpack_require__(40);
2013
+
2014
+ var splunk_charting_1 = __webpack_require__(2);
2015
+
2016
+ var validOptions = Object.assign({}, Scatter_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
2017
+
2018
+ var defaultChanges = {
2019
+ yAxisAbbreviation: 'off',
2020
+ legendTruncation: 'ellipsisMiddle'
2021
+ };
2022
+
2023
+ var migrateVizToSplunkScatter = function migrateVizToSplunkScatter(vizDefinition) {
2024
+ return splunk_charting_1.migrateBaseChartingVizDefinition({
2025
+ defaultChanges: defaultChanges,
2026
+ validOptions: validOptions,
2027
+ vizDefinition: vizDefinition,
2028
+ vizType: 'splunk.scatter'
2029
+ });
2030
+ };
2031
+
2032
+ exports.migrateVizToSplunkScatter = migrateVizToSplunkScatter;
2033
+
2034
+ /***/ }),
2035
+ /* 40 */
2036
+ /***/ (function(module, exports) {
2037
+
2038
+ module.exports = require("@splunk/visualizations/Scatter.config");
2039
+
2040
+ /***/ }),
2041
+ /* 41 */
2042
+ /***/ (function(module, exports, __webpack_require__) {
2043
+
2044
+ "use strict";
2045
+
2046
+
2047
+ var __rest = this && this.__rest || function (s, e) {
2048
+ var t = {};
2049
+
2050
+ for (var p in s) {
2051
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2052
+ }
2053
+
2054
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2055
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2056
+ }
2057
+ return t;
2058
+ };
2059
+
2060
+ Object.defineProperty(exports, "__esModule", {
2061
+ value: true
2062
+ });
2063
+ exports.migrateVizToSplunkRectangle = void 0;
2064
+
2065
+ var Rectangle_config_1 = __webpack_require__(42);
2066
+
2067
+ var encoding_1 = __webpack_require__(1);
2068
+
2069
+ var migrationUtils_1 = __webpack_require__(0);
2070
+
2071
+ var optionsToRename = {
2072
+ fill: 'fillColor',
2073
+ stroke: 'strokeColor',
2074
+ strokeDasharray: 'strokeDashStyle',
2075
+ strokeLinejoin: 'strokeJoinStyle'
2076
+ };
2077
+ var validOptions = Object.assign({}, Rectangle_config_1.default.optionsSchema);
2078
+
2079
+ var migrateVizToSplunkRectangle = function migrateVizToSplunkRectangle(vizDefinition) {
2080
+ var _vizDefinition$encodi = vizDefinition.encoding,
2081
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2082
+ options = vizDefinition.options,
2083
+ otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
2084
+
2085
+ var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
2086
+ type: 'splunk.rectangle',
2087
+ options: {},
2088
+ context: {}
2089
+ }); // translate encoding to dynamic options equivalent
2090
+
2091
+ var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
2092
+ dataOptions = _encoding_1$encodingT.options,
2093
+ dataContext = _encoding_1$encodingT.context; // To simulate the implicit logic in the shape parser that Rectangle utilizes, append
2094
+ // the lastPoint() DataSeries selector.
2095
+
2096
+
2097
+ var updatedDataOptions = migrationUtils_1.addsDataSelectorToOptions(dataOptions, 'lastPoint()');
2098
+ migratedDefinition.options = Object.assign(Object.assign({}, options), updatedDataOptions); // perform option rename
2099
+
2100
+ migratedDefinition.options = migrationUtils_1.renameVizOptions(migratedDefinition.options, optionsToRename); // remove invalid options, validOptions is taken from the config.optionsSchema
2101
+
2102
+ migrationUtils_1.removeInvalidOptions(migratedDefinition.options, validOptions);
2103
+ migratedDefinition.context = dataContext;
2104
+ return migratedDefinition;
2105
+ };
2106
+
2107
+ exports.migrateVizToSplunkRectangle = migrateVizToSplunkRectangle;
2108
+
2109
+ /***/ }),
2110
+ /* 42 */
2111
+ /***/ (function(module, exports) {
2112
+
2113
+ module.exports = require("@splunk/visualizations/Rectangle.config");
2114
+
2115
+ /***/ }),
2116
+ /* 43 */
2117
+ /***/ (function(module, exports, __webpack_require__) {
2118
+
2119
+ "use strict";
2120
+
2121
+
2122
+ var __rest = this && this.__rest || function (s, e) {
2123
+ var t = {};
2124
+
2125
+ for (var p in s) {
2126
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2127
+ }
2128
+
2129
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2130
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2131
+ }
2132
+ return t;
2133
+ };
2134
+
2135
+ Object.defineProperty(exports, "__esModule", {
2136
+ value: true
2137
+ });
2138
+ exports.migrateVizToSplunkSingleValue = void 0;
2139
+
2140
+ var SingleValue_config_1 = __webpack_require__(44);
2141
+
2142
+ var encoding_1 = __webpack_require__(1);
2143
+
2144
+ var migrationUtils_1 = __webpack_require__(0);
2145
+
2146
+ var singlevalue_1 = __webpack_require__(3);
2147
+
2148
+ var validOptions = Object.assign({}, SingleValue_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
2149
+
2150
+ var defaultsToRetain = {
2151
+ showSparklineAreaGraph: false,
2152
+ sparklineValues: '> primary | seriesByTypes("number", "string")'
2153
+ };
2154
+ var optionRenames = {
2155
+ useTrendUnits: 'shouldAbbreviateTrendValue',
2156
+ useThousandSeparators: 'shouldUseThousandSeparators',
2157
+ sparklineAreaGraph: 'showSparklineAreaGraph',
2158
+ sparklineFillColor: 'sparklineAreaColor',
2159
+ sparklineAcceptNullData: 'shouldSparklineAcceptNullData',
2160
+ deltaFontSize: 'trendFontSize'
2161
+ };
2162
+ /**
2163
+ * Helper function to consolidate `sparklinePosition` - before/after/below
2164
+ * and `showSparkline` - true/false into `sparklineDisplay` - off/before/after/below
2165
+ * 1. if `showSparkline` is explicitly false, `sparklineDisplay` is off
2166
+ * 2. if `showSparkline` is undefined (defaults to true), return `sparklinePosition` value if present
2167
+ * 3. if `showSparkline` is explicitly true, return 'below'
2168
+ * 4. if both the old options are undefined, return nothing as their defaults (true and `below`)
2169
+ * correspond to `sparklineDisplay` default - below
2170
+ */
2171
+
2172
+ var consolidateSparklineDisplay = function consolidateSparklineDisplay(sparklinePosition, showSparkline) {
2173
+ if (showSparkline === false) {
2174
+ return 'off';
2175
+ }
2176
+
2177
+ if (['before', 'after', 'below'].includes(sparklinePosition)) {
2178
+ return sparklinePosition;
2179
+ }
2180
+
2181
+ if (showSparkline === true) {
2182
+ return 'below';
2183
+ }
2184
+
2185
+ return null;
2186
+ };
2187
+
2188
+ var migrateVizToSplunkSingleValue = function migrateVizToSplunkSingleValue(vizDefinition) {
2189
+ var _a, _b, _c;
2190
+
2191
+ var _vizDefinition$option = vizDefinition.options,
2192
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2193
+ _vizDefinition$encodi = vizDefinition.encoding,
2194
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2195
+ otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
2196
+
2197
+ var migratedVisualization = Object.assign(Object.assign({}, otherDefinitionParts), {
2198
+ type: 'splunk.singlevalue',
2199
+ context: {},
2200
+ options: {}
2201
+ });
2202
+
2203
+ var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
2204
+ dataOptions = _encoding_1$encodingT.options,
2205
+ dataContext = _encoding_1$encodingT.context;
2206
+
2207
+ var migratedDataOptions = Object.assign(Object.assign(Object.assign(Object.assign({}, (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.trend) && {
2208
+ sparklineValues: dataOptions.trend
2209
+ }), (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.majorColor) && {
2210
+ majorColor: (_a = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.majorColor, 'lastPoint()')) !== null && _a !== void 0 ? _a : dataOptions.majorColor
2211
+ }), (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.deltaColor) && {
2212
+ trendColor: (_b = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.deltaColor, 'lastPoint()')) !== null && _b !== void 0 ? _b : dataOptions.deltaColor
2213
+ }), (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.fill) && {
2214
+ backgroundColor: (_c = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.fill, 'lastPoint()')) !== null && _c !== void 0 ? _c : dataOptions.fill
2215
+ });
2216
+ var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
2217
+ var trendDisplayMode = renamedOptions.trendDisplayMode,
2218
+ showTrendIndicator = renamedOptions.showTrendIndicator,
2219
+ showSparkline = renamedOptions.showSparkline,
2220
+ sparklinePosition = renamedOptions.sparklinePosition;
2221
+ var trendDisplay = singlevalue_1.consolidateTrendDisplay(trendDisplayMode, showTrendIndicator);
2222
+ var sparklineDisplay = consolidateSparklineDisplay(sparklinePosition, showSparkline);
2223
+ migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultsToRetain), renamedOptions), migratedDataOptions), typeof trendDisplay === 'string' && {
2224
+ trendDisplay: trendDisplay
2225
+ }), typeof sparklineDisplay === 'string' && {
2226
+ sparklineDisplay: sparklineDisplay
2227
+ });
2228
+ migratedVisualization.context = dataContext; // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalue as reference
2229
+
2230
+ migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
2231
+ return migratedVisualization;
2232
+ };
2233
+
2234
+ exports.migrateVizToSplunkSingleValue = migrateVizToSplunkSingleValue;
2235
+
2236
+ /***/ }),
2237
+ /* 44 */
2238
+ /***/ (function(module, exports) {
2239
+
2240
+ module.exports = require("@splunk/visualizations/SingleValue.config");
2241
+
2242
+ /***/ }),
2243
+ /* 45 */
2244
+ /***/ (function(module, exports, __webpack_require__) {
2245
+
2246
+ "use strict";
2247
+
2248
+
2249
+ var __rest = this && this.__rest || function (s, e) {
2250
+ var t = {};
2251
+
2252
+ for (var p in s) {
2253
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2254
+ }
2255
+
2256
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2257
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2258
+ }
2259
+ return t;
2260
+ };
2261
+
2262
+ Object.defineProperty(exports, "__esModule", {
2263
+ value: true
2264
+ });
2265
+ exports.migrateVizToSplunkSingleValueIcon = void 0;
2266
+
2267
+ var SingleValueIcon_config_1 = __webpack_require__(46);
2268
+
2269
+ var encoding_1 = __webpack_require__(1);
2270
+
2271
+ var migrationUtils_1 = __webpack_require__(0);
2272
+
2273
+ var singlevalue_1 = __webpack_require__(3);
2274
+
2275
+ var validOptions = Object.assign({}, SingleValueIcon_config_1.default.optionsSchema);
2276
+ var defaultsToRetain = {
2277
+ majorValue: '> primary | seriesByIndex(0) | lastPoint()',
2278
+ trendValue: '> primary | seriesByIndex(0) | delta(-2)'
2279
+ };
2280
+ var optionsToRename = {
2281
+ useTrendUnits: 'shouldAbbreviateTrendValue',
2282
+ useThousandSeparators: 'shouldUseThousandSeparators',
2283
+ deltaColor: 'trendColor',
2284
+ color: 'iconColor'
2285
+ };
2286
+
2287
+ var migrateVizToSplunkSingleValueIcon = function migrateVizToSplunkSingleValueIcon(vizDefinition) {
2288
+ var _a, _b, _c;
2289
+
2290
+ var _vizDefinition$option = vizDefinition.options,
2291
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2292
+ _vizDefinition$encodi = vizDefinition.encoding,
2293
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2294
+ otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
2295
+
2296
+ var migratedVisualization = Object.assign(Object.assign({}, otherDefinitionParts), {
2297
+ type: 'splunk.singlevalueicon',
2298
+ context: {},
2299
+ options: {}
2300
+ });
2301
+
2302
+ var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
2303
+ dataOptions = _encoding_1$encodingT.options,
2304
+ dataContext = _encoding_1$encodingT.context;
2305
+
2306
+ var migratedDataOptions = Object.assign(Object.assign({}, (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.trend) && {
2307
+ majorValue: (_a = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.trend, 'lastPoint()')) !== null && _a !== void 0 ? _a : dataOptions.trend,
2308
+ trendValue: (_b = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.trend, 'delta(-2)')) !== null && _b !== void 0 ? _b : dataOptions.trend
2309
+ }), (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.fill) && {
2310
+ backgroundColor: (_c = migrationUtils_1.preserveDataSelectionForValueOption(dataOptions.fill, 'lastPoint()')) !== null && _c !== void 0 ? _c : dataOptions.fill
2311
+ });
2312
+ var renamedOptions = migrationUtils_1.renameVizOptions(options, optionsToRename);
2313
+ var trendDisplayMode = renamedOptions.trendDisplayMode,
2314
+ showTrendIndicator = renamedOptions.showTrendIndicator;
2315
+ var trendDisplay = singlevalue_1.consolidateTrendDisplay(trendDisplayMode, showTrendIndicator);
2316
+ migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultsToRetain), renamedOptions), migratedDataOptions), typeof trendDisplay === 'string' && {
2317
+ trendDisplay: trendDisplay
2318
+ });
2319
+ migratedVisualization.context = dataContext; // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalueicon as reference
2320
+
2321
+ migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
2322
+ return migratedVisualization;
2323
+ };
2324
+
2325
+ exports.migrateVizToSplunkSingleValueIcon = migrateVizToSplunkSingleValueIcon;
2326
+
2327
+ /***/ }),
2328
+ /* 46 */
2329
+ /***/ (function(module, exports) {
2330
+
2331
+ module.exports = require("@splunk/visualizations/SingleValueIcon.config");
2332
+
2333
+ /***/ }),
2334
+ /* 47 */
2335
+ /***/ (function(module, exports, __webpack_require__) {
2336
+
2337
+ "use strict";
2338
+
2339
+
2340
+ var __rest = this && this.__rest || function (s, e) {
2341
+ var t = {};
2342
+
2343
+ for (var p in s) {
2344
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2345
+ }
2346
+
2347
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2348
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2349
+ }
2350
+ return t;
2351
+ };
2352
+
2353
+ Object.defineProperty(exports, "__esModule", {
2354
+ value: true
2355
+ });
2356
+ exports.migrateVizToSplunkSingleValueRadial = void 0;
2357
+
2358
+ var SingleValueRadial_config_1 = __webpack_require__(48);
2359
+
2360
+ var encoding_1 = __webpack_require__(1);
2361
+
2362
+ var migrationUtils_1 = __webpack_require__(0);
2363
+
2364
+ var singlevalue_1 = __webpack_require__(3);
2365
+
2366
+ var validOptions = Object.assign({}, SingleValueRadial_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
2367
+
2368
+ var defaultsToRetain = {
2369
+ majorValue: '> primary | seriesByIndex(0) | lastPoint()',
2370
+ trendValue: '> primary | seriesByIndex(0) | delta(-2)'
2371
+ };
2372
+ var optionRenames = {
2373
+ useTrendUnits: 'shouldAbbreviateTrendValue',
2374
+ useThousandSeparators: 'shouldUseThousandSeparators'
2375
+ };
2376
+
2377
+ var migrateVizToSplunkSingleValueRadial = function migrateVizToSplunkSingleValueRadial(vizDefinition) {
2378
+ var _a, _b, _c;
2379
+
2380
+ var _vizDefinition$option = vizDefinition.options,
2381
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2382
+ _vizDefinition$encodi = vizDefinition.encoding,
2383
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2384
+ otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
2385
+
2386
+ var migratedVisualization = Object.assign(Object.assign({}, otherDefinitionParts), {
2387
+ type: 'splunk.singlevalueradial',
2388
+ context: {},
2389
+ options: {}
2390
+ });
2391
+
2392
+ var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
2393
+ dataOptions = _encoding_1$encodingT.options,
2394
+ dataContext = _encoding_1$encodingT.context;
2395
+
2396
+ var originalTrend = dataOptions.trend,
2397
+ originalFill = dataOptions.fill;
2398
+ var migratedDataOptions = Object.assign(Object.assign({}, originalTrend && {
2399
+ majorValue: (_a = migrationUtils_1.preserveDataSelectionForValueOption(originalTrend, 'lastPoint()')) !== null && _a !== void 0 ? _a : originalTrend,
2400
+ trendValue: (_b = migrationUtils_1.preserveDataSelectionForValueOption(originalTrend, 'delta(-2)')) !== null && _b !== void 0 ? _b : originalTrend
2401
+ }), originalFill && {
2402
+ backgroundColor: (_c = migrationUtils_1.preserveDataSelectionForValueOption(originalFill, 'lastPoint()')) !== null && _c !== void 0 ? _c : originalFill
2403
+ });
2404
+ var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
2405
+ var trendDisplayMode = renamedOptions.trendDisplayMode,
2406
+ showTrendIndicator = renamedOptions.showTrendIndicator;
2407
+ var trendDisplay = singlevalue_1.consolidateTrendDisplay(trendDisplayMode, showTrendIndicator);
2408
+ migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultsToRetain), renamedOptions), migratedDataOptions), typeof trendDisplay === 'string' && {
2409
+ trendDisplay: trendDisplay
2410
+ });
2411
+ migratedVisualization.context = dataContext; // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalueradial as reference
2412
+
2413
+ migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
2414
+ return migratedVisualization;
2415
+ };
2416
+
2417
+ exports.migrateVizToSplunkSingleValueRadial = migrateVizToSplunkSingleValueRadial;
2418
+
2419
+ /***/ }),
2420
+ /* 48 */
2421
+ /***/ (function(module, exports) {
2422
+
2423
+ module.exports = require("@splunk/visualizations/SingleValueRadial.config");
2424
+
2425
+ /***/ }),
2426
+ /* 49 */
2427
+ /***/ (function(module, exports, __webpack_require__) {
2428
+
2429
+ "use strict";
2430
+
2431
+
2432
+ var _slicedToArray = __webpack_require__(6);
2433
+
2434
+ var __rest = this && this.__rest || function (s, e) {
2435
+ var t = {};
2436
+
2437
+ for (var p in s) {
2438
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2439
+ }
2440
+
2441
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2442
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2443
+ }
2444
+ return t;
2445
+ };
2446
+
2447
+ Object.defineProperty(exports, "__esModule", {
2448
+ value: true
2449
+ });
2450
+ exports.migrateVizToSplunkTable = void 0;
2451
+
2452
+ var lodash_1 = __webpack_require__(9);
2453
+
2454
+ var Table_config_1 = __webpack_require__(50);
2455
+
2456
+ var hocUtils_1 = __webpack_require__(51);
2457
+
2458
+ var encoding_1 = __webpack_require__(1);
2459
+
2460
+ var migrationUtils_1 = __webpack_require__(0);
2461
+
2462
+ var validOptions = Object.assign({}, Table_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
2463
+
2464
+ var defaultChanges = {
2465
+ count: 20
2466
+ };
2467
+ var optionRenames = {
2468
+ rowNumbers: 'showRowNumbers'
2469
+ };
2470
+
2471
+ var migrateHeaderVisibility = function migrateHeaderVisibility(oldHeaderVisibility) {
2472
+ if (oldHeaderVisibility === undefined) {
2473
+ // headerVisibility: 'inline' is the default in splunk.table
2474
+ // this corresponds to `showHeader: true`, which is the default in viz.table
2475
+ return undefined;
2476
+ }
2477
+
2478
+ return oldHeaderVisibility ? 'inline' : 'none';
2479
+ };
2480
+ /**
2481
+ * Helper to migrate alternating color options (text and background) to their corresponding DSL and context configs
2482
+ */
2483
+
2484
+
2485
+ var migrateAlternatingColors = function migrateAlternatingColors(colors, optionToConvert, contextConfigName) {
2486
+ // default alternating themed color values as defined in table config
2487
+ var themedAlternatingColors = {
2488
+ rowBackgroundColors: {
2489
+ even: '> themes.rowBackgroundColorEven',
2490
+ odd: '> themes.rowBackgroundColorOdd'
2491
+ },
2492
+ rowColors: {
2493
+ even: '> themes.inverseTextColor',
2494
+ odd: '> themes.textColor'
2495
+ }
2496
+ };
2497
+ var colorsContext = [];
2498
+ var oddColor = colors.oddColor,
2499
+ evenColor = colors.evenColor;
2500
+
2501
+ if (oddColor && evenColor) {
2502
+ colorsContext.push.apply(colorsContext, [oddColor, evenColor]);
2503
+ } else if (oddColor) {
2504
+ colorsContext.push.apply(colorsContext, [oddColor, themedAlternatingColors[optionToConvert].even]);
2505
+ } else if (evenColor) {
2506
+ colorsContext.push.apply(colorsContext, [themedAlternatingColors[optionToConvert].odd, evenColor]);
2507
+ }
2508
+
2509
+ if (colorsContext.length) {
2510
+ return {
2511
+ contextConfigName: contextConfigName,
2512
+ context: colorsContext,
2513
+ dsl: "> table | pick(".concat(contextConfigName, ")")
2514
+ };
2515
+ }
2516
+
2517
+ return {};
2518
+ };
2519
+ /**
2520
+ * Intermediate helper to translate column-specific formatting in viz.table to their DSL equivalents
2521
+ * viz.table defines column-specific formatting via entries specified in options.fields.<columnName>
2522
+ *
2523
+ * This requires moving numberPrecision, useThousandSeparators, unitPosition, and other formatting options to the config
2524
+ * The resultant config is used as the argument for formatByType
2525
+ */
2526
+
2527
+
2528
+ var migrateToColumnFormat = function migrateToColumnFormat(fieldsOption) {
2529
+ var columnFormat = {};
2530
+ var columnFormatContext = {};
2531
+
2532
+ if (!fieldsOption) {
2533
+ return {
2534
+ columnFormat: columnFormat,
2535
+ columnFormatContext: columnFormatContext
2536
+ };
2537
+ }
2538
+
2539
+ Object.entries(fieldsOption).forEach(function (_ref) {
2540
+ var _ref2 = _slicedToArray(_ref, 2),
2541
+ column = _ref2[0],
2542
+ formatting = _ref2[1];
2543
+
2544
+ // need to prepend `formatted` in case the column has leading digits, which the nearley parser cannot account for
2545
+ var contextEntry = "formatted".concat(column, "Config");
2546
+ columnFormatContext[contextEntry] = {};
2547
+ columnFormat[column] = {
2548
+ data: "> table | seriesByName(\"".concat(column, "\") | formatByType(").concat(contextEntry, ")")
2549
+ }; // all columnFormatting options are optional; if they are not present in the original config, tableFormat should take precedence
2550
+
2551
+ var unit = formatting.unit,
2552
+ unitPosition = formatting.unitPosition,
2553
+ numberPrecision = formatting.numberPrecision,
2554
+ useThousandSeparators = formatting.useThousandSeparators;
2555
+
2556
+ if (typeof unitPosition === 'string') {
2557
+ lodash_1.set(columnFormatContext, [contextEntry, 'number', 'unitPosition'], unitPosition);
2558
+ lodash_1.set(columnFormatContext, [contextEntry, 'string', 'unitPosition'], unitPosition);
2559
+ }
2560
+
2561
+ if (typeof unit === 'string' || typeof unit === 'number') {
2562
+ lodash_1.set(columnFormatContext, [contextEntry, 'number', 'unit'], unit);
2563
+ lodash_1.set(columnFormatContext, [contextEntry, 'string', 'unit'], unit);
2564
+ }
2565
+
2566
+ if (numberPrecision != null) {
2567
+ lodash_1.set(columnFormatContext, [contextEntry, 'number', 'precision'], numberPrecision);
2568
+ }
2569
+
2570
+ if (useThousandSeparators != null) {
2571
+ lodash_1.set(columnFormatContext, [contextEntry, 'number', 'thousandSeparated'], useThousandSeparators);
2572
+ }
2573
+ });
2574
+ return {
2575
+ columnFormat: columnFormat,
2576
+ columnFormatContext: columnFormatContext
2577
+ };
2578
+ };
2579
+ /**
2580
+ * Intermediate helper to translate table-wide formatting and coloring in viz.table to their DSL equivalents
2581
+ *
2582
+ * This requires moving numberPrecision, useThousandSeparators, unitPosition, and other formatting/coloring options to the config
2583
+ * The resultant formatting and coloring config is used as the argument for the formatByType() and pick() DSL formatters respectively
2584
+ */
2585
+
2586
+
2587
+ var migrateToTableFormat = function migrateToTableFormat() {
2588
+ var oldOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2589
+ var tableFormat = {};
2590
+ var tableFormatContext = {
2591
+ formattedConfig: {}
2592
+ };
2593
+ var unit = oldOptions.unit,
2594
+ oldUnitPosition = oldOptions.unitPosition,
2595
+ oldNumberPrecision = oldOptions.numberPrecision,
2596
+ oldUseThousandSeparators = oldOptions.useThousandSeparators;
2597
+ var unitPosition = typeof oldUnitPosition === 'string' ? oldUnitPosition : 'after';
2598
+ var numberPrecision = typeof oldNumberPrecision === 'number' ? oldNumberPrecision : 0;
2599
+ var useThousandSeparators = typeof oldUseThousandSeparators === 'boolean' ? oldUseThousandSeparators : false;
2600
+ lodash_1.set(tableFormatContext, ['formattedConfig', 'number', 'precision'], numberPrecision);
2601
+ lodash_1.set(tableFormatContext, ['formattedConfig', 'number', 'thousandSeparated'], useThousandSeparators);
2602
+ lodash_1.set(tableFormatContext, ['formattedConfig', 'number', 'unitPosition'], unitPosition);
2603
+ lodash_1.set(tableFormatContext, ['formattedConfig', 'string', 'unitPosition'], unitPosition);
2604
+
2605
+ if (typeof unit === 'string' || typeof unit === 'number') {
2606
+ lodash_1.set(tableFormatContext, ['formattedConfig', 'number', 'unit'], unit);
2607
+ lodash_1.set(tableFormatContext, ['formattedConfig', 'string', 'unit'], unit);
2608
+ }
2609
+
2610
+ tableFormat.data = "> table | formatByType(formattedConfig)";
2611
+ var rowBackgroundColorEven = oldOptions.rowBackgroundColorEven,
2612
+ rowBackgroundColorOdd = oldOptions.rowBackgroundColorOdd,
2613
+ rowTextColorOdd = oldOptions.rowTextColorOdd,
2614
+ rowTextColorEven = oldOptions.rowTextColorEven,
2615
+ headerTextColor = oldOptions.headerTextColor,
2616
+ headerBackgroundColor = oldOptions.headerBackgroundColor;
2617
+
2618
+ var _migrateAlternatingCo = migrateAlternatingColors({
2619
+ oddColor: rowTextColorOdd,
2620
+ evenColor: rowTextColorEven
2621
+ }, 'rowColors', 'rowColorsConfig'),
2622
+ rowColorsContext = _migrateAlternatingCo.context,
2623
+ rowColorsDSL = _migrateAlternatingCo.dsl;
2624
+
2625
+ if (rowColorsContext && rowColorsDSL) {
2626
+ tableFormatContext.rowColorsConfig = rowColorsContext;
2627
+ tableFormat.rowColors = rowColorsDSL;
2628
+ }
2629
+
2630
+ var _migrateAlternatingCo2 = migrateAlternatingColors({
2631
+ oddColor: rowBackgroundColorOdd,
2632
+ evenColor: rowBackgroundColorEven
2633
+ }, 'rowBackgroundColors', 'rowBackgroundColorsConfig'),
2634
+ rowBackgroundColorsContext = _migrateAlternatingCo2.context,
2635
+ rowBackgroundColorsDSL = _migrateAlternatingCo2.dsl;
2636
+
2637
+ if (rowBackgroundColorsContext && rowBackgroundColorsDSL) {
2638
+ tableFormat.rowBackgroundColors = rowBackgroundColorsDSL;
2639
+ tableFormatContext.rowBackgroundColorsConfig = rowBackgroundColorsContext;
2640
+ }
2641
+
2642
+ if (headerTextColor) {
2643
+ tableFormat.headerColor = headerTextColor;
2644
+ }
2645
+
2646
+ if (headerBackgroundColor) {
2647
+ tableFormat.headerBackgroundColor = headerBackgroundColor;
2648
+ }
2649
+
2650
+ return {
2651
+ tableFormat: tableFormat,
2652
+ tableFormatContext: tableFormatContext
2653
+ };
2654
+ };
2655
+
2656
+ var migrateVizToSplunkTable = function migrateVizToSplunkTable(vizDefinition) {
2657
+ var _vizDefinition$encodi = vizDefinition.encoding,
2658
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2659
+ _vizDefinition$option = vizDefinition.options,
2660
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2661
+ otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
2662
+
2663
+ var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
2664
+ type: 'splunk.table',
2665
+ options: {},
2666
+ context: {}
2667
+ });
2668
+
2669
+ var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
2670
+ dataOptions = _encoding_1$encodingT.options,
2671
+ dataContext = _encoding_1$encodingT.context;
2672
+
2673
+ var renamedOptions = migrationUtils_1.renameVizOptions(options, optionRenames);
2674
+ var headerVisibility = migrateHeaderVisibility(renamedOptions.showHeader);
2675
+
2676
+ var _migrateToTableFormat = migrateToTableFormat(renamedOptions),
2677
+ tableFormat = _migrateToTableFormat.tableFormat,
2678
+ tableFormatContext = _migrateToTableFormat.tableFormatContext;
2679
+
2680
+ var _migrateToColumnForma = migrateToColumnFormat(renamedOptions.fields),
2681
+ columnFormat = _migrateToColumnForma.columnFormat,
2682
+ columnFormatContext = _migrateToColumnForma.columnFormatContext;
2683
+
2684
+ var migratedDataOptions = Object.assign({}, (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.columns) && {
2685
+ table: dataOptions.columns
2686
+ });
2687
+ var formattingOptions = Object.assign(Object.assign(Object.assign({}, !lodash_1.isEmpty(columnFormat) && {
2688
+ columnFormat: columnFormat
2689
+ }), typeof headerVisibility === 'string' && {
2690
+ headerVisibility: headerVisibility
2691
+ }), {
2692
+ tableFormat: tableFormat
2693
+ });
2694
+ var migratedOptions = hocUtils_1.deepMergeWithArrayOverrides({}, defaultChanges, formattingOptions, migratedDataOptions, renamedOptions); // remove invalid options
2695
+
2696
+ Object.keys(migratedOptions).forEach(function (key) {
2697
+ if (!validOptions[key]) {
2698
+ delete migratedOptions[key];
2699
+ }
2700
+ });
2701
+ migratedDefinition.context = Object.assign(Object.assign(Object.assign({}, dataContext), !lodash_1.isEmpty(columnFormatContext) && Object.assign({}, columnFormatContext)), tableFormatContext);
2702
+ migratedDefinition.options = migratedOptions;
2703
+ return migratedDefinition;
2704
+ };
2705
+
2706
+ exports.migrateVizToSplunkTable = migrateVizToSplunkTable;
2707
+
2708
+ /***/ }),
2709
+ /* 50 */
2710
+ /***/ (function(module, exports) {
2711
+
2712
+ module.exports = require("@splunk/visualizations/Table.config");
2713
+
2714
+ /***/ }),
2715
+ /* 51 */
2716
+ /***/ (function(module, exports) {
2717
+
2718
+ module.exports = require("@splunk/visualizations/common/utils/hocUtils");
2719
+
2720
+ /***/ }),
2721
+ /* 52 */
2722
+ /***/ (function(module, exports, __webpack_require__) {
2723
+
2724
+ "use strict";
2725
+
2726
+
2727
+ var __rest = this && this.__rest || function (s, e) {
2728
+ var t = {};
2729
+
2730
+ for (var p in s) {
2731
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2732
+ }
2733
+
2734
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2735
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2736
+ }
2737
+ return t;
2738
+ };
2739
+
2740
+ Object.defineProperty(exports, "__esModule", {
2741
+ value: true
2742
+ });
2743
+ exports.migrateVizTextToSplunkMarkdown = void 0;
2744
+
2745
+ var _ = __webpack_require__(9);
2746
+
2747
+ var Markdown_config_1 = __webpack_require__(8);
2748
+
2749
+ var migrationUtils_1 = __webpack_require__(0);
2750
+
2751
+ var validOptions = Object.assign({}, Markdown_config_1.default.optionsSchema);
2752
+ var optionsToRename = {
2753
+ textColor: 'fontColor',
2754
+ content: 'markdown'
2755
+ };
2756
+
2757
+ var convertTextContentToMarkDown = function convertTextContentToMarkDown(fontWeight, fontSize) {
2758
+ var textContent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
2759
+
2760
+ if (!_.isNumber(fontSize)) {
2761
+ return textContent;
2762
+ }
2763
+
2764
+ if (textContent.trim().length === 0) {
2765
+ return textContent;
2766
+ } // Remove any trailing newline chars from the content
2767
+
2768
+
2769
+ var markdownContent = textContent.replace(/\n*$/, ''); // Handle text conversion to marker tags based on fontSize and fontWeight
2770
+
2771
+ var regex = /\n/g; // regex to match /n with global scope across the string
2772
+ // Convert to H1 header type (#) in markdown, if fontSize >=24
2773
+
2774
+ if (fontSize >= 24) {
2775
+ markdownContent = markdownContent.replace(regex, '\n# ');
2776
+ return "# ".concat(markdownContent);
2777
+ } // Convert to H2 header type (##) in markdown, if fontSize >= 18 && fontSize < 24
2778
+
2779
+
2780
+ if (fontSize >= 18 && fontSize < 24) {
2781
+ markdownContent = markdownContent.replace(regex, '\n## ');
2782
+ return "## ".concat(markdownContent);
2783
+ } // Convert to H3 header type (###) in markdown, if fontSize >= 16 && fontSize < 18
2784
+
2785
+
2786
+ if (fontSize >= 16 && fontSize < 18) {
2787
+ markdownContent = markdownContent.replace(regex, '\n### ');
2788
+ return "### ".concat(markdownContent);
2789
+ } // Convert to paragraph in markdown, if fontSize < 16,
2790
+ // If text has fontWeight set to 'bold', add bold tag (**{markdown}**)
2791
+
2792
+
2793
+ if (fontWeight === 'bold') {
2794
+ // Here direct regex replace doesnt work, as we need to remove the
2795
+ // extra trailing space if any exist before appending **{markdown}** to the text
2796
+ var contentStrings = markdownContent.split('\n');
2797
+ var stringsTrimmed = contentStrings.map(function (str) {
2798
+ return str && str.trim().length ? "**".concat(str.trim(), "**") : '';
2799
+ }); // Remove all blank entries from the end of the trimmed string array,
2800
+ // to avoid `\` to get rendered, which happens if following line after `\\n` is empty)
2801
+
2802
+ var idx = stringsTrimmed.length - 1;
2803
+
2804
+ while (idx >= 0 && stringsTrimmed[idx].length === 0) {
2805
+ stringsTrimmed.pop();
2806
+ idx -= 1;
2807
+ }
2808
+
2809
+ return stringsTrimmed.join('\\\n');
2810
+ } // If fontWeight is not bold, replace '\n' with '\\n` using regex
2811
+
2812
+
2813
+ markdownContent = markdownContent.replace(regex, '\\\n');
2814
+ return markdownContent;
2815
+ };
2816
+
2817
+ var migrateVizTextToSplunkMarkdown = function migrateVizTextToSplunkMarkdown(vizDefinition) {
2818
+ var _vizDefinition$option = vizDefinition.options,
2819
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2820
+ otherDefinitionParts = __rest(vizDefinition, ["options"]);
2821
+
2822
+ var _options$fontSize = options.fontSize,
2823
+ fontSize = _options$fontSize === void 0 ? 24 : _options$fontSize,
2824
+ _options$fontWeight = options.fontWeight,
2825
+ fontWeight = _options$fontWeight === void 0 ? 'normal' : _options$fontWeight;
2826
+ var migratedVisualization = Object.assign(Object.assign({
2827
+ options: options
2828
+ }, otherDefinitionParts), {
2829
+ type: 'splunk.markdown',
2830
+ context: {}
2831
+ }); // perform any option renames
2832
+
2833
+ migratedVisualization.options = migrationUtils_1.renameVizOptions(migratedVisualization.options, optionsToRename);
2834
+ var migratedVizOptions = migratedVisualization.options; // convert text content to respective markdown
2835
+
2836
+ migratedVizOptions.markdown = convertTextContentToMarkDown(fontWeight, fontSize, migratedVizOptions.markdown); // remove invalid options using the optionsSchema for splunk.markdown as reference
2837
+
2838
+ migrationUtils_1.removeInvalidOptions(migratedVizOptions, validOptions);
2839
+ return migratedVisualization;
2840
+ };
2841
+
2842
+ exports.migrateVizTextToSplunkMarkdown = migrateVizTextToSplunkMarkdown;
2843
+
2844
+ /***/ }),
2845
+ /* 53 */
2846
+ /***/ (function(module, exports, __webpack_require__) {
2847
+
2848
+ "use strict";
2849
+
2850
+
2851
+ var _toConsumableArray = __webpack_require__(5);
2852
+
2853
+ var __rest = this && this.__rest || function (s, e) {
2854
+ var t = {};
2855
+
2856
+ for (var p in s) {
2857
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2858
+ }
2859
+
2860
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2861
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2862
+ }
2863
+ return t;
2864
+ };
2865
+
2866
+ Object.defineProperty(exports, "__esModule", {
2867
+ value: true
2868
+ });
2869
+ exports.migrateVizToSplunkPunchcard = void 0;
2870
+
2871
+ var Punchcard_config_1 = __webpack_require__(54);
2872
+
2873
+ var encoding_1 = __webpack_require__(1);
2874
+
2875
+ var migrationUtils_1 = __webpack_require__(0);
2876
+
2877
+ var validOptions = Object.assign({}, Punchcard_config_1.default.optionsSchema);
2878
+ var defaultContext = Object.assign({}, Punchcard_config_1.default.defaultContext);
2879
+ var optionsToRename = {
2880
+ showBubbleLabels: 'bubbleLabelDisplay',
2881
+ bubbleScale: 'bubbleSizeMethod',
2882
+ isBubbleSizeDynamic: 'showDynamicBubbleSize',
2883
+ maxBubbleRadius: 'bubbleRadiusMax',
2884
+ minBubbleRadius: 'bubbleRadiusMin',
2885
+ maxBubbleSize: 'bubbleSizeMax',
2886
+ minBubbleSize: 'bubbleSizeMin',
2887
+ showLegend: 'legendDisplay',
2888
+ useDefaultSort: 'showDefaultSort'
2889
+ };
2890
+
2891
+ var consolidateLegendDisplay = function consolidateLegendDisplay(vizOptions) {
2892
+ if (!vizOptions) {
2893
+ return;
2894
+ }
2895
+
2896
+ var options = vizOptions;
2897
+
2898
+ if (options.legendDisplay) {
2899
+ options.legendDisplay = 'right';
2900
+ } else if (options.legendDisplay === false) {
2901
+ options.legendDisplay = 'off'; // legenddisplay set explicitly to false
2902
+ }
2903
+ };
2904
+
2905
+ var consolidateBubbleLabelDisplay = function consolidateBubbleLabelDisplay(vizOptions) {
2906
+ if (!vizOptions) {
2907
+ return;
2908
+ }
2909
+
2910
+ var options = vizOptions;
2911
+
2912
+ if (options.bubbleLabelDisplay === 'none') {
2913
+ options.bubbleLabelDisplay = 'off';
2914
+ }
2915
+ }; // Updates the first color of the bubbleColorConfig with the minBubbleColorIntensity
2916
+
2917
+
2918
+ var convertGradientConfig = function convertGradientConfig(minBubbleColorIntensity, defaultBubbleColorConfig) {
2919
+ if (!defaultBubbleColorConfig || !defaultBubbleColorConfig.colors || !defaultBubbleColorConfig.colors[0] || typeof minBubbleColorIntensity !== 'number') {
2920
+ return null;
2921
+ }
2922
+
2923
+ var firstColor = defaultBubbleColorConfig.colors[0];
2924
+ var firstColorUpdated = "".concat(firstColor.substring(0, firstColor.lastIndexOf(',')), ",").concat(minBubbleColorIntensity, ")");
2925
+
2926
+ var colors = _toConsumableArray(defaultBubbleColorConfig.colors);
2927
+
2928
+ colors[0] = firstColorUpdated;
2929
+ var bubbleColorConfigUpdated = Object.assign(Object.assign({}, defaultBubbleColorConfig), {
2930
+ colors: colors
2931
+ });
2932
+ return bubbleColorConfigUpdated;
2933
+ };
2934
+
2935
+ var convertColorModeOption = function convertColorModeOption(visualizationDefinition) {
2936
+ var visualizationDef = visualizationDefinition;
2937
+
2938
+ if (!visualizationDef || !visualizationDef.options) {
2939
+ return;
2940
+ } // Rename the colorMode option from 'sequential' to 'dynamic' if specified
2941
+
2942
+
2943
+ if (visualizationDef.options.colorMode === 'sequential') {
2944
+ visualizationDef.options.colorMode = 'dynamic';
2945
+ } // If no colorMode was specified the default in viz.punchcard used to be 'categorical'.
2946
+ // But in splunk.punchcard default is 'dynamic', we need to preserve the original default.
2947
+ // Set colorMode to 'categorical' if no colorMode was specified in viz
2948
+
2949
+
2950
+ if (!visualizationDef.options.colorMode) {
2951
+ visualizationDef.options.colorMode = 'categorical';
2952
+ }
2953
+
2954
+ var minBubbleColorIntensity = visualizationDef.options.minBubbleColorIntensity; // If there is no category option set or if the colorMode is not categorical, then the colorMode will to 'dynamic'
2955
+ // In both cases we need to update the gradient config bubbleColorConfig with the minBubbleColorIntensity for first color
2956
+
2957
+ if ((!visualizationDef.options.category || visualizationDef.options.colorMode !== 'categorical') && minBubbleColorIntensity && typeof minBubbleColorIntensity === 'number') {
2958
+ var bubbleColorConfig = convertGradientConfig(minBubbleColorIntensity, defaultContext.bubbleColorConfig);
2959
+
2960
+ if (bubbleColorConfig) {
2961
+ visualizationDef.context = Object.assign(Object.assign({}, visualizationDef.context), {
2962
+ bubbleColorConfig: bubbleColorConfig
2963
+ });
2964
+ }
2965
+ }
2966
+ };
2967
+
2968
+ var migrateVizToSplunkPunchcard = function migrateVizToSplunkPunchcard(vizDefinition) {
2969
+ var _vizDefinition$option = vizDefinition.options,
2970
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2971
+ _vizDefinition$encodi = vizDefinition.encoding,
2972
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2973
+ otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
2974
+
2975
+ var migratedVisualization = Object.assign(Object.assign({
2976
+ options: options
2977
+ }, otherDefinitionParts), {
2978
+ type: 'splunk.punchcard',
2979
+ context: {}
2980
+ });
2981
+
2982
+ var _encoding_1$encodingT = encoding_1.encodingToDynamicOptionsDSL(encoding),
2983
+ dataOptions = _encoding_1$encodingT.options,
2984
+ dataContext = _encoding_1$encodingT.context; // perform any option renames
2985
+
2986
+
2987
+ var renamedOptions = migrationUtils_1.renameVizOptions(migratedVisualization.options, optionsToRename);
2988
+ consolidateLegendDisplay(renamedOptions);
2989
+ consolidateBubbleLabelDisplay(renamedOptions);
2990
+ migratedVisualization.options = Object.assign(Object.assign({}, renamedOptions), dataOptions);
2991
+ migratedVisualization.context = dataContext;
2992
+ convertColorModeOption(migratedVisualization); // remove invalid options using the optionsSchema for splunk.punchcard as reference
2993
+
2994
+ migrationUtils_1.removeInvalidOptions(migratedVisualization.options, validOptions);
2995
+ return migratedVisualization;
2996
+ };
2997
+
2998
+ exports.migrateVizToSplunkPunchcard = migrateVizToSplunkPunchcard;
2999
+
3000
+ /***/ }),
3001
+ /* 54 */
1169
3002
  /***/ (function(module, exports) {
1170
3003
 
1171
- module.exports = require("@splunk/visualizations/Scatter");
3004
+ module.exports = require("@splunk/visualizations/Punchcard.config");
1172
3005
 
1173
3006
  /***/ })
1174
3007
  /******/ ]);