@hpcc-js/ddl-shim 2.17.24 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +43 -43
- package/dist/cli.js +1048 -1103
- package/dist/cli.js.map +1 -1
- package/dist/index.es6.js +1327 -1406
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +1332 -1411
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +3 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +10 -25
- package/schema/v1.json +26 -78
- package/schema/v2.json +40 -120
- package/src/__package__.ts +2 -2
- package/src/cli.ts +60 -60
- package/src/ddl/v0_0_22.ts +344 -344
- package/src/ddl/v1.ts +313 -313
- package/src/ddl/v2.ts +426 -426
- package/src/ddl/v2_0_23.ts +395 -395
- package/src/ddl/v2_1_0.ts +406 -406
- package/src/dermatology.ts +229 -229
- package/src/index.ts +11 -11
- package/src/upgrade.ts +734 -734
- package/src/validate.ts +39 -39
- package/types/__package__.d.ts +3 -3
- package/types/__package__.d.ts.map +1 -1
- package/types/cli.d.ts +1 -1
- package/types/ddl/v0_0_22.d.ts +270 -270
- package/types/ddl/v1.d.ts +234 -234
- package/types/ddl/v2.d.ts +338 -338
- package/types/ddl/v2_0_23.d.ts +314 -314
- package/types/ddl/v2_1_0.d.ts +321 -321
- package/types/dermatology.d.ts +10 -10
- package/types/index.d.ts +7 -7
- package/types/upgrade.d.ts +3 -3
- package/types/validate.d.ts +7 -7
package/dist/index.es6.js
CHANGED
|
@@ -1,48 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
28
|
-
}
|
|
29
|
-
function
|
|
30
|
-
return viz.type === "
|
|
31
|
-
}
|
|
32
|
-
function
|
|
33
|
-
return viz.type === "
|
|
34
|
-
}
|
|
35
|
-
function
|
|
36
|
-
return viz.type === "
|
|
37
|
-
}
|
|
38
|
-
function
|
|
39
|
-
return
|
|
40
|
-
}
|
|
41
|
-
function
|
|
42
|
-
return
|
|
43
|
-
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
1
|
+
function _mergeNamespaces(n, m) {
|
|
2
|
+
m.forEach(function (e) {
|
|
3
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
4
|
+
if (k !== 'default' && !(k in n)) {
|
|
5
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
6
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () { return e[k]; }
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
return Object.freeze(n);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var PKG_NAME = "@hpcc-js/ddl-shim";
|
|
17
|
+
var PKG_VERSION = "2.19.0";
|
|
18
|
+
var BUILD_VERSION = "2.102.2";
|
|
19
|
+
|
|
20
|
+
function isWorkunitDatasource(ref) {
|
|
21
|
+
return ref.WUID !== undefined;
|
|
22
|
+
}
|
|
23
|
+
function isDatabombDatasource(ref) {
|
|
24
|
+
return ref.databomb === true;
|
|
25
|
+
}
|
|
26
|
+
function isHipieDatasource(ref) {
|
|
27
|
+
return ref.URL !== undefined;
|
|
28
|
+
}
|
|
29
|
+
function isPieVisualization(viz) {
|
|
30
|
+
return viz.type === "PIE" || viz.type === "BAR";
|
|
31
|
+
}
|
|
32
|
+
function isLineVisualization(viz) {
|
|
33
|
+
return viz.type === "LINE";
|
|
34
|
+
}
|
|
35
|
+
function isChoroVisualization(viz) {
|
|
36
|
+
return viz.type === "CHORO";
|
|
37
|
+
}
|
|
38
|
+
function isTableVisualization(viz) {
|
|
39
|
+
return viz.type === "TABLE";
|
|
40
|
+
}
|
|
41
|
+
function isSliderVisualization(viz) {
|
|
42
|
+
return viz.type === "SLIDER";
|
|
43
|
+
}
|
|
44
|
+
function isGraphVisualization(viz) {
|
|
45
|
+
return viz.type === "GRAPH";
|
|
46
|
+
}
|
|
47
|
+
function isHeatMapVisualization(viz) {
|
|
48
|
+
return viz.type === "HEAT_MAP";
|
|
49
|
+
}
|
|
50
|
+
function isFormVisualization(viz) {
|
|
51
|
+
return viz.type === "FORM";
|
|
52
|
+
}
|
|
53
|
+
function isUSStateMapping(mappings) {
|
|
54
|
+
return mappings.state !== undefined;
|
|
55
|
+
}
|
|
56
|
+
function isUSCountyMapping(mappings) {
|
|
57
|
+
return mappings.county !== undefined;
|
|
58
|
+
}
|
|
59
|
+
function isGeohashMapping(mappings) {
|
|
60
|
+
return mappings.geohash !== undefined;
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
var v1 = /*#__PURE__*/Object.freeze({
|
|
@@ -63,39 +78,39 @@ var v1 = /*#__PURE__*/Object.freeze({
|
|
|
63
78
|
isGeohashMapping: isGeohashMapping
|
|
64
79
|
});
|
|
65
80
|
|
|
66
|
-
function isDatabombRef(ref) {
|
|
67
|
-
return !isWUResultRef(ref) && !isRoxieServiceRef(ref);
|
|
68
|
-
}
|
|
69
|
-
function isWUResultRef(ref) {
|
|
70
|
-
return ref.output !== undefined && !isRoxieServiceRef(ref);
|
|
71
|
-
}
|
|
72
|
-
function isRoxieServiceRef(ref) {
|
|
73
|
-
return ref.request !== undefined;
|
|
74
|
-
}
|
|
75
|
-
function isIFilterCondition(fc) {
|
|
76
|
-
return !!fc.viewID;
|
|
77
|
-
}
|
|
78
|
-
function isFilterActivity(activity) {
|
|
79
|
-
return activity.type === "filter";
|
|
80
|
-
}
|
|
81
|
-
function isProjectActivity(activity) {
|
|
82
|
-
return activity.type === "project";
|
|
83
|
-
}
|
|
84
|
-
function isMappingsActivity(activity) {
|
|
85
|
-
return activity.type === "mappings";
|
|
86
|
-
}
|
|
87
|
-
function isGroupByActivity(activity) {
|
|
88
|
-
return activity.type === "groupby";
|
|
89
|
-
}
|
|
90
|
-
function isSortActivity(activity) {
|
|
91
|
-
return activity.type === "sort";
|
|
92
|
-
}
|
|
93
|
-
function isLimitActivity(activity) {
|
|
94
|
-
return activity.type === "limit";
|
|
95
|
-
}
|
|
81
|
+
function isDatabombRef(ref) {
|
|
82
|
+
return !isWUResultRef(ref) && !isRoxieServiceRef(ref);
|
|
83
|
+
}
|
|
84
|
+
function isWUResultRef(ref) {
|
|
85
|
+
return ref.output !== undefined && !isRoxieServiceRef(ref);
|
|
86
|
+
}
|
|
87
|
+
function isRoxieServiceRef(ref) {
|
|
88
|
+
return ref.request !== undefined;
|
|
89
|
+
}
|
|
90
|
+
function isIFilterCondition(fc) {
|
|
91
|
+
return !!fc.viewID;
|
|
92
|
+
}
|
|
93
|
+
function isFilterActivity(activity) {
|
|
94
|
+
return activity.type === "filter";
|
|
95
|
+
}
|
|
96
|
+
function isProjectActivity(activity) {
|
|
97
|
+
return activity.type === "project";
|
|
98
|
+
}
|
|
99
|
+
function isMappingsActivity(activity) {
|
|
100
|
+
return activity.type === "mappings";
|
|
101
|
+
}
|
|
102
|
+
function isGroupByActivity(activity) {
|
|
103
|
+
return activity.type === "groupby";
|
|
104
|
+
}
|
|
105
|
+
function isSortActivity(activity) {
|
|
106
|
+
return activity.type === "sort";
|
|
107
|
+
}
|
|
108
|
+
function isLimitActivity(activity) {
|
|
109
|
+
return activity.type === "limit";
|
|
110
|
+
}
|
|
96
111
|
var VisibilitySet = ["normal", "flyout"];
|
|
97
112
|
|
|
98
|
-
var v2 = /*#__PURE__*/Object.freeze({
|
|
113
|
+
var v2$1 = /*#__PURE__*/Object.freeze({
|
|
99
114
|
__proto__: null,
|
|
100
115
|
isDatabombRef: isDatabombRef,
|
|
101
116
|
isWUResultRef: isWUResultRef,
|
|
@@ -143,960 +158,941 @@ function __spreadArray(to, from, pack) {
|
|
|
143
158
|
ar[i] = from[i];
|
|
144
159
|
}
|
|
145
160
|
}
|
|
146
|
-
return to.concat(ar || from);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
var classMappings = {
|
|
150
|
-
c3chart_Bar: "chart_Bar",
|
|
151
|
-
c3chart_Column: "chart_Column",
|
|
152
|
-
c3chart_Pie: "chart_Pie",
|
|
153
|
-
c3chart_Area: "chart_Area",
|
|
154
|
-
c3chart_Line: "chart_Line",
|
|
155
|
-
amchart_Bar: "chart_Bar",
|
|
156
|
-
amchart_Column: "chart_Column",
|
|
157
|
-
amchart_Pie: "chart_Pie",
|
|
158
|
-
amchart_Area: "chart_Area",
|
|
159
|
-
amchart_Line: "chart_Line",
|
|
160
|
-
google_Bar: "chart_Bar",
|
|
161
|
-
google_Column: "chart_Column",
|
|
162
|
-
google_Pie: "chart_Pie",
|
|
163
|
-
google_Area: "chart_Area",
|
|
164
|
-
google_Line: "chart_Line",
|
|
165
|
-
other_Table: "dgrid_Table"
|
|
166
|
-
};
|
|
167
|
-
var propertyMappings = {
|
|
168
|
-
xAxisLabelRotation: [
|
|
169
|
-
{ name: "xAxisOverlapMode", transform: function (n) { return "rotate"; } },
|
|
170
|
-
{ name: "xAxisLabelRotation", transform: function (n) { return n; } }
|
|
171
|
-
],
|
|
172
|
-
tooltipLabelColor: {
|
|
173
|
-
name: "tooltipLabelColor"
|
|
174
|
-
},
|
|
175
|
-
tooltipSeriesColor: {
|
|
176
|
-
name: "tooltipSeriesColor"
|
|
177
|
-
},
|
|
178
|
-
tooltipValueColor: {
|
|
179
|
-
name: "tooltipValueColor"
|
|
180
|
-
},
|
|
181
|
-
tooltipValueFormat: {
|
|
182
|
-
name: "tooltipValueFormat"
|
|
183
|
-
},
|
|
184
|
-
timePattern: {
|
|
185
|
-
name: "xAxisTypeTimePattern"
|
|
186
|
-
},
|
|
187
|
-
smoothLines: {
|
|
188
|
-
name: "interpolate",
|
|
189
|
-
transform: function (n) {
|
|
190
|
-
if (n === false)
|
|
191
|
-
return "linear";
|
|
192
|
-
return "catmullRom";
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
holePercent: {
|
|
196
|
-
name: "innerRadius"
|
|
197
|
-
},
|
|
198
|
-
flip: {
|
|
199
|
-
name: "orientation",
|
|
200
|
-
transform: function (n) { return n ? "vertical" : "horizontal"; }
|
|
201
|
-
},
|
|
202
|
-
bottomText: {
|
|
203
|
-
name: "xAxisTitle"
|
|
204
|
-
},
|
|
205
|
-
xAxisTypeTimePattern: {
|
|
206
|
-
name: "xAxisTypeTimePattern"
|
|
207
|
-
},
|
|
208
|
-
yAxisTypeTimePattern: {
|
|
209
|
-
name: "yAxisTypeTimePattern"
|
|
210
|
-
},
|
|
211
|
-
valueFormat: {
|
|
212
|
-
name: "tooltipValueFormat"
|
|
213
|
-
},
|
|
214
|
-
stacked: {
|
|
215
|
-
name: "yAxisStacked"
|
|
216
|
-
},
|
|
217
|
-
showYGrid: {
|
|
218
|
-
name: "yAxisGuideLines"
|
|
219
|
-
},
|
|
220
|
-
showXGrid: {
|
|
221
|
-
name: "xAxisGuideLines"
|
|
222
|
-
},
|
|
223
|
-
showValueLabel: {
|
|
224
|
-
name: "showValue"
|
|
225
|
-
},
|
|
226
|
-
low: {
|
|
227
|
-
name: "yAxisDomainLow"
|
|
228
|
-
},
|
|
229
|
-
high: {
|
|
230
|
-
name: "yAxisDomainHigh"
|
|
231
|
-
},
|
|
232
|
-
fillOpacity: {
|
|
233
|
-
name: "interpolateFillOpacity"
|
|
234
|
-
},
|
|
235
|
-
areaFillOpacity: {
|
|
236
|
-
name: "interpolateFillOpacity"
|
|
237
|
-
},
|
|
238
|
-
showToolbar: {
|
|
239
|
-
name: "titleVisible"
|
|
240
|
-
},
|
|
241
|
-
showCSV: {
|
|
242
|
-
name: "downloadButtonVisible"
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
function findKeyVal(object, key, val) {
|
|
246
|
-
var value;
|
|
247
|
-
for (var k in object) {
|
|
248
|
-
if (k === key && object[k] === val) {
|
|
249
|
-
value = object;
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
if (object[k] && typeof object[k] === "object") {
|
|
253
|
-
value = findKeyVal(object[k], key, val);
|
|
254
|
-
if (value !== undefined) {
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
return value;
|
|
260
|
-
}
|
|
261
|
-
function apply_to_dataviews(ddl2, dermObj) {
|
|
262
|
-
ddl2.dataviews.forEach(apply_to_dataview);
|
|
263
|
-
function apply_to_dataview(dv) {
|
|
264
|
-
var widgetId = dv.id;
|
|
265
|
-
var dermPanelObj = findKeyVal(dermObj, "__id", widgetId);
|
|
266
|
-
if (dermPanelObj) {
|
|
267
|
-
var dermPanelProps = dermPanelObj.__properties;
|
|
268
|
-
var dermWidgetObj = dermPanelObj.__properties.chart ? dermPanelObj.__properties.chart : dermPanelObj.__properties.widget;
|
|
269
|
-
var dermWidgetProps = dermWidgetObj.__properties;
|
|
270
|
-
apply_class_mapping(dermWidgetObj);
|
|
271
|
-
apply_panel_property_mapping(dermPanelProps, dermWidgetProps);
|
|
272
|
-
apply_widget_property_mapping(dermPanelProps, dermWidgetProps);
|
|
273
|
-
if (dv.visualization.properties.chartType) {
|
|
274
|
-
dv.visualization.properties.charttype = dv.visualization.properties.chartType;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
console.warn(widgetId + " not found in dermObj");
|
|
279
|
-
}
|
|
280
|
-
function apply_class_mapping(dermWidgetObj) {
|
|
281
|
-
dv.visualization.__class = swap_with_supported_class(dermWidgetObj.__class);
|
|
282
|
-
dv.visualization.properties.__class = "marshaller_VizChartPanel";
|
|
283
|
-
if (!dv.visualization.properties.widget)
|
|
284
|
-
dv.visualization.properties.widget = {};
|
|
285
|
-
dv.visualization.properties.widget.__class = dv.visualization.__class;
|
|
286
|
-
function swap_with_supported_class(_class) {
|
|
287
|
-
return classMappings[_class] ? classMappings[_class] : _class;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
function apply_panel_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
291
|
-
dv.visualization.title = dermPanelProps.title || "";
|
|
292
|
-
dv.visualization.description = "";
|
|
293
|
-
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
294
|
-
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
295
|
-
for (var propName in dermPanelProps) {
|
|
296
|
-
if (typeof propertyMappings[propName] !== "undefined") {
|
|
297
|
-
var newPropName = propertyMappings[propName].name;
|
|
298
|
-
if (typeof propertyMappings[propName].transform === "function") {
|
|
299
|
-
dv.visualization.properties[newPropName] = propertyMappings[propName].transform(dermPanelProps[propName]);
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
dv.visualization.properties[newPropName] = dermPanelProps[propName];
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
if (dermWidgetProps && dermWidgetProps.showLegend && dv.visualization.properties) {
|
|
307
|
-
dv.visualization.properties.legendVisible = true;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
function apply_widget_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
311
|
-
dv.visualization.title = dv.visualization.title || dermWidgetProps.title || "";
|
|
312
|
-
dv.visualization.description = ""; // TODO - should this map to anything?
|
|
313
|
-
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
314
|
-
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
315
|
-
var _loop_1 = function (propName) {
|
|
316
|
-
if (typeof propertyMappings[propName] !== "undefined") {
|
|
317
|
-
if (propertyMappings[propName] instanceof Array) {
|
|
318
|
-
propertyMappings[propName].forEach(function (p) {
|
|
319
|
-
var newPropName = p.name;
|
|
320
|
-
dv.visualization.properties.widget[newPropName] = p.transform(dermWidgetProps[propName]);
|
|
321
|
-
if (typeof propertyMappings[propName].transform === "function") {
|
|
322
|
-
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
323
|
-
}
|
|
324
|
-
else {
|
|
325
|
-
dv.visualization.properties.widget[newPropName] = dermWidgetProps[propName];
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
else {
|
|
330
|
-
var newPropName = propertyMappings[propName].name;
|
|
331
|
-
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
for (var propName in dermWidgetProps) {
|
|
336
|
-
_loop_1(propName);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
function apply_to_properties_layout(ddl2, dermObj) {
|
|
342
|
-
var retVal = {
|
|
343
|
-
layout: []
|
|
344
|
-
};
|
|
345
|
-
if (!dermObj || !dermObj.__properties)
|
|
346
|
-
return;
|
|
347
|
-
dermObj.__properties.content.forEach(function (cell) {
|
|
348
|
-
var cellPosition = {
|
|
349
|
-
// TODO - if "id" could be avoided then layouts could apply to any dashboard with the same number of widgets
|
|
350
|
-
id: cell.__properties.widget.__id,
|
|
351
|
-
position: [
|
|
352
|
-
cell.__properties.gridCol,
|
|
353
|
-
cell.__properties.gridRow,
|
|
354
|
-
cell.__properties.gridColSpan,
|
|
355
|
-
cell.__properties.gridRowSpan
|
|
356
|
-
]
|
|
357
|
-
};
|
|
358
|
-
retVal.layout.push(cellPosition);
|
|
359
|
-
});
|
|
360
|
-
return retVal;
|
|
361
|
-
}
|
|
362
|
-
function upgrade(ddl2, dermObj) {
|
|
363
|
-
apply_to_dataviews(ddl2, dermObj);
|
|
364
|
-
return apply_to_properties_layout(ddl2, dermObj);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
function faCharFix(faChar) {
|
|
368
|
-
return faChar;
|
|
369
|
-
}
|
|
370
|
-
var DDLUpgrade = /** @class */ (function () {
|
|
371
|
-
function DDLUpgrade(ddl, baseUrl, wuid, toLowerCase) {
|
|
372
|
-
if (baseUrl === void 0) { baseUrl = "http://localhost:8010"; }
|
|
373
|
-
if (wuid === void 0) { wuid = "WUID"; }
|
|
374
|
-
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
375
|
-
this._datasources = {};
|
|
376
|
-
this._datasourceUpdates = {};
|
|
377
|
-
this._visualizations = {};
|
|
378
|
-
this._ddl2Datasources = {};
|
|
379
|
-
this._ddl2DatasourceFields = {};
|
|
380
|
-
this._ddl2Dataviews = {};
|
|
381
|
-
this._ddl2DataviewActivities = {};
|
|
382
|
-
this._ddl = ddl;
|
|
383
|
-
this._baseUrl = baseUrl;
|
|
384
|
-
this._wuid = wuid;
|
|
385
|
-
this._toLowerCase = toLowerCase;
|
|
386
|
-
this.indexDDL();
|
|
387
|
-
this.readDDL();
|
|
388
|
-
}
|
|
389
|
-
DDLUpgrade.prototype.toLowerCase = function (s) {
|
|
390
|
-
return this._toLowerCase ? s.toLowerCase() : s;
|
|
391
|
-
};
|
|
392
|
-
DDLUpgrade.prototype.isVizDatasourceRoxie = function (viz) {
|
|
393
|
-
if (viz.source) {
|
|
394
|
-
var ds = this._datasources[viz.source.id];
|
|
395
|
-
if (isHipieDatasource(ds)) {
|
|
396
|
-
return true;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
return false;
|
|
400
|
-
};
|
|
401
|
-
DDLUpgrade.prototype.getDatasourceOutputs = function (dsID, vizID) {
|
|
402
|
-
var retVal = [];
|
|
403
|
-
var datasource = this._datasources[dsID];
|
|
404
|
-
for (var _i = 0, _a = datasource.outputs; _i < _a.length; _i++) {
|
|
405
|
-
var output = _a[_i];
|
|
406
|
-
if (output.notify) {
|
|
407
|
-
for (var _b = 0, _c = output.notify; _b < _c.length; _b++) {
|
|
408
|
-
var notify = _c[_b];
|
|
409
|
-
if (notify === vizID) {
|
|
410
|
-
retVal.push({
|
|
411
|
-
datasource: datasource,
|
|
412
|
-
output: output
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
return retVal;
|
|
419
|
-
};
|
|
420
|
-
DDLUpgrade.prototype.getDatasourceFilters = function (dsID, vizID) {
|
|
421
|
-
var retVal = {};
|
|
422
|
-
for (var _i = 0, _a = this.getDatasourceOutputs(dsID, vizID); _i < _a.length; _i++) {
|
|
423
|
-
var dsOut = _a[_i];
|
|
424
|
-
if (dsOut.output.filter) {
|
|
425
|
-
for (var _b = 0, _c = dsOut.output.filter; _b < _c.length; _b++) {
|
|
426
|
-
var filter = _c[_b];
|
|
427
|
-
retVal[filter.fieldid] = {
|
|
428
|
-
datasource: dsOut.datasource,
|
|
429
|
-
output: dsOut.output,
|
|
430
|
-
filter: filter
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
return retVal;
|
|
436
|
-
};
|
|
437
|
-
DDLUpgrade.prototype.indexDDL = function () {
|
|
438
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
439
|
-
var dash = _a[_i];
|
|
440
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
441
|
-
var viz = _c[_b];
|
|
442
|
-
this._visualizations[viz.id] = viz;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
for (var _d = 0, _e = this._ddl.datasources; _d < _e.length; _d++) {
|
|
446
|
-
var ds = _e[_d];
|
|
447
|
-
this._datasources[ds.id] = ds;
|
|
448
|
-
for (var _f = 0, _g = ds.outputs; _f < _g.length; _f++) {
|
|
449
|
-
var output = _g[_f];
|
|
450
|
-
if (output.notify) {
|
|
451
|
-
for (var _h = 0, _j = output.notify; _h < _j.length; _h++) {
|
|
452
|
-
var notify = _j[_h];
|
|
453
|
-
this._datasourceUpdates[notify] = {
|
|
454
|
-
id: ds.id,
|
|
455
|
-
output: output.from || output.id
|
|
456
|
-
};
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
DDLUpgrade.prototype.readDDL = function () {
|
|
463
|
-
for (var _i = 0, _a = this._ddl.datasources; _i < _a.length; _i++) {
|
|
464
|
-
var ds = _a[_i];
|
|
465
|
-
if (isWorkunitDatasource(ds)) {
|
|
466
|
-
var ddl2DS = {
|
|
467
|
-
type: "wuresult",
|
|
468
|
-
id: ds.id,
|
|
469
|
-
url: this._baseUrl,
|
|
470
|
-
wuid: this._wuid,
|
|
471
|
-
outputs: {}
|
|
472
|
-
};
|
|
473
|
-
for (var _b = 0, _c = ds.outputs; _b < _c.length; _b++) {
|
|
474
|
-
var output = _c[_b];
|
|
475
|
-
this.output2output(output, ddl2DS.outputs);
|
|
476
|
-
}
|
|
477
|
-
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
478
|
-
}
|
|
479
|
-
else if (isDatabombDatasource(ds)) ;
|
|
480
|
-
else {
|
|
481
|
-
var urlParts = ds.URL.split("/WsEcl/submit/query/");
|
|
482
|
-
var hostParts = urlParts[0];
|
|
483
|
-
var roxieParts = urlParts[1].split("/");
|
|
484
|
-
var ddl2DS = {
|
|
485
|
-
type: "hipie",
|
|
486
|
-
id: ds.id,
|
|
487
|
-
url: hostParts,
|
|
488
|
-
querySet: roxieParts[0],
|
|
489
|
-
queryID: roxieParts[1],
|
|
490
|
-
inputs: [],
|
|
491
|
-
outputs: {}
|
|
492
|
-
};
|
|
493
|
-
for (var _d = 0, _e = ds.outputs; _d < _e.length; _d++) {
|
|
494
|
-
var output = _e[_d];
|
|
495
|
-
this.output2output(output, ddl2DS.outputs);
|
|
496
|
-
}
|
|
497
|
-
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
for (var _f = 0, _g = this._ddl.dashboards; _f < _g.length; _f++) {
|
|
501
|
-
var dash = _g[_f];
|
|
502
|
-
for (var _h = 0, _j = dash.visualizations; _h < _j.length; _h++) {
|
|
503
|
-
var viz = _j[_h];
|
|
504
|
-
if (viz.type === "FORM") {
|
|
505
|
-
this._ddl2Datasources[viz.id] = {
|
|
506
|
-
type: "form",
|
|
507
|
-
id: viz.id,
|
|
508
|
-
fields: this.formFields2field(viz.fields)
|
|
509
|
-
};
|
|
510
|
-
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
511
|
-
}
|
|
512
|
-
else if (viz.type === "SLIDER") {
|
|
513
|
-
this._ddl2Datasources[viz.id] = {
|
|
514
|
-
type: "form",
|
|
515
|
-
id: viz.id,
|
|
516
|
-
fields: this.formFields2field(viz.fields, true)
|
|
517
|
-
};
|
|
518
|
-
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
519
|
-
}
|
|
520
|
-
this._ddl2Dataviews[viz.id] = this.anyViz2view(viz);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
this.readGroupBy();
|
|
524
|
-
this.readFilters();
|
|
525
|
-
this.readSort();
|
|
526
|
-
this.readMappings();
|
|
527
|
-
};
|
|
528
|
-
DDLUpgrade.prototype.readGroupBy = function () {
|
|
529
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
530
|
-
var dash = _a[_i];
|
|
531
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
532
|
-
var viz = _c[_b];
|
|
533
|
-
if (viz.fields) {
|
|
534
|
-
var projectTransformations = [];
|
|
535
|
-
var groupByColumns = [];
|
|
536
|
-
var aggrFields = [];
|
|
537
|
-
for (var _d = 0, _e = viz.fields; _d < _e.length; _d++) {
|
|
538
|
-
var field = _e[_d];
|
|
539
|
-
if (field.properties && field.properties.function) {
|
|
540
|
-
switch (field.properties.function) {
|
|
541
|
-
case "SUM":
|
|
542
|
-
case "MIN":
|
|
543
|
-
case "MAX":
|
|
544
|
-
aggrFields.push({
|
|
545
|
-
type: this.func2aggr(field.properties.function),
|
|
546
|
-
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
547
|
-
fieldID: this.toLowerCase(field.id)
|
|
548
|
-
});
|
|
549
|
-
break;
|
|
550
|
-
case "AVE":
|
|
551
|
-
aggrFields.push({
|
|
552
|
-
type: this.func2aggr(field.properties.function),
|
|
553
|
-
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
554
|
-
baseCountFieldID: field.properties.params.param2 ? this.toLowerCase(field.properties.params.param2) : undefined,
|
|
555
|
-
fieldID: this.toLowerCase(field.id)
|
|
556
|
-
});
|
|
557
|
-
break;
|
|
558
|
-
case "SCALE":
|
|
559
|
-
if (typeof field.properties.params.param1 === "object") {
|
|
560
|
-
var props = field.properties.params.param1;
|
|
561
|
-
switch (props.function) {
|
|
562
|
-
case "SUM":
|
|
563
|
-
case "MIN":
|
|
564
|
-
case "MAX":
|
|
565
|
-
aggrFields.push({
|
|
566
|
-
type: this.func2aggr(props.function),
|
|
567
|
-
inFieldID: this.toLowerCase(props.params.param1),
|
|
568
|
-
fieldID: this.toLowerCase(field.id)
|
|
569
|
-
});
|
|
570
|
-
break;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
projectTransformations.push({
|
|
574
|
-
type: "scale",
|
|
575
|
-
sourceFieldID: this.toLowerCase(field.id),
|
|
576
|
-
fieldID: this.toLowerCase(field.id),
|
|
577
|
-
factor: +field.properties.params.param2
|
|
578
|
-
});
|
|
579
|
-
break;
|
|
580
|
-
default:
|
|
581
|
-
groupByColumns.push(this.toLowerCase(field.id));
|
|
582
|
-
throw new Error("Unhandled field function: "
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
else {
|
|
586
|
-
groupByColumns.push(this.toLowerCase(field.id));
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
if (projectTransformations.length) {
|
|
590
|
-
this._ddl2DataviewActivities[viz.id].project.transformations = projectTransformations;
|
|
591
|
-
}
|
|
592
|
-
if (aggrFields.length) {
|
|
593
|
-
this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns);
|
|
594
|
-
this._ddl2DataviewActivities[viz.id].groupBy.aggregates = aggrFields;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
};
|
|
600
|
-
DDLUpgrade.prototype.func2aggr = function (func) {
|
|
601
|
-
switch (func) {
|
|
602
|
-
case "SUM":
|
|
603
|
-
return "sum";
|
|
604
|
-
case "AVE":
|
|
605
|
-
return "mean";
|
|
606
|
-
case "MIN":
|
|
607
|
-
return "min";
|
|
608
|
-
case "MAX":
|
|
609
|
-
return "max";
|
|
610
|
-
}
|
|
611
|
-
throw new Error("Unknown DDL1 Function Type: "
|
|
612
|
-
};
|
|
613
|
-
DDLUpgrade.prototype.readMappings = function () {
|
|
614
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
615
|
-
var dash = _a[_i];
|
|
616
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
617
|
-
var viz = _c[_b];
|
|
618
|
-
if (isFormVisualization(viz)) ;
|
|
619
|
-
else if (isPieVisualization(viz)) {
|
|
620
|
-
this.readPieMappings(viz);
|
|
621
|
-
}
|
|
622
|
-
else if (isChoroVisualization(viz)) {
|
|
623
|
-
this.readChoroMappings(viz);
|
|
624
|
-
}
|
|
625
|
-
else if (isLineVisualization(viz)) {
|
|
626
|
-
this.readLineMappings(viz);
|
|
627
|
-
}
|
|
628
|
-
else if (isTableVisualization(viz)) {
|
|
629
|
-
this.readTableMappings(viz);
|
|
630
|
-
}
|
|
631
|
-
else if (isGraphVisualization(viz)) {
|
|
632
|
-
this.readGraphMappings(viz);
|
|
633
|
-
}
|
|
634
|
-
else if (isSliderVisualization(viz)) {
|
|
635
|
-
this.readSliderMappings(viz);
|
|
636
|
-
}
|
|
637
|
-
else {
|
|
638
|
-
throw new Error("Unkown DDL1 mapping type: "
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
DDLUpgrade.prototype.readPieMappings = function (viz) {
|
|
644
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
645
|
-
mappings.transformations.push({
|
|
646
|
-
fieldID: "label",
|
|
647
|
-
type: "=",
|
|
648
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
649
|
-
});
|
|
650
|
-
mappings.transformations.push({
|
|
651
|
-
fieldID: "weight",
|
|
652
|
-
type: "=",
|
|
653
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
654
|
-
});
|
|
655
|
-
};
|
|
656
|
-
DDLUpgrade.prototype.readChoroMappings = function (viz) {
|
|
657
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
658
|
-
mappings.transformations.push({
|
|
659
|
-
fieldID: "label",
|
|
660
|
-
type: "=",
|
|
661
|
-
sourceFieldID: this.toLowerCase(this.anyChoroMapping2label(viz.source.mappings))
|
|
662
|
-
});
|
|
663
|
-
mappings.transformations.push({
|
|
664
|
-
fieldID: "weight",
|
|
665
|
-
type: "=",
|
|
666
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
667
|
-
});
|
|
668
|
-
};
|
|
669
|
-
DDLUpgrade.prototype.anyChoroMapping2label = function (mapping) {
|
|
670
|
-
return mapping.state || mapping.county || mapping.geohash;
|
|
671
|
-
};
|
|
672
|
-
DDLUpgrade.prototype.readLineMappings = function (viz) {
|
|
673
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
674
|
-
mappings.transformations.push({
|
|
675
|
-
fieldID: viz.source.mappings.x[0],
|
|
676
|
-
type: "=",
|
|
677
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.x[0])
|
|
678
|
-
});
|
|
679
|
-
for (var i = 0; i < viz.source.mappings.y.length; ++i) {
|
|
680
|
-
mappings.transformations.push({
|
|
681
|
-
fieldID: viz.source.mappings.y[i],
|
|
682
|
-
type: "=",
|
|
683
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.y[i])
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
};
|
|
687
|
-
DDLUpgrade.prototype.readTableMappings = function (viz) {
|
|
688
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
689
|
-
for (var i = 0; i < viz.label.length; ++i) {
|
|
690
|
-
mappings.transformations.push({
|
|
691
|
-
fieldID: viz.label[i],
|
|
692
|
-
type: "=",
|
|
693
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.value[i])
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
};
|
|
697
|
-
DDLUpgrade.prototype.readGraphEnums = function (valueMappings, annotation) {
|
|
698
|
-
if (annotation === void 0) { annotation = false; }
|
|
699
|
-
var retVal = [];
|
|
700
|
-
if (valueMappings) {
|
|
701
|
-
for (var value in valueMappings) {
|
|
702
|
-
var newValue = {};
|
|
703
|
-
for (var key in valueMappings[value]) {
|
|
704
|
-
if (key === "faChar") {
|
|
705
|
-
newValue[key] = faCharFix(valueMappings[value][key]);
|
|
706
|
-
}
|
|
707
|
-
else if (annotation && key.indexOf("icon_") === 0) {
|
|
708
|
-
console.log("Deprecated flag property: " + key);
|
|
709
|
-
newValue[key.split("icon_")[1]] = valueMappings[value][key];
|
|
710
|
-
}
|
|
711
|
-
else {
|
|
712
|
-
newValue[key] = valueMappings[value][key];
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
// remove v1.x "0" annotations as they equated to "nothing" ---
|
|
716
|
-
if (!annotation || value !== "0") {
|
|
717
|
-
retVal.push({
|
|
718
|
-
value: value,
|
|
719
|
-
newValue: newValue
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
return retVal;
|
|
725
|
-
};
|
|
726
|
-
DDLUpgrade.prototype.readGraphMappings = function (viz) {
|
|
727
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
728
|
-
mappings.transformations.push({
|
|
729
|
-
fieldID: "uid",
|
|
730
|
-
type: "=",
|
|
731
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.uid)
|
|
732
|
-
});
|
|
733
|
-
mappings.transformations.push({
|
|
734
|
-
fieldID: "label",
|
|
735
|
-
type: "=",
|
|
736
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
737
|
-
});
|
|
738
|
-
if (viz.icon.fieldid) {
|
|
739
|
-
mappings.transformations.push({
|
|
740
|
-
fieldID: "icon",
|
|
741
|
-
type: "map",
|
|
742
|
-
sourceFieldID: this.toLowerCase(viz.icon.fieldid),
|
|
743
|
-
default: { fachar: faCharFix(viz.icon.faChar) },
|
|
744
|
-
mappings: this.readGraphEnums(viz.icon.valuemappings)
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
|
-
var idx = 0;
|
|
748
|
-
if (viz.flag) {
|
|
749
|
-
for (var _i = 0, _a = viz.flag; _i < _a.length; _i++) {
|
|
750
|
-
var flag = _a[_i];
|
|
751
|
-
if (flag.fieldid) {
|
|
752
|
-
mappings.transformations.push({
|
|
753
|
-
fieldID: "annotation_"
|
|
754
|
-
type: "map",
|
|
755
|
-
sourceFieldID: this.toLowerCase(flag.fieldid),
|
|
756
|
-
default: {},
|
|
757
|
-
mappings: this.readGraphEnums(flag.valuemappings, true)
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
mappings.transformations.push({
|
|
763
|
-
fieldID: "links",
|
|
764
|
-
type: "=",
|
|
765
|
-
sourceFieldID: this.toLowerCase(viz.source.link.childfile),
|
|
766
|
-
transformations: [{
|
|
767
|
-
fieldID: "uid",
|
|
768
|
-
type: "=",
|
|
769
|
-
sourceFieldID: this.toLowerCase(viz.source.link.mappings.uid)
|
|
770
|
-
}]
|
|
771
|
-
});
|
|
772
|
-
};
|
|
773
|
-
DDLUpgrade.prototype.readSliderMappings = function (viz) {
|
|
774
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
775
|
-
mappings.transformations.push({
|
|
776
|
-
fieldID: "label",
|
|
777
|
-
type: "=",
|
|
778
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
779
|
-
});
|
|
780
|
-
};
|
|
781
|
-
DDLUpgrade.prototype.readFilters = function () {
|
|
782
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
783
|
-
var dash = _a[_i];
|
|
784
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
785
|
-
var viz = _c[_b];
|
|
786
|
-
if (viz.events) {
|
|
787
|
-
for (var eventID in viz.events) {
|
|
788
|
-
var event_1 = viz.events[eventID];
|
|
789
|
-
for (var _d = 0, _e = event_1.updates; _d < _e.length; _d++) {
|
|
790
|
-
var update = _e[_d];
|
|
791
|
-
var otherViz = this._ddl2Dataviews[update.visualization];
|
|
792
|
-
var dsFilters = this.getDatasourceFilters(update.datasource, otherViz.id);
|
|
793
|
-
if (update.mappings) {
|
|
794
|
-
if (isRoxieServiceRef(otherViz.datasource)) {
|
|
795
|
-
for (var key in update.mappings) {
|
|
796
|
-
otherViz.datasource.request.push({
|
|
797
|
-
source: viz.id,
|
|
798
|
-
remoteFieldID: this.toLowerCase(key),
|
|
799
|
-
localFieldID: this.toLowerCase(update.mappings[key])
|
|
800
|
-
});
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
else {
|
|
804
|
-
var condition = {
|
|
805
|
-
viewID: viz.id,
|
|
806
|
-
mappings: []
|
|
807
|
-
};
|
|
808
|
-
for (var key in update.mappings) {
|
|
809
|
-
var mapping = update.mappings[key];
|
|
810
|
-
var dsFilter = (mapping && dsFilters[mapping]) ? dsFilters[mapping].filter : undefined;
|
|
811
|
-
if (!dsFilter) {
|
|
812
|
-
console.warn("Select Mapping \""
|
|
813
|
-
}
|
|
814
|
-
else {
|
|
815
|
-
condition.mappings.push({
|
|
816
|
-
remoteFieldID: this.toLowerCase(key),
|
|
817
|
-
localFieldID: this.toLowerCase(update.mappings[key]),
|
|
818
|
-
condition: this.rule2condition(dsFilter.rule),
|
|
819
|
-
nullable: dsFilter.nullable
|
|
820
|
-
});
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
this._ddl2DataviewActivities[otherViz.id].filters.conditions.push(condition);
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
};
|
|
832
|
-
DDLUpgrade.prototype.rule2condition = function (_) {
|
|
833
|
-
switch (_) {
|
|
834
|
-
case "set":
|
|
835
|
-
return "in";
|
|
836
|
-
case "notequals":
|
|
837
|
-
return "!=";
|
|
838
|
-
}
|
|
839
|
-
return _;
|
|
840
|
-
};
|
|
841
|
-
DDLUpgrade.prototype.readSort = function () {
|
|
842
|
-
var _this = this;
|
|
843
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
844
|
-
var dash = _a[_i];
|
|
845
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
846
|
-
var viz = _c[_b];
|
|
847
|
-
if (viz.source) {
|
|
848
|
-
if (viz.source.sort) {
|
|
849
|
-
var vizSort = this._ddl2DataviewActivities[viz.id].sort;
|
|
850
|
-
vizSort.conditions = viz.source.sort.map(function (s) {
|
|
851
|
-
if (s.indexOf("-") === 0) {
|
|
852
|
-
return {
|
|
853
|
-
fieldID: _this.toLowerCase(s.substr(1)),
|
|
854
|
-
descending: true
|
|
855
|
-
};
|
|
856
|
-
}
|
|
857
|
-
return {
|
|
858
|
-
fieldID: _this.toLowerCase(s),
|
|
859
|
-
descending: false
|
|
860
|
-
};
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
if (viz.source.first) {
|
|
864
|
-
var vizLimit = this._ddl2DataviewActivities[viz.id].limit;
|
|
865
|
-
vizLimit.limit = +viz.source.first;
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
};
|
|
871
|
-
DDLUpgrade.prototype.anyViz2view = function (viz) {
|
|
872
|
-
var project = {
|
|
873
|
-
type: "project",
|
|
874
|
-
transformations: []
|
|
875
|
-
};
|
|
876
|
-
var filters = {
|
|
877
|
-
type: "filter",
|
|
878
|
-
conditions: []
|
|
879
|
-
};
|
|
880
|
-
var groupBy = {
|
|
881
|
-
type: "groupby",
|
|
882
|
-
groupByIDs: [],
|
|
883
|
-
aggregates: []
|
|
884
|
-
};
|
|
885
|
-
var sort = {
|
|
886
|
-
type: "sort",
|
|
887
|
-
conditions: []
|
|
888
|
-
};
|
|
889
|
-
var limit = {
|
|
890
|
-
type: "limit",
|
|
891
|
-
limit: 0
|
|
892
|
-
};
|
|
893
|
-
var mappings = {
|
|
894
|
-
type: "mappings",
|
|
895
|
-
transformations: []
|
|
896
|
-
};
|
|
897
|
-
this._ddl2DataviewActivities[viz.id] = {
|
|
898
|
-
project: project,
|
|
899
|
-
filters: filters,
|
|
900
|
-
sort: sort,
|
|
901
|
-
groupBy: groupBy,
|
|
902
|
-
limit: limit,
|
|
903
|
-
mappings: mappings
|
|
904
|
-
};
|
|
905
|
-
var datasourceRef = this.isVizDatasourceRoxie(viz) ? {
|
|
906
|
-
id: this._datasourceUpdates[viz.id].id,
|
|
907
|
-
request: [],
|
|
908
|
-
output: this._datasourceUpdates[viz.id].output
|
|
909
|
-
} : {
|
|
910
|
-
id: this._datasourceUpdates[viz.id].id,
|
|
911
|
-
output: this._datasourceUpdates[viz.id].output
|
|
912
|
-
};
|
|
913
|
-
return {
|
|
914
|
-
id: viz.id,
|
|
915
|
-
datasource: datasourceRef,
|
|
916
|
-
activities: [
|
|
917
|
-
project,
|
|
918
|
-
filters,
|
|
919
|
-
sort,
|
|
920
|
-
groupBy,
|
|
921
|
-
limit
|
|
922
|
-
],
|
|
923
|
-
visualization: __assign(__assign({ id: viz.id, title: viz.title || "", description: "", visibility: viz.properties && viz.properties.flyout === true ? "flyout" : "normal" }, this.type2chartType(viz.type)), { mappings: mappings, properties: (viz.properties || {}) })
|
|
924
|
-
};
|
|
925
|
-
};
|
|
926
|
-
DDLUpgrade.prototype.type2chartType = function (chartType) {
|
|
927
|
-
switch (chartType) {
|
|
928
|
-
case "LINE":
|
|
929
|
-
return { chartType: "Line", __class: "chart_Line" };
|
|
930
|
-
case "BUBBLE":
|
|
931
|
-
return { chartType: "Bubble", __class: "chart_Bubble" };
|
|
932
|
-
case "PIE":
|
|
933
|
-
return { chartType: "Pie", __class: "chart_Pie" };
|
|
934
|
-
case "BAR":
|
|
935
|
-
return { chartType: "Column", __class: "chart_Column" };
|
|
936
|
-
case "FORM":
|
|
937
|
-
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
938
|
-
case "WORD_CLOUD":
|
|
939
|
-
return { chartType: "WordCloud", __class: "chart_WordCloud" };
|
|
940
|
-
case "CHORO":
|
|
941
|
-
return { chartType: "ChoroplethStates", __class: "map_ChoroplethStates" };
|
|
942
|
-
case "SUMMARY":
|
|
943
|
-
return { chartType: "Summary", __class: "chart_Summary" };
|
|
944
|
-
case "SLIDER":
|
|
945
|
-
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
946
|
-
case "HEAT_MAP":
|
|
947
|
-
return { chartType: "HeatMap", __class: "other_HeatMap" };
|
|
948
|
-
case "2DCHART":
|
|
949
|
-
return { chartType: "Column", __class: "chart_Column" };
|
|
950
|
-
case "GRAPH":
|
|
951
|
-
return { chartType: "AdjacencyGraph", __class: "graph_AdjacencyGraph" };
|
|
952
|
-
case "TABLE":
|
|
953
|
-
default:
|
|
954
|
-
return { chartType: "Table", __class: "dgrid_Table" };
|
|
955
|
-
}
|
|
956
|
-
};
|
|
957
|
-
DDLUpgrade.prototype.formFields2field = function (fields, slider) {
|
|
958
|
-
var _this = this;
|
|
959
|
-
if (slider === void 0) { slider = false; }
|
|
960
|
-
if (!fields)
|
|
961
|
-
return [];
|
|
962
|
-
return fields.map(function (field) {
|
|
963
|
-
switch (field.properties.type) {
|
|
964
|
-
case "range":
|
|
965
|
-
return {
|
|
966
|
-
type: "range",
|
|
967
|
-
id: field.id,
|
|
968
|
-
default: (field.properties.default ? field.properties.default : undefined)
|
|
969
|
-
};
|
|
970
|
-
case "dataset":
|
|
971
|
-
return {
|
|
972
|
-
type: "dataset",
|
|
973
|
-
id: field.id,
|
|
974
|
-
default: [],
|
|
975
|
-
children: []
|
|
976
|
-
};
|
|
977
|
-
default:
|
|
978
|
-
return {
|
|
979
|
-
type: _this.formFieldType2fieldType(field.properties.datatype, slider),
|
|
980
|
-
id: field.id,
|
|
981
|
-
default: field.properties.default ? field.properties.default[0] : undefined
|
|
982
|
-
};
|
|
983
|
-
}
|
|
984
|
-
});
|
|
985
|
-
};
|
|
986
|
-
DDLUpgrade.prototype.formFieldType2fieldType = function (fieldType, slider) {
|
|
987
|
-
switch (fieldType) {
|
|
988
|
-
case "bool":
|
|
989
|
-
case "boolean":
|
|
990
|
-
return "boolean";
|
|
991
|
-
case "integer":
|
|
992
|
-
case "unsigned":
|
|
993
|
-
case "float":
|
|
994
|
-
case "double":
|
|
995
|
-
case "real":
|
|
996
|
-
return "number";
|
|
997
|
-
case "string":
|
|
998
|
-
return "string";
|
|
999
|
-
default:
|
|
1000
|
-
return slider ? "number" : "string";
|
|
1001
|
-
}
|
|
1002
|
-
};
|
|
1003
|
-
DDLUpgrade.prototype.output2output = function (output, target) {
|
|
1004
|
-
target[output.from || output.id] = {
|
|
1005
|
-
fields: this.filters2fields(output.filter)
|
|
1006
|
-
};
|
|
1007
|
-
};
|
|
1008
|
-
DDLUpgrade.prototype.filters2fields = function (filters) {
|
|
1009
|
-
if (!filters)
|
|
1010
|
-
return [];
|
|
1011
|
-
return filters.filter(function (filter) {
|
|
1012
|
-
var idParts = filter.fieldid.split("-");
|
|
1013
|
-
return idParts.length === 1 || idParts[1] === "range";
|
|
1014
|
-
}).map(function (filter) {
|
|
1015
|
-
var idParts = filter.fieldid.split("-");
|
|
1016
|
-
var retVal = {
|
|
1017
|
-
type: "string",
|
|
1018
|
-
id: idParts[0]
|
|
1019
|
-
};
|
|
1020
|
-
return retVal;
|
|
1021
|
-
});
|
|
1022
|
-
};
|
|
1023
|
-
DDLUpgrade.prototype.getVizField = function (vizID, fieldID) {
|
|
1024
|
-
return {
|
|
1025
|
-
type: "string",
|
|
1026
|
-
id: "",
|
|
1027
|
-
default: ""
|
|
1028
|
-
};
|
|
1029
|
-
};
|
|
1030
|
-
DDLUpgrade.prototype.writeDatasources = function () {
|
|
1031
|
-
var retVal = [];
|
|
1032
|
-
for (var id in this._ddl2Datasources) {
|
|
1033
|
-
retVal.push(this._ddl2Datasources[id]);
|
|
1034
|
-
}
|
|
1035
|
-
return retVal;
|
|
1036
|
-
};
|
|
1037
|
-
DDLUpgrade.prototype.writeDataviews = function () {
|
|
1038
|
-
var retVal = [];
|
|
1039
|
-
for (var id in this._ddl2Dataviews) {
|
|
1040
|
-
retVal.push(this._ddl2Dataviews[id]);
|
|
1041
|
-
}
|
|
1042
|
-
return retVal;
|
|
1043
|
-
};
|
|
1044
|
-
DDLUpgrade.prototype.writeProperties = function () {
|
|
1045
|
-
return {
|
|
1046
|
-
// TODO
|
|
1047
|
-
};
|
|
1048
|
-
};
|
|
1049
|
-
DDLUpgrade.prototype.write = function () {
|
|
1050
|
-
return {
|
|
1051
|
-
version: "2.2.1",
|
|
1052
|
-
createdBy: {
|
|
1053
|
-
name: PKG_NAME,
|
|
1054
|
-
version: PKG_VERSION
|
|
1055
|
-
},
|
|
1056
|
-
datasources: this.writeDatasources(),
|
|
1057
|
-
dataviews: this.writeDataviews(),
|
|
1058
|
-
properties: this.writeProperties()
|
|
1059
|
-
};
|
|
1060
|
-
};
|
|
1061
|
-
return DDLUpgrade;
|
|
1062
|
-
}());
|
|
1063
|
-
function upgrade
|
|
1064
|
-
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
1065
|
-
if (dermatologyJson === void 0) { dermatologyJson = {}; }
|
|
1066
|
-
var ddlUp = new DDLUpgrade(ddl, baseUrl, wuid, toLowerCase);
|
|
1067
|
-
var retVal = ddlUp.write();
|
|
1068
|
-
retVal.properties = upgrade(retVal, dermatologyJson);
|
|
1069
|
-
return retVal;
|
|
161
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
var classMappings = {
|
|
165
|
+
c3chart_Bar: "chart_Bar",
|
|
166
|
+
c3chart_Column: "chart_Column",
|
|
167
|
+
c3chart_Pie: "chart_Pie",
|
|
168
|
+
c3chart_Area: "chart_Area",
|
|
169
|
+
c3chart_Line: "chart_Line",
|
|
170
|
+
amchart_Bar: "chart_Bar",
|
|
171
|
+
amchart_Column: "chart_Column",
|
|
172
|
+
amchart_Pie: "chart_Pie",
|
|
173
|
+
amchart_Area: "chart_Area",
|
|
174
|
+
amchart_Line: "chart_Line",
|
|
175
|
+
google_Bar: "chart_Bar",
|
|
176
|
+
google_Column: "chart_Column",
|
|
177
|
+
google_Pie: "chart_Pie",
|
|
178
|
+
google_Area: "chart_Area",
|
|
179
|
+
google_Line: "chart_Line",
|
|
180
|
+
other_Table: "dgrid_Table"
|
|
181
|
+
};
|
|
182
|
+
var propertyMappings = {
|
|
183
|
+
xAxisLabelRotation: [
|
|
184
|
+
{ name: "xAxisOverlapMode", transform: function (n) { return "rotate"; } },
|
|
185
|
+
{ name: "xAxisLabelRotation", transform: function (n) { return n; } }
|
|
186
|
+
],
|
|
187
|
+
tooltipLabelColor: {
|
|
188
|
+
name: "tooltipLabelColor"
|
|
189
|
+
},
|
|
190
|
+
tooltipSeriesColor: {
|
|
191
|
+
name: "tooltipSeriesColor"
|
|
192
|
+
},
|
|
193
|
+
tooltipValueColor: {
|
|
194
|
+
name: "tooltipValueColor"
|
|
195
|
+
},
|
|
196
|
+
tooltipValueFormat: {
|
|
197
|
+
name: "tooltipValueFormat"
|
|
198
|
+
},
|
|
199
|
+
timePattern: {
|
|
200
|
+
name: "xAxisTypeTimePattern"
|
|
201
|
+
},
|
|
202
|
+
smoothLines: {
|
|
203
|
+
name: "interpolate",
|
|
204
|
+
transform: function (n) {
|
|
205
|
+
if (n === false)
|
|
206
|
+
return "linear";
|
|
207
|
+
return "catmullRom";
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
holePercent: {
|
|
211
|
+
name: "innerRadius"
|
|
212
|
+
},
|
|
213
|
+
flip: {
|
|
214
|
+
name: "orientation",
|
|
215
|
+
transform: function (n) { return n ? "vertical" : "horizontal"; }
|
|
216
|
+
},
|
|
217
|
+
bottomText: {
|
|
218
|
+
name: "xAxisTitle"
|
|
219
|
+
},
|
|
220
|
+
xAxisTypeTimePattern: {
|
|
221
|
+
name: "xAxisTypeTimePattern"
|
|
222
|
+
},
|
|
223
|
+
yAxisTypeTimePattern: {
|
|
224
|
+
name: "yAxisTypeTimePattern"
|
|
225
|
+
},
|
|
226
|
+
valueFormat: {
|
|
227
|
+
name: "tooltipValueFormat"
|
|
228
|
+
},
|
|
229
|
+
stacked: {
|
|
230
|
+
name: "yAxisStacked"
|
|
231
|
+
},
|
|
232
|
+
showYGrid: {
|
|
233
|
+
name: "yAxisGuideLines"
|
|
234
|
+
},
|
|
235
|
+
showXGrid: {
|
|
236
|
+
name: "xAxisGuideLines"
|
|
237
|
+
},
|
|
238
|
+
showValueLabel: {
|
|
239
|
+
name: "showValue"
|
|
240
|
+
},
|
|
241
|
+
low: {
|
|
242
|
+
name: "yAxisDomainLow"
|
|
243
|
+
},
|
|
244
|
+
high: {
|
|
245
|
+
name: "yAxisDomainHigh"
|
|
246
|
+
},
|
|
247
|
+
fillOpacity: {
|
|
248
|
+
name: "interpolateFillOpacity"
|
|
249
|
+
},
|
|
250
|
+
areaFillOpacity: {
|
|
251
|
+
name: "interpolateFillOpacity"
|
|
252
|
+
},
|
|
253
|
+
showToolbar: {
|
|
254
|
+
name: "titleVisible"
|
|
255
|
+
},
|
|
256
|
+
showCSV: {
|
|
257
|
+
name: "downloadButtonVisible"
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
function findKeyVal(object, key, val) {
|
|
261
|
+
var value;
|
|
262
|
+
for (var k in object) {
|
|
263
|
+
if (k === key && object[k] === val) {
|
|
264
|
+
value = object;
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
if (object[k] && typeof object[k] === "object") {
|
|
268
|
+
value = findKeyVal(object[k], key, val);
|
|
269
|
+
if (value !== undefined) {
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return value;
|
|
275
|
+
}
|
|
276
|
+
function apply_to_dataviews(ddl2, dermObj) {
|
|
277
|
+
ddl2.dataviews.forEach(apply_to_dataview);
|
|
278
|
+
function apply_to_dataview(dv) {
|
|
279
|
+
var widgetId = dv.id;
|
|
280
|
+
var dermPanelObj = findKeyVal(dermObj, "__id", widgetId);
|
|
281
|
+
if (dermPanelObj) {
|
|
282
|
+
var dermPanelProps = dermPanelObj.__properties;
|
|
283
|
+
var dermWidgetObj = dermPanelObj.__properties.chart ? dermPanelObj.__properties.chart : dermPanelObj.__properties.widget;
|
|
284
|
+
var dermWidgetProps = dermWidgetObj.__properties;
|
|
285
|
+
apply_class_mapping(dermWidgetObj);
|
|
286
|
+
apply_panel_property_mapping(dermPanelProps, dermWidgetProps);
|
|
287
|
+
apply_widget_property_mapping(dermPanelProps, dermWidgetProps);
|
|
288
|
+
if (dv.visualization.properties.chartType) {
|
|
289
|
+
dv.visualization.properties.charttype = dv.visualization.properties.chartType;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
console.warn(widgetId + " not found in dermObj");
|
|
294
|
+
}
|
|
295
|
+
function apply_class_mapping(dermWidgetObj) {
|
|
296
|
+
dv.visualization.__class = swap_with_supported_class(dermWidgetObj.__class);
|
|
297
|
+
dv.visualization.properties.__class = "marshaller_VizChartPanel";
|
|
298
|
+
if (!dv.visualization.properties.widget)
|
|
299
|
+
dv.visualization.properties.widget = {};
|
|
300
|
+
dv.visualization.properties.widget.__class = dv.visualization.__class;
|
|
301
|
+
function swap_with_supported_class(_class) {
|
|
302
|
+
return classMappings[_class] ? classMappings[_class] : _class;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
function apply_panel_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
306
|
+
dv.visualization.title = dermPanelProps.title || "";
|
|
307
|
+
dv.visualization.description = "";
|
|
308
|
+
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
309
|
+
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
310
|
+
for (var propName in dermPanelProps) {
|
|
311
|
+
if (typeof propertyMappings[propName] !== "undefined") {
|
|
312
|
+
var newPropName = propertyMappings[propName].name;
|
|
313
|
+
if (typeof propertyMappings[propName].transform === "function") {
|
|
314
|
+
dv.visualization.properties[newPropName] = propertyMappings[propName].transform(dermPanelProps[propName]);
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
dv.visualization.properties[newPropName] = dermPanelProps[propName];
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (dermWidgetProps && dermWidgetProps.showLegend && dv.visualization.properties) {
|
|
322
|
+
dv.visualization.properties.legendVisible = true;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
function apply_widget_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
326
|
+
dv.visualization.title = dv.visualization.title || dermWidgetProps.title || "";
|
|
327
|
+
dv.visualization.description = ""; // TODO - should this map to anything?
|
|
328
|
+
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
329
|
+
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
330
|
+
var _loop_1 = function (propName) {
|
|
331
|
+
if (typeof propertyMappings[propName] !== "undefined") {
|
|
332
|
+
if (propertyMappings[propName] instanceof Array) {
|
|
333
|
+
propertyMappings[propName].forEach(function (p) {
|
|
334
|
+
var newPropName = p.name;
|
|
335
|
+
dv.visualization.properties.widget[newPropName] = p.transform(dermWidgetProps[propName]);
|
|
336
|
+
if (typeof propertyMappings[propName].transform === "function") {
|
|
337
|
+
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
dv.visualization.properties.widget[newPropName] = dermWidgetProps[propName];
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
var newPropName = propertyMappings[propName].name;
|
|
346
|
+
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
for (var propName in dermWidgetProps) {
|
|
351
|
+
_loop_1(propName);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
function apply_to_properties_layout(ddl2, dermObj) {
|
|
357
|
+
var retVal = {
|
|
358
|
+
layout: []
|
|
359
|
+
};
|
|
360
|
+
if (!dermObj || !dermObj.__properties)
|
|
361
|
+
return;
|
|
362
|
+
dermObj.__properties.content.forEach(function (cell) {
|
|
363
|
+
var cellPosition = {
|
|
364
|
+
// TODO - if "id" could be avoided then layouts could apply to any dashboard with the same number of widgets
|
|
365
|
+
id: cell.__properties.widget.__id,
|
|
366
|
+
position: [
|
|
367
|
+
cell.__properties.gridCol,
|
|
368
|
+
cell.__properties.gridRow,
|
|
369
|
+
cell.__properties.gridColSpan,
|
|
370
|
+
cell.__properties.gridRowSpan
|
|
371
|
+
]
|
|
372
|
+
};
|
|
373
|
+
retVal.layout.push(cellPosition);
|
|
374
|
+
});
|
|
375
|
+
return retVal;
|
|
376
|
+
}
|
|
377
|
+
function upgrade$1(ddl2, dermObj) {
|
|
378
|
+
apply_to_dataviews(ddl2, dermObj);
|
|
379
|
+
return apply_to_properties_layout(ddl2, dermObj);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function faCharFix(faChar) {
|
|
383
|
+
return faChar;
|
|
384
|
+
}
|
|
385
|
+
var DDLUpgrade = /** @class */ (function () {
|
|
386
|
+
function DDLUpgrade(ddl, baseUrl, wuid, toLowerCase) {
|
|
387
|
+
if (baseUrl === void 0) { baseUrl = "http://localhost:8010"; }
|
|
388
|
+
if (wuid === void 0) { wuid = "WUID"; }
|
|
389
|
+
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
390
|
+
this._datasources = {};
|
|
391
|
+
this._datasourceUpdates = {};
|
|
392
|
+
this._visualizations = {};
|
|
393
|
+
this._ddl2Datasources = {};
|
|
394
|
+
this._ddl2DatasourceFields = {};
|
|
395
|
+
this._ddl2Dataviews = {};
|
|
396
|
+
this._ddl2DataviewActivities = {};
|
|
397
|
+
this._ddl = ddl;
|
|
398
|
+
this._baseUrl = baseUrl;
|
|
399
|
+
this._wuid = wuid;
|
|
400
|
+
this._toLowerCase = toLowerCase;
|
|
401
|
+
this.indexDDL();
|
|
402
|
+
this.readDDL();
|
|
403
|
+
}
|
|
404
|
+
DDLUpgrade.prototype.toLowerCase = function (s) {
|
|
405
|
+
return this._toLowerCase ? s.toLowerCase() : s;
|
|
406
|
+
};
|
|
407
|
+
DDLUpgrade.prototype.isVizDatasourceRoxie = function (viz) {
|
|
408
|
+
if (viz.source) {
|
|
409
|
+
var ds = this._datasources[viz.source.id];
|
|
410
|
+
if (isHipieDatasource(ds)) {
|
|
411
|
+
return true;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return false;
|
|
415
|
+
};
|
|
416
|
+
DDLUpgrade.prototype.getDatasourceOutputs = function (dsID, vizID) {
|
|
417
|
+
var retVal = [];
|
|
418
|
+
var datasource = this._datasources[dsID];
|
|
419
|
+
for (var _i = 0, _a = datasource.outputs; _i < _a.length; _i++) {
|
|
420
|
+
var output = _a[_i];
|
|
421
|
+
if (output.notify) {
|
|
422
|
+
for (var _b = 0, _c = output.notify; _b < _c.length; _b++) {
|
|
423
|
+
var notify = _c[_b];
|
|
424
|
+
if (notify === vizID) {
|
|
425
|
+
retVal.push({
|
|
426
|
+
datasource: datasource,
|
|
427
|
+
output: output
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return retVal;
|
|
434
|
+
};
|
|
435
|
+
DDLUpgrade.prototype.getDatasourceFilters = function (dsID, vizID) {
|
|
436
|
+
var retVal = {};
|
|
437
|
+
for (var _i = 0, _a = this.getDatasourceOutputs(dsID, vizID); _i < _a.length; _i++) {
|
|
438
|
+
var dsOut = _a[_i];
|
|
439
|
+
if (dsOut.output.filter) {
|
|
440
|
+
for (var _b = 0, _c = dsOut.output.filter; _b < _c.length; _b++) {
|
|
441
|
+
var filter = _c[_b];
|
|
442
|
+
retVal[filter.fieldid] = {
|
|
443
|
+
datasource: dsOut.datasource,
|
|
444
|
+
output: dsOut.output,
|
|
445
|
+
filter: filter
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return retVal;
|
|
451
|
+
};
|
|
452
|
+
DDLUpgrade.prototype.indexDDL = function () {
|
|
453
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
454
|
+
var dash = _a[_i];
|
|
455
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
456
|
+
var viz = _c[_b];
|
|
457
|
+
this._visualizations[viz.id] = viz;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
for (var _d = 0, _e = this._ddl.datasources; _d < _e.length; _d++) {
|
|
461
|
+
var ds = _e[_d];
|
|
462
|
+
this._datasources[ds.id] = ds;
|
|
463
|
+
for (var _f = 0, _g = ds.outputs; _f < _g.length; _f++) {
|
|
464
|
+
var output = _g[_f];
|
|
465
|
+
if (output.notify) {
|
|
466
|
+
for (var _h = 0, _j = output.notify; _h < _j.length; _h++) {
|
|
467
|
+
var notify = _j[_h];
|
|
468
|
+
this._datasourceUpdates[notify] = {
|
|
469
|
+
id: ds.id,
|
|
470
|
+
output: output.from || output.id
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
DDLUpgrade.prototype.readDDL = function () {
|
|
478
|
+
for (var _i = 0, _a = this._ddl.datasources; _i < _a.length; _i++) {
|
|
479
|
+
var ds = _a[_i];
|
|
480
|
+
if (isWorkunitDatasource(ds)) {
|
|
481
|
+
var ddl2DS = {
|
|
482
|
+
type: "wuresult",
|
|
483
|
+
id: ds.id,
|
|
484
|
+
url: this._baseUrl,
|
|
485
|
+
wuid: this._wuid,
|
|
486
|
+
outputs: {}
|
|
487
|
+
};
|
|
488
|
+
for (var _b = 0, _c = ds.outputs; _b < _c.length; _b++) {
|
|
489
|
+
var output = _c[_b];
|
|
490
|
+
this.output2output(output, ddl2DS.outputs);
|
|
491
|
+
}
|
|
492
|
+
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
493
|
+
}
|
|
494
|
+
else if (isDatabombDatasource(ds)) ;
|
|
495
|
+
else {
|
|
496
|
+
var urlParts = ds.URL.split("/WsEcl/submit/query/");
|
|
497
|
+
var hostParts = urlParts[0];
|
|
498
|
+
var roxieParts = urlParts[1].split("/");
|
|
499
|
+
var ddl2DS = {
|
|
500
|
+
type: "hipie",
|
|
501
|
+
id: ds.id,
|
|
502
|
+
url: hostParts,
|
|
503
|
+
querySet: roxieParts[0],
|
|
504
|
+
queryID: roxieParts[1],
|
|
505
|
+
inputs: [],
|
|
506
|
+
outputs: {}
|
|
507
|
+
};
|
|
508
|
+
for (var _d = 0, _e = ds.outputs; _d < _e.length; _d++) {
|
|
509
|
+
var output = _e[_d];
|
|
510
|
+
this.output2output(output, ddl2DS.outputs);
|
|
511
|
+
}
|
|
512
|
+
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
for (var _f = 0, _g = this._ddl.dashboards; _f < _g.length; _f++) {
|
|
516
|
+
var dash = _g[_f];
|
|
517
|
+
for (var _h = 0, _j = dash.visualizations; _h < _j.length; _h++) {
|
|
518
|
+
var viz = _j[_h];
|
|
519
|
+
if (viz.type === "FORM") {
|
|
520
|
+
this._ddl2Datasources[viz.id] = {
|
|
521
|
+
type: "form",
|
|
522
|
+
id: viz.id,
|
|
523
|
+
fields: this.formFields2field(viz.fields)
|
|
524
|
+
};
|
|
525
|
+
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
526
|
+
}
|
|
527
|
+
else if (viz.type === "SLIDER") {
|
|
528
|
+
this._ddl2Datasources[viz.id] = {
|
|
529
|
+
type: "form",
|
|
530
|
+
id: viz.id,
|
|
531
|
+
fields: this.formFields2field(viz.fields, true)
|
|
532
|
+
};
|
|
533
|
+
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
534
|
+
}
|
|
535
|
+
this._ddl2Dataviews[viz.id] = this.anyViz2view(viz);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
this.readGroupBy();
|
|
539
|
+
this.readFilters();
|
|
540
|
+
this.readSort();
|
|
541
|
+
this.readMappings();
|
|
542
|
+
};
|
|
543
|
+
DDLUpgrade.prototype.readGroupBy = function () {
|
|
544
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
545
|
+
var dash = _a[_i];
|
|
546
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
547
|
+
var viz = _c[_b];
|
|
548
|
+
if (viz.fields) {
|
|
549
|
+
var projectTransformations = [];
|
|
550
|
+
var groupByColumns = [];
|
|
551
|
+
var aggrFields = [];
|
|
552
|
+
for (var _d = 0, _e = viz.fields; _d < _e.length; _d++) {
|
|
553
|
+
var field = _e[_d];
|
|
554
|
+
if (field.properties && field.properties.function) {
|
|
555
|
+
switch (field.properties.function) {
|
|
556
|
+
case "SUM":
|
|
557
|
+
case "MIN":
|
|
558
|
+
case "MAX":
|
|
559
|
+
aggrFields.push({
|
|
560
|
+
type: this.func2aggr(field.properties.function),
|
|
561
|
+
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
562
|
+
fieldID: this.toLowerCase(field.id)
|
|
563
|
+
});
|
|
564
|
+
break;
|
|
565
|
+
case "AVE":
|
|
566
|
+
aggrFields.push({
|
|
567
|
+
type: this.func2aggr(field.properties.function),
|
|
568
|
+
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
569
|
+
baseCountFieldID: field.properties.params.param2 ? this.toLowerCase(field.properties.params.param2) : undefined,
|
|
570
|
+
fieldID: this.toLowerCase(field.id)
|
|
571
|
+
});
|
|
572
|
+
break;
|
|
573
|
+
case "SCALE":
|
|
574
|
+
if (typeof field.properties.params.param1 === "object") {
|
|
575
|
+
var props = field.properties.params.param1;
|
|
576
|
+
switch (props.function) {
|
|
577
|
+
case "SUM":
|
|
578
|
+
case "MIN":
|
|
579
|
+
case "MAX":
|
|
580
|
+
aggrFields.push({
|
|
581
|
+
type: this.func2aggr(props.function),
|
|
582
|
+
inFieldID: this.toLowerCase(props.params.param1),
|
|
583
|
+
fieldID: this.toLowerCase(field.id)
|
|
584
|
+
});
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
projectTransformations.push({
|
|
589
|
+
type: "scale",
|
|
590
|
+
sourceFieldID: this.toLowerCase(field.id),
|
|
591
|
+
fieldID: this.toLowerCase(field.id),
|
|
592
|
+
factor: +field.properties.params.param2
|
|
593
|
+
});
|
|
594
|
+
break;
|
|
595
|
+
default:
|
|
596
|
+
groupByColumns.push(this.toLowerCase(field.id));
|
|
597
|
+
throw new Error("Unhandled field function: ".concat(field.properties.function));
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
groupByColumns.push(this.toLowerCase(field.id));
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
if (projectTransformations.length) {
|
|
605
|
+
this._ddl2DataviewActivities[viz.id].project.transformations = projectTransformations;
|
|
606
|
+
}
|
|
607
|
+
if (aggrFields.length) {
|
|
608
|
+
this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns, true);
|
|
609
|
+
this._ddl2DataviewActivities[viz.id].groupBy.aggregates = aggrFields;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
DDLUpgrade.prototype.func2aggr = function (func) {
|
|
616
|
+
switch (func) {
|
|
617
|
+
case "SUM":
|
|
618
|
+
return "sum";
|
|
619
|
+
case "AVE":
|
|
620
|
+
return "mean";
|
|
621
|
+
case "MIN":
|
|
622
|
+
return "min";
|
|
623
|
+
case "MAX":
|
|
624
|
+
return "max";
|
|
625
|
+
}
|
|
626
|
+
throw new Error("Unknown DDL1 Function Type: ".concat(func));
|
|
627
|
+
};
|
|
628
|
+
DDLUpgrade.prototype.readMappings = function () {
|
|
629
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
630
|
+
var dash = _a[_i];
|
|
631
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
632
|
+
var viz = _c[_b];
|
|
633
|
+
if (isFormVisualization(viz)) ;
|
|
634
|
+
else if (isPieVisualization(viz)) {
|
|
635
|
+
this.readPieMappings(viz);
|
|
636
|
+
}
|
|
637
|
+
else if (isChoroVisualization(viz)) {
|
|
638
|
+
this.readChoroMappings(viz);
|
|
639
|
+
}
|
|
640
|
+
else if (isLineVisualization(viz)) {
|
|
641
|
+
this.readLineMappings(viz);
|
|
642
|
+
}
|
|
643
|
+
else if (isTableVisualization(viz)) {
|
|
644
|
+
this.readTableMappings(viz);
|
|
645
|
+
}
|
|
646
|
+
else if (isGraphVisualization(viz)) {
|
|
647
|
+
this.readGraphMappings(viz);
|
|
648
|
+
}
|
|
649
|
+
else if (isSliderVisualization(viz)) {
|
|
650
|
+
this.readSliderMappings(viz);
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
throw new Error("Unkown DDL1 mapping type: ".concat(viz.type));
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
DDLUpgrade.prototype.readPieMappings = function (viz) {
|
|
659
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
660
|
+
mappings.transformations.push({
|
|
661
|
+
fieldID: "label",
|
|
662
|
+
type: "=",
|
|
663
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
664
|
+
});
|
|
665
|
+
mappings.transformations.push({
|
|
666
|
+
fieldID: "weight",
|
|
667
|
+
type: "=",
|
|
668
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
669
|
+
});
|
|
670
|
+
};
|
|
671
|
+
DDLUpgrade.prototype.readChoroMappings = function (viz) {
|
|
672
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
673
|
+
mappings.transformations.push({
|
|
674
|
+
fieldID: "label",
|
|
675
|
+
type: "=",
|
|
676
|
+
sourceFieldID: this.toLowerCase(this.anyChoroMapping2label(viz.source.mappings))
|
|
677
|
+
});
|
|
678
|
+
mappings.transformations.push({
|
|
679
|
+
fieldID: "weight",
|
|
680
|
+
type: "=",
|
|
681
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
682
|
+
});
|
|
683
|
+
};
|
|
684
|
+
DDLUpgrade.prototype.anyChoroMapping2label = function (mapping) {
|
|
685
|
+
return mapping.state || mapping.county || mapping.geohash;
|
|
686
|
+
};
|
|
687
|
+
DDLUpgrade.prototype.readLineMappings = function (viz) {
|
|
688
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
689
|
+
mappings.transformations.push({
|
|
690
|
+
fieldID: viz.source.mappings.x[0],
|
|
691
|
+
type: "=",
|
|
692
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.x[0])
|
|
693
|
+
});
|
|
694
|
+
for (var i = 0; i < viz.source.mappings.y.length; ++i) {
|
|
695
|
+
mappings.transformations.push({
|
|
696
|
+
fieldID: viz.source.mappings.y[i],
|
|
697
|
+
type: "=",
|
|
698
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.y[i])
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
DDLUpgrade.prototype.readTableMappings = function (viz) {
|
|
703
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
704
|
+
for (var i = 0; i < viz.label.length; ++i) {
|
|
705
|
+
mappings.transformations.push({
|
|
706
|
+
fieldID: viz.label[i],
|
|
707
|
+
type: "=",
|
|
708
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.value[i])
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
DDLUpgrade.prototype.readGraphEnums = function (valueMappings, annotation) {
|
|
713
|
+
if (annotation === void 0) { annotation = false; }
|
|
714
|
+
var retVal = [];
|
|
715
|
+
if (valueMappings) {
|
|
716
|
+
for (var value in valueMappings) {
|
|
717
|
+
var newValue = {};
|
|
718
|
+
for (var key in valueMappings[value]) {
|
|
719
|
+
if (key === "faChar") {
|
|
720
|
+
newValue[key] = faCharFix(valueMappings[value][key]);
|
|
721
|
+
}
|
|
722
|
+
else if (annotation && key.indexOf("icon_") === 0) {
|
|
723
|
+
console.log("Deprecated flag property: " + key);
|
|
724
|
+
newValue[key.split("icon_")[1]] = valueMappings[value][key];
|
|
725
|
+
}
|
|
726
|
+
else {
|
|
727
|
+
newValue[key] = valueMappings[value][key];
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
// remove v1.x "0" annotations as they equated to "nothing" ---
|
|
731
|
+
if (!annotation || value !== "0") {
|
|
732
|
+
retVal.push({
|
|
733
|
+
value: value,
|
|
734
|
+
newValue: newValue
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
return retVal;
|
|
740
|
+
};
|
|
741
|
+
DDLUpgrade.prototype.readGraphMappings = function (viz) {
|
|
742
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
743
|
+
mappings.transformations.push({
|
|
744
|
+
fieldID: "uid",
|
|
745
|
+
type: "=",
|
|
746
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.uid)
|
|
747
|
+
});
|
|
748
|
+
mappings.transformations.push({
|
|
749
|
+
fieldID: "label",
|
|
750
|
+
type: "=",
|
|
751
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
752
|
+
});
|
|
753
|
+
if (viz.icon.fieldid) {
|
|
754
|
+
mappings.transformations.push({
|
|
755
|
+
fieldID: "icon",
|
|
756
|
+
type: "map",
|
|
757
|
+
sourceFieldID: this.toLowerCase(viz.icon.fieldid),
|
|
758
|
+
default: { fachar: faCharFix(viz.icon.faChar) },
|
|
759
|
+
mappings: this.readGraphEnums(viz.icon.valuemappings)
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
var idx = 0;
|
|
763
|
+
if (viz.flag) {
|
|
764
|
+
for (var _i = 0, _a = viz.flag; _i < _a.length; _i++) {
|
|
765
|
+
var flag = _a[_i];
|
|
766
|
+
if (flag.fieldid) {
|
|
767
|
+
mappings.transformations.push({
|
|
768
|
+
fieldID: "annotation_".concat(idx++),
|
|
769
|
+
type: "map",
|
|
770
|
+
sourceFieldID: this.toLowerCase(flag.fieldid),
|
|
771
|
+
default: {},
|
|
772
|
+
mappings: this.readGraphEnums(flag.valuemappings, true)
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
mappings.transformations.push({
|
|
778
|
+
fieldID: "links",
|
|
779
|
+
type: "=",
|
|
780
|
+
sourceFieldID: this.toLowerCase(viz.source.link.childfile),
|
|
781
|
+
transformations: [{
|
|
782
|
+
fieldID: "uid",
|
|
783
|
+
type: "=",
|
|
784
|
+
sourceFieldID: this.toLowerCase(viz.source.link.mappings.uid)
|
|
785
|
+
}]
|
|
786
|
+
});
|
|
787
|
+
};
|
|
788
|
+
DDLUpgrade.prototype.readSliderMappings = function (viz) {
|
|
789
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
790
|
+
mappings.transformations.push({
|
|
791
|
+
fieldID: "label",
|
|
792
|
+
type: "=",
|
|
793
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
794
|
+
});
|
|
795
|
+
};
|
|
796
|
+
DDLUpgrade.prototype.readFilters = function () {
|
|
797
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
798
|
+
var dash = _a[_i];
|
|
799
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
800
|
+
var viz = _c[_b];
|
|
801
|
+
if (viz.events) {
|
|
802
|
+
for (var eventID in viz.events) {
|
|
803
|
+
var event_1 = viz.events[eventID];
|
|
804
|
+
for (var _d = 0, _e = event_1.updates; _d < _e.length; _d++) {
|
|
805
|
+
var update = _e[_d];
|
|
806
|
+
var otherViz = this._ddl2Dataviews[update.visualization];
|
|
807
|
+
var dsFilters = this.getDatasourceFilters(update.datasource, otherViz.id);
|
|
808
|
+
if (update.mappings) {
|
|
809
|
+
if (isRoxieServiceRef(otherViz.datasource)) {
|
|
810
|
+
for (var key in update.mappings) {
|
|
811
|
+
otherViz.datasource.request.push({
|
|
812
|
+
source: viz.id,
|
|
813
|
+
remoteFieldID: this.toLowerCase(key),
|
|
814
|
+
localFieldID: this.toLowerCase(update.mappings[key])
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
var condition = {
|
|
820
|
+
viewID: viz.id,
|
|
821
|
+
mappings: []
|
|
822
|
+
};
|
|
823
|
+
for (var key in update.mappings) {
|
|
824
|
+
var mapping = update.mappings[key];
|
|
825
|
+
var dsFilter = (mapping && dsFilters[mapping]) ? dsFilters[mapping].filter : undefined;
|
|
826
|
+
if (!dsFilter) {
|
|
827
|
+
console.warn("Select Mapping \"".concat(mapping, "\" in viz \"").concat(viz.id, "\" not found in filters for \"").concat(otherViz.id, "\""));
|
|
828
|
+
}
|
|
829
|
+
else {
|
|
830
|
+
condition.mappings.push({
|
|
831
|
+
remoteFieldID: this.toLowerCase(key),
|
|
832
|
+
localFieldID: this.toLowerCase(update.mappings[key]),
|
|
833
|
+
condition: this.rule2condition(dsFilter.rule),
|
|
834
|
+
nullable: dsFilter.nullable
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
this._ddl2DataviewActivities[otherViz.id].filters.conditions.push(condition);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
};
|
|
847
|
+
DDLUpgrade.prototype.rule2condition = function (_) {
|
|
848
|
+
switch (_) {
|
|
849
|
+
case "set":
|
|
850
|
+
return "in";
|
|
851
|
+
case "notequals":
|
|
852
|
+
return "!=";
|
|
853
|
+
}
|
|
854
|
+
return _;
|
|
855
|
+
};
|
|
856
|
+
DDLUpgrade.prototype.readSort = function () {
|
|
857
|
+
var _this = this;
|
|
858
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
859
|
+
var dash = _a[_i];
|
|
860
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
861
|
+
var viz = _c[_b];
|
|
862
|
+
if (viz.source) {
|
|
863
|
+
if (viz.source.sort) {
|
|
864
|
+
var vizSort = this._ddl2DataviewActivities[viz.id].sort;
|
|
865
|
+
vizSort.conditions = viz.source.sort.map(function (s) {
|
|
866
|
+
if (s.indexOf("-") === 0) {
|
|
867
|
+
return {
|
|
868
|
+
fieldID: _this.toLowerCase(s.substr(1)),
|
|
869
|
+
descending: true
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
return {
|
|
873
|
+
fieldID: _this.toLowerCase(s),
|
|
874
|
+
descending: false
|
|
875
|
+
};
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
if (viz.source.first) {
|
|
879
|
+
var vizLimit = this._ddl2DataviewActivities[viz.id].limit;
|
|
880
|
+
vizLimit.limit = +viz.source.first;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
DDLUpgrade.prototype.anyViz2view = function (viz) {
|
|
887
|
+
var project = {
|
|
888
|
+
type: "project",
|
|
889
|
+
transformations: []
|
|
890
|
+
};
|
|
891
|
+
var filters = {
|
|
892
|
+
type: "filter",
|
|
893
|
+
conditions: []
|
|
894
|
+
};
|
|
895
|
+
var groupBy = {
|
|
896
|
+
type: "groupby",
|
|
897
|
+
groupByIDs: [],
|
|
898
|
+
aggregates: []
|
|
899
|
+
};
|
|
900
|
+
var sort = {
|
|
901
|
+
type: "sort",
|
|
902
|
+
conditions: []
|
|
903
|
+
};
|
|
904
|
+
var limit = {
|
|
905
|
+
type: "limit",
|
|
906
|
+
limit: 0
|
|
907
|
+
};
|
|
908
|
+
var mappings = {
|
|
909
|
+
type: "mappings",
|
|
910
|
+
transformations: []
|
|
911
|
+
};
|
|
912
|
+
this._ddl2DataviewActivities[viz.id] = {
|
|
913
|
+
project: project,
|
|
914
|
+
filters: filters,
|
|
915
|
+
sort: sort,
|
|
916
|
+
groupBy: groupBy,
|
|
917
|
+
limit: limit,
|
|
918
|
+
mappings: mappings
|
|
919
|
+
};
|
|
920
|
+
var datasourceRef = this.isVizDatasourceRoxie(viz) ? {
|
|
921
|
+
id: this._datasourceUpdates[viz.id].id,
|
|
922
|
+
request: [],
|
|
923
|
+
output: this._datasourceUpdates[viz.id].output
|
|
924
|
+
} : {
|
|
925
|
+
id: this._datasourceUpdates[viz.id].id,
|
|
926
|
+
output: this._datasourceUpdates[viz.id].output
|
|
927
|
+
};
|
|
928
|
+
return {
|
|
929
|
+
id: viz.id,
|
|
930
|
+
datasource: datasourceRef,
|
|
931
|
+
activities: [
|
|
932
|
+
project,
|
|
933
|
+
filters,
|
|
934
|
+
sort,
|
|
935
|
+
groupBy,
|
|
936
|
+
limit
|
|
937
|
+
],
|
|
938
|
+
visualization: __assign(__assign({ id: viz.id, title: viz.title || "", description: "", visibility: viz.properties && viz.properties.flyout === true ? "flyout" : "normal" }, this.type2chartType(viz.type)), { mappings: mappings, properties: (viz.properties || {}) })
|
|
939
|
+
};
|
|
940
|
+
};
|
|
941
|
+
DDLUpgrade.prototype.type2chartType = function (chartType) {
|
|
942
|
+
switch (chartType) {
|
|
943
|
+
case "LINE":
|
|
944
|
+
return { chartType: "Line", __class: "chart_Line" };
|
|
945
|
+
case "BUBBLE":
|
|
946
|
+
return { chartType: "Bubble", __class: "chart_Bubble" };
|
|
947
|
+
case "PIE":
|
|
948
|
+
return { chartType: "Pie", __class: "chart_Pie" };
|
|
949
|
+
case "BAR":
|
|
950
|
+
return { chartType: "Column", __class: "chart_Column" };
|
|
951
|
+
case "FORM":
|
|
952
|
+
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
953
|
+
case "WORD_CLOUD":
|
|
954
|
+
return { chartType: "WordCloud", __class: "chart_WordCloud" };
|
|
955
|
+
case "CHORO":
|
|
956
|
+
return { chartType: "ChoroplethStates", __class: "map_ChoroplethStates" };
|
|
957
|
+
case "SUMMARY":
|
|
958
|
+
return { chartType: "Summary", __class: "chart_Summary" };
|
|
959
|
+
case "SLIDER":
|
|
960
|
+
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
961
|
+
case "HEAT_MAP":
|
|
962
|
+
return { chartType: "HeatMap", __class: "other_HeatMap" };
|
|
963
|
+
case "2DCHART":
|
|
964
|
+
return { chartType: "Column", __class: "chart_Column" };
|
|
965
|
+
case "GRAPH":
|
|
966
|
+
return { chartType: "AdjacencyGraph", __class: "graph_AdjacencyGraph" };
|
|
967
|
+
case "TABLE":
|
|
968
|
+
default:
|
|
969
|
+
return { chartType: "Table", __class: "dgrid_Table" };
|
|
970
|
+
}
|
|
971
|
+
};
|
|
972
|
+
DDLUpgrade.prototype.formFields2field = function (fields, slider) {
|
|
973
|
+
var _this = this;
|
|
974
|
+
if (slider === void 0) { slider = false; }
|
|
975
|
+
if (!fields)
|
|
976
|
+
return [];
|
|
977
|
+
return fields.map(function (field) {
|
|
978
|
+
switch (field.properties.type) {
|
|
979
|
+
case "range":
|
|
980
|
+
return {
|
|
981
|
+
type: "range",
|
|
982
|
+
id: field.id,
|
|
983
|
+
default: (field.properties.default ? field.properties.default : undefined)
|
|
984
|
+
};
|
|
985
|
+
case "dataset":
|
|
986
|
+
return {
|
|
987
|
+
type: "dataset",
|
|
988
|
+
id: field.id,
|
|
989
|
+
default: [],
|
|
990
|
+
children: []
|
|
991
|
+
};
|
|
992
|
+
default:
|
|
993
|
+
return {
|
|
994
|
+
type: _this.formFieldType2fieldType(field.properties.datatype, slider),
|
|
995
|
+
id: field.id,
|
|
996
|
+
default: field.properties.default ? field.properties.default[0] : undefined
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
};
|
|
1001
|
+
DDLUpgrade.prototype.formFieldType2fieldType = function (fieldType, slider) {
|
|
1002
|
+
switch (fieldType) {
|
|
1003
|
+
case "bool":
|
|
1004
|
+
case "boolean":
|
|
1005
|
+
return "boolean";
|
|
1006
|
+
case "integer":
|
|
1007
|
+
case "unsigned":
|
|
1008
|
+
case "float":
|
|
1009
|
+
case "double":
|
|
1010
|
+
case "real":
|
|
1011
|
+
return "number";
|
|
1012
|
+
case "string":
|
|
1013
|
+
return "string";
|
|
1014
|
+
default:
|
|
1015
|
+
return slider ? "number" : "string";
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
DDLUpgrade.prototype.output2output = function (output, target) {
|
|
1019
|
+
target[output.from || output.id] = {
|
|
1020
|
+
fields: this.filters2fields(output.filter)
|
|
1021
|
+
};
|
|
1022
|
+
};
|
|
1023
|
+
DDLUpgrade.prototype.filters2fields = function (filters) {
|
|
1024
|
+
if (!filters)
|
|
1025
|
+
return [];
|
|
1026
|
+
return filters.filter(function (filter) {
|
|
1027
|
+
var idParts = filter.fieldid.split("-");
|
|
1028
|
+
return idParts.length === 1 || idParts[1] === "range";
|
|
1029
|
+
}).map(function (filter) {
|
|
1030
|
+
var idParts = filter.fieldid.split("-");
|
|
1031
|
+
var retVal = {
|
|
1032
|
+
type: "string",
|
|
1033
|
+
id: idParts[0]
|
|
1034
|
+
};
|
|
1035
|
+
return retVal;
|
|
1036
|
+
});
|
|
1037
|
+
};
|
|
1038
|
+
DDLUpgrade.prototype.getVizField = function (vizID, fieldID) {
|
|
1039
|
+
return {
|
|
1040
|
+
type: "string",
|
|
1041
|
+
id: "",
|
|
1042
|
+
default: ""
|
|
1043
|
+
};
|
|
1044
|
+
};
|
|
1045
|
+
DDLUpgrade.prototype.writeDatasources = function () {
|
|
1046
|
+
var retVal = [];
|
|
1047
|
+
for (var id in this._ddl2Datasources) {
|
|
1048
|
+
retVal.push(this._ddl2Datasources[id]);
|
|
1049
|
+
}
|
|
1050
|
+
return retVal;
|
|
1051
|
+
};
|
|
1052
|
+
DDLUpgrade.prototype.writeDataviews = function () {
|
|
1053
|
+
var retVal = [];
|
|
1054
|
+
for (var id in this._ddl2Dataviews) {
|
|
1055
|
+
retVal.push(this._ddl2Dataviews[id]);
|
|
1056
|
+
}
|
|
1057
|
+
return retVal;
|
|
1058
|
+
};
|
|
1059
|
+
DDLUpgrade.prototype.writeProperties = function () {
|
|
1060
|
+
return {
|
|
1061
|
+
// TODO
|
|
1062
|
+
};
|
|
1063
|
+
};
|
|
1064
|
+
DDLUpgrade.prototype.write = function () {
|
|
1065
|
+
return {
|
|
1066
|
+
version: "2.2.1",
|
|
1067
|
+
createdBy: {
|
|
1068
|
+
name: PKG_NAME,
|
|
1069
|
+
version: PKG_VERSION
|
|
1070
|
+
},
|
|
1071
|
+
datasources: this.writeDatasources(),
|
|
1072
|
+
dataviews: this.writeDataviews(),
|
|
1073
|
+
properties: this.writeProperties()
|
|
1074
|
+
};
|
|
1075
|
+
};
|
|
1076
|
+
return DDLUpgrade;
|
|
1077
|
+
}());
|
|
1078
|
+
function upgrade(ddl, baseUrl, wuid, toLowerCase, dermatologyJson) {
|
|
1079
|
+
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
1080
|
+
if (dermatologyJson === void 0) { dermatologyJson = {}; }
|
|
1081
|
+
var ddlUp = new DDLUpgrade(ddl, baseUrl, wuid, toLowerCase);
|
|
1082
|
+
var retVal = ddlUp.write();
|
|
1083
|
+
retVal.properties = upgrade$1(retVal, dermatologyJson);
|
|
1084
|
+
return retVal;
|
|
1070
1085
|
}
|
|
1071
1086
|
|
|
1072
1087
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1073
1088
|
|
|
1074
|
-
|
|
1075
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
function createCommonjsModule(fn, basedir, module) {
|
|
1079
|
-
return module = {
|
|
1080
|
-
path: basedir,
|
|
1081
|
-
exports: {},
|
|
1082
|
-
require: function (path, base) {
|
|
1083
|
-
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
|
1084
|
-
}
|
|
1085
|
-
}, fn(module, module.exports), module.exports;
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
function getCjsExportFromNamespace (n) {
|
|
1089
|
-
return n && n['default'] || n;
|
|
1090
|
-
}
|
|
1089
|
+
var uri_all = {exports: {}};
|
|
1091
1090
|
|
|
1092
|
-
function commonjsRequire () {
|
|
1093
|
-
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
var uri_all = createCommonjsModule(function (module, exports) {
|
|
1097
1091
|
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
|
1092
|
+
|
|
1093
|
+
(function (module, exports) {
|
|
1098
1094
|
(function (global, factory) {
|
|
1099
|
-
|
|
1095
|
+
factory(exports) ;
|
|
1100
1096
|
}(commonjsGlobal, (function (exports) {
|
|
1101
1097
|
function merge() {
|
|
1102
1098
|
for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -1150,10 +1146,10 @@ function buildExps(isIRI) {
|
|
|
1150
1146
|
//subset, excludes bidi control characters
|
|
1151
1147
|
IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
|
|
1152
1148
|
//subset
|
|
1153
|
-
UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$)
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$),
|
|
1149
|
+
UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
|
|
1150
|
+
subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
|
|
1151
|
+
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
|
|
1152
|
+
var DEC_OCTET_RELAXED$ = subexp(subexp("25[0-5]") + "|" + subexp("2[0-4]" + DIGIT$$) + "|" + subexp("1" + DIGIT$$ + DIGIT$$) + "|" + subexp("0?[1-9]" + DIGIT$$) + "|0?0?" + DIGIT$$),
|
|
1157
1153
|
//relaxed parsing rules
|
|
1158
1154
|
IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
|
|
1159
1155
|
H16$ = subexp(HEXDIG$$ + "{1,4}"),
|
|
@@ -1177,14 +1173,14 @@ function buildExps(isIRI) {
|
|
|
1177
1173
|
IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
|
|
1178
1174
|
//[ *6( h16 ":" ) h16 ] "::"
|
|
1179
1175
|
IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
|
|
1180
|
-
ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+")
|
|
1176
|
+
ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
|
|
1181
1177
|
//RFC 6874, with relaxed parsing rules
|
|
1182
|
-
|
|
1178
|
+
subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
|
|
1183
1179
|
//RFC 6874
|
|
1184
|
-
|
|
1185
|
-
PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"))
|
|
1186
|
-
|
|
1187
|
-
|
|
1180
|
+
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
|
|
1181
|
+
var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
|
|
1182
|
+
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
|
|
1183
|
+
subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
|
|
1188
1184
|
return {
|
|
1189
1185
|
NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
|
|
1190
1186
|
NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
@@ -2298,7 +2294,7 @@ var handler$3 = {
|
|
|
2298
2294
|
|
|
2299
2295
|
var O = {};
|
|
2300
2296
|
//RFC 3986
|
|
2301
|
-
var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (
|
|
2297
|
+
var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
|
|
2302
2298
|
var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
|
|
2303
2299
|
var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
|
|
2304
2300
|
//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
|
|
@@ -2496,9 +2492,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
2496
2492
|
|
|
2497
2493
|
})));
|
|
2498
2494
|
|
|
2499
|
-
});
|
|
2500
|
-
|
|
2501
|
-
unwrapExports(uri_all);
|
|
2495
|
+
}(uri_all, uri_all.exports));
|
|
2502
2496
|
|
|
2503
2497
|
// do not edit .js files directly - edit src/index.jst
|
|
2504
2498
|
|
|
@@ -2547,7 +2541,7 @@ var fastDeepEqual = function equal(a, b) {
|
|
|
2547
2541
|
|
|
2548
2542
|
// https://mathiasbynens.be/notes/javascript-encoding
|
|
2549
2543
|
// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
|
|
2550
|
-
var ucs2length = function ucs2length(str) {
|
|
2544
|
+
var ucs2length$1 = function ucs2length(str) {
|
|
2551
2545
|
var length = 0
|
|
2552
2546
|
, len = str.length
|
|
2553
2547
|
, pos = 0
|
|
@@ -2564,16 +2558,16 @@ var ucs2length = function ucs2length(str) {
|
|
|
2564
2558
|
return length;
|
|
2565
2559
|
};
|
|
2566
2560
|
|
|
2567
|
-
var util = {
|
|
2561
|
+
var util$5 = {
|
|
2568
2562
|
copy: copy,
|
|
2569
2563
|
checkDataType: checkDataType,
|
|
2570
2564
|
checkDataTypes: checkDataTypes,
|
|
2571
2565
|
coerceToTypes: coerceToTypes,
|
|
2572
|
-
toHash: toHash,
|
|
2566
|
+
toHash: toHash$1,
|
|
2573
2567
|
getProperty: getProperty,
|
|
2574
2568
|
escapeQuotes: escapeQuotes,
|
|
2575
2569
|
equal: fastDeepEqual,
|
|
2576
|
-
ucs2length: ucs2length,
|
|
2570
|
+
ucs2length: ucs2length$1,
|
|
2577
2571
|
varOccurences: varOccurences,
|
|
2578
2572
|
varReplace: varReplace,
|
|
2579
2573
|
schemaHasRules: schemaHasRules,
|
|
@@ -2624,7 +2618,7 @@ function checkDataTypes(dataTypes, data, strictNumbers) {
|
|
|
2624
2618
|
case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);
|
|
2625
2619
|
default:
|
|
2626
2620
|
var code = '';
|
|
2627
|
-
var types = toHash(dataTypes);
|
|
2621
|
+
var types = toHash$1(dataTypes);
|
|
2628
2622
|
if (types.array && types.object) {
|
|
2629
2623
|
code = types.null ? '(': '(!' + data + ' || ';
|
|
2630
2624
|
code += 'typeof ' + data + ' !== "object")';
|
|
@@ -2641,7 +2635,7 @@ function checkDataTypes(dataTypes, data, strictNumbers) {
|
|
|
2641
2635
|
}
|
|
2642
2636
|
|
|
2643
2637
|
|
|
2644
|
-
var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);
|
|
2638
|
+
var COERCE_TO_TYPES = toHash$1([ 'string', 'number', 'integer', 'boolean', 'null' ]);
|
|
2645
2639
|
function coerceToTypes(optionCoerceTypes, dataTypes) {
|
|
2646
2640
|
if (Array.isArray(dataTypes)) {
|
|
2647
2641
|
var types = [];
|
|
@@ -2659,19 +2653,19 @@ function coerceToTypes(optionCoerceTypes, dataTypes) {
|
|
|
2659
2653
|
}
|
|
2660
2654
|
|
|
2661
2655
|
|
|
2662
|
-
function toHash(arr) {
|
|
2656
|
+
function toHash$1(arr) {
|
|
2663
2657
|
var hash = {};
|
|
2664
2658
|
for (var i=0; i<arr.length; i++) hash[arr[i]] = true;
|
|
2665
2659
|
return hash;
|
|
2666
2660
|
}
|
|
2667
2661
|
|
|
2668
2662
|
|
|
2669
|
-
var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
|
2663
|
+
var IDENTIFIER$1 = /^[a-z$_][a-z$_0-9]*$/i;
|
|
2670
2664
|
var SINGLE_QUOTE = /'|\\/g;
|
|
2671
2665
|
function getProperty(key) {
|
|
2672
2666
|
return typeof key == 'number'
|
|
2673
2667
|
? '[' + key + ']'
|
|
2674
|
-
: IDENTIFIER.test(key)
|
|
2668
|
+
: IDENTIFIER$1.test(key)
|
|
2675
2669
|
? '.' + key
|
|
2676
2670
|
: "['" + escapeQuotes(key) + "']";
|
|
2677
2671
|
}
|
|
@@ -2739,17 +2733,17 @@ function getPath(currentPath, prop, jsonPointers) {
|
|
|
2739
2733
|
}
|
|
2740
2734
|
|
|
2741
2735
|
|
|
2742
|
-
var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
|
|
2743
|
-
var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
|
2736
|
+
var JSON_POINTER$1 = /^\/(?:[^~]|~0|~1)*$/;
|
|
2737
|
+
var RELATIVE_JSON_POINTER$1 = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
|
2744
2738
|
function getData($data, lvl, paths) {
|
|
2745
2739
|
var up, jsonPointer, data, matches;
|
|
2746
2740
|
if ($data === '') return 'rootData';
|
|
2747
2741
|
if ($data[0] == '/') {
|
|
2748
|
-
if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data);
|
|
2742
|
+
if (!JSON_POINTER$1.test($data)) throw new Error('Invalid JSON-pointer: ' + $data);
|
|
2749
2743
|
jsonPointer = $data;
|
|
2750
2744
|
data = 'rootData';
|
|
2751
2745
|
} else {
|
|
2752
|
-
matches = $data.match(RELATIVE_JSON_POINTER);
|
|
2746
|
+
matches = $data.match(RELATIVE_JSON_POINTER$1);
|
|
2753
2747
|
if (!matches) throw new Error('Invalid JSON-pointer: ' + $data);
|
|
2754
2748
|
up = +matches[1];
|
|
2755
2749
|
jsonPointer = matches[2];
|
|
@@ -2801,15 +2795,17 @@ function unescapeJsonPointer(str) {
|
|
|
2801
2795
|
return str.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
2802
2796
|
}
|
|
2803
2797
|
|
|
2804
|
-
var
|
|
2798
|
+
var util$4 = util$5;
|
|
2799
|
+
|
|
2800
|
+
var schema_obj = SchemaObject$2;
|
|
2805
2801
|
|
|
2806
|
-
function SchemaObject(obj) {
|
|
2807
|
-
util.copy(obj, this);
|
|
2802
|
+
function SchemaObject$2(obj) {
|
|
2803
|
+
util$4.copy(obj, this);
|
|
2808
2804
|
}
|
|
2809
2805
|
|
|
2810
|
-
var jsonSchemaTraverse =
|
|
2806
|
+
var jsonSchemaTraverse = {exports: {}};
|
|
2811
2807
|
|
|
2812
|
-
var traverse =
|
|
2808
|
+
var traverse$1 = jsonSchemaTraverse.exports = function (schema, opts, cb) {
|
|
2813
2809
|
// Legacy support for v0.3.1 and earlier.
|
|
2814
2810
|
if (typeof opts == 'function') {
|
|
2815
2811
|
cb = opts;
|
|
@@ -2824,7 +2820,7 @@ var traverse = module.exports = function (schema, opts, cb) {
|
|
|
2824
2820
|
};
|
|
2825
2821
|
|
|
2826
2822
|
|
|
2827
|
-
traverse.keywords = {
|
|
2823
|
+
traverse$1.keywords = {
|
|
2828
2824
|
additionalItems: true,
|
|
2829
2825
|
items: true,
|
|
2830
2826
|
contains: true,
|
|
@@ -2833,21 +2829,21 @@ traverse.keywords = {
|
|
|
2833
2829
|
not: true
|
|
2834
2830
|
};
|
|
2835
2831
|
|
|
2836
|
-
traverse.arrayKeywords = {
|
|
2832
|
+
traverse$1.arrayKeywords = {
|
|
2837
2833
|
items: true,
|
|
2838
2834
|
allOf: true,
|
|
2839
2835
|
anyOf: true,
|
|
2840
2836
|
oneOf: true
|
|
2841
2837
|
};
|
|
2842
2838
|
|
|
2843
|
-
traverse.propsKeywords = {
|
|
2839
|
+
traverse$1.propsKeywords = {
|
|
2844
2840
|
definitions: true,
|
|
2845
2841
|
properties: true,
|
|
2846
2842
|
patternProperties: true,
|
|
2847
2843
|
dependencies: true
|
|
2848
2844
|
};
|
|
2849
2845
|
|
|
2850
|
-
traverse.skipKeywords = {
|
|
2846
|
+
traverse$1.skipKeywords = {
|
|
2851
2847
|
default: true,
|
|
2852
2848
|
enum: true,
|
|
2853
2849
|
const: true,
|
|
@@ -2875,16 +2871,16 @@ function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr,
|
|
|
2875
2871
|
for (var key in schema) {
|
|
2876
2872
|
var sch = schema[key];
|
|
2877
2873
|
if (Array.isArray(sch)) {
|
|
2878
|
-
if (key in traverse.arrayKeywords) {
|
|
2874
|
+
if (key in traverse$1.arrayKeywords) {
|
|
2879
2875
|
for (var i=0; i<sch.length; i++)
|
|
2880
2876
|
_traverse(opts, pre, post, sch[i], jsonPtr + '/' + key + '/' + i, rootSchema, jsonPtr, key, schema, i);
|
|
2881
2877
|
}
|
|
2882
|
-
} else if (key in traverse.propsKeywords) {
|
|
2878
|
+
} else if (key in traverse$1.propsKeywords) {
|
|
2883
2879
|
if (sch && typeof sch == 'object') {
|
|
2884
2880
|
for (var prop in sch)
|
|
2885
2881
|
_traverse(opts, pre, post, sch[prop], jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);
|
|
2886
2882
|
}
|
|
2887
|
-
} else if (key in traverse.keywords || (opts.allKeys && !(key in traverse.skipKeywords))) {
|
|
2883
|
+
} else if (key in traverse$1.keywords || (opts.allKeys && !(key in traverse$1.skipKeywords))) {
|
|
2888
2884
|
_traverse(opts, pre, post, sch, jsonPtr + '/' + key, rootSchema, jsonPtr, key, schema);
|
|
2889
2885
|
}
|
|
2890
2886
|
}
|
|
@@ -2896,16 +2892,21 @@ function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr,
|
|
|
2896
2892
|
function escapeJsonPtr(str) {
|
|
2897
2893
|
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
2898
2894
|
}
|
|
2899
|
-
});
|
|
2900
2895
|
|
|
2901
|
-
var
|
|
2896
|
+
var URI$1 = uri_all.exports
|
|
2897
|
+
, equal$1 = fastDeepEqual
|
|
2898
|
+
, util$3 = util$5
|
|
2899
|
+
, SchemaObject$1 = schema_obj
|
|
2900
|
+
, traverse = jsonSchemaTraverse.exports;
|
|
2901
|
+
|
|
2902
|
+
var resolve_1 = resolve$3;
|
|
2902
2903
|
|
|
2903
|
-
resolve.normalizeId = normalizeId;
|
|
2904
|
-
resolve.fullPath = getFullPath;
|
|
2905
|
-
resolve.url = resolveUrl;
|
|
2906
|
-
resolve.ids = resolveIds;
|
|
2907
|
-
resolve.inlineRef = inlineRef;
|
|
2908
|
-
resolve.schema = resolveSchema;
|
|
2904
|
+
resolve$3.normalizeId = normalizeId;
|
|
2905
|
+
resolve$3.fullPath = getFullPath;
|
|
2906
|
+
resolve$3.url = resolveUrl;
|
|
2907
|
+
resolve$3.ids = resolveIds;
|
|
2908
|
+
resolve$3.inlineRef = inlineRef;
|
|
2909
|
+
resolve$3.schema = resolveSchema;
|
|
2909
2910
|
|
|
2910
2911
|
/**
|
|
2911
2912
|
* [resolve and compile the references ($ref)]
|
|
@@ -2915,16 +2916,16 @@ resolve.schema = resolveSchema;
|
|
|
2915
2916
|
* @param {String} ref reference to resolve
|
|
2916
2917
|
* @return {Object|Function} schema object (if the schema can be inlined) or validation function
|
|
2917
2918
|
*/
|
|
2918
|
-
function resolve(compile, root, ref) {
|
|
2919
|
+
function resolve$3(compile, root, ref) {
|
|
2919
2920
|
/* jshint validthis: true */
|
|
2920
2921
|
var refVal = this._refs[ref];
|
|
2921
2922
|
if (typeof refVal == 'string') {
|
|
2922
2923
|
if (this._refs[refVal]) refVal = this._refs[refVal];
|
|
2923
|
-
else return resolve.call(this, compile, root, refVal);
|
|
2924
|
+
else return resolve$3.call(this, compile, root, refVal);
|
|
2924
2925
|
}
|
|
2925
2926
|
|
|
2926
2927
|
refVal = refVal || this._schemas[ref];
|
|
2927
|
-
if (refVal instanceof
|
|
2928
|
+
if (refVal instanceof SchemaObject$1) {
|
|
2928
2929
|
return inlineRef(refVal.schema, this._opts.inlineRefs)
|
|
2929
2930
|
? refVal.schema
|
|
2930
2931
|
: refVal.validate || this._compile(refVal);
|
|
@@ -2938,7 +2939,7 @@ function resolve(compile, root, ref) {
|
|
|
2938
2939
|
baseId = res.baseId;
|
|
2939
2940
|
}
|
|
2940
2941
|
|
|
2941
|
-
if (schema instanceof
|
|
2942
|
+
if (schema instanceof SchemaObject$1) {
|
|
2942
2943
|
v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);
|
|
2943
2944
|
} else if (schema !== undefined) {
|
|
2944
2945
|
v = inlineRef(schema, this._opts.inlineRefs)
|
|
@@ -2959,7 +2960,7 @@ function resolve(compile, root, ref) {
|
|
|
2959
2960
|
*/
|
|
2960
2961
|
function resolveSchema(root, ref) {
|
|
2961
2962
|
/* jshint validthis: true */
|
|
2962
|
-
var p =
|
|
2963
|
+
var p = URI$1.parse(ref)
|
|
2963
2964
|
, refPath = _getFullPath(p)
|
|
2964
2965
|
, baseId = getFullPath(this._getId(root.schema));
|
|
2965
2966
|
if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
|
|
@@ -2967,12 +2968,12 @@ function resolveSchema(root, ref) {
|
|
|
2967
2968
|
var refVal = this._refs[id];
|
|
2968
2969
|
if (typeof refVal == 'string') {
|
|
2969
2970
|
return resolveRecursive.call(this, root, refVal, p);
|
|
2970
|
-
} else if (refVal instanceof
|
|
2971
|
+
} else if (refVal instanceof SchemaObject$1) {
|
|
2971
2972
|
if (!refVal.validate) this._compile(refVal);
|
|
2972
2973
|
root = refVal;
|
|
2973
2974
|
} else {
|
|
2974
2975
|
refVal = this._schemas[id];
|
|
2975
|
-
if (refVal instanceof
|
|
2976
|
+
if (refVal instanceof SchemaObject$1) {
|
|
2976
2977
|
if (!refVal.validate) this._compile(refVal);
|
|
2977
2978
|
if (id == normalizeId(ref))
|
|
2978
2979
|
return { schema: refVal, root: root, baseId: baseId };
|
|
@@ -3003,7 +3004,7 @@ function resolveRecursive(root, ref, parsedRef) {
|
|
|
3003
3004
|
}
|
|
3004
3005
|
|
|
3005
3006
|
|
|
3006
|
-
var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']);
|
|
3007
|
+
var PREVENT_SCOPE_CHANGE = util$3.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']);
|
|
3007
3008
|
/* @this Ajv */
|
|
3008
3009
|
function getJsonPointer(parsedRef, baseId, schema, root) {
|
|
3009
3010
|
/* jshint validthis: true */
|
|
@@ -3014,7 +3015,7 @@ function getJsonPointer(parsedRef, baseId, schema, root) {
|
|
|
3014
3015
|
for (var i = 1; i < parts.length; i++) {
|
|
3015
3016
|
var part = parts[i];
|
|
3016
3017
|
if (part) {
|
|
3017
|
-
part = util.unescapeFragment(part);
|
|
3018
|
+
part = util$3.unescapeFragment(part);
|
|
3018
3019
|
schema = schema[part];
|
|
3019
3020
|
if (schema === undefined) break;
|
|
3020
3021
|
var id;
|
|
@@ -3038,7 +3039,7 @@ function getJsonPointer(parsedRef, baseId, schema, root) {
|
|
|
3038
3039
|
}
|
|
3039
3040
|
|
|
3040
3041
|
|
|
3041
|
-
var SIMPLE_INLINED = util.toHash([
|
|
3042
|
+
var SIMPLE_INLINED = util$3.toHash([
|
|
3042
3043
|
'type', 'format', 'pattern',
|
|
3043
3044
|
'maxLength', 'minLength',
|
|
3044
3045
|
'maxProperties', 'minProperties',
|
|
@@ -3098,13 +3099,13 @@ function countKeys(schema) {
|
|
|
3098
3099
|
|
|
3099
3100
|
function getFullPath(id, normalize) {
|
|
3100
3101
|
if (normalize !== false) id = normalizeId(id);
|
|
3101
|
-
var p =
|
|
3102
|
+
var p = URI$1.parse(id);
|
|
3102
3103
|
return _getFullPath(p);
|
|
3103
3104
|
}
|
|
3104
3105
|
|
|
3105
3106
|
|
|
3106
3107
|
function _getFullPath(p) {
|
|
3107
|
-
return
|
|
3108
|
+
return URI$1.serialize(p).split('#')[0] + '#';
|
|
3108
3109
|
}
|
|
3109
3110
|
|
|
3110
3111
|
|
|
@@ -3116,7 +3117,7 @@ function normalizeId(id) {
|
|
|
3116
3117
|
|
|
3117
3118
|
function resolveUrl(baseId, id) {
|
|
3118
3119
|
id = normalizeId(id);
|
|
3119
|
-
return
|
|
3120
|
+
return URI$1.resolve(baseId, id);
|
|
3120
3121
|
}
|
|
3121
3122
|
|
|
3122
3123
|
|
|
@@ -3128,25 +3129,25 @@ function resolveIds(schema) {
|
|
|
3128
3129
|
var localRefs = {};
|
|
3129
3130
|
var self = this;
|
|
3130
3131
|
|
|
3131
|
-
|
|
3132
|
+
traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
3132
3133
|
if (jsonPtr === '') return;
|
|
3133
3134
|
var id = self._getId(sch);
|
|
3134
3135
|
var baseId = baseIds[parentJsonPtr];
|
|
3135
3136
|
var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword;
|
|
3136
3137
|
if (keyIndex !== undefined)
|
|
3137
|
-
fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex));
|
|
3138
|
+
fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util$3.escapeFragment(keyIndex));
|
|
3138
3139
|
|
|
3139
3140
|
if (typeof id == 'string') {
|
|
3140
|
-
id = baseId = normalizeId(baseId ?
|
|
3141
|
+
id = baseId = normalizeId(baseId ? URI$1.resolve(baseId, id) : id);
|
|
3141
3142
|
|
|
3142
3143
|
var refVal = self._refs[id];
|
|
3143
3144
|
if (typeof refVal == 'string') refVal = self._refs[refVal];
|
|
3144
3145
|
if (refVal && refVal.schema) {
|
|
3145
|
-
if (!
|
|
3146
|
+
if (!equal$1(sch, refVal.schema))
|
|
3146
3147
|
throw new Error('id "' + id + '" resolves to more than one schema');
|
|
3147
3148
|
} else if (id != normalizeId(fullPath)) {
|
|
3148
3149
|
if (id[0] == '#') {
|
|
3149
|
-
if (localRefs[id] && !
|
|
3150
|
+
if (localRefs[id] && !equal$1(sch, localRefs[id]))
|
|
3150
3151
|
throw new Error('id "' + id + '" resolves to more than one schema');
|
|
3151
3152
|
localRefs[id] = sch;
|
|
3152
3153
|
} else {
|
|
@@ -3161,28 +3162,30 @@ function resolveIds(schema) {
|
|
|
3161
3162
|
return localRefs;
|
|
3162
3163
|
}
|
|
3163
3164
|
|
|
3165
|
+
var resolve$2 = resolve_1;
|
|
3166
|
+
|
|
3164
3167
|
var error_classes = {
|
|
3165
|
-
Validation: errorSubclass(ValidationError),
|
|
3166
|
-
MissingRef: errorSubclass(MissingRefError)
|
|
3168
|
+
Validation: errorSubclass(ValidationError$1),
|
|
3169
|
+
MissingRef: errorSubclass(MissingRefError$1)
|
|
3167
3170
|
};
|
|
3168
3171
|
|
|
3169
3172
|
|
|
3170
|
-
function ValidationError(errors) {
|
|
3173
|
+
function ValidationError$1(errors) {
|
|
3171
3174
|
this.message = 'validation failed';
|
|
3172
3175
|
this.errors = errors;
|
|
3173
3176
|
this.ajv = this.validation = true;
|
|
3174
3177
|
}
|
|
3175
3178
|
|
|
3176
3179
|
|
|
3177
|
-
MissingRefError.message = function (baseId, ref) {
|
|
3180
|
+
MissingRefError$1.message = function (baseId, ref) {
|
|
3178
3181
|
return 'can\'t resolve reference ' + ref + ' from id ' + baseId;
|
|
3179
3182
|
};
|
|
3180
3183
|
|
|
3181
3184
|
|
|
3182
|
-
function MissingRefError(baseId, ref, message) {
|
|
3183
|
-
this.message = message || MissingRefError.message(baseId, ref);
|
|
3184
|
-
this.missingRef =
|
|
3185
|
-
this.missingSchema =
|
|
3185
|
+
function MissingRefError$1(baseId, ref, message) {
|
|
3186
|
+
this.message = message || MissingRefError$1.message(baseId, ref);
|
|
3187
|
+
this.missingRef = resolve$2.url(baseId, ref);
|
|
3188
|
+
this.missingSchema = resolve$2.normalizeId(resolve$2.fullPath(this.missingRef));
|
|
3186
3189
|
}
|
|
3187
3190
|
|
|
3188
3191
|
|
|
@@ -3250,7 +3253,7 @@ var fastJsonStableStringify = function (data, opts) {
|
|
|
3250
3253
|
})(data);
|
|
3251
3254
|
};
|
|
3252
3255
|
|
|
3253
|
-
var validate = function generate_validate(it, $keyword, $ruleType) {
|
|
3256
|
+
var validate$1 = function generate_validate(it, $keyword, $ruleType) {
|
|
3254
3257
|
var out = '';
|
|
3255
3258
|
var $async = it.schema.$async === true,
|
|
3256
3259
|
$refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'),
|
|
@@ -3732,17 +3735,24 @@ var validate = function generate_validate(it, $keyword, $ruleType) {
|
|
|
3732
3735
|
return out;
|
|
3733
3736
|
};
|
|
3734
3737
|
|
|
3738
|
+
var resolve$1 = resolve_1
|
|
3739
|
+
, util$2 = util$5
|
|
3740
|
+
, errorClasses$1 = error_classes
|
|
3741
|
+
, stableStringify$1 = fastJsonStableStringify;
|
|
3742
|
+
|
|
3743
|
+
var validateGenerator = validate$1;
|
|
3744
|
+
|
|
3735
3745
|
/**
|
|
3736
3746
|
* Functions below are used inside compiled validations function
|
|
3737
3747
|
*/
|
|
3738
3748
|
|
|
3739
|
-
var ucs2length
|
|
3740
|
-
|
|
3749
|
+
var ucs2length = util$2.ucs2length;
|
|
3750
|
+
var equal = fastDeepEqual;
|
|
3741
3751
|
|
|
3742
3752
|
// this error is thrown by async schemas to return validation errors via exception
|
|
3743
|
-
var ValidationError
|
|
3753
|
+
var ValidationError = errorClasses$1.Validation;
|
|
3744
3754
|
|
|
3745
|
-
var compile_1 = compile;
|
|
3755
|
+
var compile_1 = compile$1;
|
|
3746
3756
|
|
|
3747
3757
|
|
|
3748
3758
|
/**
|
|
@@ -3754,7 +3764,7 @@ var compile_1 = compile;
|
|
|
3754
3764
|
* @param {String} baseId base ID for IDs in the schema
|
|
3755
3765
|
* @return {Function} validation function
|
|
3756
3766
|
*/
|
|
3757
|
-
function compile(schema, root, localRefs, baseId) {
|
|
3767
|
+
function compile$1(schema, root, localRefs, baseId) {
|
|
3758
3768
|
/* jshint validthis: true, evil: true */
|
|
3759
3769
|
/* eslint no-shadow: 0 */
|
|
3760
3770
|
var self = this
|
|
@@ -3806,11 +3816,11 @@ function compile(schema, root, localRefs, baseId) {
|
|
|
3806
3816
|
function localCompile(_schema, _root, localRefs, baseId) {
|
|
3807
3817
|
var isRoot = !_root || (_root && _root.schema == _schema);
|
|
3808
3818
|
if (_root.schema != root.schema)
|
|
3809
|
-
return compile.call(self, _schema, _root, localRefs, baseId);
|
|
3819
|
+
return compile$1.call(self, _schema, _root, localRefs, baseId);
|
|
3810
3820
|
|
|
3811
3821
|
var $async = _schema.$async === true;
|
|
3812
3822
|
|
|
3813
|
-
var sourceCode =
|
|
3823
|
+
var sourceCode = validateGenerator({
|
|
3814
3824
|
isTop: true,
|
|
3815
3825
|
schema: _schema,
|
|
3816
3826
|
isRoot: isRoot,
|
|
@@ -3819,11 +3829,11 @@ function compile(schema, root, localRefs, baseId) {
|
|
|
3819
3829
|
schemaPath: '',
|
|
3820
3830
|
errSchemaPath: '#',
|
|
3821
3831
|
errorPath: '""',
|
|
3822
|
-
MissingRefError:
|
|
3832
|
+
MissingRefError: errorClasses$1.MissingRef,
|
|
3823
3833
|
RULES: RULES,
|
|
3824
|
-
validate:
|
|
3825
|
-
util: util,
|
|
3826
|
-
resolve:
|
|
3834
|
+
validate: validateGenerator,
|
|
3835
|
+
util: util$2,
|
|
3836
|
+
resolve: resolve$1,
|
|
3827
3837
|
resolveRef: resolveRef,
|
|
3828
3838
|
usePattern: usePattern,
|
|
3829
3839
|
useDefault: useDefault,
|
|
@@ -3835,12 +3845,12 @@ function compile(schema, root, localRefs, baseId) {
|
|
|
3835
3845
|
});
|
|
3836
3846
|
|
|
3837
3847
|
sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode)
|
|
3838
|
-
+ vars(defaults, defaultCode) + vars(customRules, customRuleCode)
|
|
3848
|
+
+ vars(defaults, defaultCode) + vars(customRules, customRuleCode$1)
|
|
3839
3849
|
+ sourceCode;
|
|
3840
3850
|
|
|
3841
3851
|
if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);
|
|
3842
3852
|
// console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
|
|
3843
|
-
var validate
|
|
3853
|
+
var validate;
|
|
3844
3854
|
try {
|
|
3845
3855
|
var makeValidate = new Function(
|
|
3846
3856
|
'self',
|
|
@@ -3856,7 +3866,7 @@ function compile(schema, root, localRefs, baseId) {
|
|
|
3856
3866
|
sourceCode
|
|
3857
3867
|
);
|
|
3858
3868
|
|
|
3859
|
-
validate
|
|
3869
|
+
validate = makeValidate(
|
|
3860
3870
|
self,
|
|
3861
3871
|
RULES,
|
|
3862
3872
|
formats,
|
|
@@ -3864,36 +3874,36 @@ function compile(schema, root, localRefs, baseId) {
|
|
|
3864
3874
|
refVal,
|
|
3865
3875
|
defaults,
|
|
3866
3876
|
customRules,
|
|
3867
|
-
|
|
3868
|
-
ucs2length
|
|
3869
|
-
ValidationError
|
|
3877
|
+
equal,
|
|
3878
|
+
ucs2length,
|
|
3879
|
+
ValidationError
|
|
3870
3880
|
);
|
|
3871
3881
|
|
|
3872
|
-
refVal[0] = validate
|
|
3882
|
+
refVal[0] = validate;
|
|
3873
3883
|
} catch(e) {
|
|
3874
3884
|
self.logger.error('Error compiling schema, function code:', sourceCode);
|
|
3875
3885
|
throw e;
|
|
3876
3886
|
}
|
|
3877
3887
|
|
|
3878
|
-
validate
|
|
3879
|
-
validate
|
|
3880
|
-
validate
|
|
3881
|
-
validate
|
|
3882
|
-
validate
|
|
3883
|
-
if ($async) validate
|
|
3888
|
+
validate.schema = _schema;
|
|
3889
|
+
validate.errors = null;
|
|
3890
|
+
validate.refs = refs;
|
|
3891
|
+
validate.refVal = refVal;
|
|
3892
|
+
validate.root = isRoot ? validate : _root;
|
|
3893
|
+
if ($async) validate.$async = true;
|
|
3884
3894
|
if (opts.sourceCode === true) {
|
|
3885
|
-
validate
|
|
3895
|
+
validate.source = {
|
|
3886
3896
|
code: sourceCode,
|
|
3887
3897
|
patterns: patterns,
|
|
3888
3898
|
defaults: defaults
|
|
3889
3899
|
};
|
|
3890
3900
|
}
|
|
3891
3901
|
|
|
3892
|
-
return validate
|
|
3902
|
+
return validate;
|
|
3893
3903
|
}
|
|
3894
3904
|
|
|
3895
3905
|
function resolveRef(baseId, ref, isRoot) {
|
|
3896
|
-
ref =
|
|
3906
|
+
ref = resolve$1.url(baseId, ref);
|
|
3897
3907
|
var refIndex = refs[ref];
|
|
3898
3908
|
var _refVal, refCode;
|
|
3899
3909
|
if (refIndex !== undefined) {
|
|
@@ -3911,13 +3921,13 @@ function compile(schema, root, localRefs, baseId) {
|
|
|
3911
3921
|
}
|
|
3912
3922
|
|
|
3913
3923
|
refCode = addLocalRef(ref);
|
|
3914
|
-
var v =
|
|
3924
|
+
var v = resolve$1.call(self, localCompile, root, ref);
|
|
3915
3925
|
if (v === undefined) {
|
|
3916
3926
|
var localSchema = localRefs && localRefs[ref];
|
|
3917
3927
|
if (localSchema) {
|
|
3918
|
-
v =
|
|
3928
|
+
v = resolve$1.inlineRef(localSchema, opts.inlineRefs)
|
|
3919
3929
|
? localSchema
|
|
3920
|
-
: compile.call(self, localSchema, root, localRefs, baseId);
|
|
3930
|
+
: compile$1.call(self, localSchema, root, localRefs, baseId);
|
|
3921
3931
|
}
|
|
3922
3932
|
}
|
|
3923
3933
|
|
|
@@ -3966,10 +3976,10 @@ function compile(schema, root, localRefs, baseId) {
|
|
|
3966
3976
|
case 'number':
|
|
3967
3977
|
return '' + value;
|
|
3968
3978
|
case 'string':
|
|
3969
|
-
return util.toQuotedString(value);
|
|
3979
|
+
return util$2.toQuotedString(value);
|
|
3970
3980
|
case 'object':
|
|
3971
3981
|
if (value === null) return 'null';
|
|
3972
|
-
var valueStr =
|
|
3982
|
+
var valueStr = stableStringify$1(value);
|
|
3973
3983
|
var index = defaultsHash[valueStr];
|
|
3974
3984
|
if (index === undefined) {
|
|
3975
3985
|
index = defaultsHash[valueStr] = defaults.length;
|
|
@@ -4084,7 +4094,7 @@ function compIndex(schema, root, baseId) {
|
|
|
4084
4094
|
|
|
4085
4095
|
|
|
4086
4096
|
function patternCode(i, patterns) {
|
|
4087
|
-
return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');';
|
|
4097
|
+
return 'var pattern' + i + ' = new RegExp(' + util$2.toQuotedString(patterns[i]) + ');';
|
|
4088
4098
|
}
|
|
4089
4099
|
|
|
4090
4100
|
|
|
@@ -4098,7 +4108,7 @@ function refValCode(i, refVal) {
|
|
|
4098
4108
|
}
|
|
4099
4109
|
|
|
4100
4110
|
|
|
4101
|
-
function customRuleCode(i) {
|
|
4111
|
+
function customRuleCode$1(i) {
|
|
4102
4112
|
return 'var customRule' + i + ' = customRules[' + i + '];';
|
|
4103
4113
|
}
|
|
4104
4114
|
|
|
@@ -4111,33 +4121,33 @@ function vars(arr, statement) {
|
|
|
4111
4121
|
return code;
|
|
4112
4122
|
}
|
|
4113
4123
|
|
|
4114
|
-
var cache =
|
|
4124
|
+
var cache = {exports: {}};
|
|
4115
4125
|
|
|
4116
|
-
|
|
4117
|
-
var Cache = module.exports = function Cache() {
|
|
4126
|
+
var Cache$1 = cache.exports = function Cache() {
|
|
4118
4127
|
this._cache = {};
|
|
4119
4128
|
};
|
|
4120
4129
|
|
|
4121
4130
|
|
|
4122
|
-
Cache.prototype.put = function Cache_put(key, value) {
|
|
4131
|
+
Cache$1.prototype.put = function Cache_put(key, value) {
|
|
4123
4132
|
this._cache[key] = value;
|
|
4124
4133
|
};
|
|
4125
4134
|
|
|
4126
4135
|
|
|
4127
|
-
Cache.prototype.get = function Cache_get(key) {
|
|
4136
|
+
Cache$1.prototype.get = function Cache_get(key) {
|
|
4128
4137
|
return this._cache[key];
|
|
4129
4138
|
};
|
|
4130
4139
|
|
|
4131
4140
|
|
|
4132
|
-
Cache.prototype.del = function Cache_del(key) {
|
|
4141
|
+
Cache$1.prototype.del = function Cache_del(key) {
|
|
4133
4142
|
delete this._cache[key];
|
|
4134
4143
|
};
|
|
4135
4144
|
|
|
4136
4145
|
|
|
4137
|
-
Cache.prototype.clear = function Cache_clear() {
|
|
4146
|
+
Cache$1.prototype.clear = function Cache_clear() {
|
|
4138
4147
|
this._cache = {};
|
|
4139
4148
|
};
|
|
4140
|
-
|
|
4149
|
+
|
|
4150
|
+
var util$1 = util$5;
|
|
4141
4151
|
|
|
4142
4152
|
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
4143
4153
|
var DAYS = [0,31,28,31,30,31,30,31,31,30,31,30,31];
|
|
@@ -4153,20 +4163,20 @@ var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|
|
|
|
4153
4163
|
// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
|
|
4154
4164
|
var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
|
|
4155
4165
|
var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
|
4156
|
-
var JSON_POINTER
|
|
4166
|
+
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
|
4157
4167
|
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
|
4158
|
-
var RELATIVE_JSON_POINTER
|
|
4168
|
+
var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
|
|
4159
4169
|
|
|
4160
4170
|
|
|
4161
|
-
var formats_1 = formats;
|
|
4171
|
+
var formats_1 = formats$1;
|
|
4162
4172
|
|
|
4163
|
-
function formats(mode) {
|
|
4173
|
+
function formats$1(mode) {
|
|
4164
4174
|
mode = mode == 'full' ? 'full' : 'fast';
|
|
4165
|
-
return util.copy(formats[mode]);
|
|
4175
|
+
return util$1.copy(formats$1[mode]);
|
|
4166
4176
|
}
|
|
4167
4177
|
|
|
4168
4178
|
|
|
4169
|
-
formats.fast = {
|
|
4179
|
+
formats$1.fast = {
|
|
4170
4180
|
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
4171
4181
|
date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,
|
|
4172
4182
|
// date-time: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
@@ -4191,14 +4201,14 @@ formats.fast = {
|
|
|
4191
4201
|
uuid: UUID,
|
|
4192
4202
|
// JSON-pointer: https://tools.ietf.org/html/rfc6901
|
|
4193
4203
|
// uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A
|
|
4194
|
-
'json-pointer': JSON_POINTER
|
|
4204
|
+
'json-pointer': JSON_POINTER,
|
|
4195
4205
|
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
|
|
4196
4206
|
// relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00
|
|
4197
|
-
'relative-json-pointer': RELATIVE_JSON_POINTER
|
|
4207
|
+
'relative-json-pointer': RELATIVE_JSON_POINTER
|
|
4198
4208
|
};
|
|
4199
4209
|
|
|
4200
4210
|
|
|
4201
|
-
formats.full = {
|
|
4211
|
+
formats$1.full = {
|
|
4202
4212
|
date: date,
|
|
4203
4213
|
time: time,
|
|
4204
4214
|
'date-time': date_time,
|
|
@@ -4212,9 +4222,9 @@ formats.full = {
|
|
|
4212
4222
|
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
|
|
4213
4223
|
regex: regex,
|
|
4214
4224
|
uuid: UUID,
|
|
4215
|
-
'json-pointer': JSON_POINTER
|
|
4225
|
+
'json-pointer': JSON_POINTER,
|
|
4216
4226
|
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
|
|
4217
|
-
'relative-json-pointer': RELATIVE_JSON_POINTER
|
|
4227
|
+
'relative-json-pointer': RELATIVE_JSON_POINTER
|
|
4218
4228
|
};
|
|
4219
4229
|
|
|
4220
4230
|
|
|
@@ -4521,7 +4531,7 @@ var comment = function generate_comment(it, $keyword, $ruleType) {
|
|
|
4521
4531
|
var out = ' ';
|
|
4522
4532
|
var $schema = it.schema[$keyword];
|
|
4523
4533
|
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
|
4524
|
-
|
|
4534
|
+
!it.opts.allErrors;
|
|
4525
4535
|
var $comment = it.util.toQuotedString($schema);
|
|
4526
4536
|
if (it.opts.$comment === true) {
|
|
4527
4537
|
out += ' console.log(' + ($comment) + ');';
|
|
@@ -6007,7 +6017,7 @@ var pattern = function generate_pattern(it, $keyword, $ruleType) {
|
|
|
6007
6017
|
return out;
|
|
6008
6018
|
};
|
|
6009
6019
|
|
|
6010
|
-
var properties = function generate_properties(it, $keyword, $ruleType) {
|
|
6020
|
+
var properties$2 = function generate_properties(it, $keyword, $ruleType) {
|
|
6011
6021
|
var out = ' ';
|
|
6012
6022
|
var $lvl = it.level;
|
|
6013
6023
|
var $dataLvl = it.dataLevel;
|
|
@@ -6423,7 +6433,7 @@ var propertyNames = function generate_propertyNames(it, $keyword, $ruleType) {
|
|
|
6423
6433
|
return out;
|
|
6424
6434
|
};
|
|
6425
6435
|
|
|
6426
|
-
var required = function generate_required(it, $keyword, $ruleType) {
|
|
6436
|
+
var required$1 = function generate_required(it, $keyword, $ruleType) {
|
|
6427
6437
|
var out = ' ';
|
|
6428
6438
|
var $lvl = it.level;
|
|
6429
6439
|
var $dataLvl = it.dataLevel;
|
|
@@ -6800,16 +6810,17 @@ var dotjs = {
|
|
|
6800
6810
|
not: not,
|
|
6801
6811
|
oneOf: oneOf,
|
|
6802
6812
|
pattern: pattern,
|
|
6803
|
-
properties: properties,
|
|
6813
|
+
properties: properties$2,
|
|
6804
6814
|
propertyNames: propertyNames,
|
|
6805
|
-
required: required,
|
|
6815
|
+
required: required$1,
|
|
6806
6816
|
uniqueItems: uniqueItems,
|
|
6807
|
-
validate: validate
|
|
6817
|
+
validate: validate$1
|
|
6808
6818
|
};
|
|
6809
6819
|
|
|
6810
|
-
var
|
|
6820
|
+
var ruleModules = dotjs
|
|
6821
|
+
, toHash = util$5.toHash;
|
|
6811
6822
|
|
|
6812
|
-
var rules = function rules() {
|
|
6823
|
+
var rules$1 = function rules() {
|
|
6813
6824
|
var RULES = [
|
|
6814
6825
|
{ type: 'number',
|
|
6815
6826
|
rules: [ { 'maximum': ['exclusiveMaximum'] },
|
|
@@ -6833,8 +6844,8 @@ var rules = function rules() {
|
|
|
6833
6844
|
'additionalItems', 'then', 'else'
|
|
6834
6845
|
];
|
|
6835
6846
|
var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];
|
|
6836
|
-
RULES.all = toHash
|
|
6837
|
-
RULES.types = toHash
|
|
6847
|
+
RULES.all = toHash(ALL);
|
|
6848
|
+
RULES.types = toHash(TYPES);
|
|
6838
6849
|
|
|
6839
6850
|
RULES.forEach(function (group) {
|
|
6840
6851
|
group.rules = group.rules.map(function (keyword) {
|
|
@@ -6851,7 +6862,7 @@ var rules = function rules() {
|
|
|
6851
6862
|
ALL.push(keyword);
|
|
6852
6863
|
var rule = RULES.all[keyword] = {
|
|
6853
6864
|
keyword: keyword,
|
|
6854
|
-
code:
|
|
6865
|
+
code: ruleModules[keyword],
|
|
6855
6866
|
implements: implKeywords
|
|
6856
6867
|
};
|
|
6857
6868
|
return rule;
|
|
@@ -6859,13 +6870,13 @@ var rules = function rules() {
|
|
|
6859
6870
|
|
|
6860
6871
|
RULES.all.$comment = {
|
|
6861
6872
|
keyword: '$comment',
|
|
6862
|
-
code:
|
|
6873
|
+
code: ruleModules.$comment
|
|
6863
6874
|
};
|
|
6864
6875
|
|
|
6865
6876
|
if (group.type) RULES.types[group.type] = group;
|
|
6866
6877
|
});
|
|
6867
6878
|
|
|
6868
|
-
RULES.keywords = toHash
|
|
6879
|
+
RULES.keywords = toHash(ALL.concat(KEYWORDS));
|
|
6869
6880
|
RULES.custom = {};
|
|
6870
6881
|
|
|
6871
6882
|
return RULES;
|
|
@@ -6919,7 +6930,7 @@ var data = function (metaSchema, keywordsJsonPointers) {
|
|
|
6919
6930
|
return metaSchema;
|
|
6920
6931
|
};
|
|
6921
6932
|
|
|
6922
|
-
var MissingRefError
|
|
6933
|
+
var MissingRefError = error_classes.MissingRef;
|
|
6923
6934
|
|
|
6924
6935
|
var async = compileAsync;
|
|
6925
6936
|
|
|
@@ -6972,7 +6983,7 @@ function compileAsync(schema, meta, callback) {
|
|
|
6972
6983
|
function _compileAsync(schemaObj) {
|
|
6973
6984
|
try { return self._compile(schemaObj); }
|
|
6974
6985
|
catch(e) {
|
|
6975
|
-
if (e instanceof MissingRefError
|
|
6986
|
+
if (e instanceof MissingRefError) return loadMissingSchema(e);
|
|
6976
6987
|
throw e;
|
|
6977
6988
|
}
|
|
6978
6989
|
|
|
@@ -7236,10 +7247,10 @@ var custom = function generate_custom(it, $keyword, $ruleType) {
|
|
|
7236
7247
|
return out;
|
|
7237
7248
|
};
|
|
7238
7249
|
|
|
7239
|
-
var $schema = "http://json-schema.org/draft-07/schema#";
|
|
7240
|
-
var $id = "http://json-schema.org/draft-07/schema#";
|
|
7250
|
+
var $schema$2 = "http://json-schema.org/draft-07/schema#";
|
|
7251
|
+
var $id$1 = "http://json-schema.org/draft-07/schema#";
|
|
7241
7252
|
var title = "Core schema meta-schema";
|
|
7242
|
-
var definitions = {
|
|
7253
|
+
var definitions$1 = {
|
|
7243
7254
|
schemaArray: {
|
|
7244
7255
|
type: "array",
|
|
7245
7256
|
minItems: 1,
|
|
@@ -7282,7 +7293,7 @@ var definitions = {
|
|
|
7282
7293
|
]
|
|
7283
7294
|
}
|
|
7284
7295
|
};
|
|
7285
|
-
var type = [
|
|
7296
|
+
var type$1 = [
|
|
7286
7297
|
"object",
|
|
7287
7298
|
"boolean"
|
|
7288
7299
|
];
|
|
@@ -7478,33 +7489,22 @@ var properties$1 = {
|
|
|
7478
7489
|
$ref: "#"
|
|
7479
7490
|
}
|
|
7480
7491
|
};
|
|
7481
|
-
var
|
|
7482
|
-
$schema: $schema,
|
|
7483
|
-
$id: $id,
|
|
7492
|
+
var require$$13 = {
|
|
7493
|
+
$schema: $schema$2,
|
|
7494
|
+
$id: $id$1,
|
|
7484
7495
|
title: title,
|
|
7485
|
-
definitions: definitions,
|
|
7486
|
-
type: type,
|
|
7496
|
+
definitions: definitions$1,
|
|
7497
|
+
type: type$1,
|
|
7487
7498
|
properties: properties$1,
|
|
7488
7499
|
"default": true
|
|
7489
7500
|
};
|
|
7490
7501
|
|
|
7491
|
-
var
|
|
7492
|
-
__proto__: null,
|
|
7493
|
-
$schema: $schema,
|
|
7494
|
-
$id: $id,
|
|
7495
|
-
title: title,
|
|
7496
|
-
definitions: definitions,
|
|
7497
|
-
type: type,
|
|
7498
|
-
properties: properties$1,
|
|
7499
|
-
'default': jsonSchemaDraft07
|
|
7500
|
-
});
|
|
7501
|
-
|
|
7502
|
-
var require$$2 = getCjsExportFromNamespace(jsonSchemaDraft07$1);
|
|
7502
|
+
var metaSchema = require$$13;
|
|
7503
7503
|
|
|
7504
7504
|
var definition_schema = {
|
|
7505
7505
|
$id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js',
|
|
7506
7506
|
definitions: {
|
|
7507
|
-
simpleTypes:
|
|
7507
|
+
simpleTypes: metaSchema.definitions.simpleTypes
|
|
7508
7508
|
},
|
|
7509
7509
|
type: 'object',
|
|
7510
7510
|
dependencies: {
|
|
@@ -7514,7 +7514,7 @@ var definition_schema = {
|
|
|
7514
7514
|
valid: {not: {required: ['macro']}}
|
|
7515
7515
|
},
|
|
7516
7516
|
properties: {
|
|
7517
|
-
type:
|
|
7517
|
+
type: metaSchema.properties.type,
|
|
7518
7518
|
schema: {type: 'boolean'},
|
|
7519
7519
|
statements: {type: 'boolean'},
|
|
7520
7520
|
dependencies: {
|
|
@@ -7535,9 +7535,9 @@ var definition_schema = {
|
|
|
7535
7535
|
}
|
|
7536
7536
|
};
|
|
7537
7537
|
|
|
7538
|
-
var IDENTIFIER
|
|
7539
|
-
|
|
7540
|
-
|
|
7538
|
+
var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i;
|
|
7539
|
+
var customRuleCode = custom;
|
|
7540
|
+
var definitionSchema = definition_schema;
|
|
7541
7541
|
|
|
7542
7542
|
var keyword = {
|
|
7543
7543
|
add: addKeyword,
|
|
@@ -7561,7 +7561,7 @@ function addKeyword(keyword, definition) {
|
|
|
7561
7561
|
if (RULES.keywords[keyword])
|
|
7562
7562
|
throw new Error('Keyword ' + keyword + ' is already defined');
|
|
7563
7563
|
|
|
7564
|
-
if (!IDENTIFIER
|
|
7564
|
+
if (!IDENTIFIER.test(keyword))
|
|
7565
7565
|
throw new Error('Keyword ' + keyword + ' is not a valid identifier');
|
|
7566
7566
|
|
|
7567
7567
|
if (definition) {
|
|
@@ -7611,7 +7611,7 @@ function addKeyword(keyword, definition) {
|
|
|
7611
7611
|
keyword: keyword,
|
|
7612
7612
|
definition: definition,
|
|
7613
7613
|
custom: true,
|
|
7614
|
-
code:
|
|
7614
|
+
code: customRuleCode,
|
|
7615
7615
|
implements: definition.implements
|
|
7616
7616
|
};
|
|
7617
7617
|
ruleGroup.rules.push(rule);
|
|
@@ -7670,7 +7670,7 @@ function removeKeyword(keyword) {
|
|
|
7670
7670
|
function validateKeyword(definition, throwError) {
|
|
7671
7671
|
validateKeyword.errors = null;
|
|
7672
7672
|
var v = this._validateKeyword = this._validateKeyword
|
|
7673
|
-
|| this.compile(
|
|
7673
|
+
|| this.compile(definitionSchema, true);
|
|
7674
7674
|
|
|
7675
7675
|
if (v(definition)) return true;
|
|
7676
7676
|
validateKeyword.errors = v.errors;
|
|
@@ -7681,13 +7681,13 @@ function validateKeyword(definition, throwError) {
|
|
|
7681
7681
|
}
|
|
7682
7682
|
|
|
7683
7683
|
var $schema$1 = "http://json-schema.org/draft-07/schema#";
|
|
7684
|
-
var $id
|
|
7684
|
+
var $id = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#";
|
|
7685
7685
|
var description = "Meta-schema for $data reference (JSON Schema extension proposal)";
|
|
7686
|
-
var type
|
|
7687
|
-
var required
|
|
7686
|
+
var type = "object";
|
|
7687
|
+
var required = [
|
|
7688
7688
|
"$data"
|
|
7689
7689
|
];
|
|
7690
|
-
var properties
|
|
7690
|
+
var properties = {
|
|
7691
7691
|
$data: {
|
|
7692
7692
|
type: "string",
|
|
7693
7693
|
anyOf: [
|
|
@@ -7701,56 +7701,52 @@ var properties$2 = {
|
|
|
7701
7701
|
}
|
|
7702
7702
|
};
|
|
7703
7703
|
var additionalProperties = false;
|
|
7704
|
-
var
|
|
7704
|
+
var require$$12 = {
|
|
7705
7705
|
$schema: $schema$1,
|
|
7706
|
-
$id: $id
|
|
7706
|
+
$id: $id,
|
|
7707
7707
|
description: description,
|
|
7708
|
-
type: type
|
|
7709
|
-
required: required
|
|
7710
|
-
properties: properties
|
|
7708
|
+
type: type,
|
|
7709
|
+
required: required,
|
|
7710
|
+
properties: properties,
|
|
7711
7711
|
additionalProperties: additionalProperties
|
|
7712
7712
|
};
|
|
7713
7713
|
|
|
7714
|
-
var
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
Ajv.prototype.
|
|
7731
|
-
Ajv.prototype.
|
|
7732
|
-
Ajv.prototype.
|
|
7733
|
-
Ajv.prototype.
|
|
7734
|
-
Ajv.prototype.
|
|
7735
|
-
|
|
7736
|
-
Ajv.prototype.
|
|
7737
|
-
Ajv.prototype.
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
Ajv.prototype.
|
|
7742
|
-
|
|
7743
|
-
Ajv.prototype.
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
Ajv.
|
|
7748
|
-
Ajv.
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
Ajv.ValidationError = error_classes.Validation;
|
|
7752
|
-
Ajv.MissingRefError = error_classes.MissingRef;
|
|
7753
|
-
Ajv.$dataMetaSchema = data;
|
|
7714
|
+
var compileSchema = compile_1
|
|
7715
|
+
, resolve = resolve_1
|
|
7716
|
+
, Cache = cache.exports
|
|
7717
|
+
, SchemaObject = schema_obj
|
|
7718
|
+
, stableStringify = fastJsonStableStringify
|
|
7719
|
+
, formats = formats_1
|
|
7720
|
+
, rules = rules$1
|
|
7721
|
+
, $dataMetaSchema = data
|
|
7722
|
+
, util = util$5;
|
|
7723
|
+
|
|
7724
|
+
var ajv = Ajv$1;
|
|
7725
|
+
|
|
7726
|
+
Ajv$1.prototype.validate = validate;
|
|
7727
|
+
Ajv$1.prototype.compile = compile;
|
|
7728
|
+
Ajv$1.prototype.addSchema = addSchema;
|
|
7729
|
+
Ajv$1.prototype.addMetaSchema = addMetaSchema;
|
|
7730
|
+
Ajv$1.prototype.validateSchema = validateSchema;
|
|
7731
|
+
Ajv$1.prototype.getSchema = getSchema;
|
|
7732
|
+
Ajv$1.prototype.removeSchema = removeSchema;
|
|
7733
|
+
Ajv$1.prototype.addFormat = addFormat;
|
|
7734
|
+
Ajv$1.prototype.errorsText = errorsText;
|
|
7735
|
+
|
|
7736
|
+
Ajv$1.prototype._addSchema = _addSchema;
|
|
7737
|
+
Ajv$1.prototype._compile = _compile;
|
|
7738
|
+
|
|
7739
|
+
Ajv$1.prototype.compileAsync = async;
|
|
7740
|
+
var customKeyword = keyword;
|
|
7741
|
+
Ajv$1.prototype.addKeyword = customKeyword.add;
|
|
7742
|
+
Ajv$1.prototype.getKeyword = customKeyword.get;
|
|
7743
|
+
Ajv$1.prototype.removeKeyword = customKeyword.remove;
|
|
7744
|
+
Ajv$1.prototype.validateKeyword = customKeyword.validate;
|
|
7745
|
+
|
|
7746
|
+
var errorClasses = error_classes;
|
|
7747
|
+
Ajv$1.ValidationError = errorClasses.Validation;
|
|
7748
|
+
Ajv$1.MissingRefError = errorClasses.MissingRef;
|
|
7749
|
+
Ajv$1.$dataMetaSchema = $dataMetaSchema;
|
|
7754
7750
|
|
|
7755
7751
|
var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema';
|
|
7756
7752
|
|
|
@@ -7763,16 +7759,16 @@ var META_SUPPORT_DATA = ['/properties'];
|
|
|
7763
7759
|
* @param {Object} opts optional options
|
|
7764
7760
|
* @return {Object} ajv instance
|
|
7765
7761
|
*/
|
|
7766
|
-
function Ajv(opts) {
|
|
7767
|
-
if (!(this instanceof Ajv)) return new Ajv(opts);
|
|
7762
|
+
function Ajv$1(opts) {
|
|
7763
|
+
if (!(this instanceof Ajv$1)) return new Ajv$1(opts);
|
|
7768
7764
|
opts = this._opts = util.copy(opts) || {};
|
|
7769
7765
|
setLogger(this);
|
|
7770
7766
|
this._schemas = {};
|
|
7771
7767
|
this._refs = {};
|
|
7772
7768
|
this._fragments = {};
|
|
7773
|
-
this._formats =
|
|
7769
|
+
this._formats = formats(opts.format);
|
|
7774
7770
|
|
|
7775
|
-
this._cache = opts.cache || new
|
|
7771
|
+
this._cache = opts.cache || new Cache;
|
|
7776
7772
|
this._loadingSchemas = {};
|
|
7777
7773
|
this._compilations = [];
|
|
7778
7774
|
this.RULES = rules();
|
|
@@ -7780,7 +7776,7 @@ function Ajv(opts) {
|
|
|
7780
7776
|
|
|
7781
7777
|
opts.loopRequired = opts.loopRequired || Infinity;
|
|
7782
7778
|
if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true;
|
|
7783
|
-
if (opts.serialize === undefined) opts.serialize =
|
|
7779
|
+
if (opts.serialize === undefined) opts.serialize = stableStringify;
|
|
7784
7780
|
this._metaOpts = getMetaSchemaOptions(this);
|
|
7785
7781
|
|
|
7786
7782
|
if (opts.formats) addInitialFormats(this);
|
|
@@ -7801,7 +7797,7 @@ function Ajv(opts) {
|
|
|
7801
7797
|
* @param {Any} data to be validated
|
|
7802
7798
|
* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
|
|
7803
7799
|
*/
|
|
7804
|
-
function validate
|
|
7800
|
+
function validate(schemaKeyRef, data) {
|
|
7805
7801
|
var v;
|
|
7806
7802
|
if (typeof schemaKeyRef == 'string') {
|
|
7807
7803
|
v = this.getSchema(schemaKeyRef);
|
|
@@ -7824,7 +7820,7 @@ function validate$1(schemaKeyRef, data) {
|
|
|
7824
7820
|
* @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords.
|
|
7825
7821
|
* @return {Function} validating function
|
|
7826
7822
|
*/
|
|
7827
|
-
function compile
|
|
7823
|
+
function compile(schema, _meta) {
|
|
7828
7824
|
var schemaObj = this._addSchema(schema, undefined, _meta);
|
|
7829
7825
|
return schemaObj.validate || this._compile(schemaObj);
|
|
7830
7826
|
}
|
|
@@ -7847,7 +7843,7 @@ function addSchema(schema, key, _skipValidation, _meta) {
|
|
|
7847
7843
|
var id = this._getId(schema);
|
|
7848
7844
|
if (id !== undefined && typeof id != 'string')
|
|
7849
7845
|
throw new Error('schema id must be string');
|
|
7850
|
-
key =
|
|
7846
|
+
key = resolve.normalizeId(key || id);
|
|
7851
7847
|
checkUnique(this, key);
|
|
7852
7848
|
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
|
|
7853
7849
|
return this;
|
|
@@ -7924,13 +7920,13 @@ function getSchema(keyRef) {
|
|
|
7924
7920
|
|
|
7925
7921
|
|
|
7926
7922
|
function _getSchemaFragment(self, ref) {
|
|
7927
|
-
var res =
|
|
7923
|
+
var res = resolve.schema.call(self, { schema: {} }, ref);
|
|
7928
7924
|
if (res) {
|
|
7929
7925
|
var schema = res.schema
|
|
7930
7926
|
, root = res.root
|
|
7931
7927
|
, baseId = res.baseId;
|
|
7932
|
-
var v =
|
|
7933
|
-
self._fragments[ref] = new
|
|
7928
|
+
var v = compileSchema.call(self, schema, root, undefined, baseId);
|
|
7929
|
+
self._fragments[ref] = new SchemaObject({
|
|
7934
7930
|
ref: ref,
|
|
7935
7931
|
fragment: true,
|
|
7936
7932
|
schema: schema,
|
|
@@ -7944,7 +7940,7 @@ function _getSchemaFragment(self, ref) {
|
|
|
7944
7940
|
|
|
7945
7941
|
|
|
7946
7942
|
function _getSchemaObj(self, keyRef) {
|
|
7947
|
-
keyRef =
|
|
7943
|
+
keyRef = resolve.normalizeId(keyRef);
|
|
7948
7944
|
return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];
|
|
7949
7945
|
}
|
|
7950
7946
|
|
|
@@ -7982,7 +7978,7 @@ function removeSchema(schemaKeyRef) {
|
|
|
7982
7978
|
this._cache.del(cacheKey);
|
|
7983
7979
|
var id = this._getId(schemaKeyRef);
|
|
7984
7980
|
if (id) {
|
|
7985
|
-
id =
|
|
7981
|
+
id = resolve.normalizeId(id);
|
|
7986
7982
|
delete this._schemas[id];
|
|
7987
7983
|
delete this._refs[id];
|
|
7988
7984
|
}
|
|
@@ -8013,17 +8009,17 @@ function _addSchema(schema, skipValidation, meta, shouldAddSchema) {
|
|
|
8013
8009
|
|
|
8014
8010
|
shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
|
|
8015
8011
|
|
|
8016
|
-
var id =
|
|
8012
|
+
var id = resolve.normalizeId(this._getId(schema));
|
|
8017
8013
|
if (id && shouldAddSchema) checkUnique(this, id);
|
|
8018
8014
|
|
|
8019
8015
|
var willValidate = this._opts.validateSchema !== false && !skipValidation;
|
|
8020
8016
|
var recursiveMeta;
|
|
8021
|
-
if (willValidate && !(recursiveMeta = id && id ==
|
|
8017
|
+
if (willValidate && !(recursiveMeta = id && id == resolve.normalizeId(schema.$schema)))
|
|
8022
8018
|
this.validateSchema(schema, true);
|
|
8023
8019
|
|
|
8024
|
-
var localRefs =
|
|
8020
|
+
var localRefs = resolve.ids.call(this, schema);
|
|
8025
8021
|
|
|
8026
|
-
var schemaObj = new
|
|
8022
|
+
var schemaObj = new SchemaObject({
|
|
8027
8023
|
id: id,
|
|
8028
8024
|
schema: schema,
|
|
8029
8025
|
localRefs: localRefs,
|
|
@@ -8060,7 +8056,7 @@ function _compile(schemaObj, root) {
|
|
|
8060
8056
|
}
|
|
8061
8057
|
|
|
8062
8058
|
var v;
|
|
8063
|
-
try { v =
|
|
8059
|
+
try { v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs); }
|
|
8064
8060
|
catch(e) {
|
|
8065
8061
|
delete schemaObj.validate;
|
|
8066
8062
|
throw e;
|
|
@@ -8156,12 +8152,12 @@ function addFormat(name, format) {
|
|
|
8156
8152
|
function addDefaultMetaSchema(self) {
|
|
8157
8153
|
var $dataSchema;
|
|
8158
8154
|
if (self._opts.$data) {
|
|
8159
|
-
$dataSchema = require$$
|
|
8155
|
+
$dataSchema = require$$12;
|
|
8160
8156
|
self.addMetaSchema($dataSchema, $dataSchema.$id, true);
|
|
8161
8157
|
}
|
|
8162
8158
|
if (self._opts.meta === false) return;
|
|
8163
|
-
var metaSchema = require$$
|
|
8164
|
-
if (self._opts.$data) metaSchema =
|
|
8159
|
+
var metaSchema = require$$13;
|
|
8160
|
+
if (self._opts.$data) metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA);
|
|
8165
8161
|
self.addMetaSchema(metaSchema, META_SCHEMA_ID, true);
|
|
8166
8162
|
self._refs['http://json-schema.org/schema'] = META_SCHEMA_ID;
|
|
8167
8163
|
}
|
|
@@ -8220,14 +8216,14 @@ function setLogger(self) {
|
|
|
8220
8216
|
|
|
8221
8217
|
function noop() {}
|
|
8222
8218
|
|
|
8223
|
-
var _Ajv = /*#__PURE__*/
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
})
|
|
8219
|
+
var _Ajv = /*#__PURE__*/_mergeNamespaces({
|
|
8220
|
+
__proto__: null,
|
|
8221
|
+
'default': ajv
|
|
8222
|
+
}, [ajv]);
|
|
8227
8223
|
|
|
8228
8224
|
var $ref = "#/definitions/Schema";
|
|
8229
|
-
var $schema
|
|
8230
|
-
var definitions
|
|
8225
|
+
var $schema = "http://json-schema.org/draft-07/schema#";
|
|
8226
|
+
var definitions = {
|
|
8231
8227
|
ActivityType: {
|
|
8232
8228
|
anyOf: [
|
|
8233
8229
|
{
|
|
@@ -8300,17 +8296,6 @@ var definitions$1 = {
|
|
|
8300
8296
|
}
|
|
8301
8297
|
]
|
|
8302
8298
|
},
|
|
8303
|
-
IActivityType: {
|
|
8304
|
-
"enum": [
|
|
8305
|
-
"filter",
|
|
8306
|
-
"project",
|
|
8307
|
-
"groupby",
|
|
8308
|
-
"sort",
|
|
8309
|
-
"limit",
|
|
8310
|
-
"mappings"
|
|
8311
|
-
],
|
|
8312
|
-
type: "string"
|
|
8313
|
-
},
|
|
8314
8299
|
IAggregate: {
|
|
8315
8300
|
additionalProperties: false,
|
|
8316
8301
|
properties: {
|
|
@@ -8385,9 +8370,7 @@ var definitions$1 = {
|
|
|
8385
8370
|
type: "string"
|
|
8386
8371
|
},
|
|
8387
8372
|
type: {
|
|
8388
|
-
"
|
|
8389
|
-
"count"
|
|
8390
|
-
],
|
|
8373
|
+
"const": "count",
|
|
8391
8374
|
type: "string"
|
|
8392
8375
|
}
|
|
8393
8376
|
},
|
|
@@ -8416,9 +8399,7 @@ var definitions$1 = {
|
|
|
8416
8399
|
type: "string"
|
|
8417
8400
|
},
|
|
8418
8401
|
type: {
|
|
8419
|
-
"
|
|
8420
|
-
"databomb"
|
|
8421
|
-
],
|
|
8402
|
+
"const": "databomb",
|
|
8422
8403
|
type: "string"
|
|
8423
8404
|
}
|
|
8424
8405
|
},
|
|
@@ -8510,9 +8491,7 @@ var definitions$1 = {
|
|
|
8510
8491
|
type: "array"
|
|
8511
8492
|
},
|
|
8512
8493
|
type: {
|
|
8513
|
-
"
|
|
8514
|
-
"="
|
|
8515
|
-
],
|
|
8494
|
+
"const": "=",
|
|
8516
8495
|
type: "string"
|
|
8517
8496
|
}
|
|
8518
8497
|
},
|
|
@@ -8561,9 +8540,7 @@ var definitions$1 = {
|
|
|
8561
8540
|
type: "string"
|
|
8562
8541
|
},
|
|
8563
8542
|
type: {
|
|
8564
|
-
"
|
|
8565
|
-
"boolean"
|
|
8566
|
-
],
|
|
8543
|
+
"const": "boolean",
|
|
8567
8544
|
type: "string"
|
|
8568
8545
|
}
|
|
8569
8546
|
},
|
|
@@ -8589,9 +8566,7 @@ var definitions$1 = {
|
|
|
8589
8566
|
type: "string"
|
|
8590
8567
|
},
|
|
8591
8568
|
type: {
|
|
8592
|
-
"
|
|
8593
|
-
"dataset"
|
|
8594
|
-
],
|
|
8569
|
+
"const": "dataset",
|
|
8595
8570
|
type: "string"
|
|
8596
8571
|
}
|
|
8597
8572
|
},
|
|
@@ -8612,9 +8587,7 @@ var definitions$1 = {
|
|
|
8612
8587
|
type: "string"
|
|
8613
8588
|
},
|
|
8614
8589
|
type: {
|
|
8615
|
-
"
|
|
8616
|
-
"number"
|
|
8617
|
-
],
|
|
8590
|
+
"const": "number",
|
|
8618
8591
|
type: "string"
|
|
8619
8592
|
}
|
|
8620
8593
|
},
|
|
@@ -8634,9 +8607,7 @@ var definitions$1 = {
|
|
|
8634
8607
|
type: "string"
|
|
8635
8608
|
},
|
|
8636
8609
|
type: {
|
|
8637
|
-
"
|
|
8638
|
-
"number64"
|
|
8639
|
-
],
|
|
8610
|
+
"const": "number64",
|
|
8640
8611
|
type: "string"
|
|
8641
8612
|
}
|
|
8642
8613
|
},
|
|
@@ -8662,9 +8633,7 @@ var definitions$1 = {
|
|
|
8662
8633
|
type: "string"
|
|
8663
8634
|
},
|
|
8664
8635
|
type: {
|
|
8665
|
-
"
|
|
8666
|
-
"object"
|
|
8667
|
-
],
|
|
8636
|
+
"const": "object",
|
|
8668
8637
|
type: "string"
|
|
8669
8638
|
}
|
|
8670
8639
|
},
|
|
@@ -8685,9 +8654,7 @@ var definitions$1 = {
|
|
|
8685
8654
|
type: "string"
|
|
8686
8655
|
},
|
|
8687
8656
|
type: {
|
|
8688
|
-
"
|
|
8689
|
-
"range"
|
|
8690
|
-
],
|
|
8657
|
+
"const": "range",
|
|
8691
8658
|
type: "string"
|
|
8692
8659
|
}
|
|
8693
8660
|
},
|
|
@@ -8720,9 +8687,7 @@ var definitions$1 = {
|
|
|
8720
8687
|
type: "string"
|
|
8721
8688
|
},
|
|
8722
8689
|
type: {
|
|
8723
|
-
"
|
|
8724
|
-
"set"
|
|
8725
|
-
],
|
|
8690
|
+
"const": "set",
|
|
8726
8691
|
type: "string"
|
|
8727
8692
|
}
|
|
8728
8693
|
},
|
|
@@ -8743,9 +8708,7 @@ var definitions$1 = {
|
|
|
8743
8708
|
type: "string"
|
|
8744
8709
|
},
|
|
8745
8710
|
type: {
|
|
8746
|
-
"
|
|
8747
|
-
"string"
|
|
8748
|
-
],
|
|
8711
|
+
"const": "string",
|
|
8749
8712
|
type: "string"
|
|
8750
8713
|
}
|
|
8751
8714
|
},
|
|
@@ -8778,9 +8741,7 @@ var definitions$1 = {
|
|
|
8778
8741
|
type: "array"
|
|
8779
8742
|
},
|
|
8780
8743
|
type: {
|
|
8781
|
-
"
|
|
8782
|
-
"filter"
|
|
8783
|
-
],
|
|
8744
|
+
"const": "filter",
|
|
8784
8745
|
type: "string"
|
|
8785
8746
|
}
|
|
8786
8747
|
},
|
|
@@ -8845,9 +8806,7 @@ var definitions$1 = {
|
|
|
8845
8806
|
type: "string"
|
|
8846
8807
|
},
|
|
8847
8808
|
type: {
|
|
8848
|
-
"
|
|
8849
|
-
"form"
|
|
8850
|
-
],
|
|
8809
|
+
"const": "form",
|
|
8851
8810
|
type: "string"
|
|
8852
8811
|
}
|
|
8853
8812
|
},
|
|
@@ -8874,9 +8833,7 @@ var definitions$1 = {
|
|
|
8874
8833
|
type: "array"
|
|
8875
8834
|
},
|
|
8876
8835
|
type: {
|
|
8877
|
-
"
|
|
8878
|
-
"groupby"
|
|
8879
|
-
],
|
|
8836
|
+
"const": "groupby",
|
|
8880
8837
|
type: "string"
|
|
8881
8838
|
}
|
|
8882
8839
|
},
|
|
@@ -8909,9 +8866,7 @@ var definitions$1 = {
|
|
|
8909
8866
|
type: "string"
|
|
8910
8867
|
},
|
|
8911
8868
|
type: {
|
|
8912
|
-
"
|
|
8913
|
-
"hipie"
|
|
8914
|
-
],
|
|
8869
|
+
"const": "hipie",
|
|
8915
8870
|
type: "string"
|
|
8916
8871
|
},
|
|
8917
8872
|
url: {
|
|
@@ -8948,9 +8903,7 @@ var definitions$1 = {
|
|
|
8948
8903
|
type: "number"
|
|
8949
8904
|
},
|
|
8950
8905
|
type: {
|
|
8951
|
-
"
|
|
8952
|
-
"limit"
|
|
8953
|
-
],
|
|
8906
|
+
"const": "limit",
|
|
8954
8907
|
type: "string"
|
|
8955
8908
|
}
|
|
8956
8909
|
},
|
|
@@ -8976,9 +8929,7 @@ var definitions$1 = {
|
|
|
8976
8929
|
type: "string"
|
|
8977
8930
|
},
|
|
8978
8931
|
type: {
|
|
8979
|
-
"
|
|
8980
|
-
"logicalfile"
|
|
8981
|
-
],
|
|
8932
|
+
"const": "logicalfile",
|
|
8982
8933
|
type: "string"
|
|
8983
8934
|
},
|
|
8984
8935
|
url: {
|
|
@@ -9012,9 +8963,7 @@ var definitions$1 = {
|
|
|
9012
8963
|
type: "string"
|
|
9013
8964
|
},
|
|
9014
8965
|
type: {
|
|
9015
|
-
"
|
|
9016
|
-
"map"
|
|
9017
|
-
],
|
|
8966
|
+
"const": "map",
|
|
9018
8967
|
type: "string"
|
|
9019
8968
|
}
|
|
9020
8969
|
},
|
|
@@ -9088,9 +9037,7 @@ var definitions$1 = {
|
|
|
9088
9037
|
type: "array"
|
|
9089
9038
|
},
|
|
9090
9039
|
type: {
|
|
9091
|
-
"
|
|
9092
|
-
"mappings"
|
|
9093
|
-
],
|
|
9040
|
+
"const": "mappings",
|
|
9094
9041
|
type: "string"
|
|
9095
9042
|
}
|
|
9096
9043
|
},
|
|
@@ -9113,9 +9060,7 @@ var definitions$1 = {
|
|
|
9113
9060
|
type: "array"
|
|
9114
9061
|
},
|
|
9115
9062
|
type: {
|
|
9116
|
-
"
|
|
9117
|
-
"multi"
|
|
9118
|
-
],
|
|
9063
|
+
"const": "multi",
|
|
9119
9064
|
type: "string"
|
|
9120
9065
|
}
|
|
9121
9066
|
},
|
|
@@ -9151,9 +9096,7 @@ var definitions$1 = {
|
|
|
9151
9096
|
type: "array"
|
|
9152
9097
|
},
|
|
9153
9098
|
type: {
|
|
9154
|
-
"
|
|
9155
|
-
"project"
|
|
9156
|
-
],
|
|
9099
|
+
"const": "project",
|
|
9157
9100
|
type: "string"
|
|
9158
9101
|
}
|
|
9159
9102
|
},
|
|
@@ -9216,9 +9159,7 @@ var definitions$1 = {
|
|
|
9216
9159
|
$ref: "#/definitions/OutputDict"
|
|
9217
9160
|
},
|
|
9218
9161
|
type: {
|
|
9219
|
-
"
|
|
9220
|
-
"rest"
|
|
9221
|
-
],
|
|
9162
|
+
"const": "rest",
|
|
9222
9163
|
type: "string"
|
|
9223
9164
|
},
|
|
9224
9165
|
url: {
|
|
@@ -9257,9 +9198,7 @@ var definitions$1 = {
|
|
|
9257
9198
|
type: "string"
|
|
9258
9199
|
},
|
|
9259
9200
|
type: {
|
|
9260
|
-
"
|
|
9261
|
-
"roxie"
|
|
9262
|
-
],
|
|
9201
|
+
"const": "roxie",
|
|
9263
9202
|
type: "string"
|
|
9264
9203
|
},
|
|
9265
9204
|
url: {
|
|
@@ -9313,9 +9252,7 @@ var definitions$1 = {
|
|
|
9313
9252
|
type: "string"
|
|
9314
9253
|
},
|
|
9315
9254
|
type: {
|
|
9316
|
-
"
|
|
9317
|
-
"scale"
|
|
9318
|
-
],
|
|
9255
|
+
"const": "scale",
|
|
9319
9256
|
type: "string"
|
|
9320
9257
|
}
|
|
9321
9258
|
},
|
|
@@ -9337,9 +9274,7 @@ var definitions$1 = {
|
|
|
9337
9274
|
type: "array"
|
|
9338
9275
|
},
|
|
9339
9276
|
type: {
|
|
9340
|
-
"
|
|
9341
|
-
"sort"
|
|
9342
|
-
],
|
|
9277
|
+
"const": "sort",
|
|
9343
9278
|
type: "string"
|
|
9344
9279
|
}
|
|
9345
9280
|
},
|
|
@@ -9375,9 +9310,7 @@ var definitions$1 = {
|
|
|
9375
9310
|
type: "string"
|
|
9376
9311
|
},
|
|
9377
9312
|
type: {
|
|
9378
|
-
"
|
|
9379
|
-
"template"
|
|
9380
|
-
],
|
|
9313
|
+
"const": "template",
|
|
9381
9314
|
type: "string"
|
|
9382
9315
|
}
|
|
9383
9316
|
},
|
|
@@ -9467,9 +9400,7 @@ var definitions$1 = {
|
|
|
9467
9400
|
$ref: "#/definitions/OutputDict"
|
|
9468
9401
|
},
|
|
9469
9402
|
type: {
|
|
9470
|
-
"
|
|
9471
|
-
"wuresult"
|
|
9472
|
-
],
|
|
9403
|
+
"const": "wuresult",
|
|
9473
9404
|
type: "string"
|
|
9474
9405
|
},
|
|
9475
9406
|
url: {
|
|
@@ -9586,20 +9517,12 @@ var definitions$1 = {
|
|
|
9586
9517
|
]
|
|
9587
9518
|
},
|
|
9588
9519
|
Range: {
|
|
9589
|
-
items:
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
},
|
|
9596
|
-
{
|
|
9597
|
-
type: [
|
|
9598
|
-
"number",
|
|
9599
|
-
"string"
|
|
9600
|
-
]
|
|
9601
|
-
}
|
|
9602
|
-
],
|
|
9520
|
+
items: {
|
|
9521
|
+
type: [
|
|
9522
|
+
"number",
|
|
9523
|
+
"string"
|
|
9524
|
+
]
|
|
9525
|
+
},
|
|
9603
9526
|
maxItems: 2,
|
|
9604
9527
|
minItems: 2,
|
|
9605
9528
|
type: "array"
|
|
@@ -9848,9 +9771,7 @@ var definitions$1 = {
|
|
|
9848
9771
|
$ref: "#/definitions/IProperties"
|
|
9849
9772
|
},
|
|
9850
9773
|
version: {
|
|
9851
|
-
"
|
|
9852
|
-
"2.2.1"
|
|
9853
|
-
],
|
|
9774
|
+
"const": "2.2.1",
|
|
9854
9775
|
type: "string"
|
|
9855
9776
|
}
|
|
9856
9777
|
},
|
|
@@ -9870,43 +9791,43 @@ var definitions$1 = {
|
|
|
9870
9791
|
type: "string"
|
|
9871
9792
|
}
|
|
9872
9793
|
};
|
|
9873
|
-
var v2
|
|
9794
|
+
var v2 = {
|
|
9874
9795
|
$ref: $ref,
|
|
9875
|
-
$schema: $schema
|
|
9876
|
-
definitions: definitions
|
|
9796
|
+
$schema: $schema,
|
|
9797
|
+
definitions: definitions
|
|
9877
9798
|
};
|
|
9878
9799
|
|
|
9879
9800
|
var _ddl2Schema = /*#__PURE__*/Object.freeze({
|
|
9880
9801
|
__proto__: null,
|
|
9881
9802
|
$ref: $ref,
|
|
9882
|
-
$schema: $schema
|
|
9883
|
-
definitions: definitions
|
|
9884
|
-
'default': v2
|
|
9803
|
+
$schema: $schema,
|
|
9804
|
+
definitions: definitions,
|
|
9805
|
+
'default': v2
|
|
9885
9806
|
});
|
|
9886
9807
|
|
|
9887
|
-
var Ajv
|
|
9888
|
-
var ddl2Schema = _ddl2Schema;
|
|
9889
|
-
var options = {
|
|
9890
|
-
allErrors: false,
|
|
9891
|
-
verbose: true,
|
|
9892
|
-
jsonPointers: false
|
|
9893
|
-
};
|
|
9894
|
-
function doValidate(ddl, schema) {
|
|
9895
|
-
var ajv = new Ajv
|
|
9896
|
-
var validate = ajv.compile(schema);
|
|
9897
|
-
var success = validate(ddl);
|
|
9898
|
-
return {
|
|
9899
|
-
success: success,
|
|
9900
|
-
errors: validate.errors
|
|
9901
|
-
};
|
|
9902
|
-
}
|
|
9903
|
-
function validate2(ddl) {
|
|
9904
|
-
return doValidate(ddl, _ddl2Schema);
|
|
9808
|
+
var Ajv = ajv || _Ajv;
|
|
9809
|
+
var ddl2Schema = _ddl2Schema;
|
|
9810
|
+
var options = {
|
|
9811
|
+
allErrors: false,
|
|
9812
|
+
verbose: true,
|
|
9813
|
+
jsonPointers: false
|
|
9814
|
+
};
|
|
9815
|
+
function doValidate(ddl, schema) {
|
|
9816
|
+
var ajv = new Ajv(options);
|
|
9817
|
+
var validate = ajv.compile(schema);
|
|
9818
|
+
var success = validate(ddl);
|
|
9819
|
+
return {
|
|
9820
|
+
success: success,
|
|
9821
|
+
errors: validate.errors
|
|
9822
|
+
};
|
|
9823
|
+
}
|
|
9824
|
+
function validate2(ddl) {
|
|
9825
|
+
return doValidate(ddl, _ddl2Schema);
|
|
9905
9826
|
}
|
|
9906
9827
|
|
|
9907
|
-
function isDDL2Schema(ref) {
|
|
9908
|
-
return ref.version !== undefined && ref.datasources !== undefined && ref.dataviews !== undefined;
|
|
9828
|
+
function isDDL2Schema(ref) {
|
|
9829
|
+
return ref.version !== undefined && ref.datasources !== undefined && ref.dataviews !== undefined;
|
|
9909
9830
|
}
|
|
9910
9831
|
|
|
9911
|
-
export { BUILD_VERSION, v1 as DDL1, v2 as DDL2, PKG_NAME, PKG_VERSION, ddl2Schema, isDDL2Schema, upgrade
|
|
9832
|
+
export { BUILD_VERSION, v1 as DDL1, v2$1 as DDL2, PKG_NAME, PKG_VERSION, ddl2Schema, isDDL2Schema, upgrade, validate2 };
|
|
9912
9833
|
//# sourceMappingURL=index.es6.js.map
|