@splunk/visualization-migrations 26.0.0 → 26.1.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.
Files changed (3) hide show
  1. package/index.js +726 -263
  2. package/index.js.map +1 -1
  3. package/package.json +10 -7
package/index.js CHANGED
@@ -98,10 +98,12 @@ module.exports =
98
98
 
99
99
 
100
100
  var _slicedToArray = __webpack_require__(6);
101
+
101
102
  Object.defineProperty(exports, "__esModule", {
102
103
  value: true
103
104
  });
104
105
  exports.addsDataSelectorToOptions = exports.preserveDataSelectionForValueOption = exports.renameVizOptions = exports.removeInvalidOptions = void 0;
106
+
105
107
  var dsl_1 = __webpack_require__(23);
106
108
  /**
107
109
  * Removes invalid keys in the options
@@ -109,10 +111,13 @@ var dsl_1 = __webpack_require__(23);
109
111
  * @param validOptions - Valid visualization option keys
110
112
  * @returns void
111
113
  */
114
+
115
+
112
116
  var removeInvalidOptions = function removeInvalidOptions(currentOptions, validOptions) {
113
117
  if (!currentOptions || !validOptions) {
114
118
  return;
115
119
  }
120
+
116
121
  var copiedCurrOptions = currentOptions;
117
122
  Object.keys(copiedCurrOptions).forEach(function (key) {
118
123
  if (!(key in validOptions)) {
@@ -120,6 +125,7 @@ var removeInvalidOptions = function removeInvalidOptions(currentOptions, validOp
120
125
  }
121
126
  });
122
127
  };
128
+
123
129
  exports.removeInvalidOptions = removeInvalidOptions;
124
130
  /**
125
131
  * Renames viz options by looking up their migration mapping
@@ -127,20 +133,24 @@ exports.removeInvalidOptions = removeInvalidOptions;
127
133
  * @param optionRenames - Mapping of old options in viz.X to their migrated counterparts in splunk.X
128
134
  * @returns updatedOptions
129
135
  */
136
+
130
137
  var renameVizOptions = function renameVizOptions(oldOptions, optionRenames) {
131
138
  var updatedOptions = {};
132
139
  if (!oldOptions) return {};
133
140
  if (!optionRenames) return oldOptions;
134
141
  Object.entries(oldOptions).forEach(function (_ref) {
135
142
  var _ref2 = _slicedToArray(_ref, 2),
136
- oldOptName = _ref2[0],
137
- val = _ref2[1];
143
+ oldOptName = _ref2[0],
144
+ val = _ref2[1];
145
+
138
146
  var _a;
147
+
139
148
  var optionName = (_a = optionRenames[oldOptName]) !== null && _a !== void 0 ? _a : oldOptName;
140
149
  updatedOptions[optionName] = val;
141
150
  });
142
151
  return updatedOptions;
143
152
  };
153
+
144
154
  exports.renameVizOptions = renameVizOptions;
145
155
  /**
146
156
  * Appends appropriate series selector to DSL string to add viz-specific implicit logic
@@ -148,17 +158,21 @@ exports.renameVizOptions = renameVizOptions;
148
158
  * @param selector - the selector to append
149
159
  * @returns string | void
150
160
  */
161
+
151
162
  var preserveDataSelectionForValueOption = function preserveDataSelectionForValueOption(valueOption, selector) {
152
163
  if (valueOption) {
153
164
  // if the last data selector starts with seriesBy, append appropriate selector to it
154
165
  var dataSelectors = (0, dsl_1.getDataSelectorsFromDSL)(valueOption);
155
166
  var lastDataSelector = dataSelectors[dataSelectors.length - 1];
167
+
156
168
  if (lastDataSelector.includes('seriesByIndex') || lastDataSelector.includes('seriesByName')) {
157
169
  return "".concat(valueOption, " | ").concat(selector);
158
170
  }
159
171
  }
172
+
160
173
  return null;
161
174
  };
175
+
162
176
  exports.preserveDataSelectionForValueOption = preserveDataSelectionForValueOption;
163
177
  /**
164
178
  * For all data options, calls preserveDataSelectionForValueOption with relevant selector and
@@ -167,11 +181,13 @@ exports.preserveDataSelectionForValueOption = preserveDataSelectionForValueOptio
167
181
  * @param selector - the selector to append
168
182
  * @returns void
169
183
  */
184
+
170
185
  var addsDataSelectorToOptions = function addsDataSelectorToOptions(dataOptions, selector) {
171
186
  var updatedDataOptions = {};
172
187
  Object.keys(dataOptions).forEach(function (key) {
173
188
  var statement = dataOptions[key];
174
189
  var updatedDSL = (0, exports.preserveDataSelectionForValueOption)(statement, selector);
190
+
175
191
  if (updatedDSL) {
176
192
  updatedDataOptions[key] = updatedDSL;
177
193
  } else {
@@ -180,6 +196,7 @@ var addsDataSelectorToOptions = function addsDataSelectorToOptions(dataOptions,
180
196
  });
181
197
  return updatedDataOptions;
182
198
  };
199
+
183
200
  exports.addsDataSelectorToOptions = addsDataSelectorToOptions;
184
201
 
185
202
  /***/ }),
@@ -192,6 +209,7 @@ exports.addsDataSelectorToOptions = addsDataSelectorToOptions;
192
209
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
193
210
  if (k2 === undefined) k2 = k;
194
211
  var desc = Object.getOwnPropertyDescriptor(m, k);
212
+
195
213
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
196
214
  desc = {
197
215
  enumerable: true,
@@ -200,19 +218,23 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
200
218
  }
201
219
  };
202
220
  }
221
+
203
222
  Object.defineProperty(o, k2, desc);
204
223
  } : function (o, m, k, k2) {
205
224
  if (k2 === undefined) k2 = k;
206
225
  o[k2] = m[k];
207
226
  });
227
+
208
228
  var __exportStar = this && this.__exportStar || function (m, exports) {
209
229
  for (var p in m) {
210
230
  if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
211
231
  }
212
232
  };
233
+
213
234
  Object.defineProperty(exports, "__esModule", {
214
235
  value: true
215
236
  });
237
+
216
238
  __exportStar(__webpack_require__(15), exports);
217
239
 
218
240
  /***/ }),
@@ -223,25 +245,32 @@ __exportStar(__webpack_require__(15), exports);
223
245
 
224
246
 
225
247
  var _typeof = __webpack_require__(4);
248
+
226
249
  var __rest = this && this.__rest || function (s, e) {
227
250
  var t = {};
251
+
228
252
  for (var p in s) {
229
253
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
230
254
  }
255
+
231
256
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
232
257
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
233
258
  }
234
259
  return t;
235
260
  };
261
+
236
262
  Object.defineProperty(exports, "__esModule", {
237
263
  value: true
238
264
  });
239
265
  exports.otherValueReplacements = exports.migrateChartingOptions = exports.migrateBaseChartingVizDefinition = void 0;
266
+
240
267
  var encoding_1 = __webpack_require__(1);
241
268
  /**
242
269
  * map of splunk charting based @splunk/dashboard-visualization option names
243
270
  * to updated @splunk/visualization option names
244
271
  */
272
+
273
+
245
274
  var optionRenames = {
246
275
  'axisTitleX.text': 'xAxisTitleText',
247
276
  'axisTitleY.text': 'yAxisTitleText',
@@ -344,6 +373,7 @@ var abbreviationEnumReplacements = {
344
373
  * for some options the valid values changed.
345
374
  * this maps enum values that need to be changed
346
375
  */
376
+
347
377
  var enumReplacements = {
348
378
  xAxisTitleVisibility: visibilityEnumReplacements,
349
379
  yAxisTitleVisibility: visibilityEnumReplacements,
@@ -359,9 +389,9 @@ var enumReplacements = {
359
389
  stackMode: {
360
390
  default: 'auto'
361
391
  }
362
- };
363
- // splits a string with multiple fields separated by comma
392
+ }; // splits a string with multiple fields separated by comma
364
393
  // returns the same value if it's already an array
394
+
365
395
  var splitValue = function splitValue(oldValue) {
366
396
  return Array.isArray(oldValue) ? oldValue : oldValue.split(',');
367
397
  };
@@ -371,16 +401,21 @@ var splitValue = function splitValue(oldValue) {
371
401
  * @param {string | Object} oldValue stringified object to parse
372
402
  * @returns {Object}
373
403
  */
404
+
405
+
374
406
  var parseObjects = function parseObjects(oldValue) {
375
407
  if (_typeof(oldValue) === 'object' && !Array.isArray(oldValue)) {
376
408
  return oldValue;
377
409
  }
410
+
378
411
  var nuValue = {};
412
+
379
413
  try {
380
414
  nuValue = JSON.parse(oldValue);
381
415
  } catch (e) {
382
416
  /* noop */
383
417
  }
418
+
384
419
  return nuValue;
385
420
  };
386
421
  /**
@@ -388,12 +423,15 @@ var parseObjects = function parseObjects(oldValue) {
388
423
  * (e.g. if the type of the updated option changed)
389
424
  * "legendLabels": "test,test2" => "legendLabels": ["test", "test2"]
390
425
  */
426
+
427
+
391
428
  var otherValueReplacements = {
392
429
  y2Fields: splitValue,
393
430
  overlayFields: splitValue,
394
431
  legendLabels: splitValue,
395
432
  seriesColorsByField: parseObjects,
396
433
  lineDashStylesByField: parseObjects,
434
+
397
435
  /**
398
436
  * the original markerDisplay was only exposed as `chart.showMarkers`
399
437
  * setting chart.showMarkers to true is the equivalent of `markerDisplay: 'outlined'`
@@ -413,20 +451,25 @@ exports.otherValueReplacements = otherValueReplacements;
413
451
  * @param {object} options dashboard-viz charting options
414
452
  * @returns {object} migratedOptions viz charting options
415
453
  */
454
+
416
455
  var migrateChartingOptions = function migrateChartingOptions(options) {
417
456
  var migratedOptions = {};
418
457
  Object.keys(options).forEach(function (key) {
419
458
  var _a, _b, _c;
459
+
420
460
  var value = options[key];
421
461
  var updatedKey = (_a = optionRenames[key]) !== null && _a !== void 0 ? _a : key;
422
462
  var updatedValue = (_c = (_b = enumReplacements === null || enumReplacements === void 0 ? void 0 : enumReplacements[updatedKey]) === null || _b === void 0 ? void 0 : _b[value]) !== null && _c !== void 0 ? _c : value;
463
+
423
464
  if (otherValueReplacements[updatedKey]) {
424
465
  updatedValue = otherValueReplacements[updatedKey](updatedValue);
425
466
  }
467
+
426
468
  migratedOptions[updatedKey] = updatedValue;
427
469
  });
428
470
  return migratedOptions;
429
471
  };
472
+
430
473
  exports.migrateChartingOptions = migrateChartingOptions;
431
474
  /**
432
475
  * helper that encapsulates shared migration logic across most charting-based viz
@@ -435,27 +478,31 @@ exports.migrateChartingOptions = migrateChartingOptions;
435
478
  * @param {VisualizationDefinition} vizDefinition - the viz definition to migrate
436
479
  * @param {String} vizType - the value of splunk.*
437
480
  */
481
+
438
482
  var migrateBaseChartingVizDefinition = function migrateBaseChartingVizDefinition(_ref) {
439
483
  var defaultChanges = _ref.defaultChanges,
440
- validOptions = _ref.validOptions,
441
- vizDefinition = _ref.vizDefinition,
442
- vizType = _ref.vizType;
484
+ validOptions = _ref.validOptions,
485
+ vizDefinition = _ref.vizDefinition,
486
+ vizType = _ref.vizType;
487
+
443
488
  var _vizDefinition$encodi = vizDefinition.encoding,
444
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
445
- _vizDefinition$option = vizDefinition.options,
446
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
447
- otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
489
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
490
+ _vizDefinition$option = vizDefinition.options,
491
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
492
+ otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
493
+
448
494
  var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
449
495
  type: vizType,
450
496
  options: {},
451
497
  context: {}
452
- });
453
- // translate encoding to dynamic options equivalent
498
+ }); // translate encoding to dynamic options equivalent
499
+
454
500
  var _ref2 = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
455
- dataOptions = _ref2.options,
456
- dataContext = _ref2.context;
457
- var migratedOptions = Object.assign(Object.assign(Object.assign({}, defaultChanges), migrateChartingOptions(options)), dataOptions);
458
- // remove invalid options
501
+ dataOptions = _ref2.options,
502
+ dataContext = _ref2.context;
503
+
504
+ var migratedOptions = Object.assign(Object.assign(Object.assign({}, defaultChanges), migrateChartingOptions(options)), dataOptions); // remove invalid options
505
+
459
506
  Object.keys(migratedOptions).forEach(function (key) {
460
507
  if (!validOptions[key]) {
461
508
  delete migratedOptions[key];
@@ -465,6 +512,7 @@ var migrateBaseChartingVizDefinition = function migrateBaseChartingVizDefinition
465
512
  migratedDefinition.context = dataContext;
466
513
  return migratedDefinition;
467
514
  };
515
+
468
516
  exports.migrateBaseChartingVizDefinition = migrateBaseChartingVizDefinition;
469
517
 
470
518
  /***/ }),
@@ -487,18 +535,23 @@ exports.consolidateTrendDisplay = void 0;
487
535
  * 4. if both the old options are undefined, return nothing as their defaults (true and `absolute`)
488
536
  * correspond to `trendDisplay` default - absolute
489
537
  */
538
+
490
539
  var consolidateTrendDisplay = function consolidateTrendDisplay(trendDisplayMode, showTrendIndicator) {
491
540
  if (showTrendIndicator === false) {
492
541
  return 'off';
493
542
  }
543
+
494
544
  if (['absolute', 'percent'].includes(trendDisplayMode)) {
495
545
  return trendDisplayMode;
496
546
  }
547
+
497
548
  if (showTrendIndicator === true) {
498
549
  return 'absolute';
499
550
  }
551
+
500
552
  return null;
501
553
  };
554
+
502
555
  exports.consolidateTrendDisplay = consolidateTrendDisplay;
503
556
 
504
557
  /***/ }),
@@ -538,19 +591,24 @@ exports.consolidateDisplayOption = void 0;
538
591
  * @param {Boolean} percentageOption - either one of `usePercentageRange` or `usePercentageValue` in the old gauges
539
592
  * @returns {String}
540
593
  */
594
+
541
595
  var consolidateDisplayOption = function consolidateDisplayOption(showOption, percentageOption) {
542
596
  if (showOption === false) {
543
597
  return 'off';
544
598
  }
599
+
545
600
  if (percentageOption === true) {
546
601
  return 'percentage';
547
602
  }
603
+
548
604
  if (showOption === true) {
549
605
  return 'number';
550
- }
551
- // if showOption is undefined and percentageOption is false, we don't need to return an explicit value (since 'number' is passed in implicitly)
606
+ } // if showOption is undefined and percentageOption is false, we don't need to return an explicit value (since 'number' is passed in implicitly)
607
+
608
+
552
609
  return null;
553
610
  };
611
+
554
612
  exports.consolidateDisplayOption = consolidateDisplayOption;
555
613
 
556
614
  /***/ }),
@@ -575,6 +633,7 @@ module.exports = require("lodash");
575
633
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
576
634
  if (k2 === undefined) k2 = k;
577
635
  var desc = Object.getOwnPropertyDescriptor(m, k);
636
+
578
637
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
579
638
  desc = {
580
639
  enumerable: true,
@@ -583,19 +642,23 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
583
642
  }
584
643
  };
585
644
  }
645
+
586
646
  Object.defineProperty(o, k2, desc);
587
647
  } : function (o, m, k, k2) {
588
648
  if (k2 === undefined) k2 = k;
589
649
  o[k2] = m[k];
590
650
  });
651
+
591
652
  var __exportStar = this && this.__exportStar || function (m, exports) {
592
653
  for (var p in m) {
593
654
  if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
594
655
  }
595
656
  };
657
+
596
658
  Object.defineProperty(exports, "__esModule", {
597
659
  value: true
598
660
  });
661
+
599
662
  __exportStar(__webpack_require__(11), exports);
600
663
 
601
664
  /***/ }),
@@ -609,7 +672,9 @@ Object.defineProperty(exports, "__esModule", {
609
672
  value: true
610
673
  });
611
674
  exports.inferToType = exports.canMigrate = exports.migrate = void 0;
675
+
612
676
  var visualizations_1 = __webpack_require__(12);
677
+
613
678
  var supportedMigrations = {
614
679
  'viz.area': {
615
680
  'splunk.area': visualizations_1.migrateVizToSplunkArea
@@ -678,39 +743,55 @@ var supportedMigrations = {
678
743
  'splunk.punchcard': visualizations_1.migrateVizToSplunkPunchcard
679
744
  }
680
745
  };
746
+
681
747
  var inferToType = function inferToType(typeFromDefinition) {
682
748
  if (typeFromDefinition === 'viz.img') {
683
749
  return 'splunk.image';
684
750
  }
751
+
685
752
  if (typeFromDefinition === 'viz.text') {
686
753
  return 'splunk.markdown';
687
754
  }
755
+
688
756
  if (typeFromDefinition === 'viz.geojson.us' || typeFromDefinition === 'viz.geojson.world') {
689
757
  return 'splunk.map';
690
758
  }
759
+
691
760
  return typeFromDefinition.replace(/^viz\./, 'splunk.');
692
761
  };
762
+
693
763
  exports.inferToType = inferToType;
764
+
694
765
  var migrate = function migrate(_ref) {
695
766
  var definition = _ref.definition,
696
- toTypeFromParams = _ref.toType;
767
+ toTypeFromParams = _ref.toType;
768
+
697
769
  var _a;
770
+
698
771
  var toType = toTypeFromParams !== null && toTypeFromParams !== void 0 ? toTypeFromParams : inferToType(definition.type);
772
+
699
773
  if (!((_a = supportedMigrations === null || supportedMigrations === void 0 ? void 0 : supportedMigrations[definition === null || definition === void 0 ? void 0 : definition.type]) === null || _a === void 0 ? void 0 : _a[toType])) {
700
774
  throw new Error('Migration currently not supported');
701
775
  }
776
+
702
777
  return supportedMigrations[definition.type][toType](definition);
703
778
  };
779
+
704
780
  exports.migrate = migrate;
781
+
705
782
  var canMigrate = function canMigrate(_ref2) {
706
783
  var fromType = _ref2.fromType,
707
- toType = _ref2.toType;
784
+ toType = _ref2.toType;
785
+
708
786
  var _a;
787
+
709
788
  if ((_a = supportedMigrations === null || supportedMigrations === void 0 ? void 0 : supportedMigrations[fromType]) === null || _a === void 0 ? void 0 : _a[toType]) {
710
789
  return true;
711
790
  }
791
+
712
792
  return false;
713
793
  };
794
+
714
795
  exports.canMigrate = canMigrate;
715
796
 
716
797
  /***/ }),
@@ -723,6 +804,7 @@ exports.canMigrate = canMigrate;
723
804
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
724
805
  if (k2 === undefined) k2 = k;
725
806
  var desc = Object.getOwnPropertyDescriptor(m, k);
807
+
726
808
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
727
809
  desc = {
728
810
  enumerable: true,
@@ -731,39 +813,63 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
731
813
  }
732
814
  };
733
815
  }
816
+
734
817
  Object.defineProperty(o, k2, desc);
735
818
  } : function (o, m, k, k2) {
736
819
  if (k2 === undefined) k2 = k;
737
820
  o[k2] = m[k];
738
821
  });
822
+
739
823
  var __exportStar = this && this.__exportStar || function (m, exports) {
740
824
  for (var p in m) {
741
825
  if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
742
826
  }
743
827
  };
828
+
744
829
  Object.defineProperty(exports, "__esModule", {
745
830
  value: true
746
831
  });
832
+
747
833
  __exportStar(__webpack_require__(13), exports);
834
+
748
835
  __exportStar(__webpack_require__(17), exports);
836
+
749
837
  __exportStar(__webpack_require__(19), exports);
838
+
750
839
  __exportStar(__webpack_require__(21), exports);
840
+
751
841
  __exportStar(__webpack_require__(24), exports);
842
+
752
843
  __exportStar(__webpack_require__(26), exports);
844
+
753
845
  __exportStar(__webpack_require__(28), exports);
846
+
754
847
  __exportStar(__webpack_require__(30), exports);
848
+
755
849
  __exportStar(__webpack_require__(32), exports);
850
+
756
851
  __exportStar(__webpack_require__(34), exports);
852
+
757
853
  __exportStar(__webpack_require__(35), exports);
854
+
758
855
  __exportStar(__webpack_require__(37), exports);
856
+
759
857
  __exportStar(__webpack_require__(39), exports);
858
+
760
859
  __exportStar(__webpack_require__(41), exports);
860
+
761
861
  __exportStar(__webpack_require__(43), exports);
862
+
762
863
  __exportStar(__webpack_require__(45), exports);
864
+
763
865
  __exportStar(__webpack_require__(47), exports);
866
+
764
867
  __exportStar(__webpack_require__(49), exports);
868
+
765
869
  __exportStar(__webpack_require__(52), exports);
870
+
766
871
  __exportStar(__webpack_require__(53), exports);
872
+
767
873
  __exportStar(__webpack_require__(55), exports);
768
874
 
769
875
  /***/ }),
@@ -777,10 +883,13 @@ Object.defineProperty(exports, "__esModule", {
777
883
  value: true
778
884
  });
779
885
  exports.migrateVizToSplunkArea = void 0;
886
+
780
887
  var Area_config_1 = __webpack_require__(14);
888
+
781
889
  var splunk_charting_1 = __webpack_require__(2);
782
- var validOptions = Object.assign({}, Area_config_1.default.optionsSchema);
783
- // old default configurations should be retained in migrated configuration
890
+
891
+ var validOptions = Object.assign({}, Area_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
892
+
784
893
  var defaultChanges = {
785
894
  yAxisAbbreviation: 'off',
786
895
  y2AxisAbbreviation: 'off',
@@ -788,6 +897,7 @@ var defaultChanges = {
788
897
  legendTruncation: 'ellipsisMiddle',
789
898
  showY2MajorGridLines: true
790
899
  };
900
+
791
901
  var migrateVizToSplunkArea = function migrateVizToSplunkArea(vizDefinition) {
792
902
  return (0, splunk_charting_1.migrateBaseChartingVizDefinition)({
793
903
  defaultChanges: defaultChanges,
@@ -796,6 +906,7 @@ var migrateVizToSplunkArea = function migrateVizToSplunkArea(vizDefinition) {
796
906
  vizType: 'splunk.area'
797
907
  });
798
908
  };
909
+
799
910
  exports.migrateVizToSplunkArea = migrateVizToSplunkArea;
800
911
 
801
912
  /***/ }),
@@ -812,28 +923,36 @@ module.exports = require("@splunk/visualizations/Area.config");
812
923
 
813
924
 
814
925
  var _typeof = __webpack_require__(4);
926
+
815
927
  var _toConsumableArray = __webpack_require__(5);
928
+
816
929
  Object.defineProperty(exports, "__esModule", {
817
930
  value: true
818
931
  });
819
932
  exports.encodingToDynamicOptionsDSL = void 0;
820
- var Base_1 = __webpack_require__(16);
821
- // @TODO(pwied): move the parsing helpers so we can deprecate visualization-encoding-parsers package
933
+
934
+ var Base_1 = __webpack_require__(16); // @TODO(pwied): move the parsing helpers so we can deprecate visualization-encoding-parsers package
822
935
  // index based references are defined by <dataSource>[<index>]
823
936
  // this regex matches <text with numbers>[<anything>]
824
937
  // the "[" "]" part makes it an index based reference
825
- var indexBasedRegx = /^[A-Za-z0-9_]+\[.*\].*$/;
826
- // name based references are defined by <dataSource>.<columnName>
938
+
939
+
940
+ var indexBasedRegx = /^[A-Za-z0-9_]+\[.*\].*$/; // name based references are defined by <dataSource>.<columnName>
827
941
  // the "." access makes it a name based reference
942
+
828
943
  var nameBasedRegx = /^[A-Za-z0-9_]+\..*$/;
944
+
829
945
  var isIndexBasedReference = function isIndexBasedReference(ref) {
830
946
  return indexBasedRegx.test(ref);
831
947
  };
948
+
832
949
  var isNameBasedReference = function isNameBasedReference(ref) {
833
950
  return nameBasedRegx.test(ref);
834
951
  };
952
+
835
953
  var convertFormatterToDSL = function convertFormatterToDSL(fieldReference, key, translatedValue) {
836
954
  var _a, _b, _c, _d, _e, _f;
955
+
837
956
  switch ((_a = fieldReference === null || fieldReference === void 0 ? void 0 : fieldReference.format) === null || _a === void 0 ? void 0 : _a.type) {
838
957
  case 'gradient':
839
958
  return {
@@ -845,6 +964,7 @@ var convertFormatterToDSL = function convertFormatterToDSL(fieldReference, key,
845
964
  contextKey: "".concat(key, "GradientContext"),
846
965
  dsl: "".concat(translatedValue, " | gradient(").concat(key, "GradientContext)")
847
966
  };
967
+
848
968
  case 'rangevalue':
849
969
  {
850
970
  var contextKey = "".concat(key, "RangeValueContext");
@@ -854,6 +974,7 @@ var convertFormatterToDSL = function convertFormatterToDSL(fieldReference, key,
854
974
  dsl: "".concat(translatedValue, " | rangeValue(").concat(contextKey, ")")
855
975
  };
856
976
  }
977
+
857
978
  case 'matchvalue':
858
979
  {
859
980
  var defaultValue = (_e = fieldReference.format) === null || _e === void 0 ? void 0 : _e.defaultValue;
@@ -864,9 +985,11 @@ var convertFormatterToDSL = function convertFormatterToDSL(fieldReference, key,
864
985
  dsl: "".concat(translatedValue, " | matchValue(").concat(matchValueContextKey).concat(defaultValue !== null && defaultValue !== undefined ? ", ".concat(typeof defaultValue === 'string' ? "\"".concat(defaultValue, "\"") : defaultValue) : '', ")")
865
986
  };
866
987
  }
988
+
867
989
  default:
868
990
  break;
869
991
  }
992
+
870
993
  return null;
871
994
  };
872
995
  /**
@@ -885,37 +1008,50 @@ var convertFormatterToDSL = function convertFormatterToDSL(fieldReference, key,
885
1008
  * 3. index or name based selections
886
1009
  * ['primary.foo', 'primary[1]'] => '> primary | frameBySeriesNamesOrIndexes("foo",1)'
887
1010
  */
1011
+
1012
+
888
1013
  var translateArrayFormatDataReference = function translateArrayFormatDataReference(encodingDataReference) {
889
1014
  if (encodingDataReference.length === 0) {
890
1015
  return null;
891
1016
  }
1017
+
892
1018
  var allIndexBased = encodingDataReference.every(isIndexBasedReference);
893
1019
  var allNameBased = encodingDataReference.every(isNameBasedReference);
1020
+
894
1021
  if (allIndexBased) {
895
1022
  var _ref = (0, Base_1.parseIndexBasedFieldReference)(encodingDataReference[0]),
896
- _dataSourceName = _ref.dataSourceName;
1023
+ _dataSourceName = _ref.dataSourceName;
1024
+
897
1025
  var indexesStr = encodingDataReference.map(function (ref) {
898
1026
  var _a;
1027
+
899
1028
  return (_a = (0, Base_1.parseIndexBasedFieldReference)(ref)) === null || _a === void 0 ? void 0 : _a.fieldIndex;
900
1029
  }).join(',');
901
1030
  return "> ".concat(_dataSourceName, " | frameBySeriesIndexes(").concat(indexesStr, ")");
902
1031
  }
1032
+
903
1033
  if (allNameBased) {
904
1034
  var _ref2 = (0, Base_1.parseNameBasedFieldReference)(encodingDataReference[0]),
905
- _dataSourceName2 = _ref2.dataSourceName;
1035
+ _dataSourceName2 = _ref2.dataSourceName;
1036
+
906
1037
  var namesStr = encodingDataReference.map(function (ref) {
907
1038
  var _a;
1039
+
908
1040
  return "\"".concat((_a = (0, Base_1.parseNameBasedFieldReference)(ref)) === null || _a === void 0 ? void 0 : _a.fieldName, "\"");
909
1041
  }).join(',');
910
1042
  return "> ".concat(_dataSourceName2, " | frameBySeriesNames(").concat(namesStr, ")");
911
- }
912
- // it's a mix of name and index based references
1043
+ } // it's a mix of name and index based references
913
1044
  // get the first ref to extract the dataSource
1045
+
1046
+
914
1047
  var firstEntry = encodingDataReference[0];
1048
+
915
1049
  var _ref3 = isIndexBasedReference(firstEntry) ? (0, Base_1.parseIndexBasedFieldReference)(firstEntry) : (0, Base_1.parseNameBasedFieldReference)(firstEntry),
916
- dataSourceName = _ref3.dataSourceName;
1050
+ dataSourceName = _ref3.dataSourceName;
1051
+
917
1052
  var paramStr = encodingDataReference.map(function (ref) {
918
1053
  var _a, _b;
1054
+
919
1055
  return isIndexBasedReference(ref) ? (_a = (0, Base_1.parseIndexBasedFieldReference)(ref)) === null || _a === void 0 ? void 0 : _a.fieldIndex : "\"".concat((_b = (0, Base_1.parseNameBasedFieldReference)(ref)) === null || _b === void 0 ? void 0 : _b.fieldName, "\"");
920
1056
  }).join(',');
921
1057
  return "> ".concat(dataSourceName, " | frameBySeriesNamesOrIndexes(").concat(paramStr, ")");
@@ -936,51 +1072,67 @@ var translateArrayFormatDataReference = function translateArrayFormatDataReferen
936
1072
  * Encoding references
937
1073
  * 'encoding.x' => '> x'
938
1074
  */
1075
+
1076
+
939
1077
  var translateDataReference = function translateDataReference(encodingDataReference) {
940
1078
  if (encodingDataReference.indexOf('encoding.') === 0) {
941
1079
  return "> ".concat(encodingDataReference.replace('encoding.', ''));
942
1080
  }
1081
+
943
1082
  var isIndexBasedRef = isIndexBasedReference(encodingDataReference);
944
1083
  var isNameBasedRef = isNameBasedReference(encodingDataReference);
1084
+
945
1085
  if (!isIndexBasedRef && !isNameBasedRef) {
946
1086
  console.warn('Unable to parse the encoding. Please verify the encoding format is correct');
947
1087
  return null;
948
1088
  }
1089
+
949
1090
  if (isNameBasedRef) {
950
1091
  var _ref4 = (0, Base_1.parseNameBasedFieldReference)(encodingDataReference),
951
- dataSourceName = _ref4.dataSourceName,
952
- fieldName = _ref4.fieldName,
953
- columnIndex = _ref4.columnIndex;
1092
+ dataSourceName = _ref4.dataSourceName,
1093
+ fieldName = _ref4.fieldName,
1094
+ columnIndex = _ref4.columnIndex;
1095
+
954
1096
  var returnString = "> ".concat(dataSourceName, " | seriesByName(\"").concat(fieldName, "\")");
1097
+
955
1098
  if (columnIndex) {
956
1099
  returnString += " | pointByIndex(".concat(columnIndex, ")");
957
1100
  }
1101
+
958
1102
  return returnString;
959
1103
  }
1104
+
960
1105
  if (isIndexBasedRef) {
961
1106
  var _ref5 = (0, Base_1.parseIndexBasedFieldReference)(encodingDataReference),
962
- _dataSourceName3 = _ref5.dataSourceName,
963
- fieldIndex = _ref5.fieldIndex,
964
- _columnIndex = _ref5.columnIndex,
965
- isFieldIndexRange = _ref5.isFieldIndexRange,
966
- fromFieldIndex = _ref5.fromFieldIndex,
967
- toFieldIndex = _ref5.toFieldIndex;
1107
+ _dataSourceName3 = _ref5.dataSourceName,
1108
+ fieldIndex = _ref5.fieldIndex,
1109
+ _columnIndex = _ref5.columnIndex,
1110
+ isFieldIndexRange = _ref5.isFieldIndexRange,
1111
+ fromFieldIndex = _ref5.fromFieldIndex,
1112
+ toFieldIndex = _ref5.toFieldIndex;
1113
+
968
1114
  if (isFieldIndexRange) {
969
1115
  var dslToIndexString;
1116
+
970
1117
  if (toFieldIndex === -1) {
971
1118
  dslToIndexString = '';
972
1119
  } else {
973
1120
  // adjust index, DSL is using default slice behavior whereas encoding behaved differently
974
1121
  dslToIndexString = ",".concat(toFieldIndex + 1);
975
1122
  }
1123
+
976
1124
  return "> ".concat(_dataSourceName3, " | frameBySeriesIndexRange(").concat(fromFieldIndex).concat(dslToIndexString, ")");
977
1125
  }
1126
+
978
1127
  var _returnString = "> ".concat(_dataSourceName3, " | seriesByIndex(").concat(fieldIndex, ")");
1128
+
979
1129
  if (_columnIndex) {
980
1130
  _returnString += " | pointByIndex(".concat(_columnIndex, ")");
981
1131
  }
1132
+
982
1133
  return _returnString;
983
1134
  }
1135
+
984
1136
  return null;
985
1137
  };
986
1138
  /**
@@ -1009,6 +1161,8 @@ var translateDataReference = function translateDataReference(encodingDataReferen
1009
1161
  * }
1010
1162
  * }
1011
1163
  */
1164
+
1165
+
1012
1166
  var encodingToDynamicOptionsDSL = function encodingToDynamicOptionsDSL(encoding) {
1013
1167
  var dynamicOptions = {
1014
1168
  options: {},
@@ -1019,23 +1173,28 @@ var encodingToDynamicOptionsDSL = function encodingToDynamicOptionsDSL(encoding)
1019
1173
  Object.keys(encodingObj).forEach(function (key) {
1020
1174
  var fieldReference = encoding[key];
1021
1175
  var fieldReferenceStr = fieldReference;
1176
+
1022
1177
  if (_typeof(fieldReference) === 'object' && !Array.isArray(fieldReference)) {
1023
1178
  var field = fieldReference.field;
1179
+
1024
1180
  if (field && !Array.isArray(field)) {
1025
1181
  fieldReferenceStr = field;
1026
1182
  }
1027
1183
  }
1028
- var translatedValue;
1029
- // field reference is either in form of array or string
1184
+
1185
+ var translatedValue; // field reference is either in form of array or string
1186
+
1030
1187
  if (Array.isArray(fieldReference)) {
1031
1188
  translatedValue = translateArrayFormatDataReference(fieldReference);
1032
1189
  } else {
1033
1190
  translatedValue = translateDataReference(fieldReferenceStr);
1034
- }
1035
- // omit if translated value is not set
1191
+ } // omit if translated value is not set
1192
+
1193
+
1036
1194
  if (translatedValue) {
1037
1195
  translatedOptions[key] = translatedValue;
1038
1196
  var convertedFormatterObject = convertFormatterToDSL(fieldReference, key, translatedValue);
1197
+
1039
1198
  if (convertedFormatterObject) {
1040
1199
  translatedOptions[key] = convertedFormatterObject.dsl;
1041
1200
  dynamicOptions.context[convertedFormatterObject.contextKey] = convertedFormatterObject.contextConfig;
@@ -1045,6 +1204,7 @@ var encodingToDynamicOptionsDSL = function encodingToDynamicOptionsDSL(encoding)
1045
1204
  dynamicOptions.options = translatedOptions;
1046
1205
  return dynamicOptions;
1047
1206
  };
1207
+
1048
1208
  exports.encodingToDynamicOptionsDSL = encodingToDynamicOptionsDSL;
1049
1209
 
1050
1210
  /***/ }),
@@ -1064,10 +1224,13 @@ Object.defineProperty(exports, "__esModule", {
1064
1224
  value: true
1065
1225
  });
1066
1226
  exports.migrateVizToSplunkBar = void 0;
1227
+
1067
1228
  var Bar_config_1 = __webpack_require__(18);
1229
+
1068
1230
  var splunk_charting_1 = __webpack_require__(2);
1069
- var validOptions = Object.assign({}, Bar_config_1.default.optionsSchema);
1070
- // old default configurations should be retained in migrated configuration
1231
+
1232
+ var validOptions = Object.assign({}, Bar_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
1233
+
1071
1234
  var defaultChanges = {
1072
1235
  yAxisAbbreviation: 'off',
1073
1236
  y2AxisAbbreviation: 'off',
@@ -1075,6 +1238,7 @@ var defaultChanges = {
1075
1238
  legendTruncation: 'ellipsisMiddle',
1076
1239
  showY2MajorGridLines: true
1077
1240
  };
1241
+
1078
1242
  var migrateVizToSplunkBar = function migrateVizToSplunkBar(vizDefinition) {
1079
1243
  return (0, splunk_charting_1.migrateBaseChartingVizDefinition)({
1080
1244
  defaultChanges: defaultChanges,
@@ -1083,6 +1247,7 @@ var migrateVizToSplunkBar = function migrateVizToSplunkBar(vizDefinition) {
1083
1247
  vizType: 'splunk.bar'
1084
1248
  });
1085
1249
  };
1250
+
1086
1251
  exports.migrateVizToSplunkBar = migrateVizToSplunkBar;
1087
1252
 
1088
1253
  /***/ }),
@@ -1102,14 +1267,18 @@ Object.defineProperty(exports, "__esModule", {
1102
1267
  value: true
1103
1268
  });
1104
1269
  exports.migrateVizToSplunkBubble = void 0;
1270
+
1105
1271
  var Bubble_config_1 = __webpack_require__(20);
1272
+
1106
1273
  var splunk_charting_1 = __webpack_require__(2);
1107
- var validOptions = Object.assign({}, Bubble_config_1.default.optionsSchema);
1108
- // old default configurations should be retained in migrated configuration
1274
+
1275
+ var validOptions = Object.assign({}, Bubble_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
1276
+
1109
1277
  var defaultChanges = {
1110
1278
  yAxisAbbreviation: 'off',
1111
1279
  legendTruncation: 'ellipsisMiddle'
1112
1280
  };
1281
+
1113
1282
  var migrateVizToSplunkBubble = function migrateVizToSplunkBubble(vizDefinition) {
1114
1283
  return (0, splunk_charting_1.migrateBaseChartingVizDefinition)({
1115
1284
  defaultChanges: defaultChanges,
@@ -1118,6 +1287,7 @@ var migrateVizToSplunkBubble = function migrateVizToSplunkBubble(vizDefinition)
1118
1287
  vizType: 'splunk.bubble'
1119
1288
  });
1120
1289
  };
1290
+
1121
1291
  exports.migrateVizToSplunkBubble = migrateVizToSplunkBubble;
1122
1292
 
1123
1293
  /***/ }),
@@ -1135,28 +1305,35 @@ module.exports = require("@splunk/visualizations/Bubble.config");
1135
1305
 
1136
1306
  var __rest = this && this.__rest || function (s, e) {
1137
1307
  var t = {};
1308
+
1138
1309
  for (var p in s) {
1139
1310
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1140
1311
  }
1312
+
1141
1313
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1142
1314
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1143
1315
  }
1144
1316
  return t;
1145
1317
  };
1318
+
1146
1319
  Object.defineProperty(exports, "__esModule", {
1147
1320
  value: true
1148
1321
  });
1149
1322
  exports.migrateVizToSplunkChoroplethSvg = void 0;
1323
+
1150
1324
  var ChoroplethSvg_config_1 = __webpack_require__(22);
1325
+
1151
1326
  var encoding_1 = __webpack_require__(1);
1327
+
1152
1328
  var migrationUtils_1 = __webpack_require__(0);
1329
+
1153
1330
  var validOptions = Object.assign({}, ChoroplethSvg_config_1.default.optionsSchema);
1154
1331
  var optionRenames = {
1155
1332
  featureId: 'areaIds',
1156
1333
  value: 'areaValues',
1157
1334
  fill: 'areaColors'
1158
- };
1159
- // old default encoding configurations should be retained in migrated configuration
1335
+ }; // old default encoding configurations should be retained in migrated configuration
1336
+
1160
1337
  var defaultOptionChanges = {
1161
1338
  areaIds: '> primary | seriesByIndex(0)',
1162
1339
  areaValues: '> primary | seriesByIndex(1)',
@@ -1167,34 +1344,40 @@ var defaultContextChanges = {
1167
1344
  colors: ['#7EEFDA', '#6484F6', '#C093F9', '#293873']
1168
1345
  }
1169
1346
  };
1347
+
1170
1348
  var migrateVizToSplunkChoroplethSvg = function migrateVizToSplunkChoroplethSvg(vizDefinition) {
1171
1349
  var _vizDefinition$encodi = vizDefinition.encoding,
1172
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1173
- _vizDefinition$option = vizDefinition.options,
1174
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1175
- otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]); // translate encoding to dynamic options equivalent
1350
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1351
+ _vizDefinition$option = vizDefinition.options,
1352
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1353
+ otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]); // translate encoding to dynamic options equivalent
1354
+
1355
+
1176
1356
  var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
1177
- dataOptions = _ref.options,
1178
- dataContext = _ref.context;
1357
+ dataOptions = _ref.options,
1358
+ dataContext = _ref.context;
1359
+
1179
1360
  var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
1180
1361
  type: 'splunk.choropleth.svg',
1181
1362
  options: {},
1182
1363
  context: {}
1183
- });
1184
- // add migrated option names and values
1364
+ }); // add migrated option names and values
1365
+
1185
1366
  var migratedOptions = Object.assign({}, options);
1186
1367
  Object.keys(dataOptions).forEach(function (key) {
1187
1368
  var _a;
1369
+
1188
1370
  var updatedKey = (_a = optionRenames[key]) !== null && _a !== void 0 ? _a : key;
1189
1371
  migratedOptions[updatedKey] = dataOptions[key];
1190
- });
1191
- // update migrated options and context
1372
+ }); // update migrated options and context
1373
+
1192
1374
  migratedDefinition.options = Object.assign(Object.assign({}, defaultOptionChanges), migratedOptions);
1193
- migratedDefinition.context = encoding.fill ? dataContext : defaultContextChanges;
1194
- // remove invalid options
1375
+ migratedDefinition.context = encoding.fill ? dataContext : defaultContextChanges; // remove invalid options
1376
+
1195
1377
  (0, migrationUtils_1.removeInvalidOptions)(migratedDefinition.options, validOptions);
1196
1378
  return migratedDefinition;
1197
1379
  };
1380
+
1198
1381
  exports.migrateVizToSplunkChoroplethSvg = migrateVizToSplunkChoroplethSvg;
1199
1382
 
1200
1383
  /***/ }),
@@ -1220,10 +1403,13 @@ Object.defineProperty(exports, "__esModule", {
1220
1403
  value: true
1221
1404
  });
1222
1405
  exports.migrateVizToSplunkColumn = void 0;
1406
+
1223
1407
  var Column_config_1 = __webpack_require__(25);
1408
+
1224
1409
  var splunk_charting_1 = __webpack_require__(2);
1225
- var validOptions = Object.assign({}, Column_config_1.default.optionsSchema);
1226
- // old default configurations should be retained in migrated configuration
1410
+
1411
+ var validOptions = Object.assign({}, Column_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
1412
+
1227
1413
  var defaultChanges = {
1228
1414
  yAxisAbbreviation: 'off',
1229
1415
  y2AxisAbbreviation: 'off',
@@ -1231,6 +1417,7 @@ var defaultChanges = {
1231
1417
  legendTruncation: 'ellipsisMiddle',
1232
1418
  showY2MajorGridLines: true
1233
1419
  };
1420
+
1234
1421
  var migrateVizToSplunkColumn = function migrateVizToSplunkColumn(vizDefinition) {
1235
1422
  return (0, splunk_charting_1.migrateBaseChartingVizDefinition)({
1236
1423
  defaultChanges: defaultChanges,
@@ -1239,6 +1426,7 @@ var migrateVizToSplunkColumn = function migrateVizToSplunkColumn(vizDefinition)
1239
1426
  vizType: 'splunk.column'
1240
1427
  });
1241
1428
  };
1429
+
1242
1430
  exports.migrateVizToSplunkColumn = migrateVizToSplunkColumn;
1243
1431
 
1244
1432
  /***/ }),
@@ -1256,51 +1444,64 @@ module.exports = require("@splunk/visualizations/Column.config");
1256
1444
 
1257
1445
  var __rest = this && this.__rest || function (s, e) {
1258
1446
  var t = {};
1447
+
1259
1448
  for (var p in s) {
1260
1449
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1261
1450
  }
1451
+
1262
1452
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1263
1453
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1264
1454
  }
1265
1455
  return t;
1266
1456
  };
1457
+
1267
1458
  Object.defineProperty(exports, "__esModule", {
1268
1459
  value: true
1269
1460
  });
1270
1461
  exports.migrateVizToSplunkEllipse = void 0;
1462
+
1271
1463
  var Ellipse_config_1 = __webpack_require__(27);
1464
+
1272
1465
  var encoding_1 = __webpack_require__(1);
1466
+
1273
1467
  var migrationUtils_1 = __webpack_require__(0);
1468
+
1274
1469
  var validOptions = Object.assign({}, Ellipse_config_1.default.optionsSchema);
1275
1470
  var optionsToRename = {
1276
1471
  fill: 'fillColor',
1277
1472
  stroke: 'strokeColor',
1278
1473
  strokeDasharray: 'strokeDashStyle'
1279
1474
  };
1475
+
1280
1476
  var migrateVizToSplunkEllipse = function migrateVizToSplunkEllipse(vizDefinition) {
1281
1477
  var _vizDefinition$encodi = vizDefinition.encoding,
1282
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1283
- _vizDefinition$option = vizDefinition.options,
1284
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1285
- otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
1478
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1479
+ _vizDefinition$option = vizDefinition.options,
1480
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1481
+ otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
1482
+
1286
1483
  var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
1287
1484
  type: 'splunk.ellipse',
1288
1485
  options: options,
1289
1486
  context: {}
1290
1487
  });
1488
+
1291
1489
  var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
1292
- dataOptions = _ref.options,
1293
- dataContext = _ref.context; // To simulate the implicit logic in the shape parser that Ellipse utilizes, append
1490
+ dataOptions = _ref.options,
1491
+ dataContext = _ref.context; // To simulate the implicit logic in the shape parser that Ellipse utilizes, append
1294
1492
  // the lastPoint() DataSeries selector.
1493
+
1494
+
1295
1495
  var updatedDataOptions = (0, migrationUtils_1.addsDataSelectorToOptions)(dataOptions, 'lastPoint()');
1296
- migratedDefinition.options = Object.assign(Object.assign({}, options), updatedDataOptions);
1297
- // perform any option renaming
1298
- migratedDefinition.options = (0, migrationUtils_1.renameVizOptions)(migratedDefinition.options, optionsToRename);
1299
- // remove invalid options from new definition
1496
+ migratedDefinition.options = Object.assign(Object.assign({}, options), updatedDataOptions); // perform any option renaming
1497
+
1498
+ migratedDefinition.options = (0, migrationUtils_1.renameVizOptions)(migratedDefinition.options, optionsToRename); // remove invalid options from new definition
1499
+
1300
1500
  (0, migrationUtils_1.removeInvalidOptions)(migratedDefinition.options, validOptions);
1301
1501
  migratedDefinition.context = dataContext;
1302
1502
  return migratedDefinition;
1303
1503
  };
1504
+
1304
1505
  exports.migrateVizToSplunkEllipse = migrateVizToSplunkEllipse;
1305
1506
 
1306
1507
  /***/ }),
@@ -1318,22 +1519,30 @@ module.exports = require("@splunk/visualizations/Ellipse.config");
1318
1519
 
1319
1520
  var __rest = this && this.__rest || function (s, e) {
1320
1521
  var t = {};
1522
+
1321
1523
  for (var p in s) {
1322
1524
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1323
1525
  }
1526
+
1324
1527
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1325
1528
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1326
1529
  }
1327
1530
  return t;
1328
1531
  };
1532
+
1329
1533
  Object.defineProperty(exports, "__esModule", {
1330
1534
  value: true
1331
1535
  });
1332
1536
  exports.migrateVizToSplunkFillerGauge = void 0;
1537
+
1333
1538
  var FillerGauge_config_1 = __webpack_require__(29);
1539
+
1334
1540
  var encoding_1 = __webpack_require__(1);
1541
+
1335
1542
  var gauges_1 = __webpack_require__(7);
1543
+
1336
1544
  var migrationUtils_1 = __webpack_require__(0);
1545
+
1337
1546
  var validOptions = Object.assign({}, FillerGauge_config_1.default.optionsSchema);
1338
1547
  var optionRenames = {
1339
1548
  majorUnit: 'majorTickInterval'
@@ -1362,13 +1571,16 @@ var defaultChanges = {
1362
1571
  gaugeColor: '> value | rangeValue(gaugeColorRangeValueContext)',
1363
1572
  value: '> primary | seriesByIndex(0) | lastPoint()'
1364
1573
  };
1574
+
1365
1575
  var migrateVizToSplunkFillerGauge = function migrateVizToSplunkFillerGauge(vizDefinition) {
1366
1576
  var _a;
1577
+
1367
1578
  var _vizDefinition$option = vizDefinition.options,
1368
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1369
- _vizDefinition$encodi = vizDefinition.encoding,
1370
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1371
- otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
1579
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1580
+ _vizDefinition$encodi = vizDefinition.encoding,
1581
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1582
+ otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
1583
+
1372
1584
  var migratedVisualization = Object.assign(Object.assign({
1373
1585
  options: options
1374
1586
  }, otherDefinitionParts), {
@@ -1376,16 +1588,21 @@ var migrateVizToSplunkFillerGauge = function migrateVizToSplunkFillerGauge(vizDe
1376
1588
  context: {}
1377
1589
  });
1378
1590
  var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionRenames);
1591
+
1379
1592
  var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
1380
- encodingOptions = _ref.options,
1381
- gaugeColorContext = _ref.context; // if a viz.fillergauge receives an entire column for `value` (e.g. primary[0]), it will select the last value of the column
1593
+ encodingOptions = _ref.options,
1594
+ gaugeColorContext = _ref.context; // if a viz.fillergauge receives an entire column for `value` (e.g. primary[0]), it will select the last value of the column
1382
1595
  // this contrasts with viz.markergauge (which takes the first point of the column)
1383
1596
  // this is due to differing behavior in the FillerGaugeParser, which explicitly retrieves the last point in a received array
1384
1597
  // https://cd.splunkdev.com/devplat/vision/-/blob/main/packages/visualization-encoding-parsers/src/FillerGaugeParser.js#L79
1598
+
1599
+
1385
1600
  var originalGaugeValue = encodingOptions.value;
1601
+
1386
1602
  if (typeof originalGaugeValue === 'string') {
1387
1603
  encodingOptions.value = (_a = (0, migrationUtils_1.preserveDataSelectionForValueOption)(originalGaugeValue, 'lastPoint()')) !== null && _a !== void 0 ? _a : originalGaugeValue;
1388
1604
  }
1605
+
1389
1606
  if (encodingOptions === null || encodingOptions === void 0 ? void 0 : encodingOptions.gaugeColor) {
1390
1607
  migratedVisualization.context = gaugeColorContext;
1391
1608
  } else {
@@ -1394,21 +1611,23 @@ var migrateVizToSplunkFillerGauge = function migrateVizToSplunkFillerGauge(vizDe
1394
1611
  gaugeColorRangeValueContext: previousRangeValueConfig
1395
1612
  };
1396
1613
  }
1614
+
1397
1615
  var showLabels = options.showLabels,
1398
- usePercentageRange = options.usePercentageRange,
1399
- showValue = options.showValue,
1400
- usePercentageValue = options.usePercentageValue;
1616
+ usePercentageRange = options.usePercentageRange,
1617
+ showValue = options.showValue,
1618
+ usePercentageValue = options.usePercentageValue;
1401
1619
  var labelDisplay = (0, gauges_1.consolidateDisplayOption)(showLabels, usePercentageRange);
1402
1620
  var valueDisplay = (0, gauges_1.consolidateDisplayOption)(showValue, usePercentageValue);
1403
1621
  migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultChanges), renamedOptions), encodingOptions), typeof labelDisplay === 'string' && {
1404
1622
  labelDisplay: labelDisplay
1405
1623
  }), typeof valueDisplay === 'string' && {
1406
1624
  valueDisplay: valueDisplay
1407
- });
1408
- // remove invalid options using the optionsSchema for splunk.fillergauge as reference
1625
+ }); // remove invalid options using the optionsSchema for splunk.fillergauge as reference
1626
+
1409
1627
  (0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
1410
1628
  return migratedVisualization;
1411
1629
  };
1630
+
1412
1631
  exports.migrateVizToSplunkFillerGauge = migrateVizToSplunkFillerGauge;
1413
1632
 
1414
1633
  /***/ }),
@@ -1428,11 +1647,14 @@ Object.defineProperty(exports, "__esModule", {
1428
1647
  value: true
1429
1648
  });
1430
1649
  exports.migrateVizToSplunkLine = void 0;
1650
+
1431
1651
  var Line_config_1 = __webpack_require__(31);
1652
+
1432
1653
  var splunk_charting_1 = __webpack_require__(2);
1433
- var validOptions = Object.assign({}, Line_config_1.default.optionsSchema);
1434
- // old default configurations should be retained in migrated configuration
1654
+
1655
+ var validOptions = Object.assign({}, Line_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
1435
1656
  // except for markerDisplay which migrates to the new default 'off'
1657
+
1436
1658
  var defaultChanges = {
1437
1659
  yAxisAbbreviation: 'off',
1438
1660
  y2AxisAbbreviation: 'off',
@@ -1440,6 +1662,7 @@ var defaultChanges = {
1440
1662
  legendTruncation: 'ellipsisMiddle',
1441
1663
  showY2MajorGridLines: true
1442
1664
  };
1665
+
1443
1666
  var migrateVizToSplunkLine = function migrateVizToSplunkLine(vizDefinition) {
1444
1667
  return (0, splunk_charting_1.migrateBaseChartingVizDefinition)({
1445
1668
  defaultChanges: defaultChanges,
@@ -1448,6 +1671,7 @@ var migrateVizToSplunkLine = function migrateVizToSplunkLine(vizDefinition) {
1448
1671
  vizType: 'splunk.line'
1449
1672
  });
1450
1673
  };
1674
+
1451
1675
  exports.migrateVizToSplunkLine = migrateVizToSplunkLine;
1452
1676
 
1453
1677
  /***/ }),
@@ -1465,35 +1689,44 @@ module.exports = require("@splunk/visualizations/Line.config");
1465
1689
 
1466
1690
  var __rest = this && this.__rest || function (s, e) {
1467
1691
  var t = {};
1692
+
1468
1693
  for (var p in s) {
1469
1694
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1470
1695
  }
1696
+
1471
1697
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1472
1698
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1473
1699
  }
1474
1700
  return t;
1475
1701
  };
1702
+
1476
1703
  Object.defineProperty(exports, "__esModule", {
1477
1704
  value: true
1478
1705
  });
1479
1706
  exports.migrateVizToSplunkImage = void 0;
1707
+
1480
1708
  var Image_config_1 = __webpack_require__(33);
1709
+
1481
1710
  var migrationUtils_1 = __webpack_require__(0);
1711
+
1482
1712
  var validOptions = Object.assign({}, Image_config_1.default.optionsSchema);
1713
+
1483
1714
  var migrateVizToSplunkImage = function migrateVizToSplunkImage(vizDefinition) {
1484
1715
  var _vizDefinition$option = vizDefinition.options,
1485
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1486
- otherDefinitionParts = __rest(vizDefinition, ["options"]);
1716
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1717
+ otherDefinitionParts = __rest(vizDefinition, ["options"]);
1718
+
1487
1719
  var migratedVisualization = Object.assign(Object.assign({
1488
1720
  options: options
1489
1721
  }, otherDefinitionParts), {
1490
1722
  type: 'splunk.image',
1491
1723
  context: {}
1492
- });
1493
- // remove invalid options using the optionsSchema for splunk.image as reference
1724
+ }); // remove invalid options using the optionsSchema for splunk.image as reference
1725
+
1494
1726
  (0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
1495
1727
  return migratedVisualization;
1496
1728
  };
1729
+
1497
1730
  exports.migrateVizToSplunkImage = migrateVizToSplunkImage;
1498
1731
 
1499
1732
  /***/ }),
@@ -1511,35 +1744,44 @@ module.exports = require("@splunk/visualizations/Image.config");
1511
1744
 
1512
1745
  var __rest = this && this.__rest || function (s, e) {
1513
1746
  var t = {};
1747
+
1514
1748
  for (var p in s) {
1515
1749
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1516
1750
  }
1751
+
1517
1752
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1518
1753
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1519
1754
  }
1520
1755
  return t;
1521
1756
  };
1757
+
1522
1758
  Object.defineProperty(exports, "__esModule", {
1523
1759
  value: true
1524
1760
  });
1525
1761
  exports.migrateVizToSplunkMarkdown = void 0;
1762
+
1526
1763
  var Markdown_config_1 = __webpack_require__(8);
1764
+
1527
1765
  var migrationUtils_1 = __webpack_require__(0);
1766
+
1528
1767
  var validOptions = Object.assign({}, Markdown_config_1.default.optionsSchema);
1768
+
1529
1769
  var migrateVizToSplunkMarkdown = function migrateVizToSplunkMarkdown(vizDefinition) {
1530
1770
  var _vizDefinition$option = vizDefinition.options,
1531
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1532
- otherDefinitionParts = __rest(vizDefinition, ["options"]);
1771
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1772
+ otherDefinitionParts = __rest(vizDefinition, ["options"]);
1773
+
1533
1774
  var migratedVisualization = Object.assign(Object.assign({
1534
1775
  options: options
1535
1776
  }, otherDefinitionParts), {
1536
1777
  type: 'splunk.markdown',
1537
1778
  context: {}
1538
- });
1539
- // remove invalid options using the optionsSchema for splunk.markdown as reference
1779
+ }); // remove invalid options using the optionsSchema for splunk.markdown as reference
1780
+
1540
1781
  (0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
1541
1782
  return migratedVisualization;
1542
1783
  };
1784
+
1543
1785
  exports.migrateVizToSplunkMarkdown = migrateVizToSplunkMarkdown;
1544
1786
 
1545
1787
  /***/ }),
@@ -1551,24 +1793,32 @@ exports.migrateVizToSplunkMarkdown = migrateVizToSplunkMarkdown;
1551
1793
 
1552
1794
  var __rest = this && this.__rest || function (s, e) {
1553
1795
  var t = {};
1796
+
1554
1797
  for (var p in s) {
1555
1798
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1556
1799
  }
1800
+
1557
1801
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1558
1802
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1559
1803
  }
1560
1804
  return t;
1561
1805
  };
1806
+
1562
1807
  Object.defineProperty(exports, "__esModule", {
1563
1808
  value: true
1564
1809
  });
1565
1810
  exports.migrateVizToSplunkMarkerGauge = void 0;
1811
+
1566
1812
  var MarkerGauge_config_1 = __webpack_require__(36);
1813
+
1567
1814
  var encoding_1 = __webpack_require__(1);
1815
+
1568
1816
  var migrationUtils_1 = __webpack_require__(0);
1817
+
1569
1818
  var gauges_1 = __webpack_require__(7);
1570
- var validOptions = Object.assign({}, MarkerGauge_config_1.default.optionsSchema);
1571
- // old default configurations should be retained in migrated configuration
1819
+
1820
+ var validOptions = Object.assign({}, MarkerGauge_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
1821
+
1572
1822
  var defaultChanges = {
1573
1823
  gaugeRanges: [{
1574
1824
  from: 90,
@@ -1589,13 +1839,16 @@ var optionRenames = {
1589
1839
  majorUnit: 'majorTickInterval',
1590
1840
  ranges: 'gaugeRanges'
1591
1841
  };
1842
+
1592
1843
  var migrateVizToSplunkMarkerGauge = function migrateVizToSplunkMarkerGauge(vizDefinition) {
1593
1844
  var _a;
1845
+
1594
1846
  var _vizDefinition$option = vizDefinition.options,
1595
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1596
- _vizDefinition$encodi = vizDefinition.encoding,
1597
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1598
- otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
1847
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1848
+ _vizDefinition$encodi = vizDefinition.encoding,
1849
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1850
+ otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
1851
+
1599
1852
  var migratedVisualization = Object.assign(Object.assign({
1600
1853
  options: options
1601
1854
  }, otherDefinitionParts), {
@@ -1603,29 +1856,35 @@ var migrateVizToSplunkMarkerGauge = function migrateVizToSplunkMarkerGauge(vizDe
1603
1856
  context: {}
1604
1857
  });
1605
1858
  var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionRenames);
1859
+
1606
1860
  var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
1607
- dataOptions = _ref.options; // viz.markergauge has behavior where if a column without a specific point (e.g. primary[1]) is selected,
1861
+ dataOptions = _ref.options; // viz.markergauge has behavior where if a column without a specific point (e.g. primary[1]) is selected,
1608
1862
  // the markerGauge will only display the first point of the column
1609
1863
  // the following logic accounts for this and appends firstPoint() to the DSL statement
1864
+
1865
+
1610
1866
  var originalGaugeValue = dataOptions.value;
1867
+
1611
1868
  if (typeof originalGaugeValue === 'string') {
1612
1869
  dataOptions.value = (_a = (0, migrationUtils_1.preserveDataSelectionForValueOption)(originalGaugeValue, 'firstPoint()')) !== null && _a !== void 0 ? _a : originalGaugeValue;
1613
1870
  }
1871
+
1614
1872
  var showLabels = renamedOptions.showLabels,
1615
- usePercentageRange = renamedOptions.usePercentageRange,
1616
- showValue = renamedOptions.showValue,
1617
- usePercentageValue = renamedOptions.usePercentageValue;
1873
+ usePercentageRange = renamedOptions.usePercentageRange,
1874
+ showValue = renamedOptions.showValue,
1875
+ usePercentageValue = renamedOptions.usePercentageValue;
1618
1876
  var labelDisplay = (0, gauges_1.consolidateDisplayOption)(showLabels, usePercentageRange);
1619
1877
  var valueDisplay = (0, gauges_1.consolidateDisplayOption)(showValue, usePercentageValue);
1620
1878
  migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultChanges), renamedOptions), dataOptions), typeof labelDisplay === 'string' && {
1621
1879
  labelDisplay: labelDisplay
1622
1880
  }), typeof valueDisplay === 'string' && {
1623
1881
  valueDisplay: valueDisplay
1624
- });
1625
- // remove invalid options using the optionsSchema for splunk.markergauge as reference
1882
+ }); // remove invalid options using the optionsSchema for splunk.markergauge as reference
1883
+
1626
1884
  (0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
1627
1885
  return migratedVisualization;
1628
1886
  };
1887
+
1629
1888
  exports.migrateVizToSplunkMarkerGauge = migrateVizToSplunkMarkerGauge;
1630
1889
 
1631
1890
  /***/ }),
@@ -1643,53 +1902,68 @@ module.exports = require("@splunk/visualizations/MarkerGauge.config");
1643
1902
 
1644
1903
  var __rest = this && this.__rest || function (s, e) {
1645
1904
  var t = {};
1905
+
1646
1906
  for (var p in s) {
1647
1907
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1648
1908
  }
1909
+
1649
1910
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1650
1911
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1651
1912
  }
1652
1913
  return t;
1653
1914
  };
1915
+
1654
1916
  Object.defineProperty(exports, "__esModule", {
1655
1917
  value: true
1656
1918
  });
1657
1919
  exports.migrateVizToSplunkPie = void 0;
1920
+
1658
1921
  var Pie_config_1 = __webpack_require__(38);
1922
+
1659
1923
  var encoding_1 = __webpack_require__(1);
1924
+
1660
1925
  var splunk_charting_1 = __webpack_require__(2);
1926
+
1661
1927
  var validOptions = Object.assign({}, Pie_config_1.default.optionsSchema);
1928
+
1662
1929
  var migratePieChartLabelAndPercent = function migratePieChartLabelAndPercent(options) {
1663
1930
  // if neither chart.showLabels or chart.showPercent is specified in viz.pie,
1664
1931
  // splunk.pie use the default labelDisplay value
1665
1932
  if (!('chart.showLabels' in options) && !('chart.showPercent' in options)) {
1666
1933
  return {};
1667
- }
1668
- // if only chart.showPercent is specified in viz.pie
1934
+ } // if only chart.showPercent is specified in viz.pie
1935
+
1936
+
1669
1937
  if (!('chart.showLabels' in options) && 'chart.showPercent' in options) {
1670
1938
  return {
1671
1939
  labelDisplay: options['chart.showPercent'] ? 'valuesAndPercentage' : 'values'
1672
1940
  };
1673
- }
1674
- // if only chart.showLabels is specified in viz.pie
1941
+ } // if only chart.showLabels is specified in viz.pie
1942
+
1943
+
1675
1944
  if ('chart.showLabels' in options && !('chart.showPercent' in options)) {
1676
1945
  return {
1677
1946
  labelDisplay: options['chart.showLabels'] ? 'values' : 'off'
1678
1947
  };
1679
- }
1680
- // if both chart.showLabels and chart.showPercent are specified in viz.pie
1948
+ } // if both chart.showLabels and chart.showPercent are specified in viz.pie
1949
+
1950
+
1681
1951
  var labelOption = {
1682
1952
  labelDisplay: 'values'
1683
1953
  };
1954
+
1684
1955
  if (options['chart.showLabels'] && options['chart.showPercent']) {
1685
1956
  labelOption.labelDisplay = 'valuesAndPercentage';
1686
1957
  }
1958
+
1687
1959
  if (!options['chart.showLabels']) {
1688
1960
  labelOption.labelDisplay = 'off';
1689
1961
  }
1962
+
1690
1963
  return labelOption;
1691
- };
1692
- // retain the pie position when converting viz.pie to splunk.pie - SCP-48658
1964
+ }; // retain the pie position when converting viz.pie to splunk.pie - SCP-48658
1965
+
1966
+
1693
1967
  var migrateDonutChart = function migrateDonutChart(options) {
1694
1968
  if (options.hasDonutHole) {
1695
1969
  if (options['legend.placement'] === 'none') {
@@ -1697,37 +1971,44 @@ var migrateDonutChart = function migrateDonutChart(options) {
1697
1971
  labelDisplay: 'off'
1698
1972
  };
1699
1973
  }
1974
+
1700
1975
  return {
1701
1976
  labelDisplay: 'values'
1702
1977
  };
1703
1978
  }
1979
+
1704
1980
  return {};
1705
1981
  };
1982
+
1706
1983
  var migrateFieldColors = function migrateFieldColors(options) {
1707
1984
  if ('fieldColors' in options) {
1708
1985
  return {
1709
1986
  seriesColorsByField: splunk_charting_1.otherValueReplacements.seriesColorsByField(options.fieldColors)
1710
1987
  };
1711
1988
  }
1989
+
1712
1990
  return {};
1713
1991
  };
1992
+
1714
1993
  var migrateVizToSplunkPie = function migrateVizToSplunkPie(vizDefinition) {
1715
1994
  var _vizDefinition$encodi = vizDefinition.encoding,
1716
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1717
- _vizDefinition$option = vizDefinition.options,
1718
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1719
- otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
1995
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1996
+ _vizDefinition$option = vizDefinition.options,
1997
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1998
+ otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
1999
+
1720
2000
  var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
1721
2001
  type: 'splunk.pie',
1722
2002
  options: {},
1723
2003
  context: {}
1724
- });
1725
- // translate encoding to dynamic options equivalent
2004
+ }); // translate encoding to dynamic options equivalent
2005
+
1726
2006
  var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
1727
- dataOptions = _ref.options,
1728
- dataContext = _ref.context;
1729
- var migratedOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, migratePieChartLabelAndPercent(options)), (0, splunk_charting_1.migrateChartingOptions)(options)), migrateFieldColors(options)), migrateDonutChart(options)), dataOptions);
1730
- // remove invalid options
2007
+ dataOptions = _ref.options,
2008
+ dataContext = _ref.context;
2009
+
2010
+ var migratedOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, migratePieChartLabelAndPercent(options)), (0, splunk_charting_1.migrateChartingOptions)(options)), migrateFieldColors(options)), migrateDonutChart(options)), dataOptions); // remove invalid options
2011
+
1731
2012
  Object.keys(migratedOptions).forEach(function (key) {
1732
2013
  if (!validOptions[key]) {
1733
2014
  delete migratedOptions[key];
@@ -1737,6 +2018,7 @@ var migrateVizToSplunkPie = function migrateVizToSplunkPie(vizDefinition) {
1737
2018
  migratedDefinition.context = dataContext;
1738
2019
  return migratedDefinition;
1739
2020
  };
2021
+
1740
2022
  exports.migrateVizToSplunkPie = migrateVizToSplunkPie;
1741
2023
 
1742
2024
  /***/ }),
@@ -1756,14 +2038,18 @@ Object.defineProperty(exports, "__esModule", {
1756
2038
  value: true
1757
2039
  });
1758
2040
  exports.migrateVizToSplunkScatter = void 0;
2041
+
1759
2042
  var Scatter_config_1 = __webpack_require__(40);
2043
+
1760
2044
  var splunk_charting_1 = __webpack_require__(2);
1761
- var validOptions = Object.assign({}, Scatter_config_1.default.optionsSchema);
1762
- // old default configurations should be retained in migrated configuration
2045
+
2046
+ var validOptions = Object.assign({}, Scatter_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
2047
+
1763
2048
  var defaultChanges = {
1764
2049
  yAxisAbbreviation: 'off',
1765
2050
  legendTruncation: 'ellipsisMiddle'
1766
2051
  };
2052
+
1767
2053
  var migrateVizToSplunkScatter = function migrateVizToSplunkScatter(vizDefinition) {
1768
2054
  return (0, splunk_charting_1.migrateBaseChartingVizDefinition)({
1769
2055
  defaultChanges: defaultChanges,
@@ -1772,6 +2058,7 @@ var migrateVizToSplunkScatter = function migrateVizToSplunkScatter(vizDefinition
1772
2058
  vizType: 'splunk.scatter'
1773
2059
  });
1774
2060
  };
2061
+
1775
2062
  exports.migrateVizToSplunkScatter = migrateVizToSplunkScatter;
1776
2063
 
1777
2064
  /***/ }),
@@ -1789,21 +2076,28 @@ module.exports = require("@splunk/visualizations/Scatter.config");
1789
2076
 
1790
2077
  var __rest = this && this.__rest || function (s, e) {
1791
2078
  var t = {};
2079
+
1792
2080
  for (var p in s) {
1793
2081
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1794
2082
  }
2083
+
1795
2084
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1796
2085
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1797
2086
  }
1798
2087
  return t;
1799
2088
  };
2089
+
1800
2090
  Object.defineProperty(exports, "__esModule", {
1801
2091
  value: true
1802
2092
  });
1803
2093
  exports.migrateVizToSplunkRectangle = void 0;
2094
+
1804
2095
  var Rectangle_config_1 = __webpack_require__(42);
2096
+
1805
2097
  var encoding_1 = __webpack_require__(1);
2098
+
1806
2099
  var migrationUtils_1 = __webpack_require__(0);
2100
+
1807
2101
  var optionsToRename = {
1808
2102
  fill: 'fillColor',
1809
2103
  stroke: 'strokeColor',
@@ -1811,30 +2105,35 @@ var optionsToRename = {
1811
2105
  strokeLinejoin: 'strokeJoinStyle'
1812
2106
  };
1813
2107
  var validOptions = Object.assign({}, Rectangle_config_1.default.optionsSchema);
2108
+
1814
2109
  var migrateVizToSplunkRectangle = function migrateVizToSplunkRectangle(vizDefinition) {
1815
2110
  var _vizDefinition$encodi = vizDefinition.encoding,
1816
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1817
- options = vizDefinition.options,
1818
- otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
2111
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2112
+ options = vizDefinition.options,
2113
+ otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
2114
+
1819
2115
  var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
1820
2116
  type: 'splunk.rectangle',
1821
2117
  options: {},
1822
2118
  context: {}
1823
- });
1824
- // translate encoding to dynamic options equivalent
2119
+ }); // translate encoding to dynamic options equivalent
2120
+
1825
2121
  var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
1826
- dataOptions = _ref.options,
1827
- dataContext = _ref.context; // To simulate the implicit logic in the shape parser that Rectangle utilizes, append
2122
+ dataOptions = _ref.options,
2123
+ dataContext = _ref.context; // To simulate the implicit logic in the shape parser that Rectangle utilizes, append
1828
2124
  // the lastPoint() DataSeries selector.
2125
+
2126
+
1829
2127
  var updatedDataOptions = (0, migrationUtils_1.addsDataSelectorToOptions)(dataOptions, 'lastPoint()');
1830
- migratedDefinition.options = Object.assign(Object.assign({}, options), updatedDataOptions);
1831
- // perform option rename
1832
- migratedDefinition.options = (0, migrationUtils_1.renameVizOptions)(migratedDefinition.options, optionsToRename);
1833
- // remove invalid options, validOptions is taken from the config.optionsSchema
2128
+ migratedDefinition.options = Object.assign(Object.assign({}, options), updatedDataOptions); // perform option rename
2129
+
2130
+ migratedDefinition.options = (0, migrationUtils_1.renameVizOptions)(migratedDefinition.options, optionsToRename); // remove invalid options, validOptions is taken from the config.optionsSchema
2131
+
1834
2132
  (0, migrationUtils_1.removeInvalidOptions)(migratedDefinition.options, validOptions);
1835
2133
  migratedDefinition.context = dataContext;
1836
2134
  return migratedDefinition;
1837
2135
  };
2136
+
1838
2137
  exports.migrateVizToSplunkRectangle = migrateVizToSplunkRectangle;
1839
2138
 
1840
2139
  /***/ }),
@@ -1852,24 +2151,32 @@ module.exports = require("@splunk/visualizations/Rectangle.config");
1852
2151
 
1853
2152
  var __rest = this && this.__rest || function (s, e) {
1854
2153
  var t = {};
2154
+
1855
2155
  for (var p in s) {
1856
2156
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1857
2157
  }
2158
+
1858
2159
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1859
2160
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1860
2161
  }
1861
2162
  return t;
1862
2163
  };
2164
+
1863
2165
  Object.defineProperty(exports, "__esModule", {
1864
2166
  value: true
1865
2167
  });
1866
2168
  exports.migrateVizToSplunkSingleValue = void 0;
2169
+
1867
2170
  var SingleValue_config_1 = __webpack_require__(44);
2171
+
1868
2172
  var encoding_1 = __webpack_require__(1);
2173
+
1869
2174
  var migrationUtils_1 = __webpack_require__(0);
2175
+
1870
2176
  var singlevalue_1 = __webpack_require__(3);
1871
- var validOptions = Object.assign({}, SingleValue_config_1.default.optionsSchema);
1872
- // old default configurations should be retained in migrated configuration
2177
+
2178
+ var validOptions = Object.assign({}, SingleValue_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
2179
+
1873
2180
  var defaultsToRetain = {
1874
2181
  showSparklineAreaGraph: false,
1875
2182
  sparklineValues: '> primary | seriesByTypes("number", "string")'
@@ -1891,33 +2198,42 @@ var optionRenames = {
1891
2198
  * 4. if both the old options are undefined, return nothing as their defaults (true and `below`)
1892
2199
  * correspond to `sparklineDisplay` default - below
1893
2200
  */
2201
+
1894
2202
  var consolidateSparklineDisplay = function consolidateSparklineDisplay(sparklinePosition, showSparkline) {
1895
2203
  if (showSparkline === false) {
1896
2204
  return 'off';
1897
2205
  }
2206
+
1898
2207
  if (['before', 'after', 'below'].includes(sparklinePosition)) {
1899
2208
  return sparklinePosition;
1900
2209
  }
2210
+
1901
2211
  if (showSparkline === true) {
1902
2212
  return 'below';
1903
2213
  }
2214
+
1904
2215
  return null;
1905
2216
  };
2217
+
1906
2218
  var migrateVizToSplunkSingleValue = function migrateVizToSplunkSingleValue(vizDefinition) {
1907
2219
  var _a, _b, _c;
2220
+
1908
2221
  var _vizDefinition$option = vizDefinition.options,
1909
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1910
- _vizDefinition$encodi = vizDefinition.encoding,
1911
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1912
- otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
2222
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2223
+ _vizDefinition$encodi = vizDefinition.encoding,
2224
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2225
+ otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
2226
+
1913
2227
  var migratedVisualization = Object.assign(Object.assign({}, otherDefinitionParts), {
1914
2228
  type: 'splunk.singlevalue',
1915
2229
  context: {},
1916
2230
  options: {}
1917
2231
  });
2232
+
1918
2233
  var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
1919
- dataOptions = _ref.options,
1920
- dataContext = _ref.context;
2234
+ dataOptions = _ref.options,
2235
+ dataContext = _ref.context;
2236
+
1921
2237
  var migratedDataOptions = Object.assign(Object.assign(Object.assign(Object.assign({}, (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.trend) && {
1922
2238
  sparklineValues: dataOptions.trend
1923
2239
  }), (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.majorColor) && {
@@ -1929,9 +2245,9 @@ var migrateVizToSplunkSingleValue = function migrateVizToSplunkSingleValue(vizDe
1929
2245
  });
1930
2246
  var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionRenames);
1931
2247
  var trendDisplayMode = renamedOptions.trendDisplayMode,
1932
- showTrendIndicator = renamedOptions.showTrendIndicator,
1933
- showSparkline = renamedOptions.showSparkline,
1934
- sparklinePosition = renamedOptions.sparklinePosition;
2248
+ showTrendIndicator = renamedOptions.showTrendIndicator,
2249
+ showSparkline = renamedOptions.showSparkline,
2250
+ sparklinePosition = renamedOptions.sparklinePosition;
1935
2251
  var trendDisplay = (0, singlevalue_1.consolidateTrendDisplay)(trendDisplayMode, showTrendIndicator);
1936
2252
  var sparklineDisplay = consolidateSparklineDisplay(sparklinePosition, showSparkline);
1937
2253
  migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultsToRetain), renamedOptions), migratedDataOptions), typeof trendDisplay === 'string' && {
@@ -1939,11 +2255,12 @@ var migrateVizToSplunkSingleValue = function migrateVizToSplunkSingleValue(vizDe
1939
2255
  }), typeof sparklineDisplay === 'string' && {
1940
2256
  sparklineDisplay: sparklineDisplay
1941
2257
  });
1942
- migratedVisualization.context = dataContext;
1943
- // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalue as reference
2258
+ migratedVisualization.context = dataContext; // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalue as reference
2259
+
1944
2260
  (0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
1945
2261
  return migratedVisualization;
1946
2262
  };
2263
+
1947
2264
  exports.migrateVizToSplunkSingleValue = migrateVizToSplunkSingleValue;
1948
2265
 
1949
2266
  /***/ }),
@@ -1961,22 +2278,30 @@ module.exports = require("@splunk/visualizations/SingleValue.config");
1961
2278
 
1962
2279
  var __rest = this && this.__rest || function (s, e) {
1963
2280
  var t = {};
2281
+
1964
2282
  for (var p in s) {
1965
2283
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
1966
2284
  }
2285
+
1967
2286
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1968
2287
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
1969
2288
  }
1970
2289
  return t;
1971
2290
  };
2291
+
1972
2292
  Object.defineProperty(exports, "__esModule", {
1973
2293
  value: true
1974
2294
  });
1975
2295
  exports.migrateVizToSplunkSingleValueIcon = void 0;
2296
+
1976
2297
  var SingleValueIcon_config_1 = __webpack_require__(46);
2298
+
1977
2299
  var encoding_1 = __webpack_require__(1);
2300
+
1978
2301
  var migrationUtils_1 = __webpack_require__(0);
2302
+
1979
2303
  var singlevalue_1 = __webpack_require__(3);
2304
+
1980
2305
  var validOptions = Object.assign({}, SingleValueIcon_config_1.default.optionsSchema);
1981
2306
  var defaultsToRetain = {
1982
2307
  majorValue: '> primary | seriesByIndex(0) | lastPoint()',
@@ -1988,21 +2313,26 @@ var optionsToRename = {
1988
2313
  deltaColor: 'trendColor',
1989
2314
  color: 'iconColor'
1990
2315
  };
2316
+
1991
2317
  var migrateVizToSplunkSingleValueIcon = function migrateVizToSplunkSingleValueIcon(vizDefinition) {
1992
2318
  var _a, _b, _c;
2319
+
1993
2320
  var _vizDefinition$option = vizDefinition.options,
1994
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
1995
- _vizDefinition$encodi = vizDefinition.encoding,
1996
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
1997
- otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
2321
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2322
+ _vizDefinition$encodi = vizDefinition.encoding,
2323
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2324
+ otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
2325
+
1998
2326
  var migratedVisualization = Object.assign(Object.assign({}, otherDefinitionParts), {
1999
2327
  type: 'splunk.singlevalueicon',
2000
2328
  context: {},
2001
2329
  options: {}
2002
2330
  });
2331
+
2003
2332
  var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
2004
- dataOptions = _ref.options,
2005
- dataContext = _ref.context;
2333
+ dataOptions = _ref.options,
2334
+ dataContext = _ref.context;
2335
+
2006
2336
  var migratedDataOptions = Object.assign(Object.assign({}, (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.trend) && {
2007
2337
  majorValue: (_a = (0, migrationUtils_1.preserveDataSelectionForValueOption)(dataOptions.trend, 'lastPoint()')) !== null && _a !== void 0 ? _a : dataOptions.trend,
2008
2338
  trendValue: (_b = (0, migrationUtils_1.preserveDataSelectionForValueOption)(dataOptions.trend, 'delta(-2)')) !== null && _b !== void 0 ? _b : dataOptions.trend
@@ -2011,16 +2341,17 @@ var migrateVizToSplunkSingleValueIcon = function migrateVizToSplunkSingleValueIc
2011
2341
  });
2012
2342
  var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionsToRename);
2013
2343
  var trendDisplayMode = renamedOptions.trendDisplayMode,
2014
- showTrendIndicator = renamedOptions.showTrendIndicator;
2344
+ showTrendIndicator = renamedOptions.showTrendIndicator;
2015
2345
  var trendDisplay = (0, singlevalue_1.consolidateTrendDisplay)(trendDisplayMode, showTrendIndicator);
2016
2346
  migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultsToRetain), renamedOptions), migratedDataOptions), typeof trendDisplay === 'string' && {
2017
2347
  trendDisplay: trendDisplay
2018
2348
  });
2019
- migratedVisualization.context = dataContext;
2020
- // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalueicon as reference
2349
+ migratedVisualization.context = dataContext; // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalueicon as reference
2350
+
2021
2351
  (0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
2022
2352
  return migratedVisualization;
2023
2353
  };
2354
+
2024
2355
  exports.migrateVizToSplunkSingleValueIcon = migrateVizToSplunkSingleValueIcon;
2025
2356
 
2026
2357
  /***/ }),
@@ -2038,24 +2369,32 @@ module.exports = require("@splunk/visualizations/SingleValueIcon.config");
2038
2369
 
2039
2370
  var __rest = this && this.__rest || function (s, e) {
2040
2371
  var t = {};
2372
+
2041
2373
  for (var p in s) {
2042
2374
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2043
2375
  }
2376
+
2044
2377
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2045
2378
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2046
2379
  }
2047
2380
  return t;
2048
2381
  };
2382
+
2049
2383
  Object.defineProperty(exports, "__esModule", {
2050
2384
  value: true
2051
2385
  });
2052
2386
  exports.migrateVizToSplunkSingleValueRadial = void 0;
2387
+
2053
2388
  var SingleValueRadial_config_1 = __webpack_require__(48);
2389
+
2054
2390
  var encoding_1 = __webpack_require__(1);
2391
+
2055
2392
  var migrationUtils_1 = __webpack_require__(0);
2393
+
2056
2394
  var singlevalue_1 = __webpack_require__(3);
2057
- var validOptions = Object.assign({}, SingleValueRadial_config_1.default.optionsSchema);
2058
- // old default configurations should be retained in migrated configuration
2395
+
2396
+ var validOptions = Object.assign({}, SingleValueRadial_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
2397
+
2059
2398
  var defaultsToRetain = {
2060
2399
  majorValue: '> primary | seriesByIndex(0) | lastPoint()',
2061
2400
  trendValue: '> primary | seriesByIndex(0) | delta(-2)'
@@ -2064,23 +2403,28 @@ var optionRenames = {
2064
2403
  useTrendUnits: 'shouldAbbreviateTrendValue',
2065
2404
  useThousandSeparators: 'shouldUseThousandSeparators'
2066
2405
  };
2406
+
2067
2407
  var migrateVizToSplunkSingleValueRadial = function migrateVizToSplunkSingleValueRadial(vizDefinition) {
2068
2408
  var _a, _b, _c;
2409
+
2069
2410
  var _vizDefinition$option = vizDefinition.options,
2070
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2071
- _vizDefinition$encodi = vizDefinition.encoding,
2072
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2073
- otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
2411
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2412
+ _vizDefinition$encodi = vizDefinition.encoding,
2413
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2414
+ otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
2415
+
2074
2416
  var migratedVisualization = Object.assign(Object.assign({}, otherDefinitionParts), {
2075
2417
  type: 'splunk.singlevalueradial',
2076
2418
  context: {},
2077
2419
  options: {}
2078
2420
  });
2421
+
2079
2422
  var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
2080
- dataOptions = _ref.options,
2081
- dataContext = _ref.context;
2423
+ dataOptions = _ref.options,
2424
+ dataContext = _ref.context;
2425
+
2082
2426
  var originalTrend = dataOptions.trend,
2083
- originalFill = dataOptions.fill;
2427
+ originalFill = dataOptions.fill;
2084
2428
  var migratedDataOptions = Object.assign(Object.assign({}, originalTrend && {
2085
2429
  majorValue: (_a = (0, migrationUtils_1.preserveDataSelectionForValueOption)(originalTrend, 'lastPoint()')) !== null && _a !== void 0 ? _a : originalTrend,
2086
2430
  trendValue: (_b = (0, migrationUtils_1.preserveDataSelectionForValueOption)(originalTrend, 'delta(-2)')) !== null && _b !== void 0 ? _b : originalTrend
@@ -2089,16 +2433,17 @@ var migrateVizToSplunkSingleValueRadial = function migrateVizToSplunkSingleValue
2089
2433
  });
2090
2434
  var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionRenames);
2091
2435
  var trendDisplayMode = renamedOptions.trendDisplayMode,
2092
- showTrendIndicator = renamedOptions.showTrendIndicator;
2436
+ showTrendIndicator = renamedOptions.showTrendIndicator;
2093
2437
  var trendDisplay = (0, singlevalue_1.consolidateTrendDisplay)(trendDisplayMode, showTrendIndicator);
2094
2438
  migratedVisualization.options = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultsToRetain), renamedOptions), migratedDataOptions), typeof trendDisplay === 'string' && {
2095
2439
  trendDisplay: trendDisplay
2096
2440
  });
2097
- migratedVisualization.context = dataContext;
2098
- // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalueradial as reference
2441
+ migratedVisualization.context = dataContext; // remove invalid (and deprecated) options using the optionsSchema for splunk.singlevalueradial as reference
2442
+
2099
2443
  (0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
2100
2444
  return migratedVisualization;
2101
2445
  };
2446
+
2102
2447
  exports.migrateVizToSplunkSingleValueRadial = migrateVizToSplunkSingleValueRadial;
2103
2448
 
2104
2449
  /***/ }),
@@ -2115,44 +2460,58 @@ module.exports = require("@splunk/visualizations/SingleValueRadial.config");
2115
2460
 
2116
2461
 
2117
2462
  var _slicedToArray = __webpack_require__(6);
2463
+
2118
2464
  var __rest = this && this.__rest || function (s, e) {
2119
2465
  var t = {};
2466
+
2120
2467
  for (var p in s) {
2121
2468
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2122
2469
  }
2470
+
2123
2471
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2124
2472
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2125
2473
  }
2126
2474
  return t;
2127
2475
  };
2476
+
2128
2477
  Object.defineProperty(exports, "__esModule", {
2129
2478
  value: true
2130
2479
  });
2131
2480
  exports.migrateVizToSplunkTable = void 0;
2481
+
2132
2482
  var lodash_1 = __webpack_require__(9);
2483
+
2133
2484
  var Table_config_1 = __webpack_require__(50);
2485
+
2134
2486
  var hocUtils_1 = __webpack_require__(51);
2487
+
2135
2488
  var encoding_1 = __webpack_require__(1);
2489
+
2136
2490
  var migrationUtils_1 = __webpack_require__(0);
2137
- var validOptions = Object.assign({}, Table_config_1.default.optionsSchema);
2138
- // old default configurations should be retained in migrated configuration
2491
+
2492
+ var validOptions = Object.assign({}, Table_config_1.default.optionsSchema); // old default configurations should be retained in migrated configuration
2493
+
2139
2494
  var defaultChanges = {
2140
2495
  count: 20
2141
2496
  };
2142
2497
  var optionRenames = {
2143
2498
  rowNumbers: 'showRowNumbers'
2144
2499
  };
2500
+
2145
2501
  var migrateHeaderVisibility = function migrateHeaderVisibility(oldHeaderVisibility) {
2146
2502
  if (oldHeaderVisibility === undefined) {
2147
2503
  // headerVisibility: 'inline' is the default in splunk.table
2148
2504
  // this corresponds to `showHeader: true`, which is the default in viz.table
2149
2505
  return undefined;
2150
2506
  }
2507
+
2151
2508
  return oldHeaderVisibility ? 'inline' : 'none';
2152
2509
  };
2153
2510
  /**
2154
2511
  * Helper to migrate alternating color options (text and background) to their corresponding DSL and context configs
2155
2512
  */
2513
+
2514
+
2156
2515
  var migrateAlternatingColors = function migrateAlternatingColors(colors, optionToConvert, contextConfigName) {
2157
2516
  // default alternating themed color values as defined in table config
2158
2517
  var themedAlternatingColors = {
@@ -2167,7 +2526,8 @@ var migrateAlternatingColors = function migrateAlternatingColors(colors, optionT
2167
2526
  };
2168
2527
  var colorsContext = [];
2169
2528
  var oddColor = colors.oddColor,
2170
- evenColor = colors.evenColor;
2529
+ evenColor = colors.evenColor;
2530
+
2171
2531
  if (oddColor && evenColor) {
2172
2532
  colorsContext.push.apply(colorsContext, [oddColor, evenColor]);
2173
2533
  } else if (oddColor) {
@@ -2175,6 +2535,7 @@ var migrateAlternatingColors = function migrateAlternatingColors(colors, optionT
2175
2535
  } else if (evenColor) {
2176
2536
  colorsContext.push.apply(colorsContext, [themedAlternatingColors[optionToConvert].odd, evenColor]);
2177
2537
  }
2538
+
2178
2539
  if (colorsContext.length) {
2179
2540
  return {
2180
2541
  contextConfigName: contextConfigName,
@@ -2182,6 +2543,7 @@ var migrateAlternatingColors = function migrateAlternatingColors(colors, optionT
2182
2543
  dsl: "> table | pick(".concat(contextConfigName, ")")
2183
2544
  };
2184
2545
  }
2546
+
2185
2547
  return {};
2186
2548
  };
2187
2549
  /**
@@ -2191,41 +2553,50 @@ var migrateAlternatingColors = function migrateAlternatingColors(colors, optionT
2191
2553
  * This requires moving numberPrecision, useThousandSeparators, unitPosition, and other formatting options to the config
2192
2554
  * The resultant config is used as the argument for formatByType
2193
2555
  */
2556
+
2557
+
2194
2558
  var migrateToColumnFormat = function migrateToColumnFormat(fieldsOption) {
2195
2559
  var columnFormat = {};
2196
2560
  var columnFormatContext = {};
2561
+
2197
2562
  if (!fieldsOption) {
2198
2563
  return {
2199
2564
  columnFormat: columnFormat,
2200
2565
  columnFormatContext: columnFormatContext
2201
2566
  };
2202
2567
  }
2568
+
2203
2569
  Object.entries(fieldsOption).forEach(function (_ref) {
2204
2570
  var _ref2 = _slicedToArray(_ref, 2),
2205
- column = _ref2[0],
2206
- formatting = _ref2[1];
2571
+ column = _ref2[0],
2572
+ formatting = _ref2[1];
2573
+
2207
2574
  // need to prepend `formatted` in case the column has leading digits, which the nearley parser cannot account for
2208
2575
  var contextEntry = "formatted".concat(column, "Config");
2209
2576
  columnFormatContext[contextEntry] = {};
2210
2577
  columnFormat[column] = {
2211
2578
  data: "> table | seriesByName(\"".concat(column, "\") | formatByType(").concat(contextEntry, ")")
2212
- };
2213
- // all columnFormatting options are optional; if they are not present in the original config, tableFormat should take precedence
2579
+ }; // all columnFormatting options are optional; if they are not present in the original config, tableFormat should take precedence
2580
+
2214
2581
  var unit = formatting.unit,
2215
- unitPosition = formatting.unitPosition,
2216
- numberPrecision = formatting.numberPrecision,
2217
- useThousandSeparators = formatting.useThousandSeparators;
2582
+ unitPosition = formatting.unitPosition,
2583
+ numberPrecision = formatting.numberPrecision,
2584
+ useThousandSeparators = formatting.useThousandSeparators;
2585
+
2218
2586
  if (typeof unitPosition === 'string') {
2219
2587
  (0, lodash_1.set)(columnFormatContext, [contextEntry, 'number', 'unitPosition'], unitPosition);
2220
2588
  (0, lodash_1.set)(columnFormatContext, [contextEntry, 'string', 'unitPosition'], unitPosition);
2221
2589
  }
2590
+
2222
2591
  if (typeof unit === 'string' || typeof unit === 'number') {
2223
2592
  (0, lodash_1.set)(columnFormatContext, [contextEntry, 'number', 'unit'], unit);
2224
2593
  (0, lodash_1.set)(columnFormatContext, [contextEntry, 'string', 'unit'], unit);
2225
2594
  }
2595
+
2226
2596
  if (numberPrecision != null) {
2227
2597
  (0, lodash_1.set)(columnFormatContext, [contextEntry, 'number', 'precision'], numberPrecision);
2228
2598
  }
2599
+
2229
2600
  if (useThousandSeparators != null) {
2230
2601
  (0, lodash_1.set)(columnFormatContext, [contextEntry, 'number', 'thousandSeparated'], useThousandSeparators);
2231
2602
  }
@@ -2241,6 +2612,8 @@ var migrateToColumnFormat = function migrateToColumnFormat(fieldsOption) {
2241
2612
  * This requires moving numberPrecision, useThousandSeparators, unitPosition, and other formatting/coloring options to the config
2242
2613
  * The resultant formatting and coloring config is used as the argument for the formatByType() and pick() DSL formatters respectively
2243
2614
  */
2615
+
2616
+
2244
2617
  var migrateToTableFormat = function migrateToTableFormat() {
2245
2618
  var oldOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2246
2619
  var tableFormat = {};
@@ -2248,9 +2621,9 @@ var migrateToTableFormat = function migrateToTableFormat() {
2248
2621
  formattedConfig: {}
2249
2622
  };
2250
2623
  var unit = oldOptions.unit,
2251
- oldUnitPosition = oldOptions.unitPosition,
2252
- oldNumberPrecision = oldOptions.numberPrecision,
2253
- oldUseThousandSeparators = oldOptions.useThousandSeparators;
2624
+ oldUnitPosition = oldOptions.unitPosition,
2625
+ oldNumberPrecision = oldOptions.numberPrecision,
2626
+ oldUseThousandSeparators = oldOptions.useThousandSeparators;
2254
2627
  var unitPosition = typeof oldUnitPosition === 'string' ? oldUnitPosition : 'after';
2255
2628
  var numberPrecision = typeof oldNumberPrecision === 'number' ? oldNumberPrecision : 0;
2256
2629
  var useThousandSeparators = typeof oldUseThousandSeparators === 'boolean' ? oldUseThousandSeparators : false;
@@ -2258,70 +2631,86 @@ var migrateToTableFormat = function migrateToTableFormat() {
2258
2631
  (0, lodash_1.set)(tableFormatContext, ['formattedConfig', 'number', 'thousandSeparated'], useThousandSeparators);
2259
2632
  (0, lodash_1.set)(tableFormatContext, ['formattedConfig', 'number', 'unitPosition'], unitPosition);
2260
2633
  (0, lodash_1.set)(tableFormatContext, ['formattedConfig', 'string', 'unitPosition'], unitPosition);
2634
+
2261
2635
  if (typeof unit === 'string' || typeof unit === 'number') {
2262
2636
  (0, lodash_1.set)(tableFormatContext, ['formattedConfig', 'number', 'unit'], unit);
2263
2637
  (0, lodash_1.set)(tableFormatContext, ['formattedConfig', 'string', 'unit'], unit);
2264
2638
  }
2639
+
2265
2640
  tableFormat.data = "> table | formatByType(formattedConfig)";
2266
2641
  var rowBackgroundColorEven = oldOptions.rowBackgroundColorEven,
2267
- rowBackgroundColorOdd = oldOptions.rowBackgroundColorOdd,
2268
- rowTextColorOdd = oldOptions.rowTextColorOdd,
2269
- rowTextColorEven = oldOptions.rowTextColorEven,
2270
- headerTextColor = oldOptions.headerTextColor,
2271
- headerBackgroundColor = oldOptions.headerBackgroundColor;
2642
+ rowBackgroundColorOdd = oldOptions.rowBackgroundColorOdd,
2643
+ rowTextColorOdd = oldOptions.rowTextColorOdd,
2644
+ rowTextColorEven = oldOptions.rowTextColorEven,
2645
+ headerTextColor = oldOptions.headerTextColor,
2646
+ headerBackgroundColor = oldOptions.headerBackgroundColor;
2647
+
2272
2648
  var _migrateAlternatingCo = migrateAlternatingColors({
2273
- oddColor: rowTextColorOdd,
2274
- evenColor: rowTextColorEven
2275
- }, 'rowColors', 'rowColorsConfig'),
2276
- rowColorsContext = _migrateAlternatingCo.context,
2277
- rowColorsDSL = _migrateAlternatingCo.dsl;
2649
+ oddColor: rowTextColorOdd,
2650
+ evenColor: rowTextColorEven
2651
+ }, 'rowColors', 'rowColorsConfig'),
2652
+ rowColorsContext = _migrateAlternatingCo.context,
2653
+ rowColorsDSL = _migrateAlternatingCo.dsl;
2654
+
2278
2655
  if (rowColorsContext && rowColorsDSL) {
2279
2656
  tableFormatContext.rowColorsConfig = rowColorsContext;
2280
2657
  tableFormat.rowColors = rowColorsDSL;
2281
2658
  }
2659
+
2282
2660
  var _migrateAlternatingCo2 = migrateAlternatingColors({
2283
- oddColor: rowBackgroundColorOdd,
2284
- evenColor: rowBackgroundColorEven
2285
- }, 'rowBackgroundColors', 'rowBackgroundColorsConfig'),
2286
- rowBackgroundColorsContext = _migrateAlternatingCo2.context,
2287
- rowBackgroundColorsDSL = _migrateAlternatingCo2.dsl;
2661
+ oddColor: rowBackgroundColorOdd,
2662
+ evenColor: rowBackgroundColorEven
2663
+ }, 'rowBackgroundColors', 'rowBackgroundColorsConfig'),
2664
+ rowBackgroundColorsContext = _migrateAlternatingCo2.context,
2665
+ rowBackgroundColorsDSL = _migrateAlternatingCo2.dsl;
2666
+
2288
2667
  if (rowBackgroundColorsContext && rowBackgroundColorsDSL) {
2289
2668
  tableFormat.rowBackgroundColors = rowBackgroundColorsDSL;
2290
2669
  tableFormatContext.rowBackgroundColorsConfig = rowBackgroundColorsContext;
2291
2670
  }
2671
+
2292
2672
  if (headerTextColor) {
2293
2673
  tableFormat.headerColor = headerTextColor;
2294
2674
  }
2675
+
2295
2676
  if (headerBackgroundColor) {
2296
2677
  tableFormat.headerBackgroundColor = headerBackgroundColor;
2297
2678
  }
2679
+
2298
2680
  return {
2299
2681
  tableFormat: tableFormat,
2300
2682
  tableFormatContext: tableFormatContext
2301
2683
  };
2302
2684
  };
2685
+
2303
2686
  var migrateVizToSplunkTable = function migrateVizToSplunkTable(vizDefinition) {
2304
2687
  var _vizDefinition$encodi = vizDefinition.encoding,
2305
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2306
- _vizDefinition$option = vizDefinition.options,
2307
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2308
- otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
2688
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2689
+ _vizDefinition$option = vizDefinition.options,
2690
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2691
+ otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
2692
+
2309
2693
  var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
2310
2694
  type: 'splunk.table',
2311
2695
  options: {},
2312
2696
  context: {}
2313
2697
  });
2698
+
2314
2699
  var _ref3 = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
2315
- dataOptions = _ref3.options,
2316
- dataContext = _ref3.context;
2700
+ dataOptions = _ref3.options,
2701
+ dataContext = _ref3.context;
2702
+
2317
2703
  var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionRenames);
2318
2704
  var headerVisibility = migrateHeaderVisibility(renamedOptions.showHeader);
2705
+
2319
2706
  var _migrateToTableFormat = migrateToTableFormat(renamedOptions),
2320
- tableFormat = _migrateToTableFormat.tableFormat,
2321
- tableFormatContext = _migrateToTableFormat.tableFormatContext;
2707
+ tableFormat = _migrateToTableFormat.tableFormat,
2708
+ tableFormatContext = _migrateToTableFormat.tableFormatContext;
2709
+
2322
2710
  var _migrateToColumnForma = migrateToColumnFormat(renamedOptions.fields),
2323
- columnFormat = _migrateToColumnForma.columnFormat,
2324
- columnFormatContext = _migrateToColumnForma.columnFormatContext;
2711
+ columnFormat = _migrateToColumnForma.columnFormat,
2712
+ columnFormatContext = _migrateToColumnForma.columnFormatContext;
2713
+
2325
2714
  var migratedDataOptions = Object.assign({}, (dataOptions === null || dataOptions === void 0 ? void 0 : dataOptions.columns) && {
2326
2715
  table: dataOptions.columns
2327
2716
  });
@@ -2332,8 +2721,8 @@ var migrateVizToSplunkTable = function migrateVizToSplunkTable(vizDefinition) {
2332
2721
  }), {
2333
2722
  tableFormat: tableFormat
2334
2723
  });
2335
- var migratedOptions = (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, defaultChanges, formattingOptions, migratedDataOptions, renamedOptions);
2336
- // remove invalid options
2724
+ var migratedOptions = (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, defaultChanges, formattingOptions, migratedDataOptions, renamedOptions); // remove invalid options
2725
+
2337
2726
  Object.keys(migratedOptions).forEach(function (key) {
2338
2727
  if (!validOptions[key]) {
2339
2728
  delete migratedOptions[key];
@@ -2343,6 +2732,7 @@ var migrateVizToSplunkTable = function migrateVizToSplunkTable(vizDefinition) {
2343
2732
  migratedDefinition.options = migratedOptions;
2344
2733
  return migratedDefinition;
2345
2734
  };
2735
+
2346
2736
  exports.migrateVizToSplunkTable = migrateVizToSplunkTable;
2347
2737
 
2348
2738
  /***/ }),
@@ -2366,107 +2756,129 @@ module.exports = require("@splunk/visualizations-shared/hocUtils");
2366
2756
 
2367
2757
  var __rest = this && this.__rest || function (s, e) {
2368
2758
  var t = {};
2759
+
2369
2760
  for (var p in s) {
2370
2761
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2371
2762
  }
2763
+
2372
2764
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2373
2765
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2374
2766
  }
2375
2767
  return t;
2376
2768
  };
2769
+
2377
2770
  Object.defineProperty(exports, "__esModule", {
2378
2771
  value: true
2379
2772
  });
2380
2773
  exports.migrateVizTextToSplunkMarkdown = exports.convertFontSize = void 0;
2774
+
2381
2775
  var _ = __webpack_require__(9);
2776
+
2382
2777
  var Markdown_config_1 = __webpack_require__(8);
2778
+
2383
2779
  var migrationUtils_1 = __webpack_require__(0);
2780
+
2384
2781
  var validOptions = Object.assign({}, Markdown_config_1.default.optionsSchema);
2385
2782
  var optionsToRename = {
2386
2783
  textColor: 'fontColor',
2387
2784
  content: 'markdown'
2388
2785
  };
2786
+
2389
2787
  var convertTextContentToMarkDown = function convertTextContentToMarkDown(fontWeight, fontSize) {
2390
2788
  var textContent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
2789
+
2391
2790
  if (!_.isNumber(fontSize)) {
2392
2791
  return textContent;
2393
2792
  }
2793
+
2394
2794
  if (textContent.trim().length === 0) {
2395
2795
  return textContent;
2396
- }
2397
- // Remove any trailing newline chars from the content
2398
- var markdownContent = textContent.replace(/\n*$/, '');
2399
- // Handle text conversion to marker tags based on fontSize and fontWeight
2796
+ } // Remove any trailing newline chars from the content
2797
+
2798
+
2799
+ var markdownContent = textContent.replace(/\n*$/, ''); // Handle text conversion to marker tags based on fontSize and fontWeight
2800
+
2400
2801
  var regex = /\n/g; // regex to match /n with global scope across the string
2401
2802
  // Convert to paragraph in markdown, if fontSize < 20,
2402
2803
  // If text has fontWeight set to 'bold', add bold tag (**{markdown}**)
2804
+
2403
2805
  if (fontWeight === 'bold') {
2404
2806
  // Here direct regex replace doesnt work, as we need to remove the
2405
2807
  // extra trailing space if any exist before appending **{markdown}** to the text
2406
2808
  var contentStrings = markdownContent.split('\n');
2407
2809
  var stringsTrimmed = contentStrings.map(function (str) {
2408
2810
  return str && str.trim().length ? "**".concat(str.trim(), "**") : '';
2409
- });
2410
- // Remove all blank entries from the end of the trimmed string array,
2811
+ }); // Remove all blank entries from the end of the trimmed string array,
2411
2812
  // to avoid `\` to get rendered, which happens if following line after `\\n` is empty)
2813
+
2412
2814
  var idx = stringsTrimmed.length - 1;
2815
+
2413
2816
  while (idx >= 0 && stringsTrimmed[idx].length === 0) {
2414
2817
  stringsTrimmed.pop();
2415
2818
  idx -= 1;
2416
2819
  }
2820
+
2417
2821
  return stringsTrimmed.join('\\\n');
2418
- }
2419
- // If fontWeight is not bold, replace '\n' with '\\n` using regex
2822
+ } // If fontWeight is not bold, replace '\n' with '\\n` using regex
2823
+
2824
+
2420
2825
  markdownContent = markdownContent.replace(regex, '\\\n');
2421
2826
  return markdownContent;
2422
2827
  };
2828
+
2423
2829
  var convertFontSize = function convertFontSize(fontSize) {
2424
2830
  if (!_.isNumber(fontSize)) {
2425
2831
  return {
2426
2832
  fontSize: 'default'
2427
2833
  };
2428
2834
  }
2835
+
2429
2836
  return {
2430
2837
  fontSize: 'custom',
2431
2838
  customFontSize: fontSize
2432
2839
  };
2433
2840
  };
2841
+
2434
2842
  exports.convertFontSize = convertFontSize;
2843
+
2435
2844
  var migrateVizTextToSplunkMarkdown = function migrateVizTextToSplunkMarkdown(vizDefinition) {
2436
2845
  var _vizDefinition$option = vizDefinition.options,
2437
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2438
- otherDefinitionParts = __rest(vizDefinition, ["options"]);
2846
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2847
+ otherDefinitionParts = __rest(vizDefinition, ["options"]);
2848
+
2439
2849
  var _options$fontSize = options.fontSize,
2440
- fontSize = _options$fontSize === void 0 ? 24 : _options$fontSize,
2441
- _options$fontWeight = options.fontWeight,
2442
- fontWeight = _options$fontWeight === void 0 ? 'normal' : _options$fontWeight,
2443
- _options$fontFamily = options.fontFamily,
2444
- fontFamily = _options$fontFamily === void 0 ? 'Splunk Platform Sans' : _options$fontFamily,
2445
- _options$rotation = options.rotation,
2446
- rotation = _options$rotation === void 0 ? 0 : _options$rotation;
2850
+ fontSize = _options$fontSize === void 0 ? 24 : _options$fontSize,
2851
+ _options$fontWeight = options.fontWeight,
2852
+ fontWeight = _options$fontWeight === void 0 ? 'normal' : _options$fontWeight,
2853
+ _options$fontFamily = options.fontFamily,
2854
+ fontFamily = _options$fontFamily === void 0 ? 'Splunk Platform Sans' : _options$fontFamily,
2855
+ _options$rotation = options.rotation,
2856
+ rotation = _options$rotation === void 0 ? 0 : _options$rotation;
2447
2857
  var migratedVisualization = Object.assign(Object.assign({
2448
2858
  options: options
2449
2859
  }, otherDefinitionParts), {
2450
2860
  type: 'splunk.markdown',
2451
2861
  context: {}
2452
- });
2453
- // perform any option renames
2862
+ }); // perform any option renames
2863
+
2454
2864
  migratedVisualization.options = (0, migrationUtils_1.renameVizOptions)(migratedVisualization.options, optionsToRename);
2455
- var migratedVizOptions = migratedVisualization.options;
2456
- // convert text content to respective markdown
2457
- migratedVizOptions.markdown = convertTextContentToMarkDown(fontWeight, fontSize, migratedVizOptions.markdown);
2458
- // convert text fontSize to markdown fontSize
2865
+ var migratedVizOptions = migratedVisualization.options; // convert text content to respective markdown
2866
+
2867
+ migratedVizOptions.markdown = convertTextContentToMarkDown(fontWeight, fontSize, migratedVizOptions.markdown); // convert text fontSize to markdown fontSize
2868
+
2459
2869
  var _ref = (0, exports.convertFontSize)(fontSize),
2460
- fontSizeValue = _ref.fontSize,
2461
- customFontSize = _ref.customFontSize;
2870
+ fontSizeValue = _ref.fontSize,
2871
+ customFontSize = _ref.customFontSize;
2872
+
2462
2873
  migratedVizOptions.fontSize = fontSizeValue;
2463
2874
  migratedVizOptions.customFontSize = customFontSize;
2464
2875
  migratedVizOptions.fontFamily = fontFamily;
2465
- migratedVizOptions.rotation = rotation;
2466
- // remove invalid options using the optionsSchema for splunk.markdown as reference
2876
+ migratedVizOptions.rotation = rotation; // remove invalid options using the optionsSchema for splunk.markdown as reference
2877
+
2467
2878
  (0, migrationUtils_1.removeInvalidOptions)(migratedVizOptions, validOptions);
2468
2879
  return migratedVisualization;
2469
2880
  };
2881
+
2470
2882
  exports.migrateVizTextToSplunkMarkdown = migrateVizTextToSplunkMarkdown;
2471
2883
 
2472
2884
  /***/ }),
@@ -2477,23 +2889,31 @@ exports.migrateVizTextToSplunkMarkdown = migrateVizTextToSplunkMarkdown;
2477
2889
 
2478
2890
 
2479
2891
  var _toConsumableArray = __webpack_require__(5);
2892
+
2480
2893
  var __rest = this && this.__rest || function (s, e) {
2481
2894
  var t = {};
2895
+
2482
2896
  for (var p in s) {
2483
2897
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2484
2898
  }
2899
+
2485
2900
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2486
2901
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2487
2902
  }
2488
2903
  return t;
2489
2904
  };
2905
+
2490
2906
  Object.defineProperty(exports, "__esModule", {
2491
2907
  value: true
2492
2908
  });
2493
2909
  exports.migrateVizToSplunkPunchcard = void 0;
2910
+
2494
2911
  var Punchcard_config_1 = __webpack_require__(54);
2912
+
2495
2913
  var encoding_1 = __webpack_require__(1);
2914
+
2496
2915
  var migrationUtils_1 = __webpack_require__(0);
2916
+
2497
2917
  var validOptions = Object.assign({}, Punchcard_config_1.default.optionsSchema);
2498
2918
  var defaultContext = Object.assign({}, Punchcard_config_1.default.defaultContext);
2499
2919
  var optionsToRename = {
@@ -2507,11 +2927,14 @@ var optionsToRename = {
2507
2927
  showLegend: 'legendDisplay',
2508
2928
  useDefaultSort: 'showDefaultSort'
2509
2929
  };
2930
+
2510
2931
  var consolidateLegendDisplay = function consolidateLegendDisplay(vizOptions) {
2511
2932
  if (!vizOptions) {
2512
2933
  return;
2513
2934
  }
2935
+
2514
2936
  var options = vizOptions;
2937
+
2515
2938
  if (options.legendDisplay) {
2516
2939
  options.legendDisplay = 'right';
2517
2940
  } else if (options.legendDisplay === false) {
@@ -2523,44 +2946,57 @@ var consolidateBubbleLabelDisplay = function consolidateBubbleLabelDisplay(vizOp
2523
2946
  if (!vizOptions) {
2524
2947
  return;
2525
2948
  }
2949
+
2526
2950
  var options = vizOptions;
2951
+
2527
2952
  if (options.bubbleLabelDisplay === 'none') {
2528
2953
  options.bubbleLabelDisplay = 'off';
2529
2954
  }
2530
- };
2531
- // Updates the first color of the bubbleColorConfig with the minBubbleColorIntensity
2955
+ }; // Updates the first color of the bubbleColorConfig with the minBubbleColorIntensity
2956
+
2957
+
2532
2958
  var convertGradientConfig = function convertGradientConfig(minBubbleColorIntensity, defaultBubbleColorConfig) {
2533
2959
  if (!defaultBubbleColorConfig || !defaultBubbleColorConfig.colors || !defaultBubbleColorConfig.colors[0] || typeof minBubbleColorIntensity !== 'number') {
2534
2960
  return null;
2535
2961
  }
2962
+
2536
2963
  var firstColor = defaultBubbleColorConfig.colors[0];
2537
2964
  var firstColorUpdated = "".concat(firstColor.substring(0, firstColor.lastIndexOf(',')), ",").concat(minBubbleColorIntensity, ")");
2965
+
2538
2966
  var colors = _toConsumableArray(defaultBubbleColorConfig.colors);
2967
+
2539
2968
  colors[0] = firstColorUpdated;
2540
2969
  var bubbleColorConfigUpdated = Object.assign(Object.assign({}, defaultBubbleColorConfig), {
2541
2970
  colors: colors
2542
2971
  });
2543
2972
  return bubbleColorConfigUpdated;
2544
2973
  };
2974
+
2545
2975
  var convertColorModeOption = function convertColorModeOption(visualizationDefinition) {
2546
2976
  var visualizationDef = visualizationDefinition;
2977
+
2547
2978
  if (!visualizationDef || !visualizationDef.options) {
2548
2979
  return;
2549
- }
2550
- // Rename the colorMode option from 'sequential' to 'dynamic' if specified
2980
+ } // Rename the colorMode option from 'sequential' to 'dynamic' if specified
2981
+
2982
+
2551
2983
  if (visualizationDef.options.colorMode === 'sequential') {
2552
2984
  visualizationDef.options.colorMode = 'dynamic';
2553
- }
2554
- // If no colorMode was specified the default in viz.punchcard used to be 'categorical'.
2985
+ } // If no colorMode was specified the default in viz.punchcard used to be 'categorical'.
2555
2986
  // But in splunk.punchcard default is 'dynamic', we need to preserve the original default.
2556
2987
  // Set colorMode to 'categorical' if no colorMode was specified in viz
2988
+
2989
+
2557
2990
  if (!visualizationDef.options.colorMode) {
2558
2991
  visualizationDef.options.colorMode = 'categorical';
2559
2992
  }
2993
+
2560
2994
  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'
2561
2995
  // In both cases we need to update the gradient config bubbleColorConfig with the minBubbleColorIntensity for first color
2996
+
2562
2997
  if ((!visualizationDef.options.category || visualizationDef.options.colorMode !== 'categorical') && minBubbleColorIntensity && typeof minBubbleColorIntensity === 'number') {
2563
2998
  var bubbleColorConfig = convertGradientConfig(minBubbleColorIntensity, defaultContext.bubbleColorConfig);
2999
+
2564
3000
  if (bubbleColorConfig) {
2565
3001
  visualizationDef.context = Object.assign(Object.assign({}, visualizationDef.context), {
2566
3002
  bubbleColorConfig: bubbleColorConfig
@@ -2568,31 +3004,37 @@ var convertColorModeOption = function convertColorModeOption(visualizationDefini
2568
3004
  }
2569
3005
  }
2570
3006
  };
3007
+
2571
3008
  var migrateVizToSplunkPunchcard = function migrateVizToSplunkPunchcard(vizDefinition) {
2572
3009
  var _vizDefinition$option = vizDefinition.options,
2573
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2574
- _vizDefinition$encodi = vizDefinition.encoding,
2575
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2576
- otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
3010
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
3011
+ _vizDefinition$encodi = vizDefinition.encoding,
3012
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
3013
+ otherDefinitionParts = __rest(vizDefinition, ["options", "encoding"]);
3014
+
2577
3015
  var migratedVisualization = Object.assign(Object.assign({
2578
3016
  options: options
2579
3017
  }, otherDefinitionParts), {
2580
3018
  type: 'splunk.punchcard',
2581
3019
  context: {}
2582
3020
  });
3021
+
2583
3022
  var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
2584
- dataOptions = _ref.options,
2585
- dataContext = _ref.context; // perform any option renames
3023
+ dataOptions = _ref.options,
3024
+ dataContext = _ref.context; // perform any option renames
3025
+
3026
+
2586
3027
  var renamedOptions = (0, migrationUtils_1.renameVizOptions)(migratedVisualization.options, optionsToRename);
2587
3028
  consolidateLegendDisplay(renamedOptions);
2588
3029
  consolidateBubbleLabelDisplay(renamedOptions);
2589
3030
  migratedVisualization.options = Object.assign(Object.assign({}, renamedOptions), dataOptions);
2590
3031
  migratedVisualization.context = dataContext;
2591
- convertColorModeOption(migratedVisualization);
2592
- // remove invalid options using the optionsSchema for splunk.punchcard as reference
3032
+ convertColorModeOption(migratedVisualization); // remove invalid options using the optionsSchema for splunk.punchcard as reference
3033
+
2593
3034
  (0, migrationUtils_1.removeInvalidOptions)(migratedVisualization.options, validOptions);
2594
3035
  return migratedVisualization;
2595
3036
  };
3037
+
2596
3038
  exports.migrateVizToSplunkPunchcard = migrateVizToSplunkPunchcard;
2597
3039
 
2598
3040
  /***/ }),
@@ -2610,21 +3052,28 @@ module.exports = require("@splunk/visualizations/Punchcard.config");
2610
3052
 
2611
3053
  var __rest = this && this.__rest || function (s, e) {
2612
3054
  var t = {};
3055
+
2613
3056
  for (var p in s) {
2614
3057
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
2615
3058
  }
3059
+
2616
3060
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2617
3061
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
2618
3062
  }
2619
3063
  return t;
2620
3064
  };
3065
+
2621
3066
  Object.defineProperty(exports, "__esModule", {
2622
3067
  value: true
2623
3068
  });
2624
3069
  exports.migrateVizToSplunkMapChoropleth = exports.defaultEmptyAreaColor = exports.defaultStrokeColor = void 0;
3070
+
2625
3071
  var Map_config_1 = __webpack_require__(56);
3072
+
2626
3073
  var encoding_1 = __webpack_require__(1);
3074
+
2627
3075
  var migrationUtils_1 = __webpack_require__(0);
3076
+
2628
3077
  var validOptions = Object.assign({}, Map_config_1.default.optionsSchema);
2629
3078
  var optionRenames = {
2630
3079
  fillColor: 'choroplethEmptyAreaColor',
@@ -2640,29 +3089,35 @@ var defaultContextChanges = {
2640
3089
  };
2641
3090
  exports.defaultStrokeColor = '#689C8D';
2642
3091
  exports.defaultEmptyAreaColor = '#EAEFF2';
3092
+
2643
3093
  var migrateVizToSplunkMapChoropleth = function migrateVizToSplunkMapChoropleth(vizDefinition) {
2644
3094
  var _vizDefinition$encodi = vizDefinition.encoding,
2645
- encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
2646
- _vizDefinition$option = vizDefinition.options,
2647
- options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
2648
- otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
3095
+ encoding = _vizDefinition$encodi === void 0 ? {} : _vizDefinition$encodi,
3096
+ _vizDefinition$option = vizDefinition.options,
3097
+ options = _vizDefinition$option === void 0 ? {} : _vizDefinition$option,
3098
+ otherDefinitionParts = __rest(vizDefinition, ["encoding", "options"]);
3099
+
2649
3100
  var migratedDefinition = Object.assign(Object.assign({}, otherDefinitionParts), {
2650
3101
  type: 'splunk.map',
2651
3102
  options: {},
2652
3103
  context: {}
2653
3104
  });
3105
+
2654
3106
  var _ref = (0, encoding_1.encodingToDynamicOptionsDSL)(encoding),
2655
- dataOptions = _ref.options,
2656
- dataContext = _ref.context;
3107
+ dataOptions = _ref.options,
3108
+ dataContext = _ref.context;
3109
+
2657
3110
  var dynamicOptions = (0, migrationUtils_1.renameVizOptions)(dataOptions, optionRenames);
2658
3111
  var renamedOptions = (0, migrationUtils_1.renameVizOptions)(options, optionRenames);
3112
+
2659
3113
  if (!('dataColors' in dynamicOptions)) {
2660
3114
  Object.assign(dynamicOptions, {
2661
3115
  dataColors: '> areaValues | gradient(fillGradientContext)'
2662
3116
  });
2663
3117
  }
3118
+
2664
3119
  var choroplethEmptyAreaColor = renamedOptions.choroplethEmptyAreaColor,
2665
- choroplethStrokeColor = renamedOptions.choroplethStrokeColor;
3120
+ choroplethStrokeColor = renamedOptions.choroplethStrokeColor;
2666
3121
  var source = renamedOptions.source;
2667
3122
  var layerOptions = ['choroplethEmptyAreaColor', 'choroplethStrokeColor', 'source'];
2668
3123
  var renamedOptionsFiltered = Object.keys(renamedOptions).filter(function (key) {
@@ -2673,6 +3128,7 @@ var migrateVizToSplunkMapChoropleth = function migrateVizToSplunkMapChoropleth(v
2673
3128
  return obj;
2674
3129
  }, {});
2675
3130
  /* migrate default strokeColor in viz.geojson to either the backgroundColor if configured and non-transparent or defaultBackgroundColor in splunk.map */
3131
+
2676
3132
  if (choroplethStrokeColor === exports.defaultStrokeColor && choroplethEmptyAreaColor !== 'transparent') {
2677
3133
  if ('backgroundColor' in renamedOptionsFiltered) {
2678
3134
  /* eslint-disable-next-line dot-notation */
@@ -2686,10 +3142,12 @@ var migrateVizToSplunkMapChoropleth = function migrateVizToSplunkMapChoropleth(v
2686
3142
  choroplethStrokeColor = '> themes.defaultBackgroundColor';
2687
3143
  }
2688
3144
  }
3145
+
2689
3146
  if (choroplethEmptyAreaColor === exports.defaultEmptyAreaColor) {
2690
3147
  choroplethEmptyAreaColor = '> themes.defaultChoroplethEmptyAreaColor';
2691
- }
2692
- // update migrated options and context
3148
+ } // update migrated options and context
3149
+
3150
+
2693
3151
  migratedDefinition.options = Object.assign(Object.assign({}, renamedOptionsFiltered), {
2694
3152
  layers: [Object.assign(Object.assign({
2695
3153
  type: 'choropleth',
@@ -2703,6 +3161,7 @@ var migrateVizToSplunkMapChoropleth = function migrateVizToSplunkMapChoropleth(v
2703
3161
  showBaseLayer: false,
2704
3162
  showZoomControls: false
2705
3163
  });
3164
+
2706
3165
  if (vizDefinition.type === 'viz.geojson.us') {
2707
3166
  migratedDefinition.options.center = [39.83, -97];
2708
3167
  migratedDefinition.options.zoom = 3;
@@ -2710,7 +3169,9 @@ var migrateVizToSplunkMapChoropleth = function migrateVizToSplunkMapChoropleth(v
2710
3169
  migratedDefinition.options.center = [46.56, 10.35];
2711
3170
  migratedDefinition.options.zoom = 0;
2712
3171
  }
3172
+
2713
3173
  migratedDefinition.context = encoding.fill ? dataContext : defaultContextChanges;
3174
+
2714
3175
  if (JSON.stringify(dataContext) === JSON.stringify({
2715
3176
  fillGradientContext: {}
2716
3177
  })) {
@@ -2718,9 +3179,11 @@ var migrateVizToSplunkMapChoropleth = function migrateVizToSplunkMapChoropleth(v
2718
3179
  context: defaultContextChanges
2719
3180
  });
2720
3181
  }
3182
+
2721
3183
  (0, migrationUtils_1.removeInvalidOptions)(migratedDefinition.options, validOptions);
2722
3184
  return migratedDefinition;
2723
3185
  };
3186
+
2724
3187
  exports.migrateVizToSplunkMapChoropleth = migrateVizToSplunkMapChoropleth;
2725
3188
 
2726
3189
  /***/ }),