@hpcc-js/ddl-shim 3.2.0 → 3.2.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/dist/index.js +990 -815
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +2 -2
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,889 +1,1064 @@
|
|
|
1
|
-
import * as _Ajv from "ajv";
|
|
2
|
-
|
|
3
|
-
//#region rolldown:runtime
|
|
4
1
|
var __defProp = Object.defineProperty;
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
for (var name in all) __defProp(target, name, {
|
|
8
|
-
get: all[name],
|
|
9
|
-
enumerable: true
|
|
10
|
-
});
|
|
11
|
-
return target;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/__package__.ts
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import * as _Ajv from "ajv";
|
|
16
4
|
const PKG_NAME = "@hpcc-js/ddl-shim";
|
|
17
|
-
const PKG_VERSION = "3.2.
|
|
18
|
-
const BUILD_VERSION = "3.15.
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
//#region src/ddl/v1.ts
|
|
22
|
-
var v1_exports = /* @__PURE__ */ __export({
|
|
23
|
-
isChoroVisualization: () => isChoroVisualization,
|
|
24
|
-
isDatabombDatasource: () => isDatabombDatasource,
|
|
25
|
-
isFormVisualization: () => isFormVisualization,
|
|
26
|
-
isGeohashMapping: () => isGeohashMapping,
|
|
27
|
-
isGraphVisualization: () => isGraphVisualization,
|
|
28
|
-
isHeatMapVisualization: () => isHeatMapVisualization,
|
|
29
|
-
isHipieDatasource: () => isHipieDatasource,
|
|
30
|
-
isLineVisualization: () => isLineVisualization,
|
|
31
|
-
isPieVisualization: () => isPieVisualization,
|
|
32
|
-
isSliderVisualization: () => isSliderVisualization,
|
|
33
|
-
isTableVisualization: () => isTableVisualization,
|
|
34
|
-
isUSCountyMapping: () => isUSCountyMapping,
|
|
35
|
-
isUSStateMapping: () => isUSStateMapping,
|
|
36
|
-
isWorkunitDatasource: () => isWorkunitDatasource
|
|
37
|
-
});
|
|
5
|
+
const PKG_VERSION = "3.2.1";
|
|
6
|
+
const BUILD_VERSION = "3.15.1";
|
|
38
7
|
function isWorkunitDatasource(ref) {
|
|
39
|
-
|
|
8
|
+
return ref.WUID !== void 0;
|
|
40
9
|
}
|
|
10
|
+
__name(isWorkunitDatasource, "isWorkunitDatasource");
|
|
41
11
|
function isDatabombDatasource(ref) {
|
|
42
|
-
|
|
12
|
+
return ref.databomb === true;
|
|
43
13
|
}
|
|
14
|
+
__name(isDatabombDatasource, "isDatabombDatasource");
|
|
44
15
|
function isHipieDatasource(ref) {
|
|
45
|
-
|
|
16
|
+
return ref.URL !== void 0;
|
|
46
17
|
}
|
|
18
|
+
__name(isHipieDatasource, "isHipieDatasource");
|
|
47
19
|
function isPieVisualization(viz) {
|
|
48
|
-
|
|
20
|
+
return viz.type === "PIE" || viz.type === "BAR";
|
|
49
21
|
}
|
|
22
|
+
__name(isPieVisualization, "isPieVisualization");
|
|
50
23
|
function isLineVisualization(viz) {
|
|
51
|
-
|
|
24
|
+
return viz.type === "LINE";
|
|
52
25
|
}
|
|
26
|
+
__name(isLineVisualization, "isLineVisualization");
|
|
53
27
|
function isChoroVisualization(viz) {
|
|
54
|
-
|
|
28
|
+
return viz.type === "CHORO";
|
|
55
29
|
}
|
|
30
|
+
__name(isChoroVisualization, "isChoroVisualization");
|
|
56
31
|
function isTableVisualization(viz) {
|
|
57
|
-
|
|
32
|
+
return viz.type === "TABLE";
|
|
58
33
|
}
|
|
34
|
+
__name(isTableVisualization, "isTableVisualization");
|
|
59
35
|
function isSliderVisualization(viz) {
|
|
60
|
-
|
|
36
|
+
return viz.type === "SLIDER";
|
|
61
37
|
}
|
|
38
|
+
__name(isSliderVisualization, "isSliderVisualization");
|
|
62
39
|
function isGraphVisualization(viz) {
|
|
63
|
-
|
|
40
|
+
return viz.type === "GRAPH";
|
|
64
41
|
}
|
|
42
|
+
__name(isGraphVisualization, "isGraphVisualization");
|
|
65
43
|
function isHeatMapVisualization(viz) {
|
|
66
|
-
|
|
44
|
+
return viz.type === "HEAT_MAP";
|
|
67
45
|
}
|
|
46
|
+
__name(isHeatMapVisualization, "isHeatMapVisualization");
|
|
68
47
|
function isFormVisualization(viz) {
|
|
69
|
-
|
|
48
|
+
return viz.type === "FORM";
|
|
70
49
|
}
|
|
50
|
+
__name(isFormVisualization, "isFormVisualization");
|
|
71
51
|
function isUSStateMapping(mappings) {
|
|
72
|
-
|
|
52
|
+
return mappings.state !== void 0;
|
|
73
53
|
}
|
|
54
|
+
__name(isUSStateMapping, "isUSStateMapping");
|
|
74
55
|
function isUSCountyMapping(mappings) {
|
|
75
|
-
|
|
56
|
+
return mappings.county !== void 0;
|
|
76
57
|
}
|
|
58
|
+
__name(isUSCountyMapping, "isUSCountyMapping");
|
|
77
59
|
function isGeohashMapping(mappings) {
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
60
|
+
return mappings.geohash !== void 0;
|
|
61
|
+
}
|
|
62
|
+
__name(isGeohashMapping, "isGeohashMapping");
|
|
63
|
+
const v1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
64
|
+
__proto__: null,
|
|
65
|
+
isChoroVisualization,
|
|
66
|
+
isDatabombDatasource,
|
|
67
|
+
isFormVisualization,
|
|
68
|
+
isGeohashMapping,
|
|
69
|
+
isGraphVisualization,
|
|
70
|
+
isHeatMapVisualization,
|
|
71
|
+
isHipieDatasource,
|
|
72
|
+
isLineVisualization,
|
|
73
|
+
isPieVisualization,
|
|
74
|
+
isSliderVisualization,
|
|
75
|
+
isTableVisualization,
|
|
76
|
+
isUSCountyMapping,
|
|
77
|
+
isUSStateMapping,
|
|
78
|
+
isWorkunitDatasource
|
|
79
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
96
80
|
function isDatabombRef(ref) {
|
|
97
|
-
|
|
81
|
+
return !isWUResultRef(ref) && !isRoxieServiceRef(ref);
|
|
98
82
|
}
|
|
83
|
+
__name(isDatabombRef, "isDatabombRef");
|
|
99
84
|
function isWUResultRef(ref) {
|
|
100
|
-
|
|
85
|
+
return ref.output !== void 0 && !isRoxieServiceRef(ref);
|
|
101
86
|
}
|
|
87
|
+
__name(isWUResultRef, "isWUResultRef");
|
|
102
88
|
function isRoxieServiceRef(ref) {
|
|
103
|
-
|
|
89
|
+
return ref.request !== void 0;
|
|
104
90
|
}
|
|
91
|
+
__name(isRoxieServiceRef, "isRoxieServiceRef");
|
|
105
92
|
function isIFilterCondition(fc) {
|
|
106
|
-
|
|
93
|
+
return !!fc.viewID;
|
|
107
94
|
}
|
|
95
|
+
__name(isIFilterCondition, "isIFilterCondition");
|
|
108
96
|
function isFilterActivity(activity) {
|
|
109
|
-
|
|
97
|
+
return activity.type === "filter";
|
|
110
98
|
}
|
|
99
|
+
__name(isFilterActivity, "isFilterActivity");
|
|
111
100
|
function isProjectActivity(activity) {
|
|
112
|
-
|
|
101
|
+
return activity.type === "project";
|
|
113
102
|
}
|
|
103
|
+
__name(isProjectActivity, "isProjectActivity");
|
|
114
104
|
function isMappingsActivity(activity) {
|
|
115
|
-
|
|
105
|
+
return activity.type === "mappings";
|
|
116
106
|
}
|
|
107
|
+
__name(isMappingsActivity, "isMappingsActivity");
|
|
117
108
|
function isGroupByActivity(activity) {
|
|
118
|
-
|
|
109
|
+
return activity.type === "groupby";
|
|
119
110
|
}
|
|
111
|
+
__name(isGroupByActivity, "isGroupByActivity");
|
|
120
112
|
function isSortActivity(activity) {
|
|
121
|
-
|
|
113
|
+
return activity.type === "sort";
|
|
122
114
|
}
|
|
115
|
+
__name(isSortActivity, "isSortActivity");
|
|
123
116
|
function isLimitActivity(activity) {
|
|
124
|
-
|
|
117
|
+
return activity.type === "limit";
|
|
125
118
|
}
|
|
119
|
+
__name(isLimitActivity, "isLimitActivity");
|
|
126
120
|
const VisibilitySet = ["normal", "flyout"];
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
121
|
+
const v2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
122
|
+
__proto__: null,
|
|
123
|
+
VisibilitySet,
|
|
124
|
+
isDatabombRef,
|
|
125
|
+
isFilterActivity,
|
|
126
|
+
isGroupByActivity,
|
|
127
|
+
isIFilterCondition,
|
|
128
|
+
isLimitActivity,
|
|
129
|
+
isMappingsActivity,
|
|
130
|
+
isProjectActivity,
|
|
131
|
+
isRoxieServiceRef,
|
|
132
|
+
isSortActivity,
|
|
133
|
+
isWUResultRef
|
|
134
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
135
|
+
const classMappings = {
|
|
136
|
+
c3chart_Bar: "chart_Bar",
|
|
137
|
+
c3chart_Column: "chart_Column",
|
|
138
|
+
c3chart_Pie: "chart_Pie",
|
|
139
|
+
c3chart_Area: "chart_Area",
|
|
140
|
+
c3chart_Line: "chart_Line",
|
|
141
|
+
amchart_Bar: "chart_Bar",
|
|
142
|
+
amchart_Column: "chart_Column",
|
|
143
|
+
amchart_Pie: "chart_Pie",
|
|
144
|
+
amchart_Area: "chart_Area",
|
|
145
|
+
amchart_Line: "chart_Line",
|
|
146
|
+
google_Bar: "chart_Bar",
|
|
147
|
+
google_Column: "chart_Column",
|
|
148
|
+
google_Pie: "chart_Pie",
|
|
149
|
+
google_Area: "chart_Area",
|
|
150
|
+
google_Line: "chart_Line",
|
|
151
|
+
other_Table: "dgrid_Table"
|
|
147
152
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
153
|
+
const propertyMappings = {
|
|
154
|
+
xAxisLabelRotation: [
|
|
155
|
+
{ name: "xAxisOverlapMode", transform: /* @__PURE__ */ __name((n) => "rotate", "transform") },
|
|
156
|
+
{ name: "xAxisLabelRotation", transform: /* @__PURE__ */ __name((n) => n, "transform") }
|
|
157
|
+
],
|
|
158
|
+
tooltipLabelColor: {
|
|
159
|
+
name: "tooltipLabelColor"
|
|
160
|
+
},
|
|
161
|
+
tooltipSeriesColor: {
|
|
162
|
+
name: "tooltipSeriesColor"
|
|
163
|
+
},
|
|
164
|
+
tooltipValueColor: {
|
|
165
|
+
name: "tooltipValueColor"
|
|
166
|
+
},
|
|
167
|
+
tooltipValueFormat: {
|
|
168
|
+
name: "tooltipValueFormat"
|
|
169
|
+
},
|
|
170
|
+
timePattern: {
|
|
171
|
+
name: "xAxisTypeTimePattern"
|
|
172
|
+
},
|
|
173
|
+
smoothLines: {
|
|
174
|
+
name: "interpolate",
|
|
175
|
+
transform: /* @__PURE__ */ __name((n) => {
|
|
176
|
+
if (n === false) return "linear";
|
|
177
|
+
return "catmullRom";
|
|
178
|
+
}, "transform")
|
|
179
|
+
},
|
|
180
|
+
holePercent: {
|
|
181
|
+
name: "innerRadius"
|
|
182
|
+
},
|
|
183
|
+
flip: {
|
|
184
|
+
name: "orientation",
|
|
185
|
+
transform: /* @__PURE__ */ __name((n) => n ? "vertical" : "horizontal", "transform")
|
|
186
|
+
},
|
|
187
|
+
bottomText: {
|
|
188
|
+
name: "xAxisTitle"
|
|
189
|
+
},
|
|
190
|
+
xAxisTypeTimePattern: {
|
|
191
|
+
name: "xAxisTypeTimePattern"
|
|
192
|
+
},
|
|
193
|
+
yAxisTypeTimePattern: {
|
|
194
|
+
name: "yAxisTypeTimePattern"
|
|
195
|
+
},
|
|
196
|
+
valueFormat: {
|
|
197
|
+
name: "tooltipValueFormat"
|
|
198
|
+
},
|
|
199
|
+
stacked: {
|
|
200
|
+
name: "yAxisStacked"
|
|
201
|
+
},
|
|
202
|
+
showYGrid: {
|
|
203
|
+
name: "yAxisGuideLines"
|
|
204
|
+
},
|
|
205
|
+
showXGrid: {
|
|
206
|
+
name: "xAxisGuideLines"
|
|
207
|
+
},
|
|
208
|
+
showValueLabel: {
|
|
209
|
+
name: "showValue"
|
|
210
|
+
},
|
|
211
|
+
low: {
|
|
212
|
+
name: "yAxisDomainLow"
|
|
213
|
+
},
|
|
214
|
+
high: {
|
|
215
|
+
name: "yAxisDomainHigh"
|
|
216
|
+
},
|
|
217
|
+
fillOpacity: {
|
|
218
|
+
name: "interpolateFillOpacity"
|
|
219
|
+
},
|
|
220
|
+
areaFillOpacity: {
|
|
221
|
+
name: "interpolateFillOpacity"
|
|
222
|
+
},
|
|
223
|
+
showToolbar: {
|
|
224
|
+
name: "titleVisible"
|
|
225
|
+
},
|
|
226
|
+
showCSV: {
|
|
227
|
+
name: "downloadButtonVisible"
|
|
228
|
+
}
|
|
187
229
|
};
|
|
188
230
|
function findKeyVal(object, key, val) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
231
|
+
let value;
|
|
232
|
+
for (const k in object) {
|
|
233
|
+
if (k === key && object[k] === val) {
|
|
234
|
+
value = object;
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
if (object[k] && typeof object[k] === "object") {
|
|
238
|
+
value = findKeyVal(object[k], key, val);
|
|
239
|
+
if (value !== void 0) {
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return value;
|
|
201
245
|
}
|
|
246
|
+
__name(findKeyVal, "findKeyVal");
|
|
202
247
|
function apply_to_dataviews(ddl2, dermObj) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
248
|
+
ddl2.dataviews.forEach(apply_to_dataview);
|
|
249
|
+
function apply_to_dataview(dv) {
|
|
250
|
+
const widgetId = dv.id;
|
|
251
|
+
const dermPanelObj = findKeyVal(dermObj, "__id", widgetId);
|
|
252
|
+
if (dermPanelObj) {
|
|
253
|
+
const dermPanelProps = dermPanelObj.__properties;
|
|
254
|
+
const dermWidgetObj = dermPanelObj.__properties.chart ? dermPanelObj.__properties.chart : dermPanelObj.__properties.widget;
|
|
255
|
+
const dermWidgetProps = dermWidgetObj.__properties;
|
|
256
|
+
apply_class_mapping(dermWidgetObj);
|
|
257
|
+
apply_panel_property_mapping(dermPanelProps, dermWidgetProps);
|
|
258
|
+
apply_widget_property_mapping(dermPanelProps, dermWidgetProps);
|
|
259
|
+
if (dv.visualization.properties.chartType) {
|
|
260
|
+
dv.visualization.properties.charttype = dv.visualization.properties.chartType;
|
|
261
|
+
}
|
|
262
|
+
} else {
|
|
263
|
+
console.warn(widgetId + " not found in dermObj");
|
|
264
|
+
}
|
|
265
|
+
function apply_class_mapping(dermWidgetObj) {
|
|
266
|
+
dv.visualization.__class = swap_with_supported_class(dermWidgetObj.__class);
|
|
267
|
+
dv.visualization.properties.__class = "marshaller_VizChartPanel";
|
|
268
|
+
if (!dv.visualization.properties.widget) dv.visualization.properties.widget = {};
|
|
269
|
+
dv.visualization.properties.widget.__class = dv.visualization.__class;
|
|
270
|
+
function swap_with_supported_class(_class) {
|
|
271
|
+
return classMappings[_class] ? classMappings[_class] : _class;
|
|
272
|
+
}
|
|
273
|
+
__name(swap_with_supported_class, "swap_with_supported_class");
|
|
274
|
+
}
|
|
275
|
+
__name(apply_class_mapping, "apply_class_mapping");
|
|
276
|
+
function apply_panel_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
277
|
+
dv.visualization.title = dermPanelProps.title || "";
|
|
278
|
+
dv.visualization.description = "";
|
|
279
|
+
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
280
|
+
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
281
|
+
for (const propName in dermPanelProps) {
|
|
282
|
+
if (typeof propertyMappings[propName] !== "undefined") {
|
|
283
|
+
const newPropName = propertyMappings[propName].name;
|
|
284
|
+
if (typeof propertyMappings[propName].transform === "function") {
|
|
285
|
+
dv.visualization.properties[newPropName] = propertyMappings[propName].transform(dermPanelProps[propName]);
|
|
286
|
+
} else {
|
|
287
|
+
dv.visualization.properties[newPropName] = dermPanelProps[propName];
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (dermWidgetProps && dermWidgetProps.showLegend && dv.visualization.properties) {
|
|
292
|
+
dv.visualization.properties.legendVisible = true;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
__name(apply_panel_property_mapping, "apply_panel_property_mapping");
|
|
296
|
+
function apply_widget_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
297
|
+
dv.visualization.title = dv.visualization.title || dermWidgetProps.title || "";
|
|
298
|
+
dv.visualization.description = "";
|
|
299
|
+
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
300
|
+
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
301
|
+
for (const propName in dermWidgetProps) {
|
|
302
|
+
if (typeof propertyMappings[propName] !== "undefined") {
|
|
303
|
+
if (propertyMappings[propName] instanceof Array) {
|
|
304
|
+
propertyMappings[propName].forEach((p) => {
|
|
305
|
+
const newPropName = p.name;
|
|
306
|
+
dv.visualization.properties.widget[newPropName] = p.transform(dermWidgetProps[propName]);
|
|
307
|
+
if (typeof propertyMappings[propName].transform === "function") {
|
|
308
|
+
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
309
|
+
} else {
|
|
310
|
+
dv.visualization.properties.widget[newPropName] = dermWidgetProps[propName];
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
} else {
|
|
314
|
+
const newPropName = propertyMappings[propName].name;
|
|
315
|
+
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
__name(apply_widget_property_mapping, "apply_widget_property_mapping");
|
|
321
|
+
}
|
|
322
|
+
__name(apply_to_dataview, "apply_to_dataview");
|
|
254
323
|
}
|
|
324
|
+
__name(apply_to_dataviews, "apply_to_dataviews");
|
|
255
325
|
function apply_to_properties_layout(ddl2, dermObj) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
326
|
+
const retVal = {
|
|
327
|
+
layout: []
|
|
328
|
+
};
|
|
329
|
+
if (!dermObj || !dermObj.__properties) return;
|
|
330
|
+
dermObj.__properties.content.forEach((cell) => {
|
|
331
|
+
const cellPosition = {
|
|
332
|
+
// TODO - if "id" could be avoided then layouts could apply to any dashboard with the same number of widgets
|
|
333
|
+
id: cell.__properties.widget.__id,
|
|
334
|
+
position: [
|
|
335
|
+
cell.__properties.gridCol,
|
|
336
|
+
cell.__properties.gridRow,
|
|
337
|
+
cell.__properties.gridColSpan,
|
|
338
|
+
cell.__properties.gridRowSpan
|
|
339
|
+
]
|
|
340
|
+
};
|
|
341
|
+
retVal.layout.push(cellPosition);
|
|
342
|
+
});
|
|
343
|
+
return retVal;
|
|
271
344
|
}
|
|
345
|
+
__name(apply_to_properties_layout, "apply_to_properties_layout");
|
|
272
346
|
function upgrade$1(ddl2, dermObj) {
|
|
273
|
-
|
|
274
|
-
|
|
347
|
+
apply_to_dataviews(ddl2, dermObj);
|
|
348
|
+
return apply_to_properties_layout(ddl2, dermObj);
|
|
275
349
|
}
|
|
276
|
-
|
|
277
|
-
//#endregion
|
|
278
|
-
//#region src/upgrade.ts
|
|
350
|
+
__name(upgrade$1, "upgrade$1");
|
|
279
351
|
function faCharFix(faChar) {
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
352
|
+
return faChar;
|
|
353
|
+
}
|
|
354
|
+
__name(faCharFix, "faCharFix");
|
|
355
|
+
const _DDLUpgrade = class _DDLUpgrade {
|
|
356
|
+
_ddl;
|
|
357
|
+
_baseUrl;
|
|
358
|
+
_wuid;
|
|
359
|
+
_toLowerCase;
|
|
360
|
+
_datasources = {};
|
|
361
|
+
_datasourceUpdates = {};
|
|
362
|
+
_visualizations = {};
|
|
363
|
+
_ddl2Datasources = {};
|
|
364
|
+
_ddl2DatasourceFields = {};
|
|
365
|
+
_ddl2Dataviews = {};
|
|
366
|
+
_ddl2DataviewActivities = {};
|
|
367
|
+
constructor(ddl, baseUrl = "http://localhost:8010", wuid = "WUID", toLowerCase = true) {
|
|
368
|
+
this._ddl = ddl;
|
|
369
|
+
this._baseUrl = baseUrl;
|
|
370
|
+
this._wuid = wuid;
|
|
371
|
+
this._toLowerCase = toLowerCase;
|
|
372
|
+
this.indexDDL();
|
|
373
|
+
this.readDDL();
|
|
374
|
+
}
|
|
375
|
+
toLowerCase(s) {
|
|
376
|
+
return this._toLowerCase ? s.toLowerCase() : s;
|
|
377
|
+
}
|
|
378
|
+
isVizDatasourceRoxie(viz) {
|
|
379
|
+
if (viz.source) {
|
|
380
|
+
const ds = this._datasources[viz.source.id];
|
|
381
|
+
if (isHipieDatasource(ds)) {
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
getDatasourceOutputs(dsID, vizID) {
|
|
388
|
+
const retVal = [];
|
|
389
|
+
const datasource = this._datasources[dsID];
|
|
390
|
+
for (const output of datasource.outputs) {
|
|
391
|
+
if (output.notify) {
|
|
392
|
+
for (const notify of output.notify) {
|
|
393
|
+
if (notify === vizID) {
|
|
394
|
+
retVal.push({
|
|
395
|
+
datasource,
|
|
396
|
+
output
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return retVal;
|
|
403
|
+
}
|
|
404
|
+
getDatasourceFilters(dsID, vizID) {
|
|
405
|
+
const retVal = {};
|
|
406
|
+
for (const dsOut of this.getDatasourceOutputs(dsID, vizID)) {
|
|
407
|
+
if (dsOut.output.filter) {
|
|
408
|
+
for (const filter of dsOut.output.filter) {
|
|
409
|
+
retVal[filter.fieldid] = {
|
|
410
|
+
datasource: dsOut.datasource,
|
|
411
|
+
output: dsOut.output,
|
|
412
|
+
filter
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return retVal;
|
|
418
|
+
}
|
|
419
|
+
indexDDL() {
|
|
420
|
+
for (const dash of this._ddl.dashboards) {
|
|
421
|
+
for (const viz of dash.visualizations) {
|
|
422
|
+
this._visualizations[viz.id] = viz;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
for (const ds of this._ddl.datasources) {
|
|
426
|
+
this._datasources[ds.id] = ds;
|
|
427
|
+
for (const output of ds.outputs) {
|
|
428
|
+
if (output.notify) {
|
|
429
|
+
for (const notify of output.notify) {
|
|
430
|
+
this._datasourceUpdates[notify] = {
|
|
431
|
+
id: ds.id,
|
|
432
|
+
output: output.from || output.id
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
readDDL() {
|
|
440
|
+
for (const ds of this._ddl.datasources) {
|
|
441
|
+
if (isWorkunitDatasource(ds)) {
|
|
442
|
+
const ddl2DS = {
|
|
443
|
+
type: "wuresult",
|
|
444
|
+
id: ds.id,
|
|
445
|
+
url: this._baseUrl,
|
|
446
|
+
wuid: this._wuid,
|
|
447
|
+
outputs: {}
|
|
448
|
+
};
|
|
449
|
+
for (const output of ds.outputs) {
|
|
450
|
+
this.output2output(output, ddl2DS.outputs);
|
|
451
|
+
}
|
|
452
|
+
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
453
|
+
} else if (isDatabombDatasource(ds)) ;
|
|
454
|
+
else {
|
|
455
|
+
const urlParts = ds.URL.split("/WsEcl/submit/query/");
|
|
456
|
+
const hostParts = urlParts[0];
|
|
457
|
+
const roxieParts = urlParts[1].split("/");
|
|
458
|
+
const ddl2DS = {
|
|
459
|
+
type: "hipie",
|
|
460
|
+
id: ds.id,
|
|
461
|
+
url: hostParts,
|
|
462
|
+
querySet: roxieParts[0],
|
|
463
|
+
queryID: roxieParts[1],
|
|
464
|
+
inputs: [],
|
|
465
|
+
outputs: {}
|
|
466
|
+
};
|
|
467
|
+
for (const output of ds.outputs) {
|
|
468
|
+
this.output2output(output, ddl2DS.outputs);
|
|
469
|
+
}
|
|
470
|
+
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
for (const dash of this._ddl.dashboards) {
|
|
474
|
+
for (const viz of dash.visualizations) {
|
|
475
|
+
if (viz.type === "FORM") {
|
|
476
|
+
this._ddl2Datasources[viz.id] = {
|
|
477
|
+
type: "form",
|
|
478
|
+
id: viz.id,
|
|
479
|
+
fields: this.formFields2field(viz.fields)
|
|
480
|
+
};
|
|
481
|
+
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
482
|
+
} else if (viz.type === "SLIDER") {
|
|
483
|
+
this._ddl2Datasources[viz.id] = {
|
|
484
|
+
type: "form",
|
|
485
|
+
id: viz.id,
|
|
486
|
+
fields: this.formFields2field(viz.fields, true)
|
|
487
|
+
};
|
|
488
|
+
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
489
|
+
}
|
|
490
|
+
this._ddl2Dataviews[viz.id] = this.anyViz2view(viz);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
this.readGroupBy();
|
|
494
|
+
this.readFilters();
|
|
495
|
+
this.readSort();
|
|
496
|
+
this.readMappings();
|
|
497
|
+
}
|
|
498
|
+
readGroupBy() {
|
|
499
|
+
for (const dash of this._ddl.dashboards) {
|
|
500
|
+
for (const viz of dash.visualizations) {
|
|
501
|
+
if (viz.fields) {
|
|
502
|
+
const projectTransformations = [];
|
|
503
|
+
const groupByColumns = [];
|
|
504
|
+
const aggrFields = [];
|
|
505
|
+
for (const field of viz.fields) {
|
|
506
|
+
if (field.properties && field.properties.function) {
|
|
507
|
+
switch (field.properties.function) {
|
|
508
|
+
case "SUM":
|
|
509
|
+
case "MIN":
|
|
510
|
+
case "MAX":
|
|
511
|
+
aggrFields.push({
|
|
512
|
+
type: this.func2aggr(field.properties.function),
|
|
513
|
+
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
514
|
+
fieldID: this.toLowerCase(field.id)
|
|
515
|
+
});
|
|
516
|
+
break;
|
|
517
|
+
case "AVE":
|
|
518
|
+
aggrFields.push({
|
|
519
|
+
type: this.func2aggr(field.properties.function),
|
|
520
|
+
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
521
|
+
baseCountFieldID: field.properties.params.param2 ? this.toLowerCase(field.properties.params.param2) : void 0,
|
|
522
|
+
fieldID: this.toLowerCase(field.id)
|
|
523
|
+
});
|
|
524
|
+
break;
|
|
525
|
+
case "SCALE":
|
|
526
|
+
if (typeof field.properties.params.param1 === "object") {
|
|
527
|
+
const props = field.properties.params.param1;
|
|
528
|
+
switch (props.function) {
|
|
529
|
+
case "SUM":
|
|
530
|
+
case "MIN":
|
|
531
|
+
case "MAX":
|
|
532
|
+
aggrFields.push({
|
|
533
|
+
type: this.func2aggr(props.function),
|
|
534
|
+
inFieldID: this.toLowerCase(props.params.param1),
|
|
535
|
+
fieldID: this.toLowerCase(field.id)
|
|
536
|
+
});
|
|
537
|
+
break;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
projectTransformations.push({
|
|
541
|
+
type: "scale",
|
|
542
|
+
sourceFieldID: this.toLowerCase(field.id),
|
|
543
|
+
fieldID: this.toLowerCase(field.id),
|
|
544
|
+
factor: +field.properties.params.param2
|
|
545
|
+
});
|
|
546
|
+
break;
|
|
547
|
+
default:
|
|
548
|
+
groupByColumns.push(this.toLowerCase(field.id));
|
|
549
|
+
throw new Error(`Unhandled field function: ${field.properties.function}`);
|
|
550
|
+
}
|
|
551
|
+
} else {
|
|
552
|
+
groupByColumns.push(this.toLowerCase(field.id));
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
if (projectTransformations.length) {
|
|
556
|
+
this._ddl2DataviewActivities[viz.id].project.transformations = projectTransformations;
|
|
557
|
+
}
|
|
558
|
+
if (aggrFields.length) {
|
|
559
|
+
this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = [...groupByColumns];
|
|
560
|
+
this._ddl2DataviewActivities[viz.id].groupBy.aggregates = aggrFields;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
func2aggr(func) {
|
|
567
|
+
switch (func) {
|
|
568
|
+
case "SUM":
|
|
569
|
+
return "sum";
|
|
570
|
+
case "AVE":
|
|
571
|
+
return "mean";
|
|
572
|
+
case "MIN":
|
|
573
|
+
return "min";
|
|
574
|
+
case "MAX":
|
|
575
|
+
return "max";
|
|
576
|
+
}
|
|
577
|
+
throw new Error(`Unknown DDL1 Function Type: ${func}`);
|
|
578
|
+
}
|
|
579
|
+
readMappings() {
|
|
580
|
+
for (const dash of this._ddl.dashboards) {
|
|
581
|
+
for (const viz of dash.visualizations) {
|
|
582
|
+
if (isFormVisualization(viz)) ;
|
|
583
|
+
else if (isPieVisualization(viz)) {
|
|
584
|
+
this.readPieMappings(viz);
|
|
585
|
+
} else if (isChoroVisualization(viz)) {
|
|
586
|
+
this.readChoroMappings(viz);
|
|
587
|
+
} else if (isLineVisualization(viz)) {
|
|
588
|
+
this.readLineMappings(viz);
|
|
589
|
+
} else if (isTableVisualization(viz)) {
|
|
590
|
+
this.readTableMappings(viz);
|
|
591
|
+
} else if (isGraphVisualization(viz)) {
|
|
592
|
+
this.readGraphMappings(viz);
|
|
593
|
+
} else if (isSliderVisualization(viz)) {
|
|
594
|
+
this.readSliderMappings(viz);
|
|
595
|
+
} else {
|
|
596
|
+
throw new Error(`Unkown DDL1 mapping type: ${viz.type}`);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
readPieMappings(viz) {
|
|
602
|
+
const mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
603
|
+
mappings.transformations.push({
|
|
604
|
+
fieldID: "label",
|
|
605
|
+
type: "=",
|
|
606
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
607
|
+
});
|
|
608
|
+
mappings.transformations.push({
|
|
609
|
+
fieldID: "weight",
|
|
610
|
+
type: "=",
|
|
611
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
readChoroMappings(viz) {
|
|
615
|
+
const mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
616
|
+
mappings.transformations.push({
|
|
617
|
+
fieldID: "label",
|
|
618
|
+
type: "=",
|
|
619
|
+
sourceFieldID: this.toLowerCase(this.anyChoroMapping2label(viz.source.mappings))
|
|
620
|
+
});
|
|
621
|
+
mappings.transformations.push({
|
|
622
|
+
fieldID: "weight",
|
|
623
|
+
type: "=",
|
|
624
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
anyChoroMapping2label(mapping) {
|
|
628
|
+
return mapping.state || mapping.county || mapping.geohash;
|
|
629
|
+
}
|
|
630
|
+
readLineMappings(viz) {
|
|
631
|
+
const mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
632
|
+
mappings.transformations.push({
|
|
633
|
+
fieldID: viz.source.mappings.x[0],
|
|
634
|
+
type: "=",
|
|
635
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.x[0])
|
|
636
|
+
});
|
|
637
|
+
for (let i = 0; i < viz.source.mappings.y.length; ++i) {
|
|
638
|
+
mappings.transformations.push({
|
|
639
|
+
fieldID: viz.source.mappings.y[i],
|
|
640
|
+
type: "=",
|
|
641
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.y[i])
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
readTableMappings(viz) {
|
|
646
|
+
const mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
647
|
+
for (let i = 0; i < viz.label.length; ++i) {
|
|
648
|
+
mappings.transformations.push({
|
|
649
|
+
fieldID: viz.label[i],
|
|
650
|
+
type: "=",
|
|
651
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.value[i])
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
readGraphEnums(valueMappings, annotation = false) {
|
|
656
|
+
const retVal = [];
|
|
657
|
+
if (valueMappings) {
|
|
658
|
+
for (const value in valueMappings) {
|
|
659
|
+
const newValue = {};
|
|
660
|
+
for (const key in valueMappings[value]) {
|
|
661
|
+
if (key === "faChar") {
|
|
662
|
+
newValue[key] = faCharFix(valueMappings[value][key]);
|
|
663
|
+
} else if (annotation && key.indexOf("icon_") === 0) {
|
|
664
|
+
console.warn("Deprecated flag property: " + key);
|
|
665
|
+
newValue[key.split("icon_")[1]] = valueMappings[value][key];
|
|
666
|
+
} else {
|
|
667
|
+
newValue[key] = valueMappings[value][key];
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
if (!annotation || value !== "0") {
|
|
671
|
+
retVal.push({
|
|
672
|
+
value,
|
|
673
|
+
newValue
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
return retVal;
|
|
679
|
+
}
|
|
680
|
+
readGraphMappings(viz) {
|
|
681
|
+
const mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
682
|
+
mappings.transformations.push({
|
|
683
|
+
fieldID: "uid",
|
|
684
|
+
type: "=",
|
|
685
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.uid)
|
|
686
|
+
});
|
|
687
|
+
mappings.transformations.push({
|
|
688
|
+
fieldID: "label",
|
|
689
|
+
type: "=",
|
|
690
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
691
|
+
});
|
|
692
|
+
if (viz.icon.fieldid) {
|
|
693
|
+
mappings.transformations.push({
|
|
694
|
+
fieldID: "icon",
|
|
695
|
+
type: "map",
|
|
696
|
+
sourceFieldID: this.toLowerCase(viz.icon.fieldid),
|
|
697
|
+
default: { fachar: faCharFix(viz.icon.faChar) },
|
|
698
|
+
mappings: this.readGraphEnums(viz.icon.valuemappings)
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
let idx = 0;
|
|
702
|
+
if (viz.flag) {
|
|
703
|
+
for (const flag of viz.flag) {
|
|
704
|
+
if (flag.fieldid) {
|
|
705
|
+
mappings.transformations.push({
|
|
706
|
+
fieldID: `annotation_${idx++}`,
|
|
707
|
+
type: "map",
|
|
708
|
+
sourceFieldID: this.toLowerCase(flag.fieldid),
|
|
709
|
+
default: {},
|
|
710
|
+
mappings: this.readGraphEnums(flag.valuemappings, true)
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
mappings.transformations.push({
|
|
716
|
+
fieldID: "links",
|
|
717
|
+
type: "=",
|
|
718
|
+
sourceFieldID: this.toLowerCase(viz.source.link.childfile),
|
|
719
|
+
transformations: [{
|
|
720
|
+
fieldID: "uid",
|
|
721
|
+
type: "=",
|
|
722
|
+
sourceFieldID: this.toLowerCase(viz.source.link.mappings.uid)
|
|
723
|
+
}]
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
readSliderMappings(viz) {
|
|
727
|
+
const mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
728
|
+
mappings.transformations.push({
|
|
729
|
+
fieldID: "label",
|
|
730
|
+
type: "=",
|
|
731
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
readFilters() {
|
|
735
|
+
for (const dash of this._ddl.dashboards) {
|
|
736
|
+
for (const viz of dash.visualizations) {
|
|
737
|
+
if (viz.events) {
|
|
738
|
+
for (const eventID in viz.events) {
|
|
739
|
+
const event = viz.events[eventID];
|
|
740
|
+
for (const update of event.updates) {
|
|
741
|
+
const otherViz = this._ddl2Dataviews[update.visualization];
|
|
742
|
+
const dsFilters = this.getDatasourceFilters(update.datasource, otherViz.id);
|
|
743
|
+
if (update.mappings) {
|
|
744
|
+
if (isRoxieServiceRef(otherViz.datasource)) {
|
|
745
|
+
for (const key in update.mappings) {
|
|
746
|
+
otherViz.datasource.request.push({
|
|
747
|
+
source: viz.id,
|
|
748
|
+
remoteFieldID: this.toLowerCase(key),
|
|
749
|
+
localFieldID: this.toLowerCase(update.mappings[key])
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
} else {
|
|
753
|
+
const condition = {
|
|
754
|
+
viewID: viz.id,
|
|
755
|
+
mappings: []
|
|
756
|
+
};
|
|
757
|
+
for (const key in update.mappings) {
|
|
758
|
+
const mapping = update.mappings[key];
|
|
759
|
+
const dsFilter = mapping && dsFilters[mapping] ? dsFilters[mapping].filter : void 0;
|
|
760
|
+
if (!dsFilter) {
|
|
761
|
+
console.warn(`Select Mapping "${mapping}" in viz "${viz.id}" not found in filters for "${otherViz.id}"`);
|
|
762
|
+
} else {
|
|
763
|
+
condition.mappings.push({
|
|
764
|
+
remoteFieldID: this.toLowerCase(key),
|
|
765
|
+
localFieldID: this.toLowerCase(update.mappings[key]),
|
|
766
|
+
condition: this.rule2condition(dsFilter.rule),
|
|
767
|
+
nullable: dsFilter.nullable
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
this._ddl2DataviewActivities[otherViz.id].filters.conditions.push(condition);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
rule2condition(_) {
|
|
781
|
+
switch (_) {
|
|
782
|
+
case "set":
|
|
783
|
+
return "in";
|
|
784
|
+
case "notequals":
|
|
785
|
+
return "!=";
|
|
786
|
+
}
|
|
787
|
+
return _;
|
|
788
|
+
}
|
|
789
|
+
readSort() {
|
|
790
|
+
for (const dash of this._ddl.dashboards) {
|
|
791
|
+
for (const viz of dash.visualizations) {
|
|
792
|
+
if (viz.source) {
|
|
793
|
+
if (viz.source.sort) {
|
|
794
|
+
const vizSort = this._ddl2DataviewActivities[viz.id].sort;
|
|
795
|
+
vizSort.conditions = viz.source.sort.map((s) => {
|
|
796
|
+
if (s.indexOf("-") === 0) {
|
|
797
|
+
return {
|
|
798
|
+
fieldID: this.toLowerCase(s.substr(1)),
|
|
799
|
+
descending: true
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
return {
|
|
803
|
+
fieldID: this.toLowerCase(s),
|
|
804
|
+
descending: false
|
|
805
|
+
};
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
if (viz.source.first) {
|
|
809
|
+
const vizLimit = this._ddl2DataviewActivities[viz.id].limit;
|
|
810
|
+
vizLimit.limit = +viz.source.first;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
anyViz2view(viz) {
|
|
817
|
+
const project = {
|
|
818
|
+
type: "project",
|
|
819
|
+
transformations: []
|
|
820
|
+
};
|
|
821
|
+
const filters = {
|
|
822
|
+
type: "filter",
|
|
823
|
+
conditions: []
|
|
824
|
+
};
|
|
825
|
+
const groupBy = {
|
|
826
|
+
type: "groupby",
|
|
827
|
+
groupByIDs: [],
|
|
828
|
+
aggregates: []
|
|
829
|
+
};
|
|
830
|
+
const sort = {
|
|
831
|
+
type: "sort",
|
|
832
|
+
conditions: []
|
|
833
|
+
};
|
|
834
|
+
const limit = {
|
|
835
|
+
type: "limit",
|
|
836
|
+
limit: 0
|
|
837
|
+
};
|
|
838
|
+
const mappings = {
|
|
839
|
+
type: "mappings",
|
|
840
|
+
transformations: []
|
|
841
|
+
};
|
|
842
|
+
this._ddl2DataviewActivities[viz.id] = {
|
|
843
|
+
project,
|
|
844
|
+
filters,
|
|
845
|
+
sort,
|
|
846
|
+
groupBy,
|
|
847
|
+
limit,
|
|
848
|
+
mappings
|
|
849
|
+
};
|
|
850
|
+
const datasourceRef = this.isVizDatasourceRoxie(viz) ? {
|
|
851
|
+
id: this._datasourceUpdates[viz.id].id,
|
|
852
|
+
request: [],
|
|
853
|
+
output: this._datasourceUpdates[viz.id].output
|
|
854
|
+
} : {
|
|
855
|
+
id: this._datasourceUpdates[viz.id].id,
|
|
856
|
+
output: this._datasourceUpdates[viz.id].output
|
|
857
|
+
};
|
|
858
|
+
return {
|
|
859
|
+
id: viz.id,
|
|
860
|
+
datasource: datasourceRef,
|
|
861
|
+
activities: [
|
|
862
|
+
project,
|
|
863
|
+
filters,
|
|
864
|
+
sort,
|
|
865
|
+
groupBy,
|
|
866
|
+
limit
|
|
867
|
+
],
|
|
868
|
+
visualization: {
|
|
869
|
+
id: viz.id,
|
|
870
|
+
title: viz.title || "",
|
|
871
|
+
description: "",
|
|
872
|
+
visibility: viz.properties && viz.properties.flyout === true ? "flyout" : "normal",
|
|
873
|
+
...this.type2chartType(viz.type),
|
|
874
|
+
mappings,
|
|
875
|
+
properties: viz.properties || {}
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
type2chartType(chartType) {
|
|
880
|
+
switch (chartType) {
|
|
881
|
+
case "LINE":
|
|
882
|
+
return { chartType: "Line", __class: "chart_Line" };
|
|
883
|
+
case "BUBBLE":
|
|
884
|
+
return { chartType: "Bubble", __class: "chart_Bubble" };
|
|
885
|
+
case "PIE":
|
|
886
|
+
return { chartType: "Pie", __class: "chart_Pie" };
|
|
887
|
+
case "BAR":
|
|
888
|
+
return { chartType: "Column", __class: "chart_Column" };
|
|
889
|
+
case "FORM":
|
|
890
|
+
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
891
|
+
case "WORD_CLOUD":
|
|
892
|
+
return { chartType: "WordCloud", __class: "chart_WordCloud" };
|
|
893
|
+
case "CHORO":
|
|
894
|
+
return { chartType: "ChoroplethStates", __class: "map_ChoroplethStates" };
|
|
895
|
+
case "SUMMARY":
|
|
896
|
+
return { chartType: "Summary", __class: "chart_Summary" };
|
|
897
|
+
case "SLIDER":
|
|
898
|
+
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
899
|
+
case "HEAT_MAP":
|
|
900
|
+
return { chartType: "HeatMap", __class: "other_HeatMap" };
|
|
901
|
+
case "2DCHART":
|
|
902
|
+
return { chartType: "Column", __class: "chart_Column" };
|
|
903
|
+
case "GRAPH":
|
|
904
|
+
return { chartType: "AdjacencyGraph", __class: "graph_AdjacencyGraph" };
|
|
905
|
+
case "TABLE":
|
|
906
|
+
default:
|
|
907
|
+
return { chartType: "Table", __class: "dgrid_Table" };
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
formFields2field(fields, slider = false) {
|
|
911
|
+
if (!fields) return [];
|
|
912
|
+
return fields.map((field) => {
|
|
913
|
+
switch (field.properties.type) {
|
|
914
|
+
case "range":
|
|
915
|
+
return {
|
|
916
|
+
type: "range",
|
|
917
|
+
id: field.id,
|
|
918
|
+
default: field.properties.default ? field.properties.default : void 0
|
|
919
|
+
};
|
|
920
|
+
case "dataset":
|
|
921
|
+
return {
|
|
922
|
+
type: "dataset",
|
|
923
|
+
id: field.id,
|
|
924
|
+
default: [],
|
|
925
|
+
children: []
|
|
926
|
+
};
|
|
927
|
+
default:
|
|
928
|
+
return {
|
|
929
|
+
type: this.formFieldType2fieldType(field.properties.datatype, slider),
|
|
930
|
+
id: field.id,
|
|
931
|
+
default: field.properties.default ? field.properties.default[0] : void 0
|
|
932
|
+
};
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
formFieldType2fieldType(fieldType, slider) {
|
|
937
|
+
switch (fieldType) {
|
|
938
|
+
case "bool":
|
|
939
|
+
case "boolean":
|
|
940
|
+
return "boolean";
|
|
941
|
+
case "integer":
|
|
942
|
+
case "unsigned":
|
|
943
|
+
case "float":
|
|
944
|
+
case "double":
|
|
945
|
+
case "real":
|
|
946
|
+
return "number";
|
|
947
|
+
case "string":
|
|
948
|
+
return "string";
|
|
949
|
+
default:
|
|
950
|
+
return slider ? "number" : "string";
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
output2output(output, target) {
|
|
954
|
+
target[output.from || output.id] = {
|
|
955
|
+
fields: this.filters2fields(output.filter)
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
filters2fields(filters) {
|
|
959
|
+
if (!filters) return [];
|
|
960
|
+
return filters.filter((filter) => {
|
|
961
|
+
const idParts = filter.fieldid.split("-");
|
|
962
|
+
return idParts.length === 1 || idParts[1] === "range";
|
|
963
|
+
}).map((filter) => {
|
|
964
|
+
const idParts = filter.fieldid.split("-");
|
|
965
|
+
const retVal = {
|
|
966
|
+
type: "string",
|
|
967
|
+
id: idParts[0]
|
|
968
|
+
};
|
|
969
|
+
return retVal;
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
getVizField(vizID, fieldID) {
|
|
973
|
+
return {
|
|
974
|
+
type: "string",
|
|
975
|
+
id: "",
|
|
976
|
+
default: ""
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
writeDatasources() {
|
|
980
|
+
const retVal = [];
|
|
981
|
+
for (const id in this._ddl2Datasources) {
|
|
982
|
+
retVal.push(this._ddl2Datasources[id]);
|
|
983
|
+
}
|
|
984
|
+
return retVal;
|
|
985
|
+
}
|
|
986
|
+
writeDataviews() {
|
|
987
|
+
const retVal = [];
|
|
988
|
+
for (const id in this._ddl2Dataviews) {
|
|
989
|
+
retVal.push(this._ddl2Dataviews[id]);
|
|
990
|
+
}
|
|
991
|
+
return retVal;
|
|
992
|
+
}
|
|
993
|
+
writeProperties() {
|
|
994
|
+
return {
|
|
995
|
+
// TODO
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
write() {
|
|
999
|
+
return {
|
|
1000
|
+
version: "2.2.1",
|
|
1001
|
+
createdBy: {
|
|
1002
|
+
name: PKG_NAME,
|
|
1003
|
+
version: PKG_VERSION
|
|
1004
|
+
},
|
|
1005
|
+
datasources: this.writeDatasources(),
|
|
1006
|
+
dataviews: this.writeDataviews(),
|
|
1007
|
+
properties: this.writeProperties()
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
843
1010
|
};
|
|
1011
|
+
__name(_DDLUpgrade, "DDLUpgrade");
|
|
1012
|
+
let DDLUpgrade = _DDLUpgrade;
|
|
844
1013
|
function upgrade(ddl, baseUrl, wuid, toLowerCase = true, dermatologyJson = {}) {
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
1014
|
+
const ddlUp = new DDLUpgrade(ddl, baseUrl, wuid, toLowerCase);
|
|
1015
|
+
const retVal = ddlUp.write();
|
|
1016
|
+
retVal.properties = upgrade$1(retVal, dermatologyJson);
|
|
1017
|
+
return retVal;
|
|
848
1018
|
}
|
|
849
|
-
|
|
850
|
-
//#endregion
|
|
851
|
-
//#region schema/v2.json
|
|
1019
|
+
__name(upgrade, "upgrade");
|
|
852
1020
|
const $ref = "#/definitions/Schema";
|
|
853
1021
|
const $schema = "http://json-schema.org/draft-07/schema#";
|
|
854
|
-
const definitions = /* @__PURE__ */ JSON.parse("{\"ActivityType\":{\"anyOf\":[{\"$ref\":\"#/definitions/IFilter\"},{\"$ref\":\"#/definitions/IProject\"},{\"$ref\":\"#/definitions/IGroupBy\"},{\"$ref\":\"#/definitions/ISort\"},{\"$ref\":\"#/definitions/ILimit\"},{\"$ref\":\"#/definitions/IMappings\"}]},\"AggregateType\":{\"anyOf\":[{\"$ref\":\"#/definitions/IAggregate\"},{\"$ref\":\"#/definitions/ICount\"}]},\"Dataset\":{\"items\":{},\"type\":\"array\"},\"DatasourceType\":{\"anyOf\":[{\"$ref\":\"#/definitions/IWUResult\"},{\"$ref\":\"#/definitions/ILogicalFile\"},{\"$ref\":\"#/definitions/IRoxieService\"},{\"$ref\":\"#/definitions/IHipieService\"},{\"$ref\":\"#/definitions/IRestService\"},{\"$ref\":\"#/definitions/IForm\"},{\"$ref\":\"#/definitions/IDatabomb\"}]},\"FilterCondition\":{\"anyOf\":[{\"$ref\":\"#/definitions/IFilterCondition\"},{\"$ref\":\"#/definitions/IFilterStaticCondition\"}]},\"IAggregate\":{\"additionalProperties\":false,\"properties\":{\"baseCountFieldID\":{\"type\":\"string\"},\"fieldID\":{\"type\":\"string\"},\"inFieldID\":{\"type\":\"string\"},\"type\":{\"$ref\":\"#/definitions/IAggregateType\"}},\"required\":[\"fieldID\",\"type\",\"inFieldID\"],\"type\":\"object\"},\"IAggregateType\":{\"enum\":[\"min\",\"max\",\"sum\",\"mean\",\"variance\",\"deviation\"],\"type\":\"string\"},\"ICalculated\":{\"additionalProperties\":false,\"properties\":{\"fieldID\":{\"type\":\"string\"},\"sourceFieldID1\":{\"type\":\"string\"},\"sourceFieldID2\":{\"type\":\"string\"},\"type\":{\"$ref\":\"#/definitions/ICalculatedType\"}},\"required\":[\"fieldID\",\"type\",\"sourceFieldID1\",\"sourceFieldID2\"],\"type\":\"object\"},\"ICalculatedType\":{\"enum\":[\"+\",\"-\",\"*\",\"/\"],\"type\":\"string\"},\"ICount\":{\"additionalProperties\":false,\"properties\":{\"fieldID\":{\"type\":\"string\"},\"type\":{\"const\":\"count\",\"type\":\"string\"}},\"required\":[\"fieldID\",\"type\"],\"type\":\"object\"},\"IDatabomb\":{\"additionalProperties\":false,\"properties\":{\"fields\":{\"items\":{\"$ref\":\"#/definitions/IField\"},\"type\":\"array\"},\"format\":{\"$ref\":\"#/definitions/IDatabombFormat\"},\"id\":{\"type\":\"string\"},\"payload\":{\"type\":\"string\"},\"type\":{\"const\":\"databomb\",\"type\":\"string\"}},\"required\":[\"fields\",\"format\",\"id\",\"type\"],\"type\":\"object\"},\"IDatabombFormat\":{\"enum\":[\"csv\",\"tsv\",\"json\"],\"type\":\"string\"},\"IDatabombRef\":{\"additionalProperties\":false,\"properties\":{\"id\":{\"type\":\"string\"}},\"required\":[\"id\"],\"type\":\"object\"},\"IDatasource\":{\"additionalProperties\":false,\"properties\":{\"id\":{\"type\":\"string\"},\"type\":{\"$ref\":\"#/definitions/IDatasourceType\"}},\"required\":[\"type\",\"id\"],\"type\":\"object\"},\"IDatasourceRef\":{\"anyOf\":[{\"$ref\":\"#/definitions/IDatabombRef\"},{\"$ref\":\"#/definitions/IWUResultRef\"},{\"$ref\":\"#/definitions/IRoxieServiceRef\"},{\"$ref\":\"#/definitions/IHipieSqlRef\"}]},\"IDatasourceType\":{\"enum\":[\"wuresult\",\"logicalfile\",\"roxie\",\"hipie\",\"rest\",\"form\",\"databomb\"],\"type\":\"string\"},\"IEquals\":{\"additionalProperties\":false,\"properties\":{\"fieldID\":{\"type\":\"string\"},\"sourceFieldID\":{\"type\":\"string\"},\"transformations\":{\"items\":{\"$ref\":\"#/definitions/MultiTransformationType\"},\"type\":\"array\"},\"type\":{\"const\":\"=\",\"type\":\"string\"}},\"required\":[\"fieldID\",\"type\",\"sourceFieldID\"],\"type\":\"object\"},\"IField\":{\"anyOf\":[{\"$ref\":\"#/definitions/IFieldBoolean\"},{\"$ref\":\"#/definitions/IFieldNumber\"},{\"$ref\":\"#/definitions/IFieldNumber64\"},{\"$ref\":\"#/definitions/IFieldString\"},{\"$ref\":\"#/definitions/IFieldRange\"},{\"$ref\":\"#/definitions/IFieldDataset\"},{\"$ref\":\"#/definitions/IFieldSet\"},{\"$ref\":\"#/definitions/IFieldObject\"}]},\"IFieldBoolean\":{\"additionalProperties\":false,\"properties\":{\"default\":{\"type\":\"boolean\"},\"id\":{\"type\":\"string\"},\"type\":{\"const\":\"boolean\",\"type\":\"string\"}},\"required\":[\"type\",\"id\"],\"type\":\"object\"},\"IFieldDataset\":{\"additionalProperties\":false,\"properties\":{\"children\":{\"items\":{\"$ref\":\"#/definitions/IField\"},\"type\":\"array\"},\"default\":{\"$ref\":\"#/definitions/Dataset\"},\"id\":{\"type\":\"string\"},\"type\":{\"const\":\"dataset\",\"type\":\"string\"}},\"required\":[\"type\",\"id\",\"children\"],\"type\":\"object\"},\"IFieldNumber\":{\"additionalProperties\":false,\"properties\":{\"default\":{\"type\":\"number\"},\"id\":{\"type\":\"string\"},\"type\":{\"const\":\"number\",\"type\":\"string\"}},\"required\":[\"type\",\"id\"],\"type\":\"object\"},\"IFieldNumber64\":{\"additionalProperties\":false,\"properties\":{\"default\":{\"$ref\":\"#/definitions/Number64\"},\"id\":{\"type\":\"string\"},\"type\":{\"const\":\"number64\",\"type\":\"string\"}},\"required\":[\"type\",\"id\"],\"type\":\"object\"},\"IFieldObject\":{\"additionalProperties\":false,\"properties\":{\"default\":{\"type\":\"object\"},\"fields\":{\"additionalProperties\":{\"$ref\":\"#/definitions/IField\"},\"type\":\"object\"},\"id\":{\"type\":\"string\"},\"type\":{\"const\":\"object\",\"type\":\"string\"}},\"required\":[\"type\",\"id\",\"fields\"],\"type\":\"object\"},\"IFieldRange\":{\"additionalProperties\":false,\"properties\":{\"default\":{\"$ref\":\"#/definitions/Range\"},\"id\":{\"type\":\"string\"},\"type\":{\"const\":\"range\",\"type\":\"string\"}},\"required\":[\"type\",\"id\"],\"type\":\"object\"},\"IFieldSet\":{\"additionalProperties\":false,\"properties\":{\"default\":{\"items\":{\"type\":[\"string\",\"number\"]},\"type\":\"array\"},\"fieldType\":{\"enum\":[\"string\",\"number\"],\"type\":\"string\"},\"id\":{\"type\":\"string\"},\"type\":{\"const\":\"set\",\"type\":\"string\"}},\"required\":[\"type\",\"id\",\"fieldType\"],\"type\":\"object\"},\"IFieldString\":{\"additionalProperties\":false,\"properties\":{\"default\":{\"type\":\"string\"},\"id\":{\"type\":\"string\"},\"type\":{\"const\":\"string\",\"type\":\"string\"}},\"required\":[\"type\",\"id\"],\"type\":\"object\"},\"IFieldType\":{\"enum\":[\"boolean\",\"number\",\"number64\",\"string\",\"range\",\"dataset\",\"set\",\"object\"],\"type\":\"string\"},\"IFilter\":{\"additionalProperties\":false,\"properties\":{\"conditions\":{\"items\":{\"$ref\":\"#/definitions/FilterCondition\"},\"type\":\"array\"},\"type\":{\"const\":\"filter\",\"type\":\"string\"}},\"required\":[\"conditions\",\"type\"],\"type\":\"object\"},\"IFilterCondition\":{\"additionalProperties\":false,\"properties\":{\"mappings\":{\"items\":{\"$ref\":\"#/definitions/IMapping\"},\"type\":\"array\"},\"viewID\":{\"type\":\"string\"}},\"required\":[\"viewID\",\"mappings\"],\"type\":\"object\"},\"IFilterStaticCondition\":{\"additionalProperties\":false,\"properties\":{\"condition\":{\"$ref\":\"#/definitions/IMappingConditionType\"},\"localFieldID\":{\"type\":\"string\"},\"value\":{\"type\":[\"string\",\"number\"]}},\"required\":[\"localFieldID\",\"condition\",\"value\"],\"type\":\"object\"},\"IForm\":{\"additionalProperties\":false,\"properties\":{\"fields\":{\"items\":{\"$ref\":\"#/definitions/IField\"},\"type\":\"array\"},\"id\":{\"type\":\"string\"},\"type\":{\"const\":\"form\",\"type\":\"string\"}},\"required\":[\"fields\",\"id\",\"type\"],\"type\":\"object\"},\"IGroupBy\":{\"additionalProperties\":false,\"properties\":{\"aggregates\":{\"items\":{\"$ref\":\"#/definitions/AggregateType\"},\"type\":\"array\"},\"groupByIDs\":{\"items\":{\"type\":\"string\"},\"type\":\"array\"},\"type\":{\"const\":\"groupby\",\"type\":\"string\"}},\"required\":[\"aggregates\",\"groupByIDs\",\"type\"],\"type\":\"object\"},\"IHipieService\":{\"additionalProperties\":false,\"properties\":{\"id\":{\"type\":\"string\"},\"inputs\":{\"items\":{\"$ref\":\"#/definitions/IField\"},\"type\":\"array\"},\"outputs\":{\"$ref\":\"#/definitions/OutputDict\"},\"queryID\":{\"type\":\"string\"},\"querySet\":{\"type\":\"string\"},\"type\":{\"const\":\"hipie\",\"type\":\"string\"},\"url\":{\"type\":\"string\"}},\"required\":[\"id\",\"inputs\",\"outputs\",\"queryID\",\"querySet\",\"type\",\"url\"],\"type\":\"object\"},\"IHipieSqlRef\":{\"additionalProperties\":false,\"properties\":{\"id\":{\"type\":\"string\"}},\"required\":[\"id\"],\"type\":\"object\"},\"ILimit\":{\"additionalProperties\":false,\"properties\":{\"limit\":{\"type\":\"number\"},\"type\":{\"const\":\"limit\",\"type\":\"string\"}},\"required\":[\"limit\",\"type\"],\"type\":\"object\"},\"ILogicalFile\":{\"additionalProperties\":false,\"properties\":{\"fields\":{\"items\":{\"$ref\":\"#/definitions/IField\"},\"type\":\"array\"},\"id\":{\"type\":\"string\"},\"logicalFile\":{\"type\":\"string\"},\"type\":{\"const\":\"logicalfile\",\"type\":\"string\"},\"url\":{\"type\":\"string\"}},\"required\":[\"fields\",\"id\",\"logicalFile\",\"type\",\"url\"],\"type\":\"object\"},\"IMap\":{\"additionalProperties\":false,\"properties\":{\"default\":{},\"fieldID\":{\"type\":\"string\"},\"mappings\":{\"items\":{\"$ref\":\"#/definitions/IMapMapping\"},\"type\":\"array\"},\"sourceFieldID\":{\"type\":\"string\"},\"type\":{\"const\":\"map\",\"type\":\"string\"}},\"required\":[\"fieldID\",\"type\",\"sourceFieldID\",\"default\",\"mappings\"],\"type\":\"object\"},\"IMapMapping\":{\"additionalProperties\":false,\"properties\":{\"newValue\":{},\"value\":{}},\"required\":[\"value\",\"newValue\"],\"type\":\"object\"},\"IMapping\":{\"additionalProperties\":false,\"properties\":{\"condition\":{\"$ref\":\"#/definitions/IMappingConditionType\"},\"localFieldID\":{\"type\":\"string\"},\"nullable\":{\"type\":\"boolean\"},\"remoteFieldID\":{\"type\":\"string\"}},\"required\":[\"remoteFieldID\",\"localFieldID\",\"condition\",\"nullable\"],\"type\":\"object\"},\"IMappingConditionType\":{\"enum\":[\"==\",\"!=\",\">\",\">=\",\"<\",\"<=\",\"range\",\"in\"],\"type\":\"string\"},\"IMappings\":{\"additionalProperties\":false,\"properties\":{\"transformations\":{\"items\":{\"$ref\":\"#/definitions/ProjectTransformationType\"},\"type\":\"array\"},\"type\":{\"const\":\"mappings\",\"type\":\"string\"}},\"required\":[\"transformations\",\"type\"],\"type\":\"object\"},\"IMulti\":{\"additionalProperties\":false,\"properties\":{\"fieldID\":{\"type\":\"string\"},\"transformations\":{\"items\":{\"$ref\":\"#/definitions/MultiTransformationType\"},\"type\":\"array\"},\"type\":{\"const\":\"multi\",\"type\":\"string\"}},\"required\":[\"fieldID\",\"type\",\"transformations\"],\"type\":\"object\"},\"IOutput\":{\"additionalProperties\":false,\"properties\":{\"fields\":{\"items\":{\"$ref\":\"#/definitions/IField\"},\"type\":\"array\"}},\"required\":[\"fields\"],\"type\":\"object\"},\"IProject\":{\"additionalProperties\":false,\"properties\":{\"transformations\":{\"items\":{\"$ref\":\"#/definitions/ProjectTransformationType\"},\"type\":\"array\"},\"type\":{\"const\":\"project\",\"type\":\"string\"}},\"required\":[\"transformations\",\"type\"],\"type\":\"object\"},\"IProperties\":{\"type\":\"object\"},\"IRequestField\":{\"additionalProperties\":false,\"properties\":{\"localFieldID\":{\"type\":\"string\"},\"remoteFieldID\":{\"type\":\"string\"},\"source\":{\"type\":\"string\"},\"value\":{\"type\":\"string\"}},\"required\":[\"localFieldID\",\"source\",\"remoteFieldID\",\"value\"],\"type\":\"object\"},\"IRestService\":{\"additionalProperties\":false,\"properties\":{\"action\":{\"type\":\"string\"},\"id\":{\"type\":\"string\"},\"inputs\":{\"items\":{\"$ref\":\"#/definitions/IField\"},\"type\":\"array\"},\"mode\":{\"enum\":[\"get\",\"post\"],\"type\":\"string\"},\"outputs\":{\"$ref\":\"#/definitions/OutputDict\"},\"type\":{\"const\":\"rest\",\"type\":\"string\"},\"url\":{\"type\":\"string\"}},\"required\":[\"action\",\"id\",\"inputs\",\"outputs\",\"type\",\"url\"],\"type\":\"object\"},\"IRoxieService\":{\"additionalProperties\":false,\"properties\":{\"id\":{\"type\":\"string\"},\"inputs\":{\"items\":{\"$ref\":\"#/definitions/IField\"},\"type\":\"array\"},\"outputs\":{\"$ref\":\"#/definitions/OutputDict\"},\"queryID\":{\"type\":\"string\"},\"querySet\":{\"type\":\"string\"},\"type\":{\"const\":\"roxie\",\"type\":\"string\"},\"url\":{\"type\":\"string\"}},\"required\":[\"id\",\"inputs\",\"outputs\",\"queryID\",\"querySet\",\"type\",\"url\"],\"type\":\"object\"},\"IRoxieServiceRef\":{\"additionalProperties\":false,\"properties\":{\"id\":{\"type\":\"string\"},\"output\":{\"type\":\"string\"},\"request\":{\"items\":{\"$ref\":\"#/definitions/IRequestField\"},\"type\":\"array\"}},\"required\":[\"id\",\"output\",\"request\"],\"type\":\"object\"},\"IScale\":{\"additionalProperties\":false,\"properties\":{\"factor\":{\"type\":\"number\"},\"fieldID\":{\"type\":\"string\"},\"sourceFieldID\":{\"type\":\"string\"},\"type\":{\"const\":\"scale\",\"type\":\"string\"}},\"required\":[\"fieldID\",\"type\",\"sourceFieldID\",\"factor\"],\"type\":\"object\"},\"ISort\":{\"additionalProperties\":false,\"properties\":{\"conditions\":{\"items\":{\"$ref\":\"#/definitions/ISortCondition\"},\"type\":\"array\"},\"type\":{\"const\":\"sort\",\"type\":\"string\"}},\"required\":[\"conditions\",\"type\"],\"type\":\"object\"},\"ISortCondition\":{\"additionalProperties\":false,\"properties\":{\"descending\":{\"type\":\"boolean\"},\"fieldID\":{\"type\":\"string\"}},\"required\":[\"fieldID\",\"descending\"],\"type\":\"object\"},\"ITemplate\":{\"additionalProperties\":false,\"properties\":{\"fieldID\":{\"type\":\"string\"},\"template\":{\"type\":\"string\"},\"type\":{\"const\":\"template\",\"type\":\"string\"}},\"required\":[\"fieldID\",\"type\",\"template\"],\"type\":\"object\"},\"IView\":{\"additionalProperties\":false,\"properties\":{\"activities\":{\"items\":{\"$ref\":\"#/definitions/ActivityType\"},\"type\":\"array\"},\"datasource\":{\"$ref\":\"#/definitions/IDatasourceRef\"},\"id\":{\"type\":\"string\"},\"visualization\":{\"$ref\":\"#/definitions/IVisualization\"}},\"required\":[\"id\",\"datasource\",\"activities\",\"visualization\"],\"type\":\"object\"},\"IVisualization\":{\"additionalProperties\":false,\"properties\":{\"__class\":{\"type\":\"string\"},\"chartType\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"id\":{\"type\":\"string\"},\"mappings\":{\"$ref\":\"#/definitions/IMappings\"},\"properties\":{\"$ref\":\"#/definitions/IWidgetProperties\"},\"secondaryDataviewID\":{\"type\":\"string\"},\"title\":{\"type\":\"string\"},\"visibility\":{\"$ref\":\"#/definitions/VisibilityType\"}},\"required\":[\"__class\",\"chartType\",\"id\",\"mappings\",\"properties\",\"title\",\"visibility\"],\"type\":\"object\"},\"IWUResult\":{\"additionalProperties\":false,\"properties\":{\"id\":{\"type\":\"string\"},\"outputs\":{\"$ref\":\"#/definitions/OutputDict\"},\"type\":{\"const\":\"wuresult\",\"type\":\"string\"},\"url\":{\"type\":\"string\"},\"wuid\":{\"type\":\"string\"}},\"required\":[\"id\",\"outputs\",\"type\",\"url\",\"wuid\"],\"type\":\"object\"},\"IWUResultRef\":{\"additionalProperties\":false,\"properties\":{\"id\":{\"type\":\"string\"},\"output\":{\"type\":\"string\"}},\"required\":[\"id\",\"output\"],\"type\":\"object\"},\"IWidgetProperties\":{\"additionalProperties\":{\"anyOf\":[{\"type\":\"string\"},{\"items\":{\"type\":\"string\"},\"type\":\"array\"},{\"type\":\"number\"},{\"type\":\"boolean\"},{\"not\":{}},{\"$ref\":\"#/definitions/IWidgetProperties\"},{\"items\":{\"$ref\":\"#/definitions/IWidgetProperties\"},\"type\":\"array\"}]},\"properties\":{\"__class\":{\"type\":\"string\"}},\"required\":[\"__class\"],\"type\":\"object\"},\"MultiTransformationType\":{\"anyOf\":[{\"$ref\":\"#/definitions/IEquals\"},{\"$ref\":\"#/definitions/ICalculated\"},{\"$ref\":\"#/definitions/IScale\"},{\"$ref\":\"#/definitions/ITemplate\"},{\"$ref\":\"#/definitions/IMap\"}]},\"Number64\":{\"type\":\"string\"},\"OutputDict\":{\"additionalProperties\":{\"$ref\":\"#/definitions/IOutput\"},\"type\":\"object\"},\"ProjectTransformationType\":{\"anyOf\":[{\"$ref\":\"#/definitions/MultiTransformationType\"},{\"$ref\":\"#/definitions/IMulti\"}]},\"Range\":{\"items\":{\"type\":[\"number\",\"string\"]},\"maxItems\":2,\"minItems\":2,\"type\":\"array\"},\"Schema\":{\"additionalProperties\":false,\"properties\":{\"createdBy\":{\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\"},\"version\":{\"type\":\"string\"}},\"required\":[\"name\",\"version\"],\"type\":\"object\"},\"datasources\":{\"items\":{\"$ref\":\"#/definitions/DatasourceType\"},\"type\":\"array\"},\"dataviews\":{\"items\":{\"$ref\":\"#/definitions/IView\"},\"type\":\"array\"},\"defs\":{\"additionalProperties\":false,\"properties\":{\"activityTypes\":{\"additionalProperties\":false,\"properties\":{\"filter\":{\"$ref\":\"#/definitions/IFilter\"},\"groupby\":{\"$ref\":\"#/definitions/IGroupBy\"},\"limit\":{\"$ref\":\"#/definitions/ILimit\"},\"mappings\":{\"$ref\":\"#/definitions/IMappings\"},\"project\":{\"$ref\":\"#/definitions/IProject\"},\"sort\":{\"$ref\":\"#/definitions/ISort\"}},\"required\":[\"filter\",\"project\",\"groupby\",\"sort\",\"limit\",\"mappings\"],\"type\":\"object\"},\"aggregateTypes\":{\"additionalProperties\":false,\"properties\":{\"aggregate\":{\"$ref\":\"#/definitions/IAggregate\"},\"count\":{\"$ref\":\"#/definitions/ICount\"}},\"required\":[\"aggregate\",\"count\"],\"type\":\"object\"},\"datasourceRefTypes\":{\"additionalProperties\":false,\"properties\":{\"roxieServiceRef\":{\"$ref\":\"#/definitions/IRoxieServiceRef\"},\"wuResultRef\":{\"$ref\":\"#/definitions/IWUResultRef\"}},\"required\":[\"wuResultRef\",\"roxieServiceRef\"],\"type\":\"object\"},\"datasourceTypes\":{\"additionalProperties\":false,\"properties\":{\"databomb\":{\"$ref\":\"#/definitions/IDatabomb\"},\"datasource\":{\"$ref\":\"#/definitions/IDatasource\"},\"form\":{\"$ref\":\"#/definitions/IForm\"},\"hipieService\":{\"$ref\":\"#/definitions/IHipieService\"},\"logicalFile\":{\"$ref\":\"#/definitions/ILogicalFile\"},\"roxieService\":{\"$ref\":\"#/definitions/IRoxieService\"},\"wuresult\":{\"$ref\":\"#/definitions/IWUResult\"}},\"required\":[\"datasource\",\"logicalFile\",\"form\",\"databomb\",\"wuresult\",\"hipieService\",\"roxieService\"],\"type\":\"object\"},\"fieldTypes\":{\"additionalProperties\":false,\"properties\":{\"dataset\":{\"$ref\":\"#/definitions/Dataset\"},\"field\":{\"$ref\":\"#/definitions/IField\"},\"fieldBoolean\":{\"$ref\":\"#/definitions/IFieldBoolean\"},\"fieldDataset\":{\"$ref\":\"#/definitions/IFieldDataset\"},\"fieldNumber\":{\"$ref\":\"#/definitions/IFieldNumber\"},\"fieldNumber64\":{\"$ref\":\"#/definitions/IFieldNumber64\"},\"fieldObject\":{\"$ref\":\"#/definitions/IFieldObject\"},\"fieldRange\":{\"$ref\":\"#/definitions/IFieldRange\"},\"fieldSet\":{\"$ref\":\"#/definitions/IFieldSet\"},\"fieldString\":{\"$ref\":\"#/definitions/IFieldString\"},\"fieldType\":{\"$ref\":\"#/definitions/IFieldType\"},\"number64\":{\"$ref\":\"#/definitions/Number64\"},\"range\":{\"$ref\":\"#/definitions/Range\"}},\"required\":[\"number64\",\"range\",\"dataset\",\"fieldType\",\"fieldBoolean\",\"fieldNumber\",\"fieldNumber64\",\"fieldString\",\"fieldRange\",\"fieldDataset\",\"fieldSet\",\"fieldObject\",\"field\"],\"type\":\"object\"},\"transformationTypes\":{\"additionalProperties\":false,\"properties\":{\"calculated\":{\"$ref\":\"#/definitions/ICalculated\"},\"equals\":{\"$ref\":\"#/definitions/IEquals\"},\"map\":{\"$ref\":\"#/definitions/IMap\"},\"multi\":{\"$ref\":\"#/definitions/IMulti\"},\"scale\":{\"$ref\":\"#/definitions/IScale\"},\"template\":{\"$ref\":\"#/definitions/ITemplate\"}},\"required\":[\"equals\",\"calculated\",\"scale\",\"template\",\"map\",\"multi\"],\"type\":\"object\"}},\"required\":[\"fieldTypes\",\"datasourceTypes\",\"datasourceRefTypes\",\"activityTypes\",\"aggregateTypes\",\"transformationTypes\"],\"type\":\"object\"},\"hipieProperties\":{\"$ref\":\"#/definitions/IProperties\"},\"properties\":{\"$ref\":\"#/definitions/IProperties\"},\"version\":{\"const\":\"2.2.1\",\"type\":\"string\"}},\"required\":[\"version\",\"createdBy\",\"datasources\",\"dataviews\"],\"type\":\"object\"},\"VisibilityType\":{\"enum\":[\"normal\",\"flyout\"],\"type\":\"string\"}}");
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
1022
|
+
const definitions = /* @__PURE__ */ JSON.parse('{"ActivityType":{"anyOf":[{"$ref":"#/definitions/IFilter"},{"$ref":"#/definitions/IProject"},{"$ref":"#/definitions/IGroupBy"},{"$ref":"#/definitions/ISort"},{"$ref":"#/definitions/ILimit"},{"$ref":"#/definitions/IMappings"}]},"AggregateType":{"anyOf":[{"$ref":"#/definitions/IAggregate"},{"$ref":"#/definitions/ICount"}]},"Dataset":{"items":{},"type":"array"},"DatasourceType":{"anyOf":[{"$ref":"#/definitions/IWUResult"},{"$ref":"#/definitions/ILogicalFile"},{"$ref":"#/definitions/IRoxieService"},{"$ref":"#/definitions/IHipieService"},{"$ref":"#/definitions/IRestService"},{"$ref":"#/definitions/IForm"},{"$ref":"#/definitions/IDatabomb"}]},"FilterCondition":{"anyOf":[{"$ref":"#/definitions/IFilterCondition"},{"$ref":"#/definitions/IFilterStaticCondition"}]},"IAggregate":{"additionalProperties":false,"properties":{"baseCountFieldID":{"type":"string"},"fieldID":{"type":"string"},"inFieldID":{"type":"string"},"type":{"$ref":"#/definitions/IAggregateType"}},"required":["fieldID","type","inFieldID"],"type":"object"},"IAggregateType":{"enum":["min","max","sum","mean","variance","deviation"],"type":"string"},"ICalculated":{"additionalProperties":false,"properties":{"fieldID":{"type":"string"},"sourceFieldID1":{"type":"string"},"sourceFieldID2":{"type":"string"},"type":{"$ref":"#/definitions/ICalculatedType"}},"required":["fieldID","type","sourceFieldID1","sourceFieldID2"],"type":"object"},"ICalculatedType":{"enum":["+","-","*","/"],"type":"string"},"ICount":{"additionalProperties":false,"properties":{"fieldID":{"type":"string"},"type":{"const":"count","type":"string"}},"required":["fieldID","type"],"type":"object"},"IDatabomb":{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/definitions/IField"},"type":"array"},"format":{"$ref":"#/definitions/IDatabombFormat"},"id":{"type":"string"},"payload":{"type":"string"},"type":{"const":"databomb","type":"string"}},"required":["fields","format","id","type"],"type":"object"},"IDatabombFormat":{"enum":["csv","tsv","json"],"type":"string"},"IDatabombRef":{"additionalProperties":false,"properties":{"id":{"type":"string"}},"required":["id"],"type":"object"},"IDatasource":{"additionalProperties":false,"properties":{"id":{"type":"string"},"type":{"$ref":"#/definitions/IDatasourceType"}},"required":["type","id"],"type":"object"},"IDatasourceRef":{"anyOf":[{"$ref":"#/definitions/IDatabombRef"},{"$ref":"#/definitions/IWUResultRef"},{"$ref":"#/definitions/IRoxieServiceRef"},{"$ref":"#/definitions/IHipieSqlRef"}]},"IDatasourceType":{"enum":["wuresult","logicalfile","roxie","hipie","rest","form","databomb"],"type":"string"},"IEquals":{"additionalProperties":false,"properties":{"fieldID":{"type":"string"},"sourceFieldID":{"type":"string"},"transformations":{"items":{"$ref":"#/definitions/MultiTransformationType"},"type":"array"},"type":{"const":"=","type":"string"}},"required":["fieldID","type","sourceFieldID"],"type":"object"},"IField":{"anyOf":[{"$ref":"#/definitions/IFieldBoolean"},{"$ref":"#/definitions/IFieldNumber"},{"$ref":"#/definitions/IFieldNumber64"},{"$ref":"#/definitions/IFieldString"},{"$ref":"#/definitions/IFieldRange"},{"$ref":"#/definitions/IFieldDataset"},{"$ref":"#/definitions/IFieldSet"},{"$ref":"#/definitions/IFieldObject"}]},"IFieldBoolean":{"additionalProperties":false,"properties":{"default":{"type":"boolean"},"id":{"type":"string"},"type":{"const":"boolean","type":"string"}},"required":["type","id"],"type":"object"},"IFieldDataset":{"additionalProperties":false,"properties":{"children":{"items":{"$ref":"#/definitions/IField"},"type":"array"},"default":{"$ref":"#/definitions/Dataset"},"id":{"type":"string"},"type":{"const":"dataset","type":"string"}},"required":["type","id","children"],"type":"object"},"IFieldNumber":{"additionalProperties":false,"properties":{"default":{"type":"number"},"id":{"type":"string"},"type":{"const":"number","type":"string"}},"required":["type","id"],"type":"object"},"IFieldNumber64":{"additionalProperties":false,"properties":{"default":{"$ref":"#/definitions/Number64"},"id":{"type":"string"},"type":{"const":"number64","type":"string"}},"required":["type","id"],"type":"object"},"IFieldObject":{"additionalProperties":false,"properties":{"default":{"type":"object"},"fields":{"additionalProperties":{"$ref":"#/definitions/IField"},"type":"object"},"id":{"type":"string"},"type":{"const":"object","type":"string"}},"required":["type","id","fields"],"type":"object"},"IFieldRange":{"additionalProperties":false,"properties":{"default":{"$ref":"#/definitions/Range"},"id":{"type":"string"},"type":{"const":"range","type":"string"}},"required":["type","id"],"type":"object"},"IFieldSet":{"additionalProperties":false,"properties":{"default":{"items":{"type":["string","number"]},"type":"array"},"fieldType":{"enum":["string","number"],"type":"string"},"id":{"type":"string"},"type":{"const":"set","type":"string"}},"required":["type","id","fieldType"],"type":"object"},"IFieldString":{"additionalProperties":false,"properties":{"default":{"type":"string"},"id":{"type":"string"},"type":{"const":"string","type":"string"}},"required":["type","id"],"type":"object"},"IFieldType":{"enum":["boolean","number","number64","string","range","dataset","set","object"],"type":"string"},"IFilter":{"additionalProperties":false,"properties":{"conditions":{"items":{"$ref":"#/definitions/FilterCondition"},"type":"array"},"type":{"const":"filter","type":"string"}},"required":["conditions","type"],"type":"object"},"IFilterCondition":{"additionalProperties":false,"properties":{"mappings":{"items":{"$ref":"#/definitions/IMapping"},"type":"array"},"viewID":{"type":"string"}},"required":["viewID","mappings"],"type":"object"},"IFilterStaticCondition":{"additionalProperties":false,"properties":{"condition":{"$ref":"#/definitions/IMappingConditionType"},"localFieldID":{"type":"string"},"value":{"type":["string","number"]}},"required":["localFieldID","condition","value"],"type":"object"},"IForm":{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/definitions/IField"},"type":"array"},"id":{"type":"string"},"type":{"const":"form","type":"string"}},"required":["fields","id","type"],"type":"object"},"IGroupBy":{"additionalProperties":false,"properties":{"aggregates":{"items":{"$ref":"#/definitions/AggregateType"},"type":"array"},"groupByIDs":{"items":{"type":"string"},"type":"array"},"type":{"const":"groupby","type":"string"}},"required":["aggregates","groupByIDs","type"],"type":"object"},"IHipieService":{"additionalProperties":false,"properties":{"id":{"type":"string"},"inputs":{"items":{"$ref":"#/definitions/IField"},"type":"array"},"outputs":{"$ref":"#/definitions/OutputDict"},"queryID":{"type":"string"},"querySet":{"type":"string"},"type":{"const":"hipie","type":"string"},"url":{"type":"string"}},"required":["id","inputs","outputs","queryID","querySet","type","url"],"type":"object"},"IHipieSqlRef":{"additionalProperties":false,"properties":{"id":{"type":"string"}},"required":["id"],"type":"object"},"ILimit":{"additionalProperties":false,"properties":{"limit":{"type":"number"},"type":{"const":"limit","type":"string"}},"required":["limit","type"],"type":"object"},"ILogicalFile":{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/definitions/IField"},"type":"array"},"id":{"type":"string"},"logicalFile":{"type":"string"},"type":{"const":"logicalfile","type":"string"},"url":{"type":"string"}},"required":["fields","id","logicalFile","type","url"],"type":"object"},"IMap":{"additionalProperties":false,"properties":{"default":{},"fieldID":{"type":"string"},"mappings":{"items":{"$ref":"#/definitions/IMapMapping"},"type":"array"},"sourceFieldID":{"type":"string"},"type":{"const":"map","type":"string"}},"required":["fieldID","type","sourceFieldID","default","mappings"],"type":"object"},"IMapMapping":{"additionalProperties":false,"properties":{"newValue":{},"value":{}},"required":["value","newValue"],"type":"object"},"IMapping":{"additionalProperties":false,"properties":{"condition":{"$ref":"#/definitions/IMappingConditionType"},"localFieldID":{"type":"string"},"nullable":{"type":"boolean"},"remoteFieldID":{"type":"string"}},"required":["remoteFieldID","localFieldID","condition","nullable"],"type":"object"},"IMappingConditionType":{"enum":["==","!=",">",">=","<","<=","range","in"],"type":"string"},"IMappings":{"additionalProperties":false,"properties":{"transformations":{"items":{"$ref":"#/definitions/ProjectTransformationType"},"type":"array"},"type":{"const":"mappings","type":"string"}},"required":["transformations","type"],"type":"object"},"IMulti":{"additionalProperties":false,"properties":{"fieldID":{"type":"string"},"transformations":{"items":{"$ref":"#/definitions/MultiTransformationType"},"type":"array"},"type":{"const":"multi","type":"string"}},"required":["fieldID","type","transformations"],"type":"object"},"IOutput":{"additionalProperties":false,"properties":{"fields":{"items":{"$ref":"#/definitions/IField"},"type":"array"}},"required":["fields"],"type":"object"},"IProject":{"additionalProperties":false,"properties":{"transformations":{"items":{"$ref":"#/definitions/ProjectTransformationType"},"type":"array"},"type":{"const":"project","type":"string"}},"required":["transformations","type"],"type":"object"},"IProperties":{"type":"object"},"IRequestField":{"additionalProperties":false,"properties":{"localFieldID":{"type":"string"},"remoteFieldID":{"type":"string"},"source":{"type":"string"},"value":{"type":"string"}},"required":["localFieldID","source","remoteFieldID","value"],"type":"object"},"IRestService":{"additionalProperties":false,"properties":{"action":{"type":"string"},"id":{"type":"string"},"inputs":{"items":{"$ref":"#/definitions/IField"},"type":"array"},"mode":{"enum":["get","post"],"type":"string"},"outputs":{"$ref":"#/definitions/OutputDict"},"type":{"const":"rest","type":"string"},"url":{"type":"string"}},"required":["action","id","inputs","outputs","type","url"],"type":"object"},"IRoxieService":{"additionalProperties":false,"properties":{"id":{"type":"string"},"inputs":{"items":{"$ref":"#/definitions/IField"},"type":"array"},"outputs":{"$ref":"#/definitions/OutputDict"},"queryID":{"type":"string"},"querySet":{"type":"string"},"type":{"const":"roxie","type":"string"},"url":{"type":"string"}},"required":["id","inputs","outputs","queryID","querySet","type","url"],"type":"object"},"IRoxieServiceRef":{"additionalProperties":false,"properties":{"id":{"type":"string"},"output":{"type":"string"},"request":{"items":{"$ref":"#/definitions/IRequestField"},"type":"array"}},"required":["id","output","request"],"type":"object"},"IScale":{"additionalProperties":false,"properties":{"factor":{"type":"number"},"fieldID":{"type":"string"},"sourceFieldID":{"type":"string"},"type":{"const":"scale","type":"string"}},"required":["fieldID","type","sourceFieldID","factor"],"type":"object"},"ISort":{"additionalProperties":false,"properties":{"conditions":{"items":{"$ref":"#/definitions/ISortCondition"},"type":"array"},"type":{"const":"sort","type":"string"}},"required":["conditions","type"],"type":"object"},"ISortCondition":{"additionalProperties":false,"properties":{"descending":{"type":"boolean"},"fieldID":{"type":"string"}},"required":["fieldID","descending"],"type":"object"},"ITemplate":{"additionalProperties":false,"properties":{"fieldID":{"type":"string"},"template":{"type":"string"},"type":{"const":"template","type":"string"}},"required":["fieldID","type","template"],"type":"object"},"IView":{"additionalProperties":false,"properties":{"activities":{"items":{"$ref":"#/definitions/ActivityType"},"type":"array"},"datasource":{"$ref":"#/definitions/IDatasourceRef"},"id":{"type":"string"},"visualization":{"$ref":"#/definitions/IVisualization"}},"required":["id","datasource","activities","visualization"],"type":"object"},"IVisualization":{"additionalProperties":false,"properties":{"__class":{"type":"string"},"chartType":{"type":"string"},"description":{"type":"string"},"id":{"type":"string"},"mappings":{"$ref":"#/definitions/IMappings"},"properties":{"$ref":"#/definitions/IWidgetProperties"},"secondaryDataviewID":{"type":"string"},"title":{"type":"string"},"visibility":{"$ref":"#/definitions/VisibilityType"}},"required":["__class","chartType","id","mappings","properties","title","visibility"],"type":"object"},"IWUResult":{"additionalProperties":false,"properties":{"id":{"type":"string"},"outputs":{"$ref":"#/definitions/OutputDict"},"type":{"const":"wuresult","type":"string"},"url":{"type":"string"},"wuid":{"type":"string"}},"required":["id","outputs","type","url","wuid"],"type":"object"},"IWUResultRef":{"additionalProperties":false,"properties":{"id":{"type":"string"},"output":{"type":"string"}},"required":["id","output"],"type":"object"},"IWidgetProperties":{"additionalProperties":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"number"},{"type":"boolean"},{"not":{}},{"$ref":"#/definitions/IWidgetProperties"},{"items":{"$ref":"#/definitions/IWidgetProperties"},"type":"array"}]},"properties":{"__class":{"type":"string"}},"required":["__class"],"type":"object"},"MultiTransformationType":{"anyOf":[{"$ref":"#/definitions/IEquals"},{"$ref":"#/definitions/ICalculated"},{"$ref":"#/definitions/IScale"},{"$ref":"#/definitions/ITemplate"},{"$ref":"#/definitions/IMap"}]},"Number64":{"type":"string"},"OutputDict":{"additionalProperties":{"$ref":"#/definitions/IOutput"},"type":"object"},"ProjectTransformationType":{"anyOf":[{"$ref":"#/definitions/MultiTransformationType"},{"$ref":"#/definitions/IMulti"}]},"Range":{"items":{"type":["number","string"]},"maxItems":2,"minItems":2,"type":"array"},"Schema":{"additionalProperties":false,"properties":{"createdBy":{"additionalProperties":false,"properties":{"name":{"type":"string"},"version":{"type":"string"}},"required":["name","version"],"type":"object"},"datasources":{"items":{"$ref":"#/definitions/DatasourceType"},"type":"array"},"dataviews":{"items":{"$ref":"#/definitions/IView"},"type":"array"},"defs":{"additionalProperties":false,"properties":{"activityTypes":{"additionalProperties":false,"properties":{"filter":{"$ref":"#/definitions/IFilter"},"groupby":{"$ref":"#/definitions/IGroupBy"},"limit":{"$ref":"#/definitions/ILimit"},"mappings":{"$ref":"#/definitions/IMappings"},"project":{"$ref":"#/definitions/IProject"},"sort":{"$ref":"#/definitions/ISort"}},"required":["filter","project","groupby","sort","limit","mappings"],"type":"object"},"aggregateTypes":{"additionalProperties":false,"properties":{"aggregate":{"$ref":"#/definitions/IAggregate"},"count":{"$ref":"#/definitions/ICount"}},"required":["aggregate","count"],"type":"object"},"datasourceRefTypes":{"additionalProperties":false,"properties":{"roxieServiceRef":{"$ref":"#/definitions/IRoxieServiceRef"},"wuResultRef":{"$ref":"#/definitions/IWUResultRef"}},"required":["wuResultRef","roxieServiceRef"],"type":"object"},"datasourceTypes":{"additionalProperties":false,"properties":{"databomb":{"$ref":"#/definitions/IDatabomb"},"datasource":{"$ref":"#/definitions/IDatasource"},"form":{"$ref":"#/definitions/IForm"},"hipieService":{"$ref":"#/definitions/IHipieService"},"logicalFile":{"$ref":"#/definitions/ILogicalFile"},"roxieService":{"$ref":"#/definitions/IRoxieService"},"wuresult":{"$ref":"#/definitions/IWUResult"}},"required":["datasource","logicalFile","form","databomb","wuresult","hipieService","roxieService"],"type":"object"},"fieldTypes":{"additionalProperties":false,"properties":{"dataset":{"$ref":"#/definitions/Dataset"},"field":{"$ref":"#/definitions/IField"},"fieldBoolean":{"$ref":"#/definitions/IFieldBoolean"},"fieldDataset":{"$ref":"#/definitions/IFieldDataset"},"fieldNumber":{"$ref":"#/definitions/IFieldNumber"},"fieldNumber64":{"$ref":"#/definitions/IFieldNumber64"},"fieldObject":{"$ref":"#/definitions/IFieldObject"},"fieldRange":{"$ref":"#/definitions/IFieldRange"},"fieldSet":{"$ref":"#/definitions/IFieldSet"},"fieldString":{"$ref":"#/definitions/IFieldString"},"fieldType":{"$ref":"#/definitions/IFieldType"},"number64":{"$ref":"#/definitions/Number64"},"range":{"$ref":"#/definitions/Range"}},"required":["number64","range","dataset","fieldType","fieldBoolean","fieldNumber","fieldNumber64","fieldString","fieldRange","fieldDataset","fieldSet","fieldObject","field"],"type":"object"},"transformationTypes":{"additionalProperties":false,"properties":{"calculated":{"$ref":"#/definitions/ICalculated"},"equals":{"$ref":"#/definitions/IEquals"},"map":{"$ref":"#/definitions/IMap"},"multi":{"$ref":"#/definitions/IMulti"},"scale":{"$ref":"#/definitions/IScale"},"template":{"$ref":"#/definitions/ITemplate"}},"required":["equals","calculated","scale","template","map","multi"],"type":"object"}},"required":["fieldTypes","datasourceTypes","datasourceRefTypes","activityTypes","aggregateTypes","transformationTypes"],"type":"object"},"hipieProperties":{"$ref":"#/definitions/IProperties"},"properties":{"$ref":"#/definitions/IProperties"},"version":{"const":"2.2.1","type":"string"}},"required":["version","createdBy","datasources","dataviews"],"type":"object"},"VisibilityType":{"enum":["normal","flyout"],"type":"string"}}');
|
|
1023
|
+
const _ddl2Schema = {
|
|
1024
|
+
$ref,
|
|
1025
|
+
$schema,
|
|
1026
|
+
definitions
|
|
859
1027
|
};
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
allErrors: false,
|
|
867
|
-
verbose: true,
|
|
868
|
-
jsonPointers: false
|
|
1028
|
+
const Ajv = _Ajv.default || _Ajv;
|
|
1029
|
+
const ddl2Schema = _ddl2Schema;
|
|
1030
|
+
const options = {
|
|
1031
|
+
allErrors: false,
|
|
1032
|
+
verbose: true,
|
|
1033
|
+
jsonPointers: false
|
|
869
1034
|
};
|
|
870
1035
|
function doValidate(ddl, schema) {
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
1036
|
+
const ajv = new Ajv(options);
|
|
1037
|
+
const validate = ajv.compile(schema);
|
|
1038
|
+
const success = validate(ddl);
|
|
1039
|
+
return {
|
|
1040
|
+
success,
|
|
1041
|
+
errors: validate.errors
|
|
1042
|
+
};
|
|
876
1043
|
}
|
|
1044
|
+
__name(doValidate, "doValidate");
|
|
877
1045
|
function validate2(ddl) {
|
|
878
|
-
|
|
1046
|
+
return doValidate(ddl, _ddl2Schema);
|
|
879
1047
|
}
|
|
880
|
-
|
|
881
|
-
//#endregion
|
|
882
|
-
//#region src/index.ts
|
|
1048
|
+
__name(validate2, "validate2");
|
|
883
1049
|
function isDDL2Schema(ref) {
|
|
884
|
-
|
|
1050
|
+
return ref.version !== void 0 && ref.datasources !== void 0 && ref.dataviews !== void 0;
|
|
885
1051
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
1052
|
+
__name(isDDL2Schema, "isDDL2Schema");
|
|
1053
|
+
export {
|
|
1054
|
+
BUILD_VERSION,
|
|
1055
|
+
v1 as DDL1,
|
|
1056
|
+
v2 as DDL2,
|
|
1057
|
+
PKG_NAME,
|
|
1058
|
+
PKG_VERSION,
|
|
1059
|
+
ddl2Schema,
|
|
1060
|
+
isDDL2Schema,
|
|
1061
|
+
upgrade,
|
|
1062
|
+
validate2
|
|
1063
|
+
};
|
|
1064
|
+
//# sourceMappingURL=index.js.map
|