@splunk/visualization-migrations 28.5.2 → 28.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +13 -0
- package/index.js +29 -15
- package/index.js.map +2 -2
- package/migrate.js +29 -15
- package/migrate.js.map +2 -2
- package/package.json +7 -7
- package/tsconfig.json +1 -1
- package/LICENSE.md +0 -449
package/migrate.js
CHANGED
|
@@ -87,10 +87,20 @@ __reExport(parserUtils_exports, require("@splunk/visualization-encoding/utils/pa
|
|
|
87
87
|
var parserUtils_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
|
|
88
88
|
|
|
89
89
|
// src/encoding/encoding.ts
|
|
90
|
-
var indexBasedRegx =
|
|
91
|
-
var nameBasedRegx =
|
|
90
|
+
var indexBasedRegx = /^\w+(?:\[[^\[\]]*\])+$/;
|
|
91
|
+
var nameBasedRegx = /^\w+\.[^\[]+(?:\[[^\[\]]*\])?$/;
|
|
92
92
|
var isIndexBasedReference = (ref) => indexBasedRegx.test(ref);
|
|
93
93
|
var isNameBasedReference = (ref) => nameBasedRegx.test(ref);
|
|
94
|
+
var serializeForDslLiteral = (value) => {
|
|
95
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
96
|
+
return String(value);
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
return JSON.stringify(value);
|
|
100
|
+
} catch (err) {
|
|
101
|
+
return String(value);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
94
104
|
var convertFormatterToDSL = (fieldReference, key, translatedValue) => {
|
|
95
105
|
var _a, _b, _c, _d, _e, _f;
|
|
96
106
|
switch ((_a = fieldReference == null ? void 0 : fieldReference.format) == null ? void 0 : _a.type) {
|
|
@@ -115,10 +125,11 @@ var convertFormatterToDSL = (fieldReference, key, translatedValue) => {
|
|
|
115
125
|
case "matchvalue": {
|
|
116
126
|
const defaultValue = (_e = fieldReference.format) == null ? void 0 : _e.defaultValue;
|
|
117
127
|
const matchValueContextKey = `${key}MatchValueContext`;
|
|
128
|
+
const defaultValueArg = defaultValue === null || defaultValue === void 0 ? "" : `, ${serializeForDslLiteral(defaultValue)}`;
|
|
118
129
|
return {
|
|
119
130
|
contextConfig: ((_f = fieldReference.format) == null ? void 0 : _f.matches) || [],
|
|
120
131
|
contextKey: matchValueContextKey,
|
|
121
|
-
dsl: `${translatedValue} | matchValue(${matchValueContextKey}${
|
|
132
|
+
dsl: `${translatedValue} | matchValue(${matchValueContextKey}${defaultValueArg})`
|
|
122
133
|
};
|
|
123
134
|
}
|
|
124
135
|
default:
|
|
@@ -157,7 +168,7 @@ var translateArrayFormatDataReference = (encodingDataReference) => {
|
|
|
157
168
|
return `> ${dataSourceName} | frameBySeriesNamesOrIndexes(${paramStr})`;
|
|
158
169
|
};
|
|
159
170
|
var translateDataReference = (encodingDataReference) => {
|
|
160
|
-
if (encodingDataReference.
|
|
171
|
+
if (encodingDataReference.startsWith("encoding.")) {
|
|
161
172
|
return `> ${encodingDataReference.replace("encoding.", "")}`;
|
|
162
173
|
}
|
|
163
174
|
const isIndexBasedRef = isIndexBasedReference(encodingDataReference);
|
|
@@ -490,12 +501,16 @@ var renameVizOptions = (oldOptions, optionRenames9) => {
|
|
|
490
501
|
return updatedOptions;
|
|
491
502
|
};
|
|
492
503
|
var preserveDataSelectionForValueOption = (valueOption, selector) => {
|
|
493
|
-
if (valueOption) {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
504
|
+
if (typeof valueOption !== "string" || valueOption.length === 0) {
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
const dataSelectors = (0, dsl_exports.getDataSelectorsFromDSL)(valueOption);
|
|
508
|
+
const lastDataSelector = dataSelectors[dataSelectors.length - 1];
|
|
509
|
+
if (!lastDataSelector) {
|
|
510
|
+
return null;
|
|
511
|
+
}
|
|
512
|
+
if (lastDataSelector.includes("seriesByIndex") || lastDataSelector.includes("seriesByName")) {
|
|
513
|
+
return `${valueOption} | ${selector}`;
|
|
499
514
|
}
|
|
500
515
|
return null;
|
|
501
516
|
};
|
|
@@ -1183,9 +1198,7 @@ var convertTextContentToMarkDown = (fontWeight, fontSize, textContent = "") => {
|
|
|
1183
1198
|
const regex = /\n/g;
|
|
1184
1199
|
if (fontWeight === "bold") {
|
|
1185
1200
|
const contentStrings = markdownContent.split("\n");
|
|
1186
|
-
const stringsTrimmed = contentStrings.map(
|
|
1187
|
-
(str) => str && str.trim().length ? `**${str.trim()}**` : ""
|
|
1188
|
-
);
|
|
1201
|
+
const stringsTrimmed = contentStrings.map((str) => (str == null ? void 0 : str.trim().length) ? `**${str.trim()}**` : "");
|
|
1189
1202
|
let idx = stringsTrimmed.length - 1;
|
|
1190
1203
|
while (idx >= 0 && stringsTrimmed[idx].length === 0) {
|
|
1191
1204
|
stringsTrimmed.pop();
|
|
@@ -1270,7 +1283,8 @@ var consolidateBubbleLabelDisplay = (vizOptions) => {
|
|
|
1270
1283
|
}
|
|
1271
1284
|
};
|
|
1272
1285
|
var convertGradientConfig = (minBubbleColorIntensity, defaultBubbleColorConfig) => {
|
|
1273
|
-
|
|
1286
|
+
var _a;
|
|
1287
|
+
if (!((_a = defaultBubbleColorConfig == null ? void 0 : defaultBubbleColorConfig.colors) == null ? void 0 : _a[0]) || typeof minBubbleColorIntensity !== "number") {
|
|
1274
1288
|
return null;
|
|
1275
1289
|
}
|
|
1276
1290
|
const firstColor = defaultBubbleColorConfig.colors[0];
|
|
@@ -1285,7 +1299,7 @@ var convertGradientConfig = (minBubbleColorIntensity, defaultBubbleColorConfig)
|
|
|
1285
1299
|
};
|
|
1286
1300
|
var convertColorModeOption = (visualizationDefinition) => {
|
|
1287
1301
|
const visualizationDef = visualizationDefinition;
|
|
1288
|
-
if (!visualizationDef
|
|
1302
|
+
if (!(visualizationDef == null ? void 0 : visualizationDef.options)) {
|
|
1289
1303
|
return;
|
|
1290
1304
|
}
|
|
1291
1305
|
if (visualizationDef.options.colorMode === "sequential") {
|