@splunk/visualization-migrations 28.5.3 → 28.6.1
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/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2026 Splunk Inc.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/index.js
CHANGED
|
@@ -88,10 +88,20 @@ __reExport(parserUtils_exports, require("@splunk/visualization-encoding/utils/pa
|
|
|
88
88
|
var parserUtils_default = "default" in defaultImport2 ? defaultImport2.default : defaultImport2;
|
|
89
89
|
|
|
90
90
|
// src/encoding/encoding.ts
|
|
91
|
-
var indexBasedRegx =
|
|
92
|
-
var nameBasedRegx =
|
|
91
|
+
var indexBasedRegx = /^\w+(?:\[[^\[\]]*\])+$/;
|
|
92
|
+
var nameBasedRegx = /^\w+\.[^\[]+(?:\[[^\[\]]*\])?$/;
|
|
93
93
|
var isIndexBasedReference = (ref) => indexBasedRegx.test(ref);
|
|
94
94
|
var isNameBasedReference = (ref) => nameBasedRegx.test(ref);
|
|
95
|
+
var serializeForDslLiteral = (value) => {
|
|
96
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
97
|
+
return String(value);
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
return JSON.stringify(value);
|
|
101
|
+
} catch (err) {
|
|
102
|
+
return String(value);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
95
105
|
var convertFormatterToDSL = (fieldReference, key, translatedValue) => {
|
|
96
106
|
var _a, _b, _c, _d, _e, _f;
|
|
97
107
|
switch ((_a = fieldReference == null ? void 0 : fieldReference.format) == null ? void 0 : _a.type) {
|
|
@@ -116,10 +126,11 @@ var convertFormatterToDSL = (fieldReference, key, translatedValue) => {
|
|
|
116
126
|
case "matchvalue": {
|
|
117
127
|
const defaultValue = (_e = fieldReference.format) == null ? void 0 : _e.defaultValue;
|
|
118
128
|
const matchValueContextKey = `${key}MatchValueContext`;
|
|
129
|
+
const defaultValueArg = defaultValue === null || defaultValue === void 0 ? "" : `, ${serializeForDslLiteral(defaultValue)}`;
|
|
119
130
|
return {
|
|
120
131
|
contextConfig: ((_f = fieldReference.format) == null ? void 0 : _f.matches) || [],
|
|
121
132
|
contextKey: matchValueContextKey,
|
|
122
|
-
dsl: `${translatedValue} | matchValue(${matchValueContextKey}${
|
|
133
|
+
dsl: `${translatedValue} | matchValue(${matchValueContextKey}${defaultValueArg})`
|
|
123
134
|
};
|
|
124
135
|
}
|
|
125
136
|
default:
|
|
@@ -158,7 +169,7 @@ var translateArrayFormatDataReference = (encodingDataReference) => {
|
|
|
158
169
|
return `> ${dataSourceName} | frameBySeriesNamesOrIndexes(${paramStr})`;
|
|
159
170
|
};
|
|
160
171
|
var translateDataReference = (encodingDataReference) => {
|
|
161
|
-
if (encodingDataReference.
|
|
172
|
+
if (encodingDataReference.startsWith("encoding.")) {
|
|
162
173
|
return `> ${encodingDataReference.replace("encoding.", "")}`;
|
|
163
174
|
}
|
|
164
175
|
const isIndexBasedRef = isIndexBasedReference(encodingDataReference);
|
|
@@ -491,12 +502,16 @@ var renameVizOptions = (oldOptions, optionRenames9) => {
|
|
|
491
502
|
return updatedOptions;
|
|
492
503
|
};
|
|
493
504
|
var preserveDataSelectionForValueOption = (valueOption, selector) => {
|
|
494
|
-
if (valueOption) {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
505
|
+
if (typeof valueOption !== "string" || valueOption.length === 0) {
|
|
506
|
+
return null;
|
|
507
|
+
}
|
|
508
|
+
const dataSelectors = (0, dsl_exports.getDataSelectorsFromDSL)(valueOption);
|
|
509
|
+
const lastDataSelector = dataSelectors[dataSelectors.length - 1];
|
|
510
|
+
if (!lastDataSelector) {
|
|
511
|
+
return null;
|
|
512
|
+
}
|
|
513
|
+
if (lastDataSelector.includes("seriesByIndex") || lastDataSelector.includes("seriesByName")) {
|
|
514
|
+
return `${valueOption} | ${selector}`;
|
|
500
515
|
}
|
|
501
516
|
return null;
|
|
502
517
|
};
|
|
@@ -1184,9 +1199,7 @@ var convertTextContentToMarkDown = (fontWeight, fontSize, textContent = "") => {
|
|
|
1184
1199
|
const regex = /\n/g;
|
|
1185
1200
|
if (fontWeight === "bold") {
|
|
1186
1201
|
const contentStrings = markdownContent.split("\n");
|
|
1187
|
-
const stringsTrimmed = contentStrings.map(
|
|
1188
|
-
(str) => str && str.trim().length ? `**${str.trim()}**` : ""
|
|
1189
|
-
);
|
|
1202
|
+
const stringsTrimmed = contentStrings.map((str) => (str == null ? void 0 : str.trim().length) ? `**${str.trim()}**` : "");
|
|
1190
1203
|
let idx = stringsTrimmed.length - 1;
|
|
1191
1204
|
while (idx >= 0 && stringsTrimmed[idx].length === 0) {
|
|
1192
1205
|
stringsTrimmed.pop();
|
|
@@ -1271,7 +1284,8 @@ var consolidateBubbleLabelDisplay = (vizOptions) => {
|
|
|
1271
1284
|
}
|
|
1272
1285
|
};
|
|
1273
1286
|
var convertGradientConfig = (minBubbleColorIntensity, defaultBubbleColorConfig) => {
|
|
1274
|
-
|
|
1287
|
+
var _a;
|
|
1288
|
+
if (!((_a = defaultBubbleColorConfig == null ? void 0 : defaultBubbleColorConfig.colors) == null ? void 0 : _a[0]) || typeof minBubbleColorIntensity !== "number") {
|
|
1275
1289
|
return null;
|
|
1276
1290
|
}
|
|
1277
1291
|
const firstColor = defaultBubbleColorConfig.colors[0];
|
|
@@ -1286,7 +1300,7 @@ var convertGradientConfig = (minBubbleColorIntensity, defaultBubbleColorConfig)
|
|
|
1286
1300
|
};
|
|
1287
1301
|
var convertColorModeOption = (visualizationDefinition) => {
|
|
1288
1302
|
const visualizationDef = visualizationDefinition;
|
|
1289
|
-
if (!visualizationDef
|
|
1303
|
+
if (!(visualizationDef == null ? void 0 : visualizationDef.options)) {
|
|
1290
1304
|
return;
|
|
1291
1305
|
}
|
|
1292
1306
|
if (visualizationDef.options.colorMode === "sequential") {
|