@hpcc-js/ddl-shim 2.17.23 → 2.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +43 -43
- package/dist/cli.js +1048 -1103
- package/dist/cli.js.map +1 -1
- package/dist/index.es6.js +1436 -1550
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +1441 -1555
- 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.js
CHANGED
|
@@ -1,54 +1,69 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = global || self, factory(global[
|
|
5
|
-
}(this, (function (exports) { 'use strict';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
return
|
|
28
|
-
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
34
|
-
}
|
|
35
|
-
function
|
|
36
|
-
return viz.type === "
|
|
37
|
-
}
|
|
38
|
-
function
|
|
39
|
-
return viz.type === "
|
|
40
|
-
}
|
|
41
|
-
function
|
|
42
|
-
return viz.type === "
|
|
43
|
-
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
function
|
|
51
|
-
return
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@hpcc-js/ddl-shim"] = {}));
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _mergeNamespaces(n, m) {
|
|
8
|
+
m.forEach(function (e) {
|
|
9
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default' && !(k in n)) {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var PKG_NAME = "@hpcc-js/ddl-shim";
|
|
23
|
+
var PKG_VERSION = "2.18.1";
|
|
24
|
+
var BUILD_VERSION = "2.102.1";
|
|
25
|
+
|
|
26
|
+
function isWorkunitDatasource(ref) {
|
|
27
|
+
return ref.WUID !== undefined;
|
|
28
|
+
}
|
|
29
|
+
function isDatabombDatasource(ref) {
|
|
30
|
+
return ref.databomb === true;
|
|
31
|
+
}
|
|
32
|
+
function isHipieDatasource(ref) {
|
|
33
|
+
return ref.URL !== undefined;
|
|
34
|
+
}
|
|
35
|
+
function isPieVisualization(viz) {
|
|
36
|
+
return viz.type === "PIE" || viz.type === "BAR";
|
|
37
|
+
}
|
|
38
|
+
function isLineVisualization(viz) {
|
|
39
|
+
return viz.type === "LINE";
|
|
40
|
+
}
|
|
41
|
+
function isChoroVisualization(viz) {
|
|
42
|
+
return viz.type === "CHORO";
|
|
43
|
+
}
|
|
44
|
+
function isTableVisualization(viz) {
|
|
45
|
+
return viz.type === "TABLE";
|
|
46
|
+
}
|
|
47
|
+
function isSliderVisualization(viz) {
|
|
48
|
+
return viz.type === "SLIDER";
|
|
49
|
+
}
|
|
50
|
+
function isGraphVisualization(viz) {
|
|
51
|
+
return viz.type === "GRAPH";
|
|
52
|
+
}
|
|
53
|
+
function isHeatMapVisualization(viz) {
|
|
54
|
+
return viz.type === "HEAT_MAP";
|
|
55
|
+
}
|
|
56
|
+
function isFormVisualization(viz) {
|
|
57
|
+
return viz.type === "FORM";
|
|
58
|
+
}
|
|
59
|
+
function isUSStateMapping(mappings) {
|
|
60
|
+
return mappings.state !== undefined;
|
|
61
|
+
}
|
|
62
|
+
function isUSCountyMapping(mappings) {
|
|
63
|
+
return mappings.county !== undefined;
|
|
64
|
+
}
|
|
65
|
+
function isGeohashMapping(mappings) {
|
|
66
|
+
return mappings.geohash !== undefined;
|
|
52
67
|
}
|
|
53
68
|
|
|
54
69
|
var v1 = /*#__PURE__*/Object.freeze({
|
|
@@ -69,39 +84,39 @@
|
|
|
69
84
|
isGeohashMapping: isGeohashMapping
|
|
70
85
|
});
|
|
71
86
|
|
|
72
|
-
function isDatabombRef(ref) {
|
|
73
|
-
return !isWUResultRef(ref) && !isRoxieServiceRef(ref);
|
|
74
|
-
}
|
|
75
|
-
function isWUResultRef(ref) {
|
|
76
|
-
return ref.output !== undefined && !isRoxieServiceRef(ref);
|
|
77
|
-
}
|
|
78
|
-
function isRoxieServiceRef(ref) {
|
|
79
|
-
return ref.request !== undefined;
|
|
80
|
-
}
|
|
81
|
-
function isIFilterCondition(fc) {
|
|
82
|
-
return !!fc.viewID;
|
|
83
|
-
}
|
|
84
|
-
function isFilterActivity(activity) {
|
|
85
|
-
return activity.type === "filter";
|
|
86
|
-
}
|
|
87
|
-
function isProjectActivity(activity) {
|
|
88
|
-
return activity.type === "project";
|
|
89
|
-
}
|
|
90
|
-
function isMappingsActivity(activity) {
|
|
91
|
-
return activity.type === "mappings";
|
|
92
|
-
}
|
|
93
|
-
function isGroupByActivity(activity) {
|
|
94
|
-
return activity.type === "groupby";
|
|
95
|
-
}
|
|
96
|
-
function isSortActivity(activity) {
|
|
97
|
-
return activity.type === "sort";
|
|
98
|
-
}
|
|
99
|
-
function isLimitActivity(activity) {
|
|
100
|
-
return activity.type === "limit";
|
|
101
|
-
}
|
|
87
|
+
function isDatabombRef(ref) {
|
|
88
|
+
return !isWUResultRef(ref) && !isRoxieServiceRef(ref);
|
|
89
|
+
}
|
|
90
|
+
function isWUResultRef(ref) {
|
|
91
|
+
return ref.output !== undefined && !isRoxieServiceRef(ref);
|
|
92
|
+
}
|
|
93
|
+
function isRoxieServiceRef(ref) {
|
|
94
|
+
return ref.request !== undefined;
|
|
95
|
+
}
|
|
96
|
+
function isIFilterCondition(fc) {
|
|
97
|
+
return !!fc.viewID;
|
|
98
|
+
}
|
|
99
|
+
function isFilterActivity(activity) {
|
|
100
|
+
return activity.type === "filter";
|
|
101
|
+
}
|
|
102
|
+
function isProjectActivity(activity) {
|
|
103
|
+
return activity.type === "project";
|
|
104
|
+
}
|
|
105
|
+
function isMappingsActivity(activity) {
|
|
106
|
+
return activity.type === "mappings";
|
|
107
|
+
}
|
|
108
|
+
function isGroupByActivity(activity) {
|
|
109
|
+
return activity.type === "groupby";
|
|
110
|
+
}
|
|
111
|
+
function isSortActivity(activity) {
|
|
112
|
+
return activity.type === "sort";
|
|
113
|
+
}
|
|
114
|
+
function isLimitActivity(activity) {
|
|
115
|
+
return activity.type === "limit";
|
|
116
|
+
}
|
|
102
117
|
var VisibilitySet = ["normal", "flyout"];
|
|
103
118
|
|
|
104
|
-
var v2 = /*#__PURE__*/Object.freeze({
|
|
119
|
+
var v2$1 = /*#__PURE__*/Object.freeze({
|
|
105
120
|
__proto__: null,
|
|
106
121
|
isDatabombRef: isDatabombRef,
|
|
107
122
|
isWUResultRef: isWUResultRef,
|
|
@@ -149,960 +164,941 @@
|
|
|
149
164
|
ar[i] = from[i];
|
|
150
165
|
}
|
|
151
166
|
}
|
|
152
|
-
return to.concat(ar || from);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
var classMappings = {
|
|
156
|
-
c3chart_Bar: "chart_Bar",
|
|
157
|
-
c3chart_Column: "chart_Column",
|
|
158
|
-
c3chart_Pie: "chart_Pie",
|
|
159
|
-
c3chart_Area: "chart_Area",
|
|
160
|
-
c3chart_Line: "chart_Line",
|
|
161
|
-
amchart_Bar: "chart_Bar",
|
|
162
|
-
amchart_Column: "chart_Column",
|
|
163
|
-
amchart_Pie: "chart_Pie",
|
|
164
|
-
amchart_Area: "chart_Area",
|
|
165
|
-
amchart_Line: "chart_Line",
|
|
166
|
-
google_Bar: "chart_Bar",
|
|
167
|
-
google_Column: "chart_Column",
|
|
168
|
-
google_Pie: "chart_Pie",
|
|
169
|
-
google_Area: "chart_Area",
|
|
170
|
-
google_Line: "chart_Line",
|
|
171
|
-
other_Table: "dgrid_Table"
|
|
172
|
-
};
|
|
173
|
-
var propertyMappings = {
|
|
174
|
-
xAxisLabelRotation: [
|
|
175
|
-
{ name: "xAxisOverlapMode", transform: function (n) { return "rotate"; } },
|
|
176
|
-
{ name: "xAxisLabelRotation", transform: function (n) { return n; } }
|
|
177
|
-
],
|
|
178
|
-
tooltipLabelColor: {
|
|
179
|
-
name: "tooltipLabelColor"
|
|
180
|
-
},
|
|
181
|
-
tooltipSeriesColor: {
|
|
182
|
-
name: "tooltipSeriesColor"
|
|
183
|
-
},
|
|
184
|
-
tooltipValueColor: {
|
|
185
|
-
name: "tooltipValueColor"
|
|
186
|
-
},
|
|
187
|
-
tooltipValueFormat: {
|
|
188
|
-
name: "tooltipValueFormat"
|
|
189
|
-
},
|
|
190
|
-
timePattern: {
|
|
191
|
-
name: "xAxisTypeTimePattern"
|
|
192
|
-
},
|
|
193
|
-
smoothLines: {
|
|
194
|
-
name: "interpolate",
|
|
195
|
-
transform: function (n) {
|
|
196
|
-
if (n === false)
|
|
197
|
-
return "linear";
|
|
198
|
-
return "catmullRom";
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
holePercent: {
|
|
202
|
-
name: "innerRadius"
|
|
203
|
-
},
|
|
204
|
-
flip: {
|
|
205
|
-
name: "orientation",
|
|
206
|
-
transform: function (n) { return n ? "vertical" : "horizontal"; }
|
|
207
|
-
},
|
|
208
|
-
bottomText: {
|
|
209
|
-
name: "xAxisTitle"
|
|
210
|
-
},
|
|
211
|
-
xAxisTypeTimePattern: {
|
|
212
|
-
name: "xAxisTypeTimePattern"
|
|
213
|
-
},
|
|
214
|
-
yAxisTypeTimePattern: {
|
|
215
|
-
name: "yAxisTypeTimePattern"
|
|
216
|
-
},
|
|
217
|
-
valueFormat: {
|
|
218
|
-
name: "tooltipValueFormat"
|
|
219
|
-
},
|
|
220
|
-
stacked: {
|
|
221
|
-
name: "yAxisStacked"
|
|
222
|
-
},
|
|
223
|
-
showYGrid: {
|
|
224
|
-
name: "yAxisGuideLines"
|
|
225
|
-
},
|
|
226
|
-
showXGrid: {
|
|
227
|
-
name: "xAxisGuideLines"
|
|
228
|
-
},
|
|
229
|
-
showValueLabel: {
|
|
230
|
-
name: "showValue"
|
|
231
|
-
},
|
|
232
|
-
low: {
|
|
233
|
-
name: "yAxisDomainLow"
|
|
234
|
-
},
|
|
235
|
-
high: {
|
|
236
|
-
name: "yAxisDomainHigh"
|
|
237
|
-
},
|
|
238
|
-
fillOpacity: {
|
|
239
|
-
name: "interpolateFillOpacity"
|
|
240
|
-
},
|
|
241
|
-
areaFillOpacity: {
|
|
242
|
-
name: "interpolateFillOpacity"
|
|
243
|
-
},
|
|
244
|
-
showToolbar: {
|
|
245
|
-
name: "titleVisible"
|
|
246
|
-
},
|
|
247
|
-
showCSV: {
|
|
248
|
-
name: "downloadButtonVisible"
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
function findKeyVal(object, key, val) {
|
|
252
|
-
var value;
|
|
253
|
-
for (var k in object) {
|
|
254
|
-
if (k === key && object[k] === val) {
|
|
255
|
-
value = object;
|
|
256
|
-
break;
|
|
257
|
-
}
|
|
258
|
-
if (object[k] && typeof object[k] === "object") {
|
|
259
|
-
value = findKeyVal(object[k], key, val);
|
|
260
|
-
if (value !== undefined) {
|
|
261
|
-
break;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
return value;
|
|
266
|
-
}
|
|
267
|
-
function apply_to_dataviews(ddl2, dermObj) {
|
|
268
|
-
ddl2.dataviews.forEach(apply_to_dataview);
|
|
269
|
-
function apply_to_dataview(dv) {
|
|
270
|
-
var widgetId = dv.id;
|
|
271
|
-
var dermPanelObj = findKeyVal(dermObj, "__id", widgetId);
|
|
272
|
-
if (dermPanelObj) {
|
|
273
|
-
var dermPanelProps = dermPanelObj.__properties;
|
|
274
|
-
var dermWidgetObj = dermPanelObj.__properties.chart ? dermPanelObj.__properties.chart : dermPanelObj.__properties.widget;
|
|
275
|
-
var dermWidgetProps = dermWidgetObj.__properties;
|
|
276
|
-
apply_class_mapping(dermWidgetObj);
|
|
277
|
-
apply_panel_property_mapping(dermPanelProps, dermWidgetProps);
|
|
278
|
-
apply_widget_property_mapping(dermPanelProps, dermWidgetProps);
|
|
279
|
-
if (dv.visualization.properties.chartType) {
|
|
280
|
-
dv.visualization.properties.charttype = dv.visualization.properties.chartType;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
console.warn(widgetId + " not found in dermObj");
|
|
285
|
-
}
|
|
286
|
-
function apply_class_mapping(dermWidgetObj) {
|
|
287
|
-
dv.visualization.__class = swap_with_supported_class(dermWidgetObj.__class);
|
|
288
|
-
dv.visualization.properties.__class = "marshaller_VizChartPanel";
|
|
289
|
-
if (!dv.visualization.properties.widget)
|
|
290
|
-
dv.visualization.properties.widget = {};
|
|
291
|
-
dv.visualization.properties.widget.__class = dv.visualization.__class;
|
|
292
|
-
function swap_with_supported_class(_class) {
|
|
293
|
-
return classMappings[_class] ? classMappings[_class] : _class;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
function apply_panel_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
297
|
-
dv.visualization.title = dermPanelProps.title || "";
|
|
298
|
-
dv.visualization.description = "";
|
|
299
|
-
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
300
|
-
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
301
|
-
for (var propName in dermPanelProps) {
|
|
302
|
-
if (typeof propertyMappings[propName] !== "undefined") {
|
|
303
|
-
var newPropName = propertyMappings[propName].name;
|
|
304
|
-
if (typeof propertyMappings[propName].transform === "function") {
|
|
305
|
-
dv.visualization.properties[newPropName] = propertyMappings[propName].transform(dermPanelProps[propName]);
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
dv.visualization.properties[newPropName] = dermPanelProps[propName];
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
if (dermWidgetProps && dermWidgetProps.showLegend && dv.visualization.properties) {
|
|
313
|
-
dv.visualization.properties.legendVisible = true;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
function apply_widget_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
317
|
-
dv.visualization.title = dv.visualization.title || dermWidgetProps.title || "";
|
|
318
|
-
dv.visualization.description = ""; // TODO - should this map to anything?
|
|
319
|
-
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
320
|
-
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
321
|
-
var _loop_1 = function (propName) {
|
|
322
|
-
if (typeof propertyMappings[propName] !== "undefined") {
|
|
323
|
-
if (propertyMappings[propName] instanceof Array) {
|
|
324
|
-
propertyMappings[propName].forEach(function (p) {
|
|
325
|
-
var newPropName = p.name;
|
|
326
|
-
dv.visualization.properties.widget[newPropName] = p.transform(dermWidgetProps[propName]);
|
|
327
|
-
if (typeof propertyMappings[propName].transform === "function") {
|
|
328
|
-
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
dv.visualization.properties.widget[newPropName] = dermWidgetProps[propName];
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
var newPropName = propertyMappings[propName].name;
|
|
337
|
-
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
for (var propName in dermWidgetProps) {
|
|
342
|
-
_loop_1(propName);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
function apply_to_properties_layout(ddl2, dermObj) {
|
|
348
|
-
var retVal = {
|
|
349
|
-
layout: []
|
|
350
|
-
};
|
|
351
|
-
if (!dermObj || !dermObj.__properties)
|
|
352
|
-
return;
|
|
353
|
-
dermObj.__properties.content.forEach(function (cell) {
|
|
354
|
-
var cellPosition = {
|
|
355
|
-
// TODO - if "id" could be avoided then layouts could apply to any dashboard with the same number of widgets
|
|
356
|
-
id: cell.__properties.widget.__id,
|
|
357
|
-
position: [
|
|
358
|
-
cell.__properties.gridCol,
|
|
359
|
-
cell.__properties.gridRow,
|
|
360
|
-
cell.__properties.gridColSpan,
|
|
361
|
-
cell.__properties.gridRowSpan
|
|
362
|
-
]
|
|
363
|
-
};
|
|
364
|
-
retVal.layout.push(cellPosition);
|
|
365
|
-
});
|
|
366
|
-
return retVal;
|
|
367
|
-
}
|
|
368
|
-
function upgrade(ddl2, dermObj) {
|
|
369
|
-
apply_to_dataviews(ddl2, dermObj);
|
|
370
|
-
return apply_to_properties_layout(ddl2, dermObj);
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
function faCharFix(faChar) {
|
|
374
|
-
return faChar;
|
|
375
|
-
}
|
|
376
|
-
var DDLUpgrade = /** @class */ (function () {
|
|
377
|
-
function DDLUpgrade(ddl, baseUrl, wuid, toLowerCase) {
|
|
378
|
-
if (baseUrl === void 0) { baseUrl = "http://localhost:8010"; }
|
|
379
|
-
if (wuid === void 0) { wuid = "WUID"; }
|
|
380
|
-
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
381
|
-
this._datasources = {};
|
|
382
|
-
this._datasourceUpdates = {};
|
|
383
|
-
this._visualizations = {};
|
|
384
|
-
this._ddl2Datasources = {};
|
|
385
|
-
this._ddl2DatasourceFields = {};
|
|
386
|
-
this._ddl2Dataviews = {};
|
|
387
|
-
this._ddl2DataviewActivities = {};
|
|
388
|
-
this._ddl = ddl;
|
|
389
|
-
this._baseUrl = baseUrl;
|
|
390
|
-
this._wuid = wuid;
|
|
391
|
-
this._toLowerCase = toLowerCase;
|
|
392
|
-
this.indexDDL();
|
|
393
|
-
this.readDDL();
|
|
394
|
-
}
|
|
395
|
-
DDLUpgrade.prototype.toLowerCase = function (s) {
|
|
396
|
-
return this._toLowerCase ? s.toLowerCase() : s;
|
|
397
|
-
};
|
|
398
|
-
DDLUpgrade.prototype.isVizDatasourceRoxie = function (viz) {
|
|
399
|
-
if (viz.source) {
|
|
400
|
-
var ds = this._datasources[viz.source.id];
|
|
401
|
-
if (isHipieDatasource(ds)) {
|
|
402
|
-
return true;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
return false;
|
|
406
|
-
};
|
|
407
|
-
DDLUpgrade.prototype.getDatasourceOutputs = function (dsID, vizID) {
|
|
408
|
-
var retVal = [];
|
|
409
|
-
var datasource = this._datasources[dsID];
|
|
410
|
-
for (var _i = 0, _a = datasource.outputs; _i < _a.length; _i++) {
|
|
411
|
-
var output = _a[_i];
|
|
412
|
-
if (output.notify) {
|
|
413
|
-
for (var _b = 0, _c = output.notify; _b < _c.length; _b++) {
|
|
414
|
-
var notify = _c[_b];
|
|
415
|
-
if (notify === vizID) {
|
|
416
|
-
retVal.push({
|
|
417
|
-
datasource: datasource,
|
|
418
|
-
output: output
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
return retVal;
|
|
425
|
-
};
|
|
426
|
-
DDLUpgrade.prototype.getDatasourceFilters = function (dsID, vizID) {
|
|
427
|
-
var retVal = {};
|
|
428
|
-
for (var _i = 0, _a = this.getDatasourceOutputs(dsID, vizID); _i < _a.length; _i++) {
|
|
429
|
-
var dsOut = _a[_i];
|
|
430
|
-
if (dsOut.output.filter) {
|
|
431
|
-
for (var _b = 0, _c = dsOut.output.filter; _b < _c.length; _b++) {
|
|
432
|
-
var filter = _c[_b];
|
|
433
|
-
retVal[filter.fieldid] = {
|
|
434
|
-
datasource: dsOut.datasource,
|
|
435
|
-
output: dsOut.output,
|
|
436
|
-
filter: filter
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
return retVal;
|
|
442
|
-
};
|
|
443
|
-
DDLUpgrade.prototype.indexDDL = function () {
|
|
444
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
445
|
-
var dash = _a[_i];
|
|
446
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
447
|
-
var viz = _c[_b];
|
|
448
|
-
this._visualizations[viz.id] = viz;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
for (var _d = 0, _e = this._ddl.datasources; _d < _e.length; _d++) {
|
|
452
|
-
var ds = _e[_d];
|
|
453
|
-
this._datasources[ds.id] = ds;
|
|
454
|
-
for (var _f = 0, _g = ds.outputs; _f < _g.length; _f++) {
|
|
455
|
-
var output = _g[_f];
|
|
456
|
-
if (output.notify) {
|
|
457
|
-
for (var _h = 0, _j = output.notify; _h < _j.length; _h++) {
|
|
458
|
-
var notify = _j[_h];
|
|
459
|
-
this._datasourceUpdates[notify] = {
|
|
460
|
-
id: ds.id,
|
|
461
|
-
output: output.from || output.id
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
DDLUpgrade.prototype.readDDL = function () {
|
|
469
|
-
for (var _i = 0, _a = this._ddl.datasources; _i < _a.length; _i++) {
|
|
470
|
-
var ds = _a[_i];
|
|
471
|
-
if (isWorkunitDatasource(ds)) {
|
|
472
|
-
var ddl2DS = {
|
|
473
|
-
type: "wuresult",
|
|
474
|
-
id: ds.id,
|
|
475
|
-
url: this._baseUrl,
|
|
476
|
-
wuid: this._wuid,
|
|
477
|
-
outputs: {}
|
|
478
|
-
};
|
|
479
|
-
for (var _b = 0, _c = ds.outputs; _b < _c.length; _b++) {
|
|
480
|
-
var output = _c[_b];
|
|
481
|
-
this.output2output(output, ddl2DS.outputs);
|
|
482
|
-
}
|
|
483
|
-
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
484
|
-
}
|
|
485
|
-
else if (isDatabombDatasource(ds)) ;
|
|
486
|
-
else {
|
|
487
|
-
var urlParts = ds.URL.split("/WsEcl/submit/query/");
|
|
488
|
-
var hostParts = urlParts[0];
|
|
489
|
-
var roxieParts = urlParts[1].split("/");
|
|
490
|
-
var ddl2DS = {
|
|
491
|
-
type: "hipie",
|
|
492
|
-
id: ds.id,
|
|
493
|
-
url: hostParts,
|
|
494
|
-
querySet: roxieParts[0],
|
|
495
|
-
queryID: roxieParts[1],
|
|
496
|
-
inputs: [],
|
|
497
|
-
outputs: {}
|
|
498
|
-
};
|
|
499
|
-
for (var _d = 0, _e = ds.outputs; _d < _e.length; _d++) {
|
|
500
|
-
var output = _e[_d];
|
|
501
|
-
this.output2output(output, ddl2DS.outputs);
|
|
502
|
-
}
|
|
503
|
-
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
for (var _f = 0, _g = this._ddl.dashboards; _f < _g.length; _f++) {
|
|
507
|
-
var dash = _g[_f];
|
|
508
|
-
for (var _h = 0, _j = dash.visualizations; _h < _j.length; _h++) {
|
|
509
|
-
var viz = _j[_h];
|
|
510
|
-
if (viz.type === "FORM") {
|
|
511
|
-
this._ddl2Datasources[viz.id] = {
|
|
512
|
-
type: "form",
|
|
513
|
-
id: viz.id,
|
|
514
|
-
fields: this.formFields2field(viz.fields)
|
|
515
|
-
};
|
|
516
|
-
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
517
|
-
}
|
|
518
|
-
else if (viz.type === "SLIDER") {
|
|
519
|
-
this._ddl2Datasources[viz.id] = {
|
|
520
|
-
type: "form",
|
|
521
|
-
id: viz.id,
|
|
522
|
-
fields: this.formFields2field(viz.fields, true)
|
|
523
|
-
};
|
|
524
|
-
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
525
|
-
}
|
|
526
|
-
this._ddl2Dataviews[viz.id] = this.anyViz2view(viz);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
this.readGroupBy();
|
|
530
|
-
this.readFilters();
|
|
531
|
-
this.readSort();
|
|
532
|
-
this.readMappings();
|
|
533
|
-
};
|
|
534
|
-
DDLUpgrade.prototype.readGroupBy = function () {
|
|
535
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
536
|
-
var dash = _a[_i];
|
|
537
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
538
|
-
var viz = _c[_b];
|
|
539
|
-
if (viz.fields) {
|
|
540
|
-
var projectTransformations = [];
|
|
541
|
-
var groupByColumns = [];
|
|
542
|
-
var aggrFields = [];
|
|
543
|
-
for (var _d = 0, _e = viz.fields; _d < _e.length; _d++) {
|
|
544
|
-
var field = _e[_d];
|
|
545
|
-
if (field.properties && field.properties.function) {
|
|
546
|
-
switch (field.properties.function) {
|
|
547
|
-
case "SUM":
|
|
548
|
-
case "MIN":
|
|
549
|
-
case "MAX":
|
|
550
|
-
aggrFields.push({
|
|
551
|
-
type: this.func2aggr(field.properties.function),
|
|
552
|
-
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
553
|
-
fieldID: this.toLowerCase(field.id)
|
|
554
|
-
});
|
|
555
|
-
break;
|
|
556
|
-
case "AVE":
|
|
557
|
-
aggrFields.push({
|
|
558
|
-
type: this.func2aggr(field.properties.function),
|
|
559
|
-
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
560
|
-
baseCountFieldID: field.properties.params.param2 ? this.toLowerCase(field.properties.params.param2) : undefined,
|
|
561
|
-
fieldID: this.toLowerCase(field.id)
|
|
562
|
-
});
|
|
563
|
-
break;
|
|
564
|
-
case "SCALE":
|
|
565
|
-
if (typeof field.properties.params.param1 === "object") {
|
|
566
|
-
var props = field.properties.params.param1;
|
|
567
|
-
switch (props.function) {
|
|
568
|
-
case "SUM":
|
|
569
|
-
case "MIN":
|
|
570
|
-
case "MAX":
|
|
571
|
-
aggrFields.push({
|
|
572
|
-
type: this.func2aggr(props.function),
|
|
573
|
-
inFieldID: this.toLowerCase(props.params.param1),
|
|
574
|
-
fieldID: this.toLowerCase(field.id)
|
|
575
|
-
});
|
|
576
|
-
break;
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
projectTransformations.push({
|
|
580
|
-
type: "scale",
|
|
581
|
-
sourceFieldID: this.toLowerCase(field.id),
|
|
582
|
-
fieldID: this.toLowerCase(field.id),
|
|
583
|
-
factor: +field.properties.params.param2
|
|
584
|
-
});
|
|
585
|
-
break;
|
|
586
|
-
default:
|
|
587
|
-
groupByColumns.push(this.toLowerCase(field.id));
|
|
588
|
-
throw new Error("Unhandled field function: "
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
else {
|
|
592
|
-
groupByColumns.push(this.toLowerCase(field.id));
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
if (projectTransformations.length) {
|
|
596
|
-
this._ddl2DataviewActivities[viz.id].project.transformations = projectTransformations;
|
|
597
|
-
}
|
|
598
|
-
if (aggrFields.length) {
|
|
599
|
-
this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns);
|
|
600
|
-
this._ddl2DataviewActivities[viz.id].groupBy.aggregates = aggrFields;
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
DDLUpgrade.prototype.func2aggr = function (func) {
|
|
607
|
-
switch (func) {
|
|
608
|
-
case "SUM":
|
|
609
|
-
return "sum";
|
|
610
|
-
case "AVE":
|
|
611
|
-
return "mean";
|
|
612
|
-
case "MIN":
|
|
613
|
-
return "min";
|
|
614
|
-
case "MAX":
|
|
615
|
-
return "max";
|
|
616
|
-
}
|
|
617
|
-
throw new Error("Unknown DDL1 Function Type: "
|
|
618
|
-
};
|
|
619
|
-
DDLUpgrade.prototype.readMappings = function () {
|
|
620
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
621
|
-
var dash = _a[_i];
|
|
622
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
623
|
-
var viz = _c[_b];
|
|
624
|
-
if (isFormVisualization(viz)) ;
|
|
625
|
-
else if (isPieVisualization(viz)) {
|
|
626
|
-
this.readPieMappings(viz);
|
|
627
|
-
}
|
|
628
|
-
else if (isChoroVisualization(viz)) {
|
|
629
|
-
this.readChoroMappings(viz);
|
|
630
|
-
}
|
|
631
|
-
else if (isLineVisualization(viz)) {
|
|
632
|
-
this.readLineMappings(viz);
|
|
633
|
-
}
|
|
634
|
-
else if (isTableVisualization(viz)) {
|
|
635
|
-
this.readTableMappings(viz);
|
|
636
|
-
}
|
|
637
|
-
else if (isGraphVisualization(viz)) {
|
|
638
|
-
this.readGraphMappings(viz);
|
|
639
|
-
}
|
|
640
|
-
else if (isSliderVisualization(viz)) {
|
|
641
|
-
this.readSliderMappings(viz);
|
|
642
|
-
}
|
|
643
|
-
else {
|
|
644
|
-
throw new Error("Unkown DDL1 mapping type: "
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
};
|
|
649
|
-
DDLUpgrade.prototype.readPieMappings = function (viz) {
|
|
650
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
651
|
-
mappings.transformations.push({
|
|
652
|
-
fieldID: "label",
|
|
653
|
-
type: "=",
|
|
654
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
655
|
-
});
|
|
656
|
-
mappings.transformations.push({
|
|
657
|
-
fieldID: "weight",
|
|
658
|
-
type: "=",
|
|
659
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
660
|
-
});
|
|
661
|
-
};
|
|
662
|
-
DDLUpgrade.prototype.readChoroMappings = function (viz) {
|
|
663
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
664
|
-
mappings.transformations.push({
|
|
665
|
-
fieldID: "label",
|
|
666
|
-
type: "=",
|
|
667
|
-
sourceFieldID: this.toLowerCase(this.anyChoroMapping2label(viz.source.mappings))
|
|
668
|
-
});
|
|
669
|
-
mappings.transformations.push({
|
|
670
|
-
fieldID: "weight",
|
|
671
|
-
type: "=",
|
|
672
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
673
|
-
});
|
|
674
|
-
};
|
|
675
|
-
DDLUpgrade.prototype.anyChoroMapping2label = function (mapping) {
|
|
676
|
-
return mapping.state || mapping.county || mapping.geohash;
|
|
677
|
-
};
|
|
678
|
-
DDLUpgrade.prototype.readLineMappings = function (viz) {
|
|
679
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
680
|
-
mappings.transformations.push({
|
|
681
|
-
fieldID: viz.source.mappings.x[0],
|
|
682
|
-
type: "=",
|
|
683
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.x[0])
|
|
684
|
-
});
|
|
685
|
-
for (var i = 0; i < viz.source.mappings.y.length; ++i) {
|
|
686
|
-
mappings.transformations.push({
|
|
687
|
-
fieldID: viz.source.mappings.y[i],
|
|
688
|
-
type: "=",
|
|
689
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.y[i])
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
};
|
|
693
|
-
DDLUpgrade.prototype.readTableMappings = function (viz) {
|
|
694
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
695
|
-
for (var i = 0; i < viz.label.length; ++i) {
|
|
696
|
-
mappings.transformations.push({
|
|
697
|
-
fieldID: viz.label[i],
|
|
698
|
-
type: "=",
|
|
699
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.value[i])
|
|
700
|
-
});
|
|
701
|
-
}
|
|
702
|
-
};
|
|
703
|
-
DDLUpgrade.prototype.readGraphEnums = function (valueMappings, annotation) {
|
|
704
|
-
if (annotation === void 0) { annotation = false; }
|
|
705
|
-
var retVal = [];
|
|
706
|
-
if (valueMappings) {
|
|
707
|
-
for (var value in valueMappings) {
|
|
708
|
-
var newValue = {};
|
|
709
|
-
for (var key in valueMappings[value]) {
|
|
710
|
-
if (key === "faChar") {
|
|
711
|
-
newValue[key] = faCharFix(valueMappings[value][key]);
|
|
712
|
-
}
|
|
713
|
-
else if (annotation && key.indexOf("icon_") === 0) {
|
|
714
|
-
console.log("Deprecated flag property: " + key);
|
|
715
|
-
newValue[key.split("icon_")[1]] = valueMappings[value][key];
|
|
716
|
-
}
|
|
717
|
-
else {
|
|
718
|
-
newValue[key] = valueMappings[value][key];
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
// remove v1.x "0" annotations as they equated to "nothing" ---
|
|
722
|
-
if (!annotation || value !== "0") {
|
|
723
|
-
retVal.push({
|
|
724
|
-
value: value,
|
|
725
|
-
newValue: newValue
|
|
726
|
-
});
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
return retVal;
|
|
731
|
-
};
|
|
732
|
-
DDLUpgrade.prototype.readGraphMappings = function (viz) {
|
|
733
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
734
|
-
mappings.transformations.push({
|
|
735
|
-
fieldID: "uid",
|
|
736
|
-
type: "=",
|
|
737
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.uid)
|
|
738
|
-
});
|
|
739
|
-
mappings.transformations.push({
|
|
740
|
-
fieldID: "label",
|
|
741
|
-
type: "=",
|
|
742
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
743
|
-
});
|
|
744
|
-
if (viz.icon.fieldid) {
|
|
745
|
-
mappings.transformations.push({
|
|
746
|
-
fieldID: "icon",
|
|
747
|
-
type: "map",
|
|
748
|
-
sourceFieldID: this.toLowerCase(viz.icon.fieldid),
|
|
749
|
-
default: { fachar: faCharFix(viz.icon.faChar) },
|
|
750
|
-
mappings: this.readGraphEnums(viz.icon.valuemappings)
|
|
751
|
-
});
|
|
752
|
-
}
|
|
753
|
-
var idx = 0;
|
|
754
|
-
if (viz.flag) {
|
|
755
|
-
for (var _i = 0, _a = viz.flag; _i < _a.length; _i++) {
|
|
756
|
-
var flag = _a[_i];
|
|
757
|
-
if (flag.fieldid) {
|
|
758
|
-
mappings.transformations.push({
|
|
759
|
-
fieldID: "annotation_"
|
|
760
|
-
type: "map",
|
|
761
|
-
sourceFieldID: this.toLowerCase(flag.fieldid),
|
|
762
|
-
default: {},
|
|
763
|
-
mappings: this.readGraphEnums(flag.valuemappings, true)
|
|
764
|
-
});
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
mappings.transformations.push({
|
|
769
|
-
fieldID: "links",
|
|
770
|
-
type: "=",
|
|
771
|
-
sourceFieldID: this.toLowerCase(viz.source.link.childfile),
|
|
772
|
-
transformations: [{
|
|
773
|
-
fieldID: "uid",
|
|
774
|
-
type: "=",
|
|
775
|
-
sourceFieldID: this.toLowerCase(viz.source.link.mappings.uid)
|
|
776
|
-
}]
|
|
777
|
-
});
|
|
778
|
-
};
|
|
779
|
-
DDLUpgrade.prototype.readSliderMappings = function (viz) {
|
|
780
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
781
|
-
mappings.transformations.push({
|
|
782
|
-
fieldID: "label",
|
|
783
|
-
type: "=",
|
|
784
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
785
|
-
});
|
|
786
|
-
};
|
|
787
|
-
DDLUpgrade.prototype.readFilters = function () {
|
|
788
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
789
|
-
var dash = _a[_i];
|
|
790
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
791
|
-
var viz = _c[_b];
|
|
792
|
-
if (viz.events) {
|
|
793
|
-
for (var eventID in viz.events) {
|
|
794
|
-
var event_1 = viz.events[eventID];
|
|
795
|
-
for (var _d = 0, _e = event_1.updates; _d < _e.length; _d++) {
|
|
796
|
-
var update = _e[_d];
|
|
797
|
-
var otherViz = this._ddl2Dataviews[update.visualization];
|
|
798
|
-
var dsFilters = this.getDatasourceFilters(update.datasource, otherViz.id);
|
|
799
|
-
if (update.mappings) {
|
|
800
|
-
if (isRoxieServiceRef(otherViz.datasource)) {
|
|
801
|
-
for (var key in update.mappings) {
|
|
802
|
-
otherViz.datasource.request.push({
|
|
803
|
-
source: viz.id,
|
|
804
|
-
remoteFieldID: this.toLowerCase(key),
|
|
805
|
-
localFieldID: this.toLowerCase(update.mappings[key])
|
|
806
|
-
});
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
else {
|
|
810
|
-
var condition = {
|
|
811
|
-
viewID: viz.id,
|
|
812
|
-
mappings: []
|
|
813
|
-
};
|
|
814
|
-
for (var key in update.mappings) {
|
|
815
|
-
var mapping = update.mappings[key];
|
|
816
|
-
var dsFilter = (mapping && dsFilters[mapping]) ? dsFilters[mapping].filter : undefined;
|
|
817
|
-
if (!dsFilter) {
|
|
818
|
-
console.warn("Select Mapping \""
|
|
819
|
-
}
|
|
820
|
-
else {
|
|
821
|
-
condition.mappings.push({
|
|
822
|
-
remoteFieldID: this.toLowerCase(key),
|
|
823
|
-
localFieldID: this.toLowerCase(update.mappings[key]),
|
|
824
|
-
condition: this.rule2condition(dsFilter.rule),
|
|
825
|
-
nullable: dsFilter.nullable
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
this._ddl2DataviewActivities[otherViz.id].filters.conditions.push(condition);
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
};
|
|
838
|
-
DDLUpgrade.prototype.rule2condition = function (_) {
|
|
839
|
-
switch (_) {
|
|
840
|
-
case "set":
|
|
841
|
-
return "in";
|
|
842
|
-
case "notequals":
|
|
843
|
-
return "!=";
|
|
844
|
-
}
|
|
845
|
-
return _;
|
|
846
|
-
};
|
|
847
|
-
DDLUpgrade.prototype.readSort = function () {
|
|
848
|
-
var _this = this;
|
|
849
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
850
|
-
var dash = _a[_i];
|
|
851
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
852
|
-
var viz = _c[_b];
|
|
853
|
-
if (viz.source) {
|
|
854
|
-
if (viz.source.sort) {
|
|
855
|
-
var vizSort = this._ddl2DataviewActivities[viz.id].sort;
|
|
856
|
-
vizSort.conditions = viz.source.sort.map(function (s) {
|
|
857
|
-
if (s.indexOf("-") === 0) {
|
|
858
|
-
return {
|
|
859
|
-
fieldID: _this.toLowerCase(s.substr(1)),
|
|
860
|
-
descending: true
|
|
861
|
-
};
|
|
862
|
-
}
|
|
863
|
-
return {
|
|
864
|
-
fieldID: _this.toLowerCase(s),
|
|
865
|
-
descending: false
|
|
866
|
-
};
|
|
867
|
-
});
|
|
868
|
-
}
|
|
869
|
-
if (viz.source.first) {
|
|
870
|
-
var vizLimit = this._ddl2DataviewActivities[viz.id].limit;
|
|
871
|
-
vizLimit.limit = +viz.source.first;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
};
|
|
877
|
-
DDLUpgrade.prototype.anyViz2view = function (viz) {
|
|
878
|
-
var project = {
|
|
879
|
-
type: "project",
|
|
880
|
-
transformations: []
|
|
881
|
-
};
|
|
882
|
-
var filters = {
|
|
883
|
-
type: "filter",
|
|
884
|
-
conditions: []
|
|
885
|
-
};
|
|
886
|
-
var groupBy = {
|
|
887
|
-
type: "groupby",
|
|
888
|
-
groupByIDs: [],
|
|
889
|
-
aggregates: []
|
|
890
|
-
};
|
|
891
|
-
var sort = {
|
|
892
|
-
type: "sort",
|
|
893
|
-
conditions: []
|
|
894
|
-
};
|
|
895
|
-
var limit = {
|
|
896
|
-
type: "limit",
|
|
897
|
-
limit: 0
|
|
898
|
-
};
|
|
899
|
-
var mappings = {
|
|
900
|
-
type: "mappings",
|
|
901
|
-
transformations: []
|
|
902
|
-
};
|
|
903
|
-
this._ddl2DataviewActivities[viz.id] = {
|
|
904
|
-
project: project,
|
|
905
|
-
filters: filters,
|
|
906
|
-
sort: sort,
|
|
907
|
-
groupBy: groupBy,
|
|
908
|
-
limit: limit,
|
|
909
|
-
mappings: mappings
|
|
910
|
-
};
|
|
911
|
-
var datasourceRef = this.isVizDatasourceRoxie(viz) ? {
|
|
912
|
-
id: this._datasourceUpdates[viz.id].id,
|
|
913
|
-
request: [],
|
|
914
|
-
output: this._datasourceUpdates[viz.id].output
|
|
915
|
-
} : {
|
|
916
|
-
id: this._datasourceUpdates[viz.id].id,
|
|
917
|
-
output: this._datasourceUpdates[viz.id].output
|
|
918
|
-
};
|
|
919
|
-
return {
|
|
920
|
-
id: viz.id,
|
|
921
|
-
datasource: datasourceRef,
|
|
922
|
-
activities: [
|
|
923
|
-
project,
|
|
924
|
-
filters,
|
|
925
|
-
sort,
|
|
926
|
-
groupBy,
|
|
927
|
-
limit
|
|
928
|
-
],
|
|
929
|
-
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 || {}) })
|
|
930
|
-
};
|
|
931
|
-
};
|
|
932
|
-
DDLUpgrade.prototype.type2chartType = function (chartType) {
|
|
933
|
-
switch (chartType) {
|
|
934
|
-
case "LINE":
|
|
935
|
-
return { chartType: "Line", __class: "chart_Line" };
|
|
936
|
-
case "BUBBLE":
|
|
937
|
-
return { chartType: "Bubble", __class: "chart_Bubble" };
|
|
938
|
-
case "PIE":
|
|
939
|
-
return { chartType: "Pie", __class: "chart_Pie" };
|
|
940
|
-
case "BAR":
|
|
941
|
-
return { chartType: "Column", __class: "chart_Column" };
|
|
942
|
-
case "FORM":
|
|
943
|
-
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
944
|
-
case "WORD_CLOUD":
|
|
945
|
-
return { chartType: "WordCloud", __class: "chart_WordCloud" };
|
|
946
|
-
case "CHORO":
|
|
947
|
-
return { chartType: "ChoroplethStates", __class: "map_ChoroplethStates" };
|
|
948
|
-
case "SUMMARY":
|
|
949
|
-
return { chartType: "Summary", __class: "chart_Summary" };
|
|
950
|
-
case "SLIDER":
|
|
951
|
-
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
952
|
-
case "HEAT_MAP":
|
|
953
|
-
return { chartType: "HeatMap", __class: "other_HeatMap" };
|
|
954
|
-
case "2DCHART":
|
|
955
|
-
return { chartType: "Column", __class: "chart_Column" };
|
|
956
|
-
case "GRAPH":
|
|
957
|
-
return { chartType: "AdjacencyGraph", __class: "graph_AdjacencyGraph" };
|
|
958
|
-
case "TABLE":
|
|
959
|
-
default:
|
|
960
|
-
return { chartType: "Table", __class: "dgrid_Table" };
|
|
961
|
-
}
|
|
962
|
-
};
|
|
963
|
-
DDLUpgrade.prototype.formFields2field = function (fields, slider) {
|
|
964
|
-
var _this = this;
|
|
965
|
-
if (slider === void 0) { slider = false; }
|
|
966
|
-
if (!fields)
|
|
967
|
-
return [];
|
|
968
|
-
return fields.map(function (field) {
|
|
969
|
-
switch (field.properties.type) {
|
|
970
|
-
case "range":
|
|
971
|
-
return {
|
|
972
|
-
type: "range",
|
|
973
|
-
id: field.id,
|
|
974
|
-
default: (field.properties.default ? field.properties.default : undefined)
|
|
975
|
-
};
|
|
976
|
-
case "dataset":
|
|
977
|
-
return {
|
|
978
|
-
type: "dataset",
|
|
979
|
-
id: field.id,
|
|
980
|
-
default: [],
|
|
981
|
-
children: []
|
|
982
|
-
};
|
|
983
|
-
default:
|
|
984
|
-
return {
|
|
985
|
-
type: _this.formFieldType2fieldType(field.properties.datatype, slider),
|
|
986
|
-
id: field.id,
|
|
987
|
-
default: field.properties.default ? field.properties.default[0] : undefined
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
|
-
});
|
|
991
|
-
};
|
|
992
|
-
DDLUpgrade.prototype.formFieldType2fieldType = function (fieldType, slider) {
|
|
993
|
-
switch (fieldType) {
|
|
994
|
-
case "bool":
|
|
995
|
-
case "boolean":
|
|
996
|
-
return "boolean";
|
|
997
|
-
case "integer":
|
|
998
|
-
case "unsigned":
|
|
999
|
-
case "float":
|
|
1000
|
-
case "double":
|
|
1001
|
-
case "real":
|
|
1002
|
-
return "number";
|
|
1003
|
-
case "string":
|
|
1004
|
-
return "string";
|
|
1005
|
-
default:
|
|
1006
|
-
return slider ? "number" : "string";
|
|
1007
|
-
}
|
|
1008
|
-
};
|
|
1009
|
-
DDLUpgrade.prototype.output2output = function (output, target) {
|
|
1010
|
-
target[output.from || output.id] = {
|
|
1011
|
-
fields: this.filters2fields(output.filter)
|
|
1012
|
-
};
|
|
1013
|
-
};
|
|
1014
|
-
DDLUpgrade.prototype.filters2fields = function (filters) {
|
|
1015
|
-
if (!filters)
|
|
1016
|
-
return [];
|
|
1017
|
-
return filters.filter(function (filter) {
|
|
1018
|
-
var idParts = filter.fieldid.split("-");
|
|
1019
|
-
return idParts.length === 1 || idParts[1] === "range";
|
|
1020
|
-
}).map(function (filter) {
|
|
1021
|
-
var idParts = filter.fieldid.split("-");
|
|
1022
|
-
var retVal = {
|
|
1023
|
-
type: "string",
|
|
1024
|
-
id: idParts[0]
|
|
1025
|
-
};
|
|
1026
|
-
return retVal;
|
|
1027
|
-
});
|
|
1028
|
-
};
|
|
1029
|
-
DDLUpgrade.prototype.getVizField = function (vizID, fieldID) {
|
|
1030
|
-
return {
|
|
1031
|
-
type: "string",
|
|
1032
|
-
id: "",
|
|
1033
|
-
default: ""
|
|
1034
|
-
};
|
|
1035
|
-
};
|
|
1036
|
-
DDLUpgrade.prototype.writeDatasources = function () {
|
|
1037
|
-
var retVal = [];
|
|
1038
|
-
for (var id in this._ddl2Datasources) {
|
|
1039
|
-
retVal.push(this._ddl2Datasources[id]);
|
|
1040
|
-
}
|
|
1041
|
-
return retVal;
|
|
1042
|
-
};
|
|
1043
|
-
DDLUpgrade.prototype.writeDataviews = function () {
|
|
1044
|
-
var retVal = [];
|
|
1045
|
-
for (var id in this._ddl2Dataviews) {
|
|
1046
|
-
retVal.push(this._ddl2Dataviews[id]);
|
|
1047
|
-
}
|
|
1048
|
-
return retVal;
|
|
1049
|
-
};
|
|
1050
|
-
DDLUpgrade.prototype.writeProperties = function () {
|
|
1051
|
-
return {
|
|
1052
|
-
// TODO
|
|
1053
|
-
};
|
|
1054
|
-
};
|
|
1055
|
-
DDLUpgrade.prototype.write = function () {
|
|
1056
|
-
return {
|
|
1057
|
-
version: "2.2.1",
|
|
1058
|
-
createdBy: {
|
|
1059
|
-
name: PKG_NAME,
|
|
1060
|
-
version: PKG_VERSION
|
|
1061
|
-
},
|
|
1062
|
-
datasources: this.writeDatasources(),
|
|
1063
|
-
dataviews: this.writeDataviews(),
|
|
1064
|
-
properties: this.writeProperties()
|
|
1065
|
-
};
|
|
1066
|
-
};
|
|
1067
|
-
return DDLUpgrade;
|
|
1068
|
-
}());
|
|
1069
|
-
function upgrade
|
|
1070
|
-
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
1071
|
-
if (dermatologyJson === void 0) { dermatologyJson = {}; }
|
|
1072
|
-
var ddlUp = new DDLUpgrade(ddl, baseUrl, wuid, toLowerCase);
|
|
1073
|
-
var retVal = ddlUp.write();
|
|
1074
|
-
retVal.properties = upgrade(retVal, dermatologyJson);
|
|
1075
|
-
return retVal;
|
|
167
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
var classMappings = {
|
|
171
|
+
c3chart_Bar: "chart_Bar",
|
|
172
|
+
c3chart_Column: "chart_Column",
|
|
173
|
+
c3chart_Pie: "chart_Pie",
|
|
174
|
+
c3chart_Area: "chart_Area",
|
|
175
|
+
c3chart_Line: "chart_Line",
|
|
176
|
+
amchart_Bar: "chart_Bar",
|
|
177
|
+
amchart_Column: "chart_Column",
|
|
178
|
+
amchart_Pie: "chart_Pie",
|
|
179
|
+
amchart_Area: "chart_Area",
|
|
180
|
+
amchart_Line: "chart_Line",
|
|
181
|
+
google_Bar: "chart_Bar",
|
|
182
|
+
google_Column: "chart_Column",
|
|
183
|
+
google_Pie: "chart_Pie",
|
|
184
|
+
google_Area: "chart_Area",
|
|
185
|
+
google_Line: "chart_Line",
|
|
186
|
+
other_Table: "dgrid_Table"
|
|
187
|
+
};
|
|
188
|
+
var propertyMappings = {
|
|
189
|
+
xAxisLabelRotation: [
|
|
190
|
+
{ name: "xAxisOverlapMode", transform: function (n) { return "rotate"; } },
|
|
191
|
+
{ name: "xAxisLabelRotation", transform: function (n) { return n; } }
|
|
192
|
+
],
|
|
193
|
+
tooltipLabelColor: {
|
|
194
|
+
name: "tooltipLabelColor"
|
|
195
|
+
},
|
|
196
|
+
tooltipSeriesColor: {
|
|
197
|
+
name: "tooltipSeriesColor"
|
|
198
|
+
},
|
|
199
|
+
tooltipValueColor: {
|
|
200
|
+
name: "tooltipValueColor"
|
|
201
|
+
},
|
|
202
|
+
tooltipValueFormat: {
|
|
203
|
+
name: "tooltipValueFormat"
|
|
204
|
+
},
|
|
205
|
+
timePattern: {
|
|
206
|
+
name: "xAxisTypeTimePattern"
|
|
207
|
+
},
|
|
208
|
+
smoothLines: {
|
|
209
|
+
name: "interpolate",
|
|
210
|
+
transform: function (n) {
|
|
211
|
+
if (n === false)
|
|
212
|
+
return "linear";
|
|
213
|
+
return "catmullRom";
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
holePercent: {
|
|
217
|
+
name: "innerRadius"
|
|
218
|
+
},
|
|
219
|
+
flip: {
|
|
220
|
+
name: "orientation",
|
|
221
|
+
transform: function (n) { return n ? "vertical" : "horizontal"; }
|
|
222
|
+
},
|
|
223
|
+
bottomText: {
|
|
224
|
+
name: "xAxisTitle"
|
|
225
|
+
},
|
|
226
|
+
xAxisTypeTimePattern: {
|
|
227
|
+
name: "xAxisTypeTimePattern"
|
|
228
|
+
},
|
|
229
|
+
yAxisTypeTimePattern: {
|
|
230
|
+
name: "yAxisTypeTimePattern"
|
|
231
|
+
},
|
|
232
|
+
valueFormat: {
|
|
233
|
+
name: "tooltipValueFormat"
|
|
234
|
+
},
|
|
235
|
+
stacked: {
|
|
236
|
+
name: "yAxisStacked"
|
|
237
|
+
},
|
|
238
|
+
showYGrid: {
|
|
239
|
+
name: "yAxisGuideLines"
|
|
240
|
+
},
|
|
241
|
+
showXGrid: {
|
|
242
|
+
name: "xAxisGuideLines"
|
|
243
|
+
},
|
|
244
|
+
showValueLabel: {
|
|
245
|
+
name: "showValue"
|
|
246
|
+
},
|
|
247
|
+
low: {
|
|
248
|
+
name: "yAxisDomainLow"
|
|
249
|
+
},
|
|
250
|
+
high: {
|
|
251
|
+
name: "yAxisDomainHigh"
|
|
252
|
+
},
|
|
253
|
+
fillOpacity: {
|
|
254
|
+
name: "interpolateFillOpacity"
|
|
255
|
+
},
|
|
256
|
+
areaFillOpacity: {
|
|
257
|
+
name: "interpolateFillOpacity"
|
|
258
|
+
},
|
|
259
|
+
showToolbar: {
|
|
260
|
+
name: "titleVisible"
|
|
261
|
+
},
|
|
262
|
+
showCSV: {
|
|
263
|
+
name: "downloadButtonVisible"
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
function findKeyVal(object, key, val) {
|
|
267
|
+
var value;
|
|
268
|
+
for (var k in object) {
|
|
269
|
+
if (k === key && object[k] === val) {
|
|
270
|
+
value = object;
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
if (object[k] && typeof object[k] === "object") {
|
|
274
|
+
value = findKeyVal(object[k], key, val);
|
|
275
|
+
if (value !== undefined) {
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return value;
|
|
281
|
+
}
|
|
282
|
+
function apply_to_dataviews(ddl2, dermObj) {
|
|
283
|
+
ddl2.dataviews.forEach(apply_to_dataview);
|
|
284
|
+
function apply_to_dataview(dv) {
|
|
285
|
+
var widgetId = dv.id;
|
|
286
|
+
var dermPanelObj = findKeyVal(dermObj, "__id", widgetId);
|
|
287
|
+
if (dermPanelObj) {
|
|
288
|
+
var dermPanelProps = dermPanelObj.__properties;
|
|
289
|
+
var dermWidgetObj = dermPanelObj.__properties.chart ? dermPanelObj.__properties.chart : dermPanelObj.__properties.widget;
|
|
290
|
+
var dermWidgetProps = dermWidgetObj.__properties;
|
|
291
|
+
apply_class_mapping(dermWidgetObj);
|
|
292
|
+
apply_panel_property_mapping(dermPanelProps, dermWidgetProps);
|
|
293
|
+
apply_widget_property_mapping(dermPanelProps, dermWidgetProps);
|
|
294
|
+
if (dv.visualization.properties.chartType) {
|
|
295
|
+
dv.visualization.properties.charttype = dv.visualization.properties.chartType;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
console.warn(widgetId + " not found in dermObj");
|
|
300
|
+
}
|
|
301
|
+
function apply_class_mapping(dermWidgetObj) {
|
|
302
|
+
dv.visualization.__class = swap_with_supported_class(dermWidgetObj.__class);
|
|
303
|
+
dv.visualization.properties.__class = "marshaller_VizChartPanel";
|
|
304
|
+
if (!dv.visualization.properties.widget)
|
|
305
|
+
dv.visualization.properties.widget = {};
|
|
306
|
+
dv.visualization.properties.widget.__class = dv.visualization.__class;
|
|
307
|
+
function swap_with_supported_class(_class) {
|
|
308
|
+
return classMappings[_class] ? classMappings[_class] : _class;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function apply_panel_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
312
|
+
dv.visualization.title = dermPanelProps.title || "";
|
|
313
|
+
dv.visualization.description = "";
|
|
314
|
+
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
315
|
+
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
316
|
+
for (var propName in dermPanelProps) {
|
|
317
|
+
if (typeof propertyMappings[propName] !== "undefined") {
|
|
318
|
+
var newPropName = propertyMappings[propName].name;
|
|
319
|
+
if (typeof propertyMappings[propName].transform === "function") {
|
|
320
|
+
dv.visualization.properties[newPropName] = propertyMappings[propName].transform(dermPanelProps[propName]);
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
dv.visualization.properties[newPropName] = dermPanelProps[propName];
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (dermWidgetProps && dermWidgetProps.showLegend && dv.visualization.properties) {
|
|
328
|
+
dv.visualization.properties.legendVisible = true;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
function apply_widget_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
332
|
+
dv.visualization.title = dv.visualization.title || dermWidgetProps.title || "";
|
|
333
|
+
dv.visualization.description = ""; // TODO - should this map to anything?
|
|
334
|
+
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
335
|
+
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
336
|
+
var _loop_1 = function (propName) {
|
|
337
|
+
if (typeof propertyMappings[propName] !== "undefined") {
|
|
338
|
+
if (propertyMappings[propName] instanceof Array) {
|
|
339
|
+
propertyMappings[propName].forEach(function (p) {
|
|
340
|
+
var newPropName = p.name;
|
|
341
|
+
dv.visualization.properties.widget[newPropName] = p.transform(dermWidgetProps[propName]);
|
|
342
|
+
if (typeof propertyMappings[propName].transform === "function") {
|
|
343
|
+
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
dv.visualization.properties.widget[newPropName] = dermWidgetProps[propName];
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
var newPropName = propertyMappings[propName].name;
|
|
352
|
+
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
for (var propName in dermWidgetProps) {
|
|
357
|
+
_loop_1(propName);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
function apply_to_properties_layout(ddl2, dermObj) {
|
|
363
|
+
var retVal = {
|
|
364
|
+
layout: []
|
|
365
|
+
};
|
|
366
|
+
if (!dermObj || !dermObj.__properties)
|
|
367
|
+
return;
|
|
368
|
+
dermObj.__properties.content.forEach(function (cell) {
|
|
369
|
+
var cellPosition = {
|
|
370
|
+
// TODO - if "id" could be avoided then layouts could apply to any dashboard with the same number of widgets
|
|
371
|
+
id: cell.__properties.widget.__id,
|
|
372
|
+
position: [
|
|
373
|
+
cell.__properties.gridCol,
|
|
374
|
+
cell.__properties.gridRow,
|
|
375
|
+
cell.__properties.gridColSpan,
|
|
376
|
+
cell.__properties.gridRowSpan
|
|
377
|
+
]
|
|
378
|
+
};
|
|
379
|
+
retVal.layout.push(cellPosition);
|
|
380
|
+
});
|
|
381
|
+
return retVal;
|
|
382
|
+
}
|
|
383
|
+
function upgrade$1(ddl2, dermObj) {
|
|
384
|
+
apply_to_dataviews(ddl2, dermObj);
|
|
385
|
+
return apply_to_properties_layout(ddl2, dermObj);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function faCharFix(faChar) {
|
|
389
|
+
return faChar;
|
|
390
|
+
}
|
|
391
|
+
var DDLUpgrade = /** @class */ (function () {
|
|
392
|
+
function DDLUpgrade(ddl, baseUrl, wuid, toLowerCase) {
|
|
393
|
+
if (baseUrl === void 0) { baseUrl = "http://localhost:8010"; }
|
|
394
|
+
if (wuid === void 0) { wuid = "WUID"; }
|
|
395
|
+
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
396
|
+
this._datasources = {};
|
|
397
|
+
this._datasourceUpdates = {};
|
|
398
|
+
this._visualizations = {};
|
|
399
|
+
this._ddl2Datasources = {};
|
|
400
|
+
this._ddl2DatasourceFields = {};
|
|
401
|
+
this._ddl2Dataviews = {};
|
|
402
|
+
this._ddl2DataviewActivities = {};
|
|
403
|
+
this._ddl = ddl;
|
|
404
|
+
this._baseUrl = baseUrl;
|
|
405
|
+
this._wuid = wuid;
|
|
406
|
+
this._toLowerCase = toLowerCase;
|
|
407
|
+
this.indexDDL();
|
|
408
|
+
this.readDDL();
|
|
409
|
+
}
|
|
410
|
+
DDLUpgrade.prototype.toLowerCase = function (s) {
|
|
411
|
+
return this._toLowerCase ? s.toLowerCase() : s;
|
|
412
|
+
};
|
|
413
|
+
DDLUpgrade.prototype.isVizDatasourceRoxie = function (viz) {
|
|
414
|
+
if (viz.source) {
|
|
415
|
+
var ds = this._datasources[viz.source.id];
|
|
416
|
+
if (isHipieDatasource(ds)) {
|
|
417
|
+
return true;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return false;
|
|
421
|
+
};
|
|
422
|
+
DDLUpgrade.prototype.getDatasourceOutputs = function (dsID, vizID) {
|
|
423
|
+
var retVal = [];
|
|
424
|
+
var datasource = this._datasources[dsID];
|
|
425
|
+
for (var _i = 0, _a = datasource.outputs; _i < _a.length; _i++) {
|
|
426
|
+
var output = _a[_i];
|
|
427
|
+
if (output.notify) {
|
|
428
|
+
for (var _b = 0, _c = output.notify; _b < _c.length; _b++) {
|
|
429
|
+
var notify = _c[_b];
|
|
430
|
+
if (notify === vizID) {
|
|
431
|
+
retVal.push({
|
|
432
|
+
datasource: datasource,
|
|
433
|
+
output: output
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return retVal;
|
|
440
|
+
};
|
|
441
|
+
DDLUpgrade.prototype.getDatasourceFilters = function (dsID, vizID) {
|
|
442
|
+
var retVal = {};
|
|
443
|
+
for (var _i = 0, _a = this.getDatasourceOutputs(dsID, vizID); _i < _a.length; _i++) {
|
|
444
|
+
var dsOut = _a[_i];
|
|
445
|
+
if (dsOut.output.filter) {
|
|
446
|
+
for (var _b = 0, _c = dsOut.output.filter; _b < _c.length; _b++) {
|
|
447
|
+
var filter = _c[_b];
|
|
448
|
+
retVal[filter.fieldid] = {
|
|
449
|
+
datasource: dsOut.datasource,
|
|
450
|
+
output: dsOut.output,
|
|
451
|
+
filter: filter
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
return retVal;
|
|
457
|
+
};
|
|
458
|
+
DDLUpgrade.prototype.indexDDL = function () {
|
|
459
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
460
|
+
var dash = _a[_i];
|
|
461
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
462
|
+
var viz = _c[_b];
|
|
463
|
+
this._visualizations[viz.id] = viz;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
for (var _d = 0, _e = this._ddl.datasources; _d < _e.length; _d++) {
|
|
467
|
+
var ds = _e[_d];
|
|
468
|
+
this._datasources[ds.id] = ds;
|
|
469
|
+
for (var _f = 0, _g = ds.outputs; _f < _g.length; _f++) {
|
|
470
|
+
var output = _g[_f];
|
|
471
|
+
if (output.notify) {
|
|
472
|
+
for (var _h = 0, _j = output.notify; _h < _j.length; _h++) {
|
|
473
|
+
var notify = _j[_h];
|
|
474
|
+
this._datasourceUpdates[notify] = {
|
|
475
|
+
id: ds.id,
|
|
476
|
+
output: output.from || output.id
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
DDLUpgrade.prototype.readDDL = function () {
|
|
484
|
+
for (var _i = 0, _a = this._ddl.datasources; _i < _a.length; _i++) {
|
|
485
|
+
var ds = _a[_i];
|
|
486
|
+
if (isWorkunitDatasource(ds)) {
|
|
487
|
+
var ddl2DS = {
|
|
488
|
+
type: "wuresult",
|
|
489
|
+
id: ds.id,
|
|
490
|
+
url: this._baseUrl,
|
|
491
|
+
wuid: this._wuid,
|
|
492
|
+
outputs: {}
|
|
493
|
+
};
|
|
494
|
+
for (var _b = 0, _c = ds.outputs; _b < _c.length; _b++) {
|
|
495
|
+
var output = _c[_b];
|
|
496
|
+
this.output2output(output, ddl2DS.outputs);
|
|
497
|
+
}
|
|
498
|
+
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
499
|
+
}
|
|
500
|
+
else if (isDatabombDatasource(ds)) ;
|
|
501
|
+
else {
|
|
502
|
+
var urlParts = ds.URL.split("/WsEcl/submit/query/");
|
|
503
|
+
var hostParts = urlParts[0];
|
|
504
|
+
var roxieParts = urlParts[1].split("/");
|
|
505
|
+
var ddl2DS = {
|
|
506
|
+
type: "hipie",
|
|
507
|
+
id: ds.id,
|
|
508
|
+
url: hostParts,
|
|
509
|
+
querySet: roxieParts[0],
|
|
510
|
+
queryID: roxieParts[1],
|
|
511
|
+
inputs: [],
|
|
512
|
+
outputs: {}
|
|
513
|
+
};
|
|
514
|
+
for (var _d = 0, _e = ds.outputs; _d < _e.length; _d++) {
|
|
515
|
+
var output = _e[_d];
|
|
516
|
+
this.output2output(output, ddl2DS.outputs);
|
|
517
|
+
}
|
|
518
|
+
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
for (var _f = 0, _g = this._ddl.dashboards; _f < _g.length; _f++) {
|
|
522
|
+
var dash = _g[_f];
|
|
523
|
+
for (var _h = 0, _j = dash.visualizations; _h < _j.length; _h++) {
|
|
524
|
+
var viz = _j[_h];
|
|
525
|
+
if (viz.type === "FORM") {
|
|
526
|
+
this._ddl2Datasources[viz.id] = {
|
|
527
|
+
type: "form",
|
|
528
|
+
id: viz.id,
|
|
529
|
+
fields: this.formFields2field(viz.fields)
|
|
530
|
+
};
|
|
531
|
+
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
532
|
+
}
|
|
533
|
+
else if (viz.type === "SLIDER") {
|
|
534
|
+
this._ddl2Datasources[viz.id] = {
|
|
535
|
+
type: "form",
|
|
536
|
+
id: viz.id,
|
|
537
|
+
fields: this.formFields2field(viz.fields, true)
|
|
538
|
+
};
|
|
539
|
+
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
540
|
+
}
|
|
541
|
+
this._ddl2Dataviews[viz.id] = this.anyViz2view(viz);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
this.readGroupBy();
|
|
545
|
+
this.readFilters();
|
|
546
|
+
this.readSort();
|
|
547
|
+
this.readMappings();
|
|
548
|
+
};
|
|
549
|
+
DDLUpgrade.prototype.readGroupBy = function () {
|
|
550
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
551
|
+
var dash = _a[_i];
|
|
552
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
553
|
+
var viz = _c[_b];
|
|
554
|
+
if (viz.fields) {
|
|
555
|
+
var projectTransformations = [];
|
|
556
|
+
var groupByColumns = [];
|
|
557
|
+
var aggrFields = [];
|
|
558
|
+
for (var _d = 0, _e = viz.fields; _d < _e.length; _d++) {
|
|
559
|
+
var field = _e[_d];
|
|
560
|
+
if (field.properties && field.properties.function) {
|
|
561
|
+
switch (field.properties.function) {
|
|
562
|
+
case "SUM":
|
|
563
|
+
case "MIN":
|
|
564
|
+
case "MAX":
|
|
565
|
+
aggrFields.push({
|
|
566
|
+
type: this.func2aggr(field.properties.function),
|
|
567
|
+
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
568
|
+
fieldID: this.toLowerCase(field.id)
|
|
569
|
+
});
|
|
570
|
+
break;
|
|
571
|
+
case "AVE":
|
|
572
|
+
aggrFields.push({
|
|
573
|
+
type: this.func2aggr(field.properties.function),
|
|
574
|
+
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
575
|
+
baseCountFieldID: field.properties.params.param2 ? this.toLowerCase(field.properties.params.param2) : undefined,
|
|
576
|
+
fieldID: this.toLowerCase(field.id)
|
|
577
|
+
});
|
|
578
|
+
break;
|
|
579
|
+
case "SCALE":
|
|
580
|
+
if (typeof field.properties.params.param1 === "object") {
|
|
581
|
+
var props = field.properties.params.param1;
|
|
582
|
+
switch (props.function) {
|
|
583
|
+
case "SUM":
|
|
584
|
+
case "MIN":
|
|
585
|
+
case "MAX":
|
|
586
|
+
aggrFields.push({
|
|
587
|
+
type: this.func2aggr(props.function),
|
|
588
|
+
inFieldID: this.toLowerCase(props.params.param1),
|
|
589
|
+
fieldID: this.toLowerCase(field.id)
|
|
590
|
+
});
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
projectTransformations.push({
|
|
595
|
+
type: "scale",
|
|
596
|
+
sourceFieldID: this.toLowerCase(field.id),
|
|
597
|
+
fieldID: this.toLowerCase(field.id),
|
|
598
|
+
factor: +field.properties.params.param2
|
|
599
|
+
});
|
|
600
|
+
break;
|
|
601
|
+
default:
|
|
602
|
+
groupByColumns.push(this.toLowerCase(field.id));
|
|
603
|
+
throw new Error("Unhandled field function: ".concat(field.properties.function));
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
groupByColumns.push(this.toLowerCase(field.id));
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
if (projectTransformations.length) {
|
|
611
|
+
this._ddl2DataviewActivities[viz.id].project.transformations = projectTransformations;
|
|
612
|
+
}
|
|
613
|
+
if (aggrFields.length) {
|
|
614
|
+
this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns, true);
|
|
615
|
+
this._ddl2DataviewActivities[viz.id].groupBy.aggregates = aggrFields;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
DDLUpgrade.prototype.func2aggr = function (func) {
|
|
622
|
+
switch (func) {
|
|
623
|
+
case "SUM":
|
|
624
|
+
return "sum";
|
|
625
|
+
case "AVE":
|
|
626
|
+
return "mean";
|
|
627
|
+
case "MIN":
|
|
628
|
+
return "min";
|
|
629
|
+
case "MAX":
|
|
630
|
+
return "max";
|
|
631
|
+
}
|
|
632
|
+
throw new Error("Unknown DDL1 Function Type: ".concat(func));
|
|
633
|
+
};
|
|
634
|
+
DDLUpgrade.prototype.readMappings = function () {
|
|
635
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
636
|
+
var dash = _a[_i];
|
|
637
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
638
|
+
var viz = _c[_b];
|
|
639
|
+
if (isFormVisualization(viz)) ;
|
|
640
|
+
else if (isPieVisualization(viz)) {
|
|
641
|
+
this.readPieMappings(viz);
|
|
642
|
+
}
|
|
643
|
+
else if (isChoroVisualization(viz)) {
|
|
644
|
+
this.readChoroMappings(viz);
|
|
645
|
+
}
|
|
646
|
+
else if (isLineVisualization(viz)) {
|
|
647
|
+
this.readLineMappings(viz);
|
|
648
|
+
}
|
|
649
|
+
else if (isTableVisualization(viz)) {
|
|
650
|
+
this.readTableMappings(viz);
|
|
651
|
+
}
|
|
652
|
+
else if (isGraphVisualization(viz)) {
|
|
653
|
+
this.readGraphMappings(viz);
|
|
654
|
+
}
|
|
655
|
+
else if (isSliderVisualization(viz)) {
|
|
656
|
+
this.readSliderMappings(viz);
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
throw new Error("Unkown DDL1 mapping type: ".concat(viz.type));
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
DDLUpgrade.prototype.readPieMappings = function (viz) {
|
|
665
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
666
|
+
mappings.transformations.push({
|
|
667
|
+
fieldID: "label",
|
|
668
|
+
type: "=",
|
|
669
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
670
|
+
});
|
|
671
|
+
mappings.transformations.push({
|
|
672
|
+
fieldID: "weight",
|
|
673
|
+
type: "=",
|
|
674
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
675
|
+
});
|
|
676
|
+
};
|
|
677
|
+
DDLUpgrade.prototype.readChoroMappings = function (viz) {
|
|
678
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
679
|
+
mappings.transformations.push({
|
|
680
|
+
fieldID: "label",
|
|
681
|
+
type: "=",
|
|
682
|
+
sourceFieldID: this.toLowerCase(this.anyChoroMapping2label(viz.source.mappings))
|
|
683
|
+
});
|
|
684
|
+
mappings.transformations.push({
|
|
685
|
+
fieldID: "weight",
|
|
686
|
+
type: "=",
|
|
687
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
688
|
+
});
|
|
689
|
+
};
|
|
690
|
+
DDLUpgrade.prototype.anyChoroMapping2label = function (mapping) {
|
|
691
|
+
return mapping.state || mapping.county || mapping.geohash;
|
|
692
|
+
};
|
|
693
|
+
DDLUpgrade.prototype.readLineMappings = function (viz) {
|
|
694
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
695
|
+
mappings.transformations.push({
|
|
696
|
+
fieldID: viz.source.mappings.x[0],
|
|
697
|
+
type: "=",
|
|
698
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.x[0])
|
|
699
|
+
});
|
|
700
|
+
for (var i = 0; i < viz.source.mappings.y.length; ++i) {
|
|
701
|
+
mappings.transformations.push({
|
|
702
|
+
fieldID: viz.source.mappings.y[i],
|
|
703
|
+
type: "=",
|
|
704
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.y[i])
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
DDLUpgrade.prototype.readTableMappings = function (viz) {
|
|
709
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
710
|
+
for (var i = 0; i < viz.label.length; ++i) {
|
|
711
|
+
mappings.transformations.push({
|
|
712
|
+
fieldID: viz.label[i],
|
|
713
|
+
type: "=",
|
|
714
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.value[i])
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
DDLUpgrade.prototype.readGraphEnums = function (valueMappings, annotation) {
|
|
719
|
+
if (annotation === void 0) { annotation = false; }
|
|
720
|
+
var retVal = [];
|
|
721
|
+
if (valueMappings) {
|
|
722
|
+
for (var value in valueMappings) {
|
|
723
|
+
var newValue = {};
|
|
724
|
+
for (var key in valueMappings[value]) {
|
|
725
|
+
if (key === "faChar") {
|
|
726
|
+
newValue[key] = faCharFix(valueMappings[value][key]);
|
|
727
|
+
}
|
|
728
|
+
else if (annotation && key.indexOf("icon_") === 0) {
|
|
729
|
+
console.log("Deprecated flag property: " + key);
|
|
730
|
+
newValue[key.split("icon_")[1]] = valueMappings[value][key];
|
|
731
|
+
}
|
|
732
|
+
else {
|
|
733
|
+
newValue[key] = valueMappings[value][key];
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
// remove v1.x "0" annotations as they equated to "nothing" ---
|
|
737
|
+
if (!annotation || value !== "0") {
|
|
738
|
+
retVal.push({
|
|
739
|
+
value: value,
|
|
740
|
+
newValue: newValue
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
return retVal;
|
|
746
|
+
};
|
|
747
|
+
DDLUpgrade.prototype.readGraphMappings = function (viz) {
|
|
748
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
749
|
+
mappings.transformations.push({
|
|
750
|
+
fieldID: "uid",
|
|
751
|
+
type: "=",
|
|
752
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.uid)
|
|
753
|
+
});
|
|
754
|
+
mappings.transformations.push({
|
|
755
|
+
fieldID: "label",
|
|
756
|
+
type: "=",
|
|
757
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
758
|
+
});
|
|
759
|
+
if (viz.icon.fieldid) {
|
|
760
|
+
mappings.transformations.push({
|
|
761
|
+
fieldID: "icon",
|
|
762
|
+
type: "map",
|
|
763
|
+
sourceFieldID: this.toLowerCase(viz.icon.fieldid),
|
|
764
|
+
default: { fachar: faCharFix(viz.icon.faChar) },
|
|
765
|
+
mappings: this.readGraphEnums(viz.icon.valuemappings)
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
var idx = 0;
|
|
769
|
+
if (viz.flag) {
|
|
770
|
+
for (var _i = 0, _a = viz.flag; _i < _a.length; _i++) {
|
|
771
|
+
var flag = _a[_i];
|
|
772
|
+
if (flag.fieldid) {
|
|
773
|
+
mappings.transformations.push({
|
|
774
|
+
fieldID: "annotation_".concat(idx++),
|
|
775
|
+
type: "map",
|
|
776
|
+
sourceFieldID: this.toLowerCase(flag.fieldid),
|
|
777
|
+
default: {},
|
|
778
|
+
mappings: this.readGraphEnums(flag.valuemappings, true)
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
mappings.transformations.push({
|
|
784
|
+
fieldID: "links",
|
|
785
|
+
type: "=",
|
|
786
|
+
sourceFieldID: this.toLowerCase(viz.source.link.childfile),
|
|
787
|
+
transformations: [{
|
|
788
|
+
fieldID: "uid",
|
|
789
|
+
type: "=",
|
|
790
|
+
sourceFieldID: this.toLowerCase(viz.source.link.mappings.uid)
|
|
791
|
+
}]
|
|
792
|
+
});
|
|
793
|
+
};
|
|
794
|
+
DDLUpgrade.prototype.readSliderMappings = function (viz) {
|
|
795
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
796
|
+
mappings.transformations.push({
|
|
797
|
+
fieldID: "label",
|
|
798
|
+
type: "=",
|
|
799
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
800
|
+
});
|
|
801
|
+
};
|
|
802
|
+
DDLUpgrade.prototype.readFilters = function () {
|
|
803
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
804
|
+
var dash = _a[_i];
|
|
805
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
806
|
+
var viz = _c[_b];
|
|
807
|
+
if (viz.events) {
|
|
808
|
+
for (var eventID in viz.events) {
|
|
809
|
+
var event_1 = viz.events[eventID];
|
|
810
|
+
for (var _d = 0, _e = event_1.updates; _d < _e.length; _d++) {
|
|
811
|
+
var update = _e[_d];
|
|
812
|
+
var otherViz = this._ddl2Dataviews[update.visualization];
|
|
813
|
+
var dsFilters = this.getDatasourceFilters(update.datasource, otherViz.id);
|
|
814
|
+
if (update.mappings) {
|
|
815
|
+
if (isRoxieServiceRef(otherViz.datasource)) {
|
|
816
|
+
for (var key in update.mappings) {
|
|
817
|
+
otherViz.datasource.request.push({
|
|
818
|
+
source: viz.id,
|
|
819
|
+
remoteFieldID: this.toLowerCase(key),
|
|
820
|
+
localFieldID: this.toLowerCase(update.mappings[key])
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
else {
|
|
825
|
+
var condition = {
|
|
826
|
+
viewID: viz.id,
|
|
827
|
+
mappings: []
|
|
828
|
+
};
|
|
829
|
+
for (var key in update.mappings) {
|
|
830
|
+
var mapping = update.mappings[key];
|
|
831
|
+
var dsFilter = (mapping && dsFilters[mapping]) ? dsFilters[mapping].filter : undefined;
|
|
832
|
+
if (!dsFilter) {
|
|
833
|
+
console.warn("Select Mapping \"".concat(mapping, "\" in viz \"").concat(viz.id, "\" not found in filters for \"").concat(otherViz.id, "\""));
|
|
834
|
+
}
|
|
835
|
+
else {
|
|
836
|
+
condition.mappings.push({
|
|
837
|
+
remoteFieldID: this.toLowerCase(key),
|
|
838
|
+
localFieldID: this.toLowerCase(update.mappings[key]),
|
|
839
|
+
condition: this.rule2condition(dsFilter.rule),
|
|
840
|
+
nullable: dsFilter.nullable
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
this._ddl2DataviewActivities[otherViz.id].filters.conditions.push(condition);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
DDLUpgrade.prototype.rule2condition = function (_) {
|
|
854
|
+
switch (_) {
|
|
855
|
+
case "set":
|
|
856
|
+
return "in";
|
|
857
|
+
case "notequals":
|
|
858
|
+
return "!=";
|
|
859
|
+
}
|
|
860
|
+
return _;
|
|
861
|
+
};
|
|
862
|
+
DDLUpgrade.prototype.readSort = function () {
|
|
863
|
+
var _this = this;
|
|
864
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
865
|
+
var dash = _a[_i];
|
|
866
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
867
|
+
var viz = _c[_b];
|
|
868
|
+
if (viz.source) {
|
|
869
|
+
if (viz.source.sort) {
|
|
870
|
+
var vizSort = this._ddl2DataviewActivities[viz.id].sort;
|
|
871
|
+
vizSort.conditions = viz.source.sort.map(function (s) {
|
|
872
|
+
if (s.indexOf("-") === 0) {
|
|
873
|
+
return {
|
|
874
|
+
fieldID: _this.toLowerCase(s.substr(1)),
|
|
875
|
+
descending: true
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
return {
|
|
879
|
+
fieldID: _this.toLowerCase(s),
|
|
880
|
+
descending: false
|
|
881
|
+
};
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
if (viz.source.first) {
|
|
885
|
+
var vizLimit = this._ddl2DataviewActivities[viz.id].limit;
|
|
886
|
+
vizLimit.limit = +viz.source.first;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
DDLUpgrade.prototype.anyViz2view = function (viz) {
|
|
893
|
+
var project = {
|
|
894
|
+
type: "project",
|
|
895
|
+
transformations: []
|
|
896
|
+
};
|
|
897
|
+
var filters = {
|
|
898
|
+
type: "filter",
|
|
899
|
+
conditions: []
|
|
900
|
+
};
|
|
901
|
+
var groupBy = {
|
|
902
|
+
type: "groupby",
|
|
903
|
+
groupByIDs: [],
|
|
904
|
+
aggregates: []
|
|
905
|
+
};
|
|
906
|
+
var sort = {
|
|
907
|
+
type: "sort",
|
|
908
|
+
conditions: []
|
|
909
|
+
};
|
|
910
|
+
var limit = {
|
|
911
|
+
type: "limit",
|
|
912
|
+
limit: 0
|
|
913
|
+
};
|
|
914
|
+
var mappings = {
|
|
915
|
+
type: "mappings",
|
|
916
|
+
transformations: []
|
|
917
|
+
};
|
|
918
|
+
this._ddl2DataviewActivities[viz.id] = {
|
|
919
|
+
project: project,
|
|
920
|
+
filters: filters,
|
|
921
|
+
sort: sort,
|
|
922
|
+
groupBy: groupBy,
|
|
923
|
+
limit: limit,
|
|
924
|
+
mappings: mappings
|
|
925
|
+
};
|
|
926
|
+
var datasourceRef = this.isVizDatasourceRoxie(viz) ? {
|
|
927
|
+
id: this._datasourceUpdates[viz.id].id,
|
|
928
|
+
request: [],
|
|
929
|
+
output: this._datasourceUpdates[viz.id].output
|
|
930
|
+
} : {
|
|
931
|
+
id: this._datasourceUpdates[viz.id].id,
|
|
932
|
+
output: this._datasourceUpdates[viz.id].output
|
|
933
|
+
};
|
|
934
|
+
return {
|
|
935
|
+
id: viz.id,
|
|
936
|
+
datasource: datasourceRef,
|
|
937
|
+
activities: [
|
|
938
|
+
project,
|
|
939
|
+
filters,
|
|
940
|
+
sort,
|
|
941
|
+
groupBy,
|
|
942
|
+
limit
|
|
943
|
+
],
|
|
944
|
+
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 || {}) })
|
|
945
|
+
};
|
|
946
|
+
};
|
|
947
|
+
DDLUpgrade.prototype.type2chartType = function (chartType) {
|
|
948
|
+
switch (chartType) {
|
|
949
|
+
case "LINE":
|
|
950
|
+
return { chartType: "Line", __class: "chart_Line" };
|
|
951
|
+
case "BUBBLE":
|
|
952
|
+
return { chartType: "Bubble", __class: "chart_Bubble" };
|
|
953
|
+
case "PIE":
|
|
954
|
+
return { chartType: "Pie", __class: "chart_Pie" };
|
|
955
|
+
case "BAR":
|
|
956
|
+
return { chartType: "Column", __class: "chart_Column" };
|
|
957
|
+
case "FORM":
|
|
958
|
+
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
959
|
+
case "WORD_CLOUD":
|
|
960
|
+
return { chartType: "WordCloud", __class: "chart_WordCloud" };
|
|
961
|
+
case "CHORO":
|
|
962
|
+
return { chartType: "ChoroplethStates", __class: "map_ChoroplethStates" };
|
|
963
|
+
case "SUMMARY":
|
|
964
|
+
return { chartType: "Summary", __class: "chart_Summary" };
|
|
965
|
+
case "SLIDER":
|
|
966
|
+
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
967
|
+
case "HEAT_MAP":
|
|
968
|
+
return { chartType: "HeatMap", __class: "other_HeatMap" };
|
|
969
|
+
case "2DCHART":
|
|
970
|
+
return { chartType: "Column", __class: "chart_Column" };
|
|
971
|
+
case "GRAPH":
|
|
972
|
+
return { chartType: "AdjacencyGraph", __class: "graph_AdjacencyGraph" };
|
|
973
|
+
case "TABLE":
|
|
974
|
+
default:
|
|
975
|
+
return { chartType: "Table", __class: "dgrid_Table" };
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
DDLUpgrade.prototype.formFields2field = function (fields, slider) {
|
|
979
|
+
var _this = this;
|
|
980
|
+
if (slider === void 0) { slider = false; }
|
|
981
|
+
if (!fields)
|
|
982
|
+
return [];
|
|
983
|
+
return fields.map(function (field) {
|
|
984
|
+
switch (field.properties.type) {
|
|
985
|
+
case "range":
|
|
986
|
+
return {
|
|
987
|
+
type: "range",
|
|
988
|
+
id: field.id,
|
|
989
|
+
default: (field.properties.default ? field.properties.default : undefined)
|
|
990
|
+
};
|
|
991
|
+
case "dataset":
|
|
992
|
+
return {
|
|
993
|
+
type: "dataset",
|
|
994
|
+
id: field.id,
|
|
995
|
+
default: [],
|
|
996
|
+
children: []
|
|
997
|
+
};
|
|
998
|
+
default:
|
|
999
|
+
return {
|
|
1000
|
+
type: _this.formFieldType2fieldType(field.properties.datatype, slider),
|
|
1001
|
+
id: field.id,
|
|
1002
|
+
default: field.properties.default ? field.properties.default[0] : undefined
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
};
|
|
1007
|
+
DDLUpgrade.prototype.formFieldType2fieldType = function (fieldType, slider) {
|
|
1008
|
+
switch (fieldType) {
|
|
1009
|
+
case "bool":
|
|
1010
|
+
case "boolean":
|
|
1011
|
+
return "boolean";
|
|
1012
|
+
case "integer":
|
|
1013
|
+
case "unsigned":
|
|
1014
|
+
case "float":
|
|
1015
|
+
case "double":
|
|
1016
|
+
case "real":
|
|
1017
|
+
return "number";
|
|
1018
|
+
case "string":
|
|
1019
|
+
return "string";
|
|
1020
|
+
default:
|
|
1021
|
+
return slider ? "number" : "string";
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
DDLUpgrade.prototype.output2output = function (output, target) {
|
|
1025
|
+
target[output.from || output.id] = {
|
|
1026
|
+
fields: this.filters2fields(output.filter)
|
|
1027
|
+
};
|
|
1028
|
+
};
|
|
1029
|
+
DDLUpgrade.prototype.filters2fields = function (filters) {
|
|
1030
|
+
if (!filters)
|
|
1031
|
+
return [];
|
|
1032
|
+
return filters.filter(function (filter) {
|
|
1033
|
+
var idParts = filter.fieldid.split("-");
|
|
1034
|
+
return idParts.length === 1 || idParts[1] === "range";
|
|
1035
|
+
}).map(function (filter) {
|
|
1036
|
+
var idParts = filter.fieldid.split("-");
|
|
1037
|
+
var retVal = {
|
|
1038
|
+
type: "string",
|
|
1039
|
+
id: idParts[0]
|
|
1040
|
+
};
|
|
1041
|
+
return retVal;
|
|
1042
|
+
});
|
|
1043
|
+
};
|
|
1044
|
+
DDLUpgrade.prototype.getVizField = function (vizID, fieldID) {
|
|
1045
|
+
return {
|
|
1046
|
+
type: "string",
|
|
1047
|
+
id: "",
|
|
1048
|
+
default: ""
|
|
1049
|
+
};
|
|
1050
|
+
};
|
|
1051
|
+
DDLUpgrade.prototype.writeDatasources = function () {
|
|
1052
|
+
var retVal = [];
|
|
1053
|
+
for (var id in this._ddl2Datasources) {
|
|
1054
|
+
retVal.push(this._ddl2Datasources[id]);
|
|
1055
|
+
}
|
|
1056
|
+
return retVal;
|
|
1057
|
+
};
|
|
1058
|
+
DDLUpgrade.prototype.writeDataviews = function () {
|
|
1059
|
+
var retVal = [];
|
|
1060
|
+
for (var id in this._ddl2Dataviews) {
|
|
1061
|
+
retVal.push(this._ddl2Dataviews[id]);
|
|
1062
|
+
}
|
|
1063
|
+
return retVal;
|
|
1064
|
+
};
|
|
1065
|
+
DDLUpgrade.prototype.writeProperties = function () {
|
|
1066
|
+
return {
|
|
1067
|
+
// TODO
|
|
1068
|
+
};
|
|
1069
|
+
};
|
|
1070
|
+
DDLUpgrade.prototype.write = function () {
|
|
1071
|
+
return {
|
|
1072
|
+
version: "2.2.1",
|
|
1073
|
+
createdBy: {
|
|
1074
|
+
name: PKG_NAME,
|
|
1075
|
+
version: PKG_VERSION
|
|
1076
|
+
},
|
|
1077
|
+
datasources: this.writeDatasources(),
|
|
1078
|
+
dataviews: this.writeDataviews(),
|
|
1079
|
+
properties: this.writeProperties()
|
|
1080
|
+
};
|
|
1081
|
+
};
|
|
1082
|
+
return DDLUpgrade;
|
|
1083
|
+
}());
|
|
1084
|
+
function upgrade(ddl, baseUrl, wuid, toLowerCase, dermatologyJson) {
|
|
1085
|
+
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
1086
|
+
if (dermatologyJson === void 0) { dermatologyJson = {}; }
|
|
1087
|
+
var ddlUp = new DDLUpgrade(ddl, baseUrl, wuid, toLowerCase);
|
|
1088
|
+
var retVal = ddlUp.write();
|
|
1089
|
+
retVal.properties = upgrade$1(retVal, dermatologyJson);
|
|
1090
|
+
return retVal;
|
|
1076
1091
|
}
|
|
1077
1092
|
|
|
1078
1093
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
1079
1094
|
|
|
1080
|
-
|
|
1081
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
function createCommonjsModule(fn, basedir, module) {
|
|
1085
|
-
return module = {
|
|
1086
|
-
path: basedir,
|
|
1087
|
-
exports: {},
|
|
1088
|
-
require: function (path, base) {
|
|
1089
|
-
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
|
1090
|
-
}
|
|
1091
|
-
}, fn(module, module.exports), module.exports;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
function getCjsExportFromNamespace (n) {
|
|
1095
|
-
return n && n['default'] || n;
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
function commonjsRequire () {
|
|
1099
|
-
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
1100
|
-
}
|
|
1095
|
+
var uri_all = {exports: {}};
|
|
1101
1096
|
|
|
1102
|
-
var uri_all = createCommonjsModule(function (module, exports) {
|
|
1103
1097
|
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
|
1098
|
+
|
|
1099
|
+
(function (module, exports) {
|
|
1104
1100
|
(function (global, factory) {
|
|
1105
|
-
|
|
1101
|
+
factory(exports) ;
|
|
1106
1102
|
}(commonjsGlobal, (function (exports) {
|
|
1107
1103
|
function merge() {
|
|
1108
1104
|
for (var _len = arguments.length, sets = Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -1156,10 +1152,10 @@
|
|
|
1156
1152
|
//subset, excludes bidi control characters
|
|
1157
1153
|
IPRIVATE$$ = isIRI ? "[\\uE000-\\uF8FF]" : "[]",
|
|
1158
1154
|
//subset
|
|
1159
|
-
UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$)
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
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$$),
|
|
1155
|
+
UNRESERVED$$ = merge(ALPHA$$, DIGIT$$, "[\\-\\.\\_\\~]", UCSCHAR$$);
|
|
1156
|
+
subexp(ALPHA$$ + merge(ALPHA$$, DIGIT$$, "[\\+\\-\\.]") + "*");
|
|
1157
|
+
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]")) + "*");
|
|
1158
|
+
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$$),
|
|
1163
1159
|
//relaxed parsing rules
|
|
1164
1160
|
IPV4ADDRESS$ = subexp(DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$ + "\\." + DEC_OCTET_RELAXED$),
|
|
1165
1161
|
H16$ = subexp(HEXDIG$$ + "{1,4}"),
|
|
@@ -1183,14 +1179,14 @@
|
|
|
1183
1179
|
IPV6ADDRESS9$ = subexp(subexp(subexp(H16$ + "\\:") + "{0,6}" + H16$) + "?\\:\\:"),
|
|
1184
1180
|
//[ *6( h16 ":" ) h16 ] "::"
|
|
1185
1181
|
IPV6ADDRESS$ = subexp([IPV6ADDRESS1$, IPV6ADDRESS2$, IPV6ADDRESS3$, IPV6ADDRESS4$, IPV6ADDRESS5$, IPV6ADDRESS6$, IPV6ADDRESS7$, IPV6ADDRESS8$, IPV6ADDRESS9$].join("|")),
|
|
1186
|
-
ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+")
|
|
1182
|
+
ZONEID$ = subexp(subexp(UNRESERVED$$ + "|" + PCT_ENCODED$) + "+");
|
|
1187
1183
|
//RFC 6874, with relaxed parsing rules
|
|
1188
|
-
|
|
1184
|
+
subexp("[vV]" + HEXDIG$$ + "+\\." + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:]") + "+");
|
|
1189
1185
|
//RFC 6874
|
|
1190
|
-
|
|
1191
|
-
PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"))
|
|
1192
|
-
|
|
1193
|
-
|
|
1186
|
+
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$)) + "*");
|
|
1187
|
+
var PCHAR$ = subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\:\\@]"));
|
|
1188
|
+
subexp(subexp(PCT_ENCODED$ + "|" + merge(UNRESERVED$$, SUB_DELIMS$$, "[\\@]")) + "+");
|
|
1189
|
+
subexp(subexp(PCHAR$ + "|" + merge("[\\/\\?]", IPRIVATE$$)) + "*");
|
|
1194
1190
|
return {
|
|
1195
1191
|
NOT_SCHEME: new RegExp(merge("[^]", ALPHA$$, DIGIT$$, "[\\+\\-\\.]"), "g"),
|
|
1196
1192
|
NOT_USERINFO: new RegExp(merge("[^\\%\\:]", UNRESERVED$$, SUB_DELIMS$$), "g"),
|
|
@@ -2304,7 +2300,7 @@
|
|
|
2304
2300
|
|
|
2305
2301
|
var O = {};
|
|
2306
2302
|
//RFC 3986
|
|
2307
|
-
var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + (
|
|
2303
|
+
var UNRESERVED$$ = "[A-Za-z0-9\\-\\.\\_\\~" + ("\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF" ) + "]";
|
|
2308
2304
|
var HEXDIG$$ = "[0-9A-Fa-f]"; //case-insensitive
|
|
2309
2305
|
var PCT_ENCODED$ = subexp(subexp("%[EFef]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%[89A-Fa-f]" + HEXDIG$$ + "%" + HEXDIG$$ + HEXDIG$$) + "|" + subexp("%" + HEXDIG$$ + HEXDIG$$)); //expanded
|
|
2310
2306
|
//RFC 5322, except these symbols as per RFC 6068: @ : / ? # [ ] & ; =
|
|
@@ -2502,25 +2498,20 @@
|
|
|
2502
2498
|
|
|
2503
2499
|
})));
|
|
2504
2500
|
|
|
2505
|
-
});
|
|
2501
|
+
}(uri_all, uri_all.exports));
|
|
2502
|
+
|
|
2503
|
+
// do not edit .js files directly - edit src/index.jst
|
|
2506
2504
|
|
|
2507
|
-
unwrapExports(uri_all);
|
|
2508
2505
|
|
|
2509
|
-
var isArray = Array.isArray;
|
|
2510
|
-
var keyList = Object.keys;
|
|
2511
|
-
var hasProp = Object.prototype.hasOwnProperty;
|
|
2512
2506
|
|
|
2513
2507
|
var fastDeepEqual = function equal(a, b) {
|
|
2514
2508
|
if (a === b) return true;
|
|
2515
2509
|
|
|
2516
2510
|
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
2517
|
-
|
|
2518
|
-
, arrB = isArray(b)
|
|
2519
|
-
, i
|
|
2520
|
-
, length
|
|
2521
|
-
, key;
|
|
2511
|
+
if (a.constructor !== b.constructor) return false;
|
|
2522
2512
|
|
|
2523
|
-
|
|
2513
|
+
var length, i, keys;
|
|
2514
|
+
if (Array.isArray(a)) {
|
|
2524
2515
|
length = a.length;
|
|
2525
2516
|
if (length != b.length) return false;
|
|
2526
2517
|
for (i = length; i-- !== 0;)
|
|
@@ -2528,41 +2519,35 @@
|
|
|
2528
2519
|
return true;
|
|
2529
2520
|
}
|
|
2530
2521
|
|
|
2531
|
-
if (arrA != arrB) return false;
|
|
2532
2522
|
|
|
2533
|
-
var dateA = a instanceof Date
|
|
2534
|
-
, dateB = b instanceof Date;
|
|
2535
|
-
if (dateA != dateB) return false;
|
|
2536
|
-
if (dateA && dateB) return a.getTime() == b.getTime();
|
|
2537
2523
|
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
if (
|
|
2541
|
-
if (regexpA && regexpB) return a.toString() == b.toString();
|
|
2524
|
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
2525
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
2526
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
2542
2527
|
|
|
2543
|
-
|
|
2528
|
+
keys = Object.keys(a);
|
|
2544
2529
|
length = keys.length;
|
|
2545
|
-
|
|
2546
|
-
if (length !== keyList(b).length)
|
|
2547
|
-
return false;
|
|
2530
|
+
if (length !== Object.keys(b).length) return false;
|
|
2548
2531
|
|
|
2549
2532
|
for (i = length; i-- !== 0;)
|
|
2550
|
-
if (!
|
|
2533
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
2551
2534
|
|
|
2552
2535
|
for (i = length; i-- !== 0;) {
|
|
2553
|
-
key = keys[i];
|
|
2536
|
+
var key = keys[i];
|
|
2537
|
+
|
|
2554
2538
|
if (!equal(a[key], b[key])) return false;
|
|
2555
2539
|
}
|
|
2556
2540
|
|
|
2557
2541
|
return true;
|
|
2558
2542
|
}
|
|
2559
2543
|
|
|
2544
|
+
// true if both NaN, false otherwise
|
|
2560
2545
|
return a!==a && b!==b;
|
|
2561
2546
|
};
|
|
2562
2547
|
|
|
2563
2548
|
// https://mathiasbynens.be/notes/javascript-encoding
|
|
2564
2549
|
// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
|
|
2565
|
-
var ucs2length = function ucs2length(str) {
|
|
2550
|
+
var ucs2length$1 = function ucs2length(str) {
|
|
2566
2551
|
var length = 0
|
|
2567
2552
|
, len = str.length
|
|
2568
2553
|
, pos = 0
|
|
@@ -2579,20 +2564,18 @@
|
|
|
2579
2564
|
return length;
|
|
2580
2565
|
};
|
|
2581
2566
|
|
|
2582
|
-
var util = {
|
|
2567
|
+
var util$5 = {
|
|
2583
2568
|
copy: copy,
|
|
2584
2569
|
checkDataType: checkDataType,
|
|
2585
2570
|
checkDataTypes: checkDataTypes,
|
|
2586
2571
|
coerceToTypes: coerceToTypes,
|
|
2587
|
-
toHash: toHash,
|
|
2572
|
+
toHash: toHash$1,
|
|
2588
2573
|
getProperty: getProperty,
|
|
2589
2574
|
escapeQuotes: escapeQuotes,
|
|
2590
2575
|
equal: fastDeepEqual,
|
|
2591
|
-
ucs2length: ucs2length,
|
|
2576
|
+
ucs2length: ucs2length$1,
|
|
2592
2577
|
varOccurences: varOccurences,
|
|
2593
2578
|
varReplace: varReplace,
|
|
2594
|
-
cleanUpCode: cleanUpCode,
|
|
2595
|
-
finalCleanUpCode: finalCleanUpCode,
|
|
2596
2579
|
schemaHasRules: schemaHasRules,
|
|
2597
2580
|
schemaHasRulesExcept: schemaHasRulesExcept,
|
|
2598
2581
|
schemaUnknownRules: schemaUnknownRules,
|
|
@@ -2614,7 +2597,7 @@
|
|
|
2614
2597
|
}
|
|
2615
2598
|
|
|
2616
2599
|
|
|
2617
|
-
function checkDataType(dataType, data, negate) {
|
|
2600
|
+
function checkDataType(dataType, data, strictNumbers, negate) {
|
|
2618
2601
|
var EQUAL = negate ? ' !== ' : ' === '
|
|
2619
2602
|
, AND = negate ? ' || ' : ' && '
|
|
2620
2603
|
, OK = negate ? '!' : ''
|
|
@@ -2627,18 +2610,21 @@
|
|
|
2627
2610
|
NOT + 'Array.isArray(' + data + '))';
|
|
2628
2611
|
case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
|
|
2629
2612
|
NOT + '(' + data + ' % 1)' +
|
|
2630
|
-
AND + data + EQUAL + data +
|
|
2613
|
+
AND + data + EQUAL + data +
|
|
2614
|
+
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
|
|
2615
|
+
case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' +
|
|
2616
|
+
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
|
|
2631
2617
|
default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
|
|
2632
2618
|
}
|
|
2633
2619
|
}
|
|
2634
2620
|
|
|
2635
2621
|
|
|
2636
|
-
function checkDataTypes(dataTypes, data) {
|
|
2622
|
+
function checkDataTypes(dataTypes, data, strictNumbers) {
|
|
2637
2623
|
switch (dataTypes.length) {
|
|
2638
|
-
case 1: return checkDataType(dataTypes[0], data, true);
|
|
2624
|
+
case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);
|
|
2639
2625
|
default:
|
|
2640
2626
|
var code = '';
|
|
2641
|
-
var types = toHash(dataTypes);
|
|
2627
|
+
var types = toHash$1(dataTypes);
|
|
2642
2628
|
if (types.array && types.object) {
|
|
2643
2629
|
code = types.null ? '(': '(!' + data + ' || ';
|
|
2644
2630
|
code += 'typeof ' + data + ' !== "object")';
|
|
@@ -2648,14 +2634,14 @@
|
|
|
2648
2634
|
}
|
|
2649
2635
|
if (types.number) delete types.integer;
|
|
2650
2636
|
for (var t in types)
|
|
2651
|
-
code += (code ? ' && ' : '' ) + checkDataType(t, data, true);
|
|
2637
|
+
code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);
|
|
2652
2638
|
|
|
2653
2639
|
return code;
|
|
2654
2640
|
}
|
|
2655
2641
|
}
|
|
2656
2642
|
|
|
2657
2643
|
|
|
2658
|
-
var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);
|
|
2644
|
+
var COERCE_TO_TYPES = toHash$1([ 'string', 'number', 'integer', 'boolean', 'null' ]);
|
|
2659
2645
|
function coerceToTypes(optionCoerceTypes, dataTypes) {
|
|
2660
2646
|
if (Array.isArray(dataTypes)) {
|
|
2661
2647
|
var types = [];
|
|
@@ -2673,19 +2659,19 @@
|
|
|
2673
2659
|
}
|
|
2674
2660
|
|
|
2675
2661
|
|
|
2676
|
-
function toHash(arr) {
|
|
2662
|
+
function toHash$1(arr) {
|
|
2677
2663
|
var hash = {};
|
|
2678
2664
|
for (var i=0; i<arr.length; i++) hash[arr[i]] = true;
|
|
2679
2665
|
return hash;
|
|
2680
2666
|
}
|
|
2681
2667
|
|
|
2682
2668
|
|
|
2683
|
-
var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
|
2669
|
+
var IDENTIFIER$1 = /^[a-z$_][a-z$_0-9]*$/i;
|
|
2684
2670
|
var SINGLE_QUOTE = /'|\\/g;
|
|
2685
2671
|
function getProperty(key) {
|
|
2686
2672
|
return typeof key == 'number'
|
|
2687
2673
|
? '[' + key + ']'
|
|
2688
|
-
: IDENTIFIER.test(key)
|
|
2674
|
+
: IDENTIFIER$1.test(key)
|
|
2689
2675
|
? '.' + key
|
|
2690
2676
|
: "['" + escapeQuotes(key) + "']";
|
|
2691
2677
|
}
|
|
@@ -2714,42 +2700,6 @@
|
|
|
2714
2700
|
}
|
|
2715
2701
|
|
|
2716
2702
|
|
|
2717
|
-
var EMPTY_ELSE = /else\s*{\s*}/g
|
|
2718
|
-
, EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g
|
|
2719
|
-
, EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g;
|
|
2720
|
-
function cleanUpCode(out) {
|
|
2721
|
-
return out.replace(EMPTY_ELSE, '')
|
|
2722
|
-
.replace(EMPTY_IF_NO_ELSE, '')
|
|
2723
|
-
.replace(EMPTY_IF_WITH_ELSE, 'if (!($1))');
|
|
2724
|
-
}
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
var ERRORS_REGEXP = /[^v.]errors/g
|
|
2728
|
-
, REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g
|
|
2729
|
-
, REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g
|
|
2730
|
-
, RETURN_VALID = 'return errors === 0;'
|
|
2731
|
-
, RETURN_TRUE = 'validate.errors = null; return true;'
|
|
2732
|
-
, RETURN_ASYNC = /if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/
|
|
2733
|
-
, RETURN_DATA_ASYNC = 'return data;'
|
|
2734
|
-
, ROOTDATA_REGEXP = /[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g
|
|
2735
|
-
, REMOVE_ROOTDATA = /if \(rootData === undefined\) rootData = data;/;
|
|
2736
|
-
|
|
2737
|
-
function finalCleanUpCode(out, async) {
|
|
2738
|
-
var matches = out.match(ERRORS_REGEXP);
|
|
2739
|
-
if (matches && matches.length == 2) {
|
|
2740
|
-
out = async
|
|
2741
|
-
? out.replace(REMOVE_ERRORS_ASYNC, '')
|
|
2742
|
-
.replace(RETURN_ASYNC, RETURN_DATA_ASYNC)
|
|
2743
|
-
: out.replace(REMOVE_ERRORS, '')
|
|
2744
|
-
.replace(RETURN_VALID, RETURN_TRUE);
|
|
2745
|
-
}
|
|
2746
|
-
|
|
2747
|
-
matches = out.match(ROOTDATA_REGEXP);
|
|
2748
|
-
if (!matches || matches.length !== 3) return out;
|
|
2749
|
-
return out.replace(REMOVE_ROOTDATA, '');
|
|
2750
|
-
}
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
2703
|
function schemaHasRules(schema, rules) {
|
|
2754
2704
|
if (typeof schema == 'boolean') return !schema;
|
|
2755
2705
|
for (var key in schema) if (rules[key]) return true;
|
|
@@ -2789,17 +2739,17 @@
|
|
|
2789
2739
|
}
|
|
2790
2740
|
|
|
2791
2741
|
|
|
2792
|
-
var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
|
|
2793
|
-
var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
|
2742
|
+
var JSON_POINTER$1 = /^\/(?:[^~]|~0|~1)*$/;
|
|
2743
|
+
var RELATIVE_JSON_POINTER$1 = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
|
2794
2744
|
function getData($data, lvl, paths) {
|
|
2795
2745
|
var up, jsonPointer, data, matches;
|
|
2796
2746
|
if ($data === '') return 'rootData';
|
|
2797
2747
|
if ($data[0] == '/') {
|
|
2798
|
-
if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data);
|
|
2748
|
+
if (!JSON_POINTER$1.test($data)) throw new Error('Invalid JSON-pointer: ' + $data);
|
|
2799
2749
|
jsonPointer = $data;
|
|
2800
2750
|
data = 'rootData';
|
|
2801
2751
|
} else {
|
|
2802
|
-
matches = $data.match(RELATIVE_JSON_POINTER);
|
|
2752
|
+
matches = $data.match(RELATIVE_JSON_POINTER$1);
|
|
2803
2753
|
if (!matches) throw new Error('Invalid JSON-pointer: ' + $data);
|
|
2804
2754
|
up = +matches[1];
|
|
2805
2755
|
jsonPointer = matches[2];
|
|
@@ -2828,7 +2778,7 @@
|
|
|
2828
2778
|
|
|
2829
2779
|
function joinPaths (a, b) {
|
|
2830
2780
|
if (a == '""') return b;
|
|
2831
|
-
return (a + ' + ' + b).replace(/' \+ '/g, '');
|
|
2781
|
+
return (a + ' + ' + b).replace(/([^\\])' \+ '/g, '$1');
|
|
2832
2782
|
}
|
|
2833
2783
|
|
|
2834
2784
|
|
|
@@ -2851,15 +2801,17 @@
|
|
|
2851
2801
|
return str.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
2852
2802
|
}
|
|
2853
2803
|
|
|
2854
|
-
var
|
|
2804
|
+
var util$4 = util$5;
|
|
2855
2805
|
|
|
2856
|
-
|
|
2857
|
-
|
|
2806
|
+
var schema_obj = SchemaObject$2;
|
|
2807
|
+
|
|
2808
|
+
function SchemaObject$2(obj) {
|
|
2809
|
+
util$4.copy(obj, this);
|
|
2858
2810
|
}
|
|
2859
2811
|
|
|
2860
|
-
var jsonSchemaTraverse =
|
|
2812
|
+
var jsonSchemaTraverse = {exports: {}};
|
|
2861
2813
|
|
|
2862
|
-
var traverse =
|
|
2814
|
+
var traverse$1 = jsonSchemaTraverse.exports = function (schema, opts, cb) {
|
|
2863
2815
|
// Legacy support for v0.3.1 and earlier.
|
|
2864
2816
|
if (typeof opts == 'function') {
|
|
2865
2817
|
cb = opts;
|
|
@@ -2874,7 +2826,7 @@
|
|
|
2874
2826
|
};
|
|
2875
2827
|
|
|
2876
2828
|
|
|
2877
|
-
traverse.keywords = {
|
|
2829
|
+
traverse$1.keywords = {
|
|
2878
2830
|
additionalItems: true,
|
|
2879
2831
|
items: true,
|
|
2880
2832
|
contains: true,
|
|
@@ -2883,21 +2835,21 @@
|
|
|
2883
2835
|
not: true
|
|
2884
2836
|
};
|
|
2885
2837
|
|
|
2886
|
-
traverse.arrayKeywords = {
|
|
2838
|
+
traverse$1.arrayKeywords = {
|
|
2887
2839
|
items: true,
|
|
2888
2840
|
allOf: true,
|
|
2889
2841
|
anyOf: true,
|
|
2890
2842
|
oneOf: true
|
|
2891
2843
|
};
|
|
2892
2844
|
|
|
2893
|
-
traverse.propsKeywords = {
|
|
2845
|
+
traverse$1.propsKeywords = {
|
|
2894
2846
|
definitions: true,
|
|
2895
2847
|
properties: true,
|
|
2896
2848
|
patternProperties: true,
|
|
2897
2849
|
dependencies: true
|
|
2898
2850
|
};
|
|
2899
2851
|
|
|
2900
|
-
traverse.skipKeywords = {
|
|
2852
|
+
traverse$1.skipKeywords = {
|
|
2901
2853
|
default: true,
|
|
2902
2854
|
enum: true,
|
|
2903
2855
|
const: true,
|
|
@@ -2925,16 +2877,16 @@
|
|
|
2925
2877
|
for (var key in schema) {
|
|
2926
2878
|
var sch = schema[key];
|
|
2927
2879
|
if (Array.isArray(sch)) {
|
|
2928
|
-
if (key in traverse.arrayKeywords) {
|
|
2880
|
+
if (key in traverse$1.arrayKeywords) {
|
|
2929
2881
|
for (var i=0; i<sch.length; i++)
|
|
2930
2882
|
_traverse(opts, pre, post, sch[i], jsonPtr + '/' + key + '/' + i, rootSchema, jsonPtr, key, schema, i);
|
|
2931
2883
|
}
|
|
2932
|
-
} else if (key in traverse.propsKeywords) {
|
|
2884
|
+
} else if (key in traverse$1.propsKeywords) {
|
|
2933
2885
|
if (sch && typeof sch == 'object') {
|
|
2934
2886
|
for (var prop in sch)
|
|
2935
2887
|
_traverse(opts, pre, post, sch[prop], jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema, prop);
|
|
2936
2888
|
}
|
|
2937
|
-
} else if (key in traverse.keywords || (opts.allKeys && !(key in traverse.skipKeywords))) {
|
|
2889
|
+
} else if (key in traverse$1.keywords || (opts.allKeys && !(key in traverse$1.skipKeywords))) {
|
|
2938
2890
|
_traverse(opts, pre, post, sch, jsonPtr + '/' + key, rootSchema, jsonPtr, key, schema);
|
|
2939
2891
|
}
|
|
2940
2892
|
}
|
|
@@ -2946,16 +2898,21 @@
|
|
|
2946
2898
|
function escapeJsonPtr(str) {
|
|
2947
2899
|
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
2948
2900
|
}
|
|
2949
|
-
});
|
|
2950
2901
|
|
|
2951
|
-
var
|
|
2902
|
+
var URI$1 = uri_all.exports
|
|
2903
|
+
, equal$1 = fastDeepEqual
|
|
2904
|
+
, util$3 = util$5
|
|
2905
|
+
, SchemaObject$1 = schema_obj
|
|
2906
|
+
, traverse = jsonSchemaTraverse.exports;
|
|
2952
2907
|
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
resolve.
|
|
2956
|
-
resolve.
|
|
2957
|
-
resolve.
|
|
2958
|
-
resolve.
|
|
2908
|
+
var resolve_1 = resolve$3;
|
|
2909
|
+
|
|
2910
|
+
resolve$3.normalizeId = normalizeId;
|
|
2911
|
+
resolve$3.fullPath = getFullPath;
|
|
2912
|
+
resolve$3.url = resolveUrl;
|
|
2913
|
+
resolve$3.ids = resolveIds;
|
|
2914
|
+
resolve$3.inlineRef = inlineRef;
|
|
2915
|
+
resolve$3.schema = resolveSchema;
|
|
2959
2916
|
|
|
2960
2917
|
/**
|
|
2961
2918
|
* [resolve and compile the references ($ref)]
|
|
@@ -2965,16 +2922,16 @@
|
|
|
2965
2922
|
* @param {String} ref reference to resolve
|
|
2966
2923
|
* @return {Object|Function} schema object (if the schema can be inlined) or validation function
|
|
2967
2924
|
*/
|
|
2968
|
-
function resolve(compile, root, ref) {
|
|
2925
|
+
function resolve$3(compile, root, ref) {
|
|
2969
2926
|
/* jshint validthis: true */
|
|
2970
2927
|
var refVal = this._refs[ref];
|
|
2971
2928
|
if (typeof refVal == 'string') {
|
|
2972
2929
|
if (this._refs[refVal]) refVal = this._refs[refVal];
|
|
2973
|
-
else return resolve.call(this, compile, root, refVal);
|
|
2930
|
+
else return resolve$3.call(this, compile, root, refVal);
|
|
2974
2931
|
}
|
|
2975
2932
|
|
|
2976
2933
|
refVal = refVal || this._schemas[ref];
|
|
2977
|
-
if (refVal instanceof
|
|
2934
|
+
if (refVal instanceof SchemaObject$1) {
|
|
2978
2935
|
return inlineRef(refVal.schema, this._opts.inlineRefs)
|
|
2979
2936
|
? refVal.schema
|
|
2980
2937
|
: refVal.validate || this._compile(refVal);
|
|
@@ -2988,7 +2945,7 @@
|
|
|
2988
2945
|
baseId = res.baseId;
|
|
2989
2946
|
}
|
|
2990
2947
|
|
|
2991
|
-
if (schema instanceof
|
|
2948
|
+
if (schema instanceof SchemaObject$1) {
|
|
2992
2949
|
v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);
|
|
2993
2950
|
} else if (schema !== undefined) {
|
|
2994
2951
|
v = inlineRef(schema, this._opts.inlineRefs)
|
|
@@ -3009,7 +2966,7 @@
|
|
|
3009
2966
|
*/
|
|
3010
2967
|
function resolveSchema(root, ref) {
|
|
3011
2968
|
/* jshint validthis: true */
|
|
3012
|
-
var p =
|
|
2969
|
+
var p = URI$1.parse(ref)
|
|
3013
2970
|
, refPath = _getFullPath(p)
|
|
3014
2971
|
, baseId = getFullPath(this._getId(root.schema));
|
|
3015
2972
|
if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
|
|
@@ -3017,12 +2974,12 @@
|
|
|
3017
2974
|
var refVal = this._refs[id];
|
|
3018
2975
|
if (typeof refVal == 'string') {
|
|
3019
2976
|
return resolveRecursive.call(this, root, refVal, p);
|
|
3020
|
-
} else if (refVal instanceof
|
|
2977
|
+
} else if (refVal instanceof SchemaObject$1) {
|
|
3021
2978
|
if (!refVal.validate) this._compile(refVal);
|
|
3022
2979
|
root = refVal;
|
|
3023
2980
|
} else {
|
|
3024
2981
|
refVal = this._schemas[id];
|
|
3025
|
-
if (refVal instanceof
|
|
2982
|
+
if (refVal instanceof SchemaObject$1) {
|
|
3026
2983
|
if (!refVal.validate) this._compile(refVal);
|
|
3027
2984
|
if (id == normalizeId(ref))
|
|
3028
2985
|
return { schema: refVal, root: root, baseId: baseId };
|
|
@@ -3053,7 +3010,7 @@
|
|
|
3053
3010
|
}
|
|
3054
3011
|
|
|
3055
3012
|
|
|
3056
|
-
var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']);
|
|
3013
|
+
var PREVENT_SCOPE_CHANGE = util$3.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']);
|
|
3057
3014
|
/* @this Ajv */
|
|
3058
3015
|
function getJsonPointer(parsedRef, baseId, schema, root) {
|
|
3059
3016
|
/* jshint validthis: true */
|
|
@@ -3064,7 +3021,7 @@
|
|
|
3064
3021
|
for (var i = 1; i < parts.length; i++) {
|
|
3065
3022
|
var part = parts[i];
|
|
3066
3023
|
if (part) {
|
|
3067
|
-
part = util.unescapeFragment(part);
|
|
3024
|
+
part = util$3.unescapeFragment(part);
|
|
3068
3025
|
schema = schema[part];
|
|
3069
3026
|
if (schema === undefined) break;
|
|
3070
3027
|
var id;
|
|
@@ -3088,7 +3045,7 @@
|
|
|
3088
3045
|
}
|
|
3089
3046
|
|
|
3090
3047
|
|
|
3091
|
-
var SIMPLE_INLINED = util.toHash([
|
|
3048
|
+
var SIMPLE_INLINED = util$3.toHash([
|
|
3092
3049
|
'type', 'format', 'pattern',
|
|
3093
3050
|
'maxLength', 'minLength',
|
|
3094
3051
|
'maxProperties', 'minProperties',
|
|
@@ -3148,13 +3105,13 @@
|
|
|
3148
3105
|
|
|
3149
3106
|
function getFullPath(id, normalize) {
|
|
3150
3107
|
if (normalize !== false) id = normalizeId(id);
|
|
3151
|
-
var p =
|
|
3108
|
+
var p = URI$1.parse(id);
|
|
3152
3109
|
return _getFullPath(p);
|
|
3153
3110
|
}
|
|
3154
3111
|
|
|
3155
3112
|
|
|
3156
3113
|
function _getFullPath(p) {
|
|
3157
|
-
return
|
|
3114
|
+
return URI$1.serialize(p).split('#')[0] + '#';
|
|
3158
3115
|
}
|
|
3159
3116
|
|
|
3160
3117
|
|
|
@@ -3166,7 +3123,7 @@
|
|
|
3166
3123
|
|
|
3167
3124
|
function resolveUrl(baseId, id) {
|
|
3168
3125
|
id = normalizeId(id);
|
|
3169
|
-
return
|
|
3126
|
+
return URI$1.resolve(baseId, id);
|
|
3170
3127
|
}
|
|
3171
3128
|
|
|
3172
3129
|
|
|
@@ -3178,25 +3135,25 @@
|
|
|
3178
3135
|
var localRefs = {};
|
|
3179
3136
|
var self = this;
|
|
3180
3137
|
|
|
3181
|
-
|
|
3138
|
+
traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
|
3182
3139
|
if (jsonPtr === '') return;
|
|
3183
3140
|
var id = self._getId(sch);
|
|
3184
3141
|
var baseId = baseIds[parentJsonPtr];
|
|
3185
3142
|
var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword;
|
|
3186
3143
|
if (keyIndex !== undefined)
|
|
3187
|
-
fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex));
|
|
3144
|
+
fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util$3.escapeFragment(keyIndex));
|
|
3188
3145
|
|
|
3189
3146
|
if (typeof id == 'string') {
|
|
3190
|
-
id = baseId = normalizeId(baseId ?
|
|
3147
|
+
id = baseId = normalizeId(baseId ? URI$1.resolve(baseId, id) : id);
|
|
3191
3148
|
|
|
3192
3149
|
var refVal = self._refs[id];
|
|
3193
3150
|
if (typeof refVal == 'string') refVal = self._refs[refVal];
|
|
3194
3151
|
if (refVal && refVal.schema) {
|
|
3195
|
-
if (!
|
|
3152
|
+
if (!equal$1(sch, refVal.schema))
|
|
3196
3153
|
throw new Error('id "' + id + '" resolves to more than one schema');
|
|
3197
3154
|
} else if (id != normalizeId(fullPath)) {
|
|
3198
3155
|
if (id[0] == '#') {
|
|
3199
|
-
if (localRefs[id] && !
|
|
3156
|
+
if (localRefs[id] && !equal$1(sch, localRefs[id]))
|
|
3200
3157
|
throw new Error('id "' + id + '" resolves to more than one schema');
|
|
3201
3158
|
localRefs[id] = sch;
|
|
3202
3159
|
} else {
|
|
@@ -3211,28 +3168,30 @@
|
|
|
3211
3168
|
return localRefs;
|
|
3212
3169
|
}
|
|
3213
3170
|
|
|
3171
|
+
var resolve$2 = resolve_1;
|
|
3172
|
+
|
|
3214
3173
|
var error_classes = {
|
|
3215
|
-
Validation: errorSubclass(ValidationError),
|
|
3216
|
-
MissingRef: errorSubclass(MissingRefError)
|
|
3174
|
+
Validation: errorSubclass(ValidationError$1),
|
|
3175
|
+
MissingRef: errorSubclass(MissingRefError$1)
|
|
3217
3176
|
};
|
|
3218
3177
|
|
|
3219
3178
|
|
|
3220
|
-
function ValidationError(errors) {
|
|
3179
|
+
function ValidationError$1(errors) {
|
|
3221
3180
|
this.message = 'validation failed';
|
|
3222
3181
|
this.errors = errors;
|
|
3223
3182
|
this.ajv = this.validation = true;
|
|
3224
3183
|
}
|
|
3225
3184
|
|
|
3226
3185
|
|
|
3227
|
-
MissingRefError.message = function (baseId, ref) {
|
|
3186
|
+
MissingRefError$1.message = function (baseId, ref) {
|
|
3228
3187
|
return 'can\'t resolve reference ' + ref + ' from id ' + baseId;
|
|
3229
3188
|
};
|
|
3230
3189
|
|
|
3231
3190
|
|
|
3232
|
-
function MissingRefError(baseId, ref, message) {
|
|
3233
|
-
this.message = message || MissingRefError.message(baseId, ref);
|
|
3234
|
-
this.missingRef =
|
|
3235
|
-
this.missingSchema =
|
|
3191
|
+
function MissingRefError$1(baseId, ref, message) {
|
|
3192
|
+
this.message = message || MissingRefError$1.message(baseId, ref);
|
|
3193
|
+
this.missingRef = resolve$2.url(baseId, ref);
|
|
3194
|
+
this.missingSchema = resolve$2.normalizeId(resolve$2.fullPath(this.missingRef));
|
|
3236
3195
|
}
|
|
3237
3196
|
|
|
3238
3197
|
|
|
@@ -3300,7 +3259,7 @@
|
|
|
3300
3259
|
})(data);
|
|
3301
3260
|
};
|
|
3302
3261
|
|
|
3303
|
-
var validate = function generate_validate(it, $keyword, $ruleType) {
|
|
3262
|
+
var validate$1 = function generate_validate(it, $keyword, $ruleType) {
|
|
3304
3263
|
var out = '';
|
|
3305
3264
|
var $async = it.schema.$async === true,
|
|
3306
3265
|
$refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'),
|
|
@@ -3392,7 +3351,7 @@
|
|
|
3392
3351
|
it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema));
|
|
3393
3352
|
it.baseId = it.baseId || it.rootId;
|
|
3394
3353
|
delete it.isTop;
|
|
3395
|
-
it.dataPathArr = [
|
|
3354
|
+
it.dataPathArr = [""];
|
|
3396
3355
|
if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
|
|
3397
3356
|
var $defaultMsg = 'default is ignored in the schema root';
|
|
3398
3357
|
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
|
|
@@ -3450,47 +3409,39 @@
|
|
|
3450
3409
|
var $schemaPath = it.schemaPath + '.type',
|
|
3451
3410
|
$errSchemaPath = it.errSchemaPath + '/type',
|
|
3452
3411
|
$method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
|
|
3453
|
-
out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { ';
|
|
3412
|
+
out += ' if (' + (it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true)) + ') { ';
|
|
3454
3413
|
if ($coerceToTypes) {
|
|
3455
3414
|
var $dataType = 'dataType' + $lvl,
|
|
3456
3415
|
$coerced = 'coerced' + $lvl;
|
|
3457
|
-
out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; ';
|
|
3416
|
+
out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; var ' + ($coerced) + ' = undefined; ';
|
|
3458
3417
|
if (it.opts.coerceTypes == 'array') {
|
|
3459
|
-
out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ')) ' + ($dataType) + ' =
|
|
3418
|
+
out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ') && ' + ($data) + '.length == 1) { ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; if (' + (it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)) + ') ' + ($coerced) + ' = ' + ($data) + '; } ';
|
|
3460
3419
|
}
|
|
3461
|
-
out += '
|
|
3462
|
-
var $bracesCoercion = '';
|
|
3420
|
+
out += ' if (' + ($coerced) + ' !== undefined) ; ';
|
|
3463
3421
|
var arr1 = $coerceToTypes;
|
|
3464
3422
|
if (arr1) {
|
|
3465
3423
|
var $type, $i = -1,
|
|
3466
3424
|
l1 = arr1.length - 1;
|
|
3467
3425
|
while ($i < l1) {
|
|
3468
3426
|
$type = arr1[$i += 1];
|
|
3469
|
-
if ($i) {
|
|
3470
|
-
out += ' if (' + ($coerced) + ' === undefined) { ';
|
|
3471
|
-
$bracesCoercion += '}';
|
|
3472
|
-
}
|
|
3473
|
-
if (it.opts.coerceTypes == 'array' && $type != 'array') {
|
|
3474
|
-
out += ' if (' + ($dataType) + ' == \'array\' && ' + ($data) + '.length == 1) { ' + ($coerced) + ' = ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; } ';
|
|
3475
|
-
}
|
|
3476
3427
|
if ($type == 'string') {
|
|
3477
|
-
out += ' if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
|
|
3428
|
+
out += ' else if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; ';
|
|
3478
3429
|
} else if ($type == 'number' || $type == 'integer') {
|
|
3479
|
-
out += ' if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
|
|
3430
|
+
out += ' else if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' ';
|
|
3480
3431
|
if ($type == 'integer') {
|
|
3481
3432
|
out += ' && !(' + ($data) + ' % 1)';
|
|
3482
3433
|
}
|
|
3483
3434
|
out += ')) ' + ($coerced) + ' = +' + ($data) + '; ';
|
|
3484
3435
|
} else if ($type == 'boolean') {
|
|
3485
|
-
out += ' if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
|
|
3436
|
+
out += ' else if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; ';
|
|
3486
3437
|
} else if ($type == 'null') {
|
|
3487
|
-
out += ' if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
|
|
3438
|
+
out += ' else if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; ';
|
|
3488
3439
|
} else if (it.opts.coerceTypes == 'array' && $type == 'array') {
|
|
3489
|
-
out += ' if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
|
|
3440
|
+
out += ' else if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; ';
|
|
3490
3441
|
}
|
|
3491
3442
|
}
|
|
3492
3443
|
}
|
|
3493
|
-
out += '
|
|
3444
|
+
out += ' else { ';
|
|
3494
3445
|
var $$outStack = $$outStack || [];
|
|
3495
3446
|
$$outStack.push(out);
|
|
3496
3447
|
out = ''; /* istanbul ignore else */
|
|
@@ -3530,7 +3481,7 @@
|
|
|
3530
3481
|
} else {
|
|
3531
3482
|
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
|
3532
3483
|
}
|
|
3533
|
-
out += ' }
|
|
3484
|
+
out += ' } if (' + ($coerced) + ' !== undefined) { ';
|
|
3534
3485
|
var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
|
|
3535
3486
|
$parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
|
|
3536
3487
|
out += ' ' + ($data) + ' = ' + ($coerced) + '; ';
|
|
@@ -3603,7 +3554,7 @@
|
|
|
3603
3554
|
$rulesGroup = arr2[i2 += 1];
|
|
3604
3555
|
if ($shouldUseGroup($rulesGroup)) {
|
|
3605
3556
|
if ($rulesGroup.type) {
|
|
3606
|
-
out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { ';
|
|
3557
|
+
out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers)) + ') { ';
|
|
3607
3558
|
}
|
|
3608
3559
|
if (it.opts.useDefaults) {
|
|
3609
3560
|
if ($rulesGroup.type == 'object' && it.schema.properties) {
|
|
@@ -3771,10 +3722,6 @@
|
|
|
3771
3722
|
} else {
|
|
3772
3723
|
out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';';
|
|
3773
3724
|
}
|
|
3774
|
-
out = it.util.cleanUpCode(out);
|
|
3775
|
-
if ($top) {
|
|
3776
|
-
out = it.util.finalCleanUpCode(out, $async);
|
|
3777
|
-
}
|
|
3778
3725
|
|
|
3779
3726
|
function $shouldUseGroup($rulesGroup) {
|
|
3780
3727
|
var rules = $rulesGroup.rules;
|
|
@@ -3794,17 +3741,24 @@
|
|
|
3794
3741
|
return out;
|
|
3795
3742
|
};
|
|
3796
3743
|
|
|
3744
|
+
var resolve$1 = resolve_1
|
|
3745
|
+
, util$2 = util$5
|
|
3746
|
+
, errorClasses$1 = error_classes
|
|
3747
|
+
, stableStringify$1 = fastJsonStableStringify;
|
|
3748
|
+
|
|
3749
|
+
var validateGenerator = validate$1;
|
|
3750
|
+
|
|
3797
3751
|
/**
|
|
3798
3752
|
* Functions below are used inside compiled validations function
|
|
3799
3753
|
*/
|
|
3800
3754
|
|
|
3801
|
-
var ucs2length
|
|
3802
|
-
|
|
3755
|
+
var ucs2length = util$2.ucs2length;
|
|
3756
|
+
var equal = fastDeepEqual;
|
|
3803
3757
|
|
|
3804
3758
|
// this error is thrown by async schemas to return validation errors via exception
|
|
3805
|
-
var ValidationError
|
|
3759
|
+
var ValidationError = errorClasses$1.Validation;
|
|
3806
3760
|
|
|
3807
|
-
var compile_1 = compile;
|
|
3761
|
+
var compile_1 = compile$1;
|
|
3808
3762
|
|
|
3809
3763
|
|
|
3810
3764
|
/**
|
|
@@ -3816,7 +3770,7 @@
|
|
|
3816
3770
|
* @param {String} baseId base ID for IDs in the schema
|
|
3817
3771
|
* @return {Function} validation function
|
|
3818
3772
|
*/
|
|
3819
|
-
function compile(schema, root, localRefs, baseId) {
|
|
3773
|
+
function compile$1(schema, root, localRefs, baseId) {
|
|
3820
3774
|
/* jshint validthis: true, evil: true */
|
|
3821
3775
|
/* eslint no-shadow: 0 */
|
|
3822
3776
|
var self = this
|
|
@@ -3868,11 +3822,11 @@
|
|
|
3868
3822
|
function localCompile(_schema, _root, localRefs, baseId) {
|
|
3869
3823
|
var isRoot = !_root || (_root && _root.schema == _schema);
|
|
3870
3824
|
if (_root.schema != root.schema)
|
|
3871
|
-
return compile.call(self, _schema, _root, localRefs, baseId);
|
|
3825
|
+
return compile$1.call(self, _schema, _root, localRefs, baseId);
|
|
3872
3826
|
|
|
3873
3827
|
var $async = _schema.$async === true;
|
|
3874
3828
|
|
|
3875
|
-
var sourceCode =
|
|
3829
|
+
var sourceCode = validateGenerator({
|
|
3876
3830
|
isTop: true,
|
|
3877
3831
|
schema: _schema,
|
|
3878
3832
|
isRoot: isRoot,
|
|
@@ -3881,11 +3835,11 @@
|
|
|
3881
3835
|
schemaPath: '',
|
|
3882
3836
|
errSchemaPath: '#',
|
|
3883
3837
|
errorPath: '""',
|
|
3884
|
-
MissingRefError:
|
|
3838
|
+
MissingRefError: errorClasses$1.MissingRef,
|
|
3885
3839
|
RULES: RULES,
|
|
3886
|
-
validate:
|
|
3887
|
-
util: util,
|
|
3888
|
-
resolve:
|
|
3840
|
+
validate: validateGenerator,
|
|
3841
|
+
util: util$2,
|
|
3842
|
+
resolve: resolve$1,
|
|
3889
3843
|
resolveRef: resolveRef,
|
|
3890
3844
|
usePattern: usePattern,
|
|
3891
3845
|
useDefault: useDefault,
|
|
@@ -3897,12 +3851,12 @@
|
|
|
3897
3851
|
});
|
|
3898
3852
|
|
|
3899
3853
|
sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode)
|
|
3900
|
-
+ vars(defaults, defaultCode) + vars(customRules, customRuleCode)
|
|
3854
|
+
+ vars(defaults, defaultCode) + vars(customRules, customRuleCode$1)
|
|
3901
3855
|
+ sourceCode;
|
|
3902
3856
|
|
|
3903
|
-
if (opts.processCode) sourceCode = opts.processCode(sourceCode);
|
|
3857
|
+
if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);
|
|
3904
3858
|
// console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
|
|
3905
|
-
var validate
|
|
3859
|
+
var validate;
|
|
3906
3860
|
try {
|
|
3907
3861
|
var makeValidate = new Function(
|
|
3908
3862
|
'self',
|
|
@@ -3918,7 +3872,7 @@
|
|
|
3918
3872
|
sourceCode
|
|
3919
3873
|
);
|
|
3920
3874
|
|
|
3921
|
-
validate
|
|
3875
|
+
validate = makeValidate(
|
|
3922
3876
|
self,
|
|
3923
3877
|
RULES,
|
|
3924
3878
|
formats,
|
|
@@ -3926,36 +3880,36 @@
|
|
|
3926
3880
|
refVal,
|
|
3927
3881
|
defaults,
|
|
3928
3882
|
customRules,
|
|
3929
|
-
|
|
3930
|
-
ucs2length
|
|
3931
|
-
ValidationError
|
|
3883
|
+
equal,
|
|
3884
|
+
ucs2length,
|
|
3885
|
+
ValidationError
|
|
3932
3886
|
);
|
|
3933
3887
|
|
|
3934
|
-
refVal[0] = validate
|
|
3888
|
+
refVal[0] = validate;
|
|
3935
3889
|
} catch(e) {
|
|
3936
3890
|
self.logger.error('Error compiling schema, function code:', sourceCode);
|
|
3937
3891
|
throw e;
|
|
3938
3892
|
}
|
|
3939
3893
|
|
|
3940
|
-
validate
|
|
3941
|
-
validate
|
|
3942
|
-
validate
|
|
3943
|
-
validate
|
|
3944
|
-
validate
|
|
3945
|
-
if ($async) validate
|
|
3894
|
+
validate.schema = _schema;
|
|
3895
|
+
validate.errors = null;
|
|
3896
|
+
validate.refs = refs;
|
|
3897
|
+
validate.refVal = refVal;
|
|
3898
|
+
validate.root = isRoot ? validate : _root;
|
|
3899
|
+
if ($async) validate.$async = true;
|
|
3946
3900
|
if (opts.sourceCode === true) {
|
|
3947
|
-
validate
|
|
3901
|
+
validate.source = {
|
|
3948
3902
|
code: sourceCode,
|
|
3949
3903
|
patterns: patterns,
|
|
3950
3904
|
defaults: defaults
|
|
3951
3905
|
};
|
|
3952
3906
|
}
|
|
3953
3907
|
|
|
3954
|
-
return validate
|
|
3908
|
+
return validate;
|
|
3955
3909
|
}
|
|
3956
3910
|
|
|
3957
3911
|
function resolveRef(baseId, ref, isRoot) {
|
|
3958
|
-
ref =
|
|
3912
|
+
ref = resolve$1.url(baseId, ref);
|
|
3959
3913
|
var refIndex = refs[ref];
|
|
3960
3914
|
var _refVal, refCode;
|
|
3961
3915
|
if (refIndex !== undefined) {
|
|
@@ -3973,13 +3927,13 @@
|
|
|
3973
3927
|
}
|
|
3974
3928
|
|
|
3975
3929
|
refCode = addLocalRef(ref);
|
|
3976
|
-
var v =
|
|
3930
|
+
var v = resolve$1.call(self, localCompile, root, ref);
|
|
3977
3931
|
if (v === undefined) {
|
|
3978
3932
|
var localSchema = localRefs && localRefs[ref];
|
|
3979
3933
|
if (localSchema) {
|
|
3980
|
-
v =
|
|
3934
|
+
v = resolve$1.inlineRef(localSchema, opts.inlineRefs)
|
|
3981
3935
|
? localSchema
|
|
3982
|
-
: compile.call(self, localSchema, root, localRefs, baseId);
|
|
3936
|
+
: compile$1.call(self, localSchema, root, localRefs, baseId);
|
|
3983
3937
|
}
|
|
3984
3938
|
}
|
|
3985
3939
|
|
|
@@ -4028,10 +3982,10 @@
|
|
|
4028
3982
|
case 'number':
|
|
4029
3983
|
return '' + value;
|
|
4030
3984
|
case 'string':
|
|
4031
|
-
return util.toQuotedString(value);
|
|
3985
|
+
return util$2.toQuotedString(value);
|
|
4032
3986
|
case 'object':
|
|
4033
3987
|
if (value === null) return 'null';
|
|
4034
|
-
var valueStr =
|
|
3988
|
+
var valueStr = stableStringify$1(value);
|
|
4035
3989
|
var index = defaultsHash[valueStr];
|
|
4036
3990
|
if (index === undefined) {
|
|
4037
3991
|
index = defaultsHash[valueStr] = defaults.length;
|
|
@@ -4146,7 +4100,7 @@
|
|
|
4146
4100
|
|
|
4147
4101
|
|
|
4148
4102
|
function patternCode(i, patterns) {
|
|
4149
|
-
return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');';
|
|
4103
|
+
return 'var pattern' + i + ' = new RegExp(' + util$2.toQuotedString(patterns[i]) + ');';
|
|
4150
4104
|
}
|
|
4151
4105
|
|
|
4152
4106
|
|
|
@@ -4160,7 +4114,7 @@
|
|
|
4160
4114
|
}
|
|
4161
4115
|
|
|
4162
4116
|
|
|
4163
|
-
function customRuleCode(i) {
|
|
4117
|
+
function customRuleCode$1(i) {
|
|
4164
4118
|
return 'var customRule' + i + ' = customRules[' + i + '];';
|
|
4165
4119
|
}
|
|
4166
4120
|
|
|
@@ -4173,38 +4127,38 @@
|
|
|
4173
4127
|
return code;
|
|
4174
4128
|
}
|
|
4175
4129
|
|
|
4176
|
-
var cache =
|
|
4130
|
+
var cache = {exports: {}};
|
|
4177
4131
|
|
|
4178
|
-
|
|
4179
|
-
var Cache = module.exports = function Cache() {
|
|
4132
|
+
var Cache$1 = cache.exports = function Cache() {
|
|
4180
4133
|
this._cache = {};
|
|
4181
4134
|
};
|
|
4182
4135
|
|
|
4183
4136
|
|
|
4184
|
-
Cache.prototype.put = function Cache_put(key, value) {
|
|
4137
|
+
Cache$1.prototype.put = function Cache_put(key, value) {
|
|
4185
4138
|
this._cache[key] = value;
|
|
4186
4139
|
};
|
|
4187
4140
|
|
|
4188
4141
|
|
|
4189
|
-
Cache.prototype.get = function Cache_get(key) {
|
|
4142
|
+
Cache$1.prototype.get = function Cache_get(key) {
|
|
4190
4143
|
return this._cache[key];
|
|
4191
4144
|
};
|
|
4192
4145
|
|
|
4193
4146
|
|
|
4194
|
-
Cache.prototype.del = function Cache_del(key) {
|
|
4147
|
+
Cache$1.prototype.del = function Cache_del(key) {
|
|
4195
4148
|
delete this._cache[key];
|
|
4196
4149
|
};
|
|
4197
4150
|
|
|
4198
4151
|
|
|
4199
|
-
Cache.prototype.clear = function Cache_clear() {
|
|
4152
|
+
Cache$1.prototype.clear = function Cache_clear() {
|
|
4200
4153
|
this._cache = {};
|
|
4201
4154
|
};
|
|
4202
|
-
|
|
4155
|
+
|
|
4156
|
+
var util$1 = util$5;
|
|
4203
4157
|
|
|
4204
4158
|
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
4205
4159
|
var DAYS = [0,31,28,31,30,31,30,31,31,30,31,30,31];
|
|
4206
|
-
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d
|
|
4207
|
-
var HOSTNAME = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)
|
|
4160
|
+
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
|
|
4161
|
+
var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
|
|
4208
4162
|
var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
4209
4163
|
var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
4210
4164
|
// uri-template: https://tools.ietf.org/html/rfc6570
|
|
@@ -4212,31 +4166,31 @@
|
|
|
4212
4166
|
// For the source: https://gist.github.com/dperini/729294
|
|
4213
4167
|
// For test cases: https://mathiasbynens.be/demo/url-regex
|
|
4214
4168
|
// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.
|
|
4215
|
-
// 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]
|
|
4216
|
-
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-
|
|
4169
|
+
// 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;
|
|
4170
|
+
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;
|
|
4217
4171
|
var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
|
4218
|
-
var JSON_POINTER
|
|
4172
|
+
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
|
4219
4173
|
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
|
4220
|
-
var RELATIVE_JSON_POINTER
|
|
4174
|
+
var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
|
|
4221
4175
|
|
|
4222
4176
|
|
|
4223
|
-
var formats_1 = formats;
|
|
4177
|
+
var formats_1 = formats$1;
|
|
4224
4178
|
|
|
4225
|
-
function formats(mode) {
|
|
4179
|
+
function formats$1(mode) {
|
|
4226
4180
|
mode = mode == 'full' ? 'full' : 'fast';
|
|
4227
|
-
return util.copy(formats[mode]);
|
|
4181
|
+
return util$1.copy(formats$1[mode]);
|
|
4228
4182
|
}
|
|
4229
4183
|
|
|
4230
4184
|
|
|
4231
|
-
formats.fast = {
|
|
4185
|
+
formats$1.fast = {
|
|
4232
4186
|
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
4233
4187
|
date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,
|
|
4234
4188
|
// date-time: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
4235
|
-
time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d
|
|
4236
|
-
'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d
|
|
4189
|
+
time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
|
|
4190
|
+
'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,
|
|
4237
4191
|
// uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
|
|
4238
|
-
uri: /^(?:[a-z][a-z0-9
|
|
4239
|
-
'uri-reference': /^(?:(?:[a-z][a-z0-9
|
|
4192
|
+
uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
|
|
4193
|
+
'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
|
4240
4194
|
'uri-template': URITEMPLATE,
|
|
4241
4195
|
url: URL,
|
|
4242
4196
|
// email (sources from jsen validator):
|
|
@@ -4253,14 +4207,14 @@
|
|
|
4253
4207
|
uuid: UUID,
|
|
4254
4208
|
// JSON-pointer: https://tools.ietf.org/html/rfc6901
|
|
4255
4209
|
// uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A
|
|
4256
|
-
'json-pointer': JSON_POINTER
|
|
4210
|
+
'json-pointer': JSON_POINTER,
|
|
4257
4211
|
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
|
|
4258
4212
|
// relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00
|
|
4259
|
-
'relative-json-pointer': RELATIVE_JSON_POINTER
|
|
4213
|
+
'relative-json-pointer': RELATIVE_JSON_POINTER
|
|
4260
4214
|
};
|
|
4261
4215
|
|
|
4262
4216
|
|
|
4263
|
-
formats.full = {
|
|
4217
|
+
formats$1.full = {
|
|
4264
4218
|
date: date,
|
|
4265
4219
|
time: time,
|
|
4266
4220
|
'date-time': date_time,
|
|
@@ -4269,14 +4223,14 @@
|
|
|
4269
4223
|
'uri-template': URITEMPLATE,
|
|
4270
4224
|
url: URL,
|
|
4271
4225
|
email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
|
|
4272
|
-
hostname:
|
|
4226
|
+
hostname: HOSTNAME,
|
|
4273
4227
|
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
|
|
4274
4228
|
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,
|
|
4275
4229
|
regex: regex,
|
|
4276
4230
|
uuid: UUID,
|
|
4277
|
-
'json-pointer': JSON_POINTER
|
|
4231
|
+
'json-pointer': JSON_POINTER,
|
|
4278
4232
|
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
|
|
4279
|
-
'relative-json-pointer': RELATIVE_JSON_POINTER
|
|
4233
|
+
'relative-json-pointer': RELATIVE_JSON_POINTER
|
|
4280
4234
|
};
|
|
4281
4235
|
|
|
4282
4236
|
|
|
@@ -4322,13 +4276,6 @@
|
|
|
4322
4276
|
}
|
|
4323
4277
|
|
|
4324
4278
|
|
|
4325
|
-
function hostname(str) {
|
|
4326
|
-
// https://tools.ietf.org/html/rfc1034#section-3.5
|
|
4327
|
-
// https://tools.ietf.org/html/rfc1123#section-2
|
|
4328
|
-
return str.length <= 255 && HOSTNAME.test(str);
|
|
4329
|
-
}
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
4279
|
var NOT_URI_FRAGMENT = /\/|:/;
|
|
4333
4280
|
function uri(str) {
|
|
4334
4281
|
// http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."
|
|
@@ -4489,7 +4436,7 @@
|
|
|
4489
4436
|
l1 = arr1.length - 1;
|
|
4490
4437
|
while ($i < l1) {
|
|
4491
4438
|
$sch = arr1[$i += 1];
|
|
4492
|
-
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
|
4439
|
+
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
|
4493
4440
|
$allSchemasEmpty = false;
|
|
4494
4441
|
$it.schema = $sch;
|
|
4495
4442
|
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
|
@@ -4510,7 +4457,6 @@
|
|
|
4510
4457
|
out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
|
|
4511
4458
|
}
|
|
4512
4459
|
}
|
|
4513
|
-
out = it.util.cleanUpCode(out);
|
|
4514
4460
|
return out;
|
|
4515
4461
|
};
|
|
4516
4462
|
|
|
@@ -4530,7 +4476,7 @@
|
|
|
4530
4476
|
$it.level++;
|
|
4531
4477
|
var $nextValid = 'valid' + $it.level;
|
|
4532
4478
|
var $noEmptySchema = $schema.every(function($sch) {
|
|
4533
|
-
return it.util.schemaHasRules($sch, it.RULES.all);
|
|
4479
|
+
return (it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all));
|
|
4534
4480
|
});
|
|
4535
4481
|
if ($noEmptySchema) {
|
|
4536
4482
|
var $currentBaseId = $it.baseId;
|
|
@@ -4579,7 +4525,6 @@
|
|
|
4579
4525
|
if (it.opts.allErrors) {
|
|
4580
4526
|
out += ' } ';
|
|
4581
4527
|
}
|
|
4582
|
-
out = it.util.cleanUpCode(out);
|
|
4583
4528
|
} else {
|
|
4584
4529
|
if ($breakOnError) {
|
|
4585
4530
|
out += ' if (true) { ';
|
|
@@ -4592,7 +4537,7 @@
|
|
|
4592
4537
|
var out = ' ';
|
|
4593
4538
|
var $schema = it.schema[$keyword];
|
|
4594
4539
|
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
|
4595
|
-
|
|
4540
|
+
!it.opts.allErrors;
|
|
4596
4541
|
var $comment = it.util.toQuotedString($schema);
|
|
4597
4542
|
if (it.opts.$comment === true) {
|
|
4598
4543
|
out += ' console.log(' + ($comment) + ');';
|
|
@@ -4673,7 +4618,7 @@
|
|
|
4673
4618
|
$dataNxt = $it.dataLevel = it.dataLevel + 1,
|
|
4674
4619
|
$nextData = 'data' + $dataNxt,
|
|
4675
4620
|
$currentBaseId = it.baseId,
|
|
4676
|
-
$nonEmptySchema = it.util.schemaHasRules($schema, it.RULES.all);
|
|
4621
|
+
$nonEmptySchema = (it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all));
|
|
4677
4622
|
out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
|
|
4678
4623
|
if ($nonEmptySchema) {
|
|
4679
4624
|
var $wasComposite = it.compositeRule;
|
|
@@ -4732,7 +4677,6 @@
|
|
|
4732
4677
|
if (it.opts.allErrors) {
|
|
4733
4678
|
out += ' } ';
|
|
4734
4679
|
}
|
|
4735
|
-
out = it.util.cleanUpCode(out);
|
|
4736
4680
|
return out;
|
|
4737
4681
|
};
|
|
4738
4682
|
|
|
@@ -4754,6 +4698,7 @@
|
|
|
4754
4698
|
$propertyDeps = {},
|
|
4755
4699
|
$ownProperties = it.opts.ownProperties;
|
|
4756
4700
|
for ($property in $schema) {
|
|
4701
|
+
if ($property == '__proto__') continue;
|
|
4757
4702
|
var $sch = $schema[$property];
|
|
4758
4703
|
var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
|
|
4759
4704
|
$deps[$property] = $sch;
|
|
@@ -4879,7 +4824,7 @@
|
|
|
4879
4824
|
var $currentBaseId = $it.baseId;
|
|
4880
4825
|
for (var $property in $schemaDeps) {
|
|
4881
4826
|
var $sch = $schemaDeps[$property];
|
|
4882
|
-
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
|
4827
|
+
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
|
4883
4828
|
out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
|
|
4884
4829
|
if ($ownProperties) {
|
|
4885
4830
|
out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
|
|
@@ -4900,7 +4845,6 @@
|
|
|
4900
4845
|
if ($breakOnError) {
|
|
4901
4846
|
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
|
4902
4847
|
}
|
|
4903
|
-
out = it.util.cleanUpCode(out);
|
|
4904
4848
|
return out;
|
|
4905
4849
|
};
|
|
4906
4850
|
|
|
@@ -5132,8 +5076,8 @@
|
|
|
5132
5076
|
var $nextValid = 'valid' + $it.level;
|
|
5133
5077
|
var $thenSch = it.schema['then'],
|
|
5134
5078
|
$elseSch = it.schema['else'],
|
|
5135
|
-
$thenPresent = $thenSch !== undefined && it.util.schemaHasRules($thenSch, it.RULES.all),
|
|
5136
|
-
$elsePresent = $elseSch !== undefined && it.util.schemaHasRules($elseSch, it.RULES.all),
|
|
5079
|
+
$thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? (typeof $thenSch == 'object' && Object.keys($thenSch).length > 0) || $thenSch === false : it.util.schemaHasRules($thenSch, it.RULES.all)),
|
|
5080
|
+
$elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? (typeof $elseSch == 'object' && Object.keys($elseSch).length > 0) || $elseSch === false : it.util.schemaHasRules($elseSch, it.RULES.all)),
|
|
5137
5081
|
$currentBaseId = $it.baseId;
|
|
5138
5082
|
if ($thenPresent || $elsePresent) {
|
|
5139
5083
|
var $ifClause;
|
|
@@ -5211,7 +5155,6 @@
|
|
|
5211
5155
|
if ($breakOnError) {
|
|
5212
5156
|
out += ' else { ';
|
|
5213
5157
|
}
|
|
5214
|
-
out = it.util.cleanUpCode(out);
|
|
5215
5158
|
} else {
|
|
5216
5159
|
if ($breakOnError) {
|
|
5217
5160
|
out += ' if (true) { ';
|
|
@@ -5287,7 +5230,7 @@
|
|
|
5287
5230
|
l1 = arr1.length - 1;
|
|
5288
5231
|
while ($i < l1) {
|
|
5289
5232
|
$sch = arr1[$i += 1];
|
|
5290
|
-
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
|
5233
|
+
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
|
5291
5234
|
out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { ';
|
|
5292
5235
|
var $passData = $data + '[' + $i + ']';
|
|
5293
5236
|
$it.schema = $sch;
|
|
@@ -5310,7 +5253,7 @@
|
|
|
5310
5253
|
}
|
|
5311
5254
|
}
|
|
5312
5255
|
}
|
|
5313
|
-
if (typeof $additionalItems == 'object' && it.util.schemaHasRules($additionalItems, it.RULES.all)) {
|
|
5256
|
+
if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? (typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0) || $additionalItems === false : it.util.schemaHasRules($additionalItems, it.RULES.all))) {
|
|
5314
5257
|
$it.schema = $additionalItems;
|
|
5315
5258
|
$it.schemaPath = it.schemaPath + '.additionalItems';
|
|
5316
5259
|
$it.errSchemaPath = it.errSchemaPath + '/additionalItems';
|
|
@@ -5334,7 +5277,7 @@
|
|
|
5334
5277
|
$closingBraces += '}';
|
|
5335
5278
|
}
|
|
5336
5279
|
}
|
|
5337
|
-
} else if (it.util.schemaHasRules($schema, it.RULES.all)) {
|
|
5280
|
+
} else if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
|
|
5338
5281
|
$it.schema = $schema;
|
|
5339
5282
|
$it.schemaPath = $schemaPath;
|
|
5340
5283
|
$it.errSchemaPath = $errSchemaPath;
|
|
@@ -5357,7 +5300,6 @@
|
|
|
5357
5300
|
if ($breakOnError) {
|
|
5358
5301
|
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
|
5359
5302
|
}
|
|
5360
|
-
out = it.util.cleanUpCode(out);
|
|
5361
5303
|
return out;
|
|
5362
5304
|
};
|
|
5363
5305
|
|
|
@@ -5386,6 +5328,12 @@
|
|
|
5386
5328
|
$op = $isMax ? '<' : '>',
|
|
5387
5329
|
$notOp = $isMax ? '>' : '<',
|
|
5388
5330
|
$errorKeyword = undefined;
|
|
5331
|
+
if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
|
|
5332
|
+
throw new Error($keyword + ' must be number');
|
|
5333
|
+
}
|
|
5334
|
+
if (!($isDataExcl || $schemaExcl === undefined || typeof $schemaExcl == 'number' || typeof $schemaExcl == 'boolean')) {
|
|
5335
|
+
throw new Error($exclusiveKeyword + ' must be number or boolean');
|
|
5336
|
+
}
|
|
5389
5337
|
if ($isDataExcl) {
|
|
5390
5338
|
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
|
|
5391
5339
|
$exclusive = 'exclusive' + $lvl,
|
|
@@ -5536,6 +5484,9 @@
|
|
|
5536
5484
|
} else {
|
|
5537
5485
|
$schemaValue = $schema;
|
|
5538
5486
|
}
|
|
5487
|
+
if (!($isData || typeof $schema == 'number')) {
|
|
5488
|
+
throw new Error($keyword + ' must be number');
|
|
5489
|
+
}
|
|
5539
5490
|
var $op = $keyword == 'maxItems' ? '>' : '<';
|
|
5540
5491
|
out += 'if ( ';
|
|
5541
5492
|
if ($isData) {
|
|
@@ -5613,6 +5564,9 @@
|
|
|
5613
5564
|
} else {
|
|
5614
5565
|
$schemaValue = $schema;
|
|
5615
5566
|
}
|
|
5567
|
+
if (!($isData || typeof $schema == 'number')) {
|
|
5568
|
+
throw new Error($keyword + ' must be number');
|
|
5569
|
+
}
|
|
5616
5570
|
var $op = $keyword == 'maxLength' ? '>' : '<';
|
|
5617
5571
|
out += 'if ( ';
|
|
5618
5572
|
if ($isData) {
|
|
@@ -5695,6 +5649,9 @@
|
|
|
5695
5649
|
} else {
|
|
5696
5650
|
$schemaValue = $schema;
|
|
5697
5651
|
}
|
|
5652
|
+
if (!($isData || typeof $schema == 'number')) {
|
|
5653
|
+
throw new Error($keyword + ' must be number');
|
|
5654
|
+
}
|
|
5698
5655
|
var $op = $keyword == 'maxProperties' ? '>' : '<';
|
|
5699
5656
|
out += 'if ( ';
|
|
5700
5657
|
if ($isData) {
|
|
@@ -5771,6 +5728,9 @@
|
|
|
5771
5728
|
} else {
|
|
5772
5729
|
$schemaValue = $schema;
|
|
5773
5730
|
}
|
|
5731
|
+
if (!($isData || typeof $schema == 'number')) {
|
|
5732
|
+
throw new Error($keyword + ' must be number');
|
|
5733
|
+
}
|
|
5774
5734
|
out += 'var division' + ($lvl) + ';if (';
|
|
5775
5735
|
if ($isData) {
|
|
5776
5736
|
out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
|
|
@@ -5844,7 +5804,7 @@
|
|
|
5844
5804
|
var $it = it.util.copy(it);
|
|
5845
5805
|
$it.level++;
|
|
5846
5806
|
var $nextValid = 'valid' + $it.level;
|
|
5847
|
-
if (it.util.schemaHasRules($schema, it.RULES.all)) {
|
|
5807
|
+
if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
|
|
5848
5808
|
$it.schema = $schema;
|
|
5849
5809
|
$it.schemaPath = $schemaPath;
|
|
5850
5810
|
$it.errSchemaPath = $errSchemaPath;
|
|
@@ -5942,7 +5902,7 @@
|
|
|
5942
5902
|
l1 = arr1.length - 1;
|
|
5943
5903
|
while ($i < l1) {
|
|
5944
5904
|
$sch = arr1[$i += 1];
|
|
5945
|
-
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
|
5905
|
+
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
|
5946
5906
|
$it.schema = $sch;
|
|
5947
5907
|
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
|
5948
5908
|
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
|
@@ -6063,7 +6023,7 @@
|
|
|
6063
6023
|
return out;
|
|
6064
6024
|
};
|
|
6065
6025
|
|
|
6066
|
-
var properties = function generate_properties(it, $keyword, $ruleType) {
|
|
6026
|
+
var properties$2 = function generate_properties(it, $keyword, $ruleType) {
|
|
6067
6027
|
var out = ' ';
|
|
6068
6028
|
var $lvl = it.level;
|
|
6069
6029
|
var $dataLvl = it.dataLevel;
|
|
@@ -6082,9 +6042,9 @@
|
|
|
6082
6042
|
$dataNxt = $it.dataLevel = it.dataLevel + 1,
|
|
6083
6043
|
$nextData = 'data' + $dataNxt,
|
|
6084
6044
|
$dataProperties = 'dataProperties' + $lvl;
|
|
6085
|
-
var $schemaKeys = Object.keys($schema || {}),
|
|
6045
|
+
var $schemaKeys = Object.keys($schema || {}).filter(notProto),
|
|
6086
6046
|
$pProperties = it.schema.patternProperties || {},
|
|
6087
|
-
$pPropertyKeys = Object.keys($pProperties),
|
|
6047
|
+
$pPropertyKeys = Object.keys($pProperties).filter(notProto),
|
|
6088
6048
|
$aProperties = it.schema.additionalProperties,
|
|
6089
6049
|
$someProperties = $schemaKeys.length || $pPropertyKeys.length,
|
|
6090
6050
|
$noAdditional = $aProperties === false,
|
|
@@ -6094,7 +6054,13 @@
|
|
|
6094
6054
|
$ownProperties = it.opts.ownProperties,
|
|
6095
6055
|
$currentBaseId = it.baseId;
|
|
6096
6056
|
var $required = it.schema.required;
|
|
6097
|
-
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired)
|
|
6057
|
+
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
|
|
6058
|
+
var $requiredHash = it.util.toHash($required);
|
|
6059
|
+
}
|
|
6060
|
+
|
|
6061
|
+
function notProto(p) {
|
|
6062
|
+
return p !== '__proto__';
|
|
6063
|
+
}
|
|
6098
6064
|
out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;';
|
|
6099
6065
|
if ($ownProperties) {
|
|
6100
6066
|
out += ' var ' + ($dataProperties) + ' = undefined;';
|
|
@@ -6247,7 +6213,7 @@
|
|
|
6247
6213
|
while (i3 < l3) {
|
|
6248
6214
|
$propertyKey = arr3[i3 += 1];
|
|
6249
6215
|
var $sch = $schema[$propertyKey];
|
|
6250
|
-
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
|
6216
|
+
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
|
6251
6217
|
var $prop = it.util.getProperty($propertyKey),
|
|
6252
6218
|
$passData = $data + $prop,
|
|
6253
6219
|
$hasDefault = $useDefaults && $sch.default !== undefined;
|
|
@@ -6350,7 +6316,7 @@
|
|
|
6350
6316
|
while (i4 < l4) {
|
|
6351
6317
|
$pProperty = arr4[i4 += 1];
|
|
6352
6318
|
var $sch = $pProperties[$pProperty];
|
|
6353
|
-
if (it.util.schemaHasRules($sch, it.RULES.all)) {
|
|
6319
|
+
if ((it.opts.strictKeywords ? (typeof $sch == 'object' && Object.keys($sch).length > 0) || $sch === false : it.util.schemaHasRules($sch, it.RULES.all))) {
|
|
6354
6320
|
$it.schema = $sch;
|
|
6355
6321
|
$it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
|
|
6356
6322
|
$it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty);
|
|
@@ -6389,7 +6355,6 @@
|
|
|
6389
6355
|
if ($breakOnError) {
|
|
6390
6356
|
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
|
6391
6357
|
}
|
|
6392
|
-
out = it.util.cleanUpCode(out);
|
|
6393
6358
|
return out;
|
|
6394
6359
|
};
|
|
6395
6360
|
|
|
@@ -6408,7 +6373,7 @@
|
|
|
6408
6373
|
$it.level++;
|
|
6409
6374
|
var $nextValid = 'valid' + $it.level;
|
|
6410
6375
|
out += 'var ' + ($errs) + ' = errors;';
|
|
6411
|
-
if (it.util.schemaHasRules($schema, it.RULES.all)) {
|
|
6376
|
+
if ((it.opts.strictKeywords ? (typeof $schema == 'object' && Object.keys($schema).length > 0) || $schema === false : it.util.schemaHasRules($schema, it.RULES.all))) {
|
|
6412
6377
|
$it.schema = $schema;
|
|
6413
6378
|
$it.schemaPath = $schemaPath;
|
|
6414
6379
|
$it.errSchemaPath = $errSchemaPath;
|
|
@@ -6471,11 +6436,10 @@
|
|
|
6471
6436
|
if ($breakOnError) {
|
|
6472
6437
|
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
|
6473
6438
|
}
|
|
6474
|
-
out = it.util.cleanUpCode(out);
|
|
6475
6439
|
return out;
|
|
6476
6440
|
};
|
|
6477
6441
|
|
|
6478
|
-
var required = function generate_required(it, $keyword, $ruleType) {
|
|
6442
|
+
var required$1 = function generate_required(it, $keyword, $ruleType) {
|
|
6479
6443
|
var out = ' ';
|
|
6480
6444
|
var $lvl = it.level;
|
|
6481
6445
|
var $dataLvl = it.dataLevel;
|
|
@@ -6500,7 +6464,7 @@
|
|
|
6500
6464
|
while (i1 < l1) {
|
|
6501
6465
|
$property = arr1[i1 += 1];
|
|
6502
6466
|
var $propertySch = it.schema.properties[$property];
|
|
6503
|
-
if (!($propertySch && it.util.schemaHasRules($propertySch, it.RULES.all))) {
|
|
6467
|
+
if (!($propertySch && (it.opts.strictKeywords ? (typeof $propertySch == 'object' && Object.keys($propertySch).length > 0) || $propertySch === false : it.util.schemaHasRules($propertySch, it.RULES.all)))) {
|
|
6504
6468
|
$required[$required.length] = $property;
|
|
6505
6469
|
}
|
|
6506
6470
|
}
|
|
@@ -6771,7 +6735,7 @@
|
|
|
6771
6735
|
} else {
|
|
6772
6736
|
out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; ';
|
|
6773
6737
|
var $method = 'checkDataType' + ($typeIsArray ? 's' : '');
|
|
6774
|
-
out += ' if (' + (it.util[$method]($itemType, 'item', true)) + ') continue; ';
|
|
6738
|
+
out += ' if (' + (it.util[$method]($itemType, 'item', it.opts.strictNumbers, true)) + ') continue; ';
|
|
6775
6739
|
if ($typeIsArray) {
|
|
6776
6740
|
out += ' if (typeof item == \'string\') item = \'"\' + item; ';
|
|
6777
6741
|
}
|
|
@@ -6852,16 +6816,17 @@
|
|
|
6852
6816
|
not: not,
|
|
6853
6817
|
oneOf: oneOf,
|
|
6854
6818
|
pattern: pattern,
|
|
6855
|
-
properties: properties,
|
|
6819
|
+
properties: properties$2,
|
|
6856
6820
|
propertyNames: propertyNames,
|
|
6857
|
-
required: required,
|
|
6821
|
+
required: required$1,
|
|
6858
6822
|
uniqueItems: uniqueItems,
|
|
6859
|
-
validate: validate
|
|
6823
|
+
validate: validate$1
|
|
6860
6824
|
};
|
|
6861
6825
|
|
|
6862
|
-
var
|
|
6826
|
+
var ruleModules = dotjs
|
|
6827
|
+
, toHash = util$5.toHash;
|
|
6863
6828
|
|
|
6864
|
-
var rules = function rules() {
|
|
6829
|
+
var rules$1 = function rules() {
|
|
6865
6830
|
var RULES = [
|
|
6866
6831
|
{ type: 'number',
|
|
6867
6832
|
rules: [ { 'maximum': ['exclusiveMaximum'] },
|
|
@@ -6885,8 +6850,8 @@
|
|
|
6885
6850
|
'additionalItems', 'then', 'else'
|
|
6886
6851
|
];
|
|
6887
6852
|
var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];
|
|
6888
|
-
RULES.all = toHash
|
|
6889
|
-
RULES.types = toHash
|
|
6853
|
+
RULES.all = toHash(ALL);
|
|
6854
|
+
RULES.types = toHash(TYPES);
|
|
6890
6855
|
|
|
6891
6856
|
RULES.forEach(function (group) {
|
|
6892
6857
|
group.rules = group.rules.map(function (keyword) {
|
|
@@ -6903,7 +6868,7 @@
|
|
|
6903
6868
|
ALL.push(keyword);
|
|
6904
6869
|
var rule = RULES.all[keyword] = {
|
|
6905
6870
|
keyword: keyword,
|
|
6906
|
-
code:
|
|
6871
|
+
code: ruleModules[keyword],
|
|
6907
6872
|
implements: implKeywords
|
|
6908
6873
|
};
|
|
6909
6874
|
return rule;
|
|
@@ -6911,13 +6876,13 @@
|
|
|
6911
6876
|
|
|
6912
6877
|
RULES.all.$comment = {
|
|
6913
6878
|
keyword: '$comment',
|
|
6914
|
-
code:
|
|
6879
|
+
code: ruleModules.$comment
|
|
6915
6880
|
};
|
|
6916
6881
|
|
|
6917
6882
|
if (group.type) RULES.types[group.type] = group;
|
|
6918
6883
|
});
|
|
6919
6884
|
|
|
6920
|
-
RULES.keywords = toHash
|
|
6885
|
+
RULES.keywords = toHash(ALL.concat(KEYWORDS));
|
|
6921
6886
|
RULES.custom = {};
|
|
6922
6887
|
|
|
6923
6888
|
return RULES;
|
|
@@ -6961,7 +6926,7 @@
|
|
|
6961
6926
|
keywords[key] = {
|
|
6962
6927
|
anyOf: [
|
|
6963
6928
|
schema,
|
|
6964
|
-
{ $ref: 'https://raw.githubusercontent.com/
|
|
6929
|
+
{ $ref: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
|
|
6965
6930
|
]
|
|
6966
6931
|
};
|
|
6967
6932
|
}
|
|
@@ -6971,7 +6936,7 @@
|
|
|
6971
6936
|
return metaSchema;
|
|
6972
6937
|
};
|
|
6973
6938
|
|
|
6974
|
-
var MissingRefError
|
|
6939
|
+
var MissingRefError = error_classes.MissingRef;
|
|
6975
6940
|
|
|
6976
6941
|
var async = compileAsync;
|
|
6977
6942
|
|
|
@@ -7024,7 +6989,7 @@
|
|
|
7024
6989
|
function _compileAsync(schemaObj) {
|
|
7025
6990
|
try { return self._compile(schemaObj); }
|
|
7026
6991
|
catch(e) {
|
|
7027
|
-
if (e instanceof MissingRefError
|
|
6992
|
+
if (e instanceof MissingRefError) return loadMissingSchema(e);
|
|
7028
6993
|
throw e;
|
|
7029
6994
|
}
|
|
7030
6995
|
|
|
@@ -7288,10 +7253,10 @@
|
|
|
7288
7253
|
return out;
|
|
7289
7254
|
};
|
|
7290
7255
|
|
|
7291
|
-
var $schema = "http://json-schema.org/draft-07/schema#";
|
|
7292
|
-
var $id = "http://json-schema.org/draft-07/schema#";
|
|
7256
|
+
var $schema$2 = "http://json-schema.org/draft-07/schema#";
|
|
7257
|
+
var $id$1 = "http://json-schema.org/draft-07/schema#";
|
|
7293
7258
|
var title = "Core schema meta-schema";
|
|
7294
|
-
var definitions = {
|
|
7259
|
+
var definitions$1 = {
|
|
7295
7260
|
schemaArray: {
|
|
7296
7261
|
type: "array",
|
|
7297
7262
|
minItems: 1,
|
|
@@ -7334,7 +7299,7 @@
|
|
|
7334
7299
|
]
|
|
7335
7300
|
}
|
|
7336
7301
|
};
|
|
7337
|
-
var type = [
|
|
7302
|
+
var type$1 = [
|
|
7338
7303
|
"object",
|
|
7339
7304
|
"boolean"
|
|
7340
7305
|
];
|
|
@@ -7530,41 +7495,20 @@
|
|
|
7530
7495
|
$ref: "#"
|
|
7531
7496
|
}
|
|
7532
7497
|
};
|
|
7533
|
-
var
|
|
7534
|
-
$schema: $schema,
|
|
7535
|
-
$id: $id,
|
|
7498
|
+
var require$$13 = {
|
|
7499
|
+
$schema: $schema$2,
|
|
7500
|
+
$id: $id$1,
|
|
7536
7501
|
title: title,
|
|
7537
|
-
definitions: definitions,
|
|
7538
|
-
type: type,
|
|
7502
|
+
definitions: definitions$1,
|
|
7503
|
+
type: type$1,
|
|
7539
7504
|
properties: properties$1,
|
|
7540
7505
|
"default": true
|
|
7541
7506
|
};
|
|
7542
7507
|
|
|
7543
|
-
var
|
|
7544
|
-
__proto__: null,
|
|
7545
|
-
$schema: $schema,
|
|
7546
|
-
$id: $id,
|
|
7547
|
-
title: title,
|
|
7548
|
-
definitions: definitions,
|
|
7549
|
-
type: type,
|
|
7550
|
-
properties: properties$1,
|
|
7551
|
-
'default': jsonSchemaDraft07
|
|
7552
|
-
});
|
|
7553
|
-
|
|
7554
|
-
var require$$2 = getCjsExportFromNamespace(jsonSchemaDraft07$1);
|
|
7555
|
-
|
|
7556
|
-
var IDENTIFIER$1 = /^[a-z_$][a-z0-9_$-]*$/i;
|
|
7557
|
-
|
|
7558
|
-
var metaSchema = require$$2;
|
|
7559
|
-
|
|
7560
|
-
var keyword = {
|
|
7561
|
-
add: addKeyword,
|
|
7562
|
-
get: getKeyword,
|
|
7563
|
-
remove: removeKeyword,
|
|
7564
|
-
validate: validateKeyword
|
|
7565
|
-
};
|
|
7508
|
+
var metaSchema = require$$13;
|
|
7566
7509
|
|
|
7567
|
-
var
|
|
7510
|
+
var definition_schema = {
|
|
7511
|
+
$id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js',
|
|
7568
7512
|
definitions: {
|
|
7569
7513
|
simpleTypes: metaSchema.definitions.simpleTypes
|
|
7570
7514
|
},
|
|
@@ -7597,6 +7541,18 @@
|
|
|
7597
7541
|
}
|
|
7598
7542
|
};
|
|
7599
7543
|
|
|
7544
|
+
var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i;
|
|
7545
|
+
var customRuleCode = custom;
|
|
7546
|
+
var definitionSchema = definition_schema;
|
|
7547
|
+
|
|
7548
|
+
var keyword = {
|
|
7549
|
+
add: addKeyword,
|
|
7550
|
+
get: getKeyword,
|
|
7551
|
+
remove: removeKeyword,
|
|
7552
|
+
validate: validateKeyword
|
|
7553
|
+
};
|
|
7554
|
+
|
|
7555
|
+
|
|
7600
7556
|
/**
|
|
7601
7557
|
* Define custom keyword
|
|
7602
7558
|
* @this Ajv
|
|
@@ -7611,7 +7567,7 @@
|
|
|
7611
7567
|
if (RULES.keywords[keyword])
|
|
7612
7568
|
throw new Error('Keyword ' + keyword + ' is already defined');
|
|
7613
7569
|
|
|
7614
|
-
if (!IDENTIFIER
|
|
7570
|
+
if (!IDENTIFIER.test(keyword))
|
|
7615
7571
|
throw new Error('Keyword ' + keyword + ' is not a valid identifier');
|
|
7616
7572
|
|
|
7617
7573
|
if (definition) {
|
|
@@ -7631,7 +7587,7 @@
|
|
|
7631
7587
|
metaSchema = {
|
|
7632
7588
|
anyOf: [
|
|
7633
7589
|
metaSchema,
|
|
7634
|
-
{ '$ref': 'https://raw.githubusercontent.com/
|
|
7590
|
+
{ '$ref': 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
|
|
7635
7591
|
]
|
|
7636
7592
|
};
|
|
7637
7593
|
}
|
|
@@ -7661,7 +7617,7 @@
|
|
|
7661
7617
|
keyword: keyword,
|
|
7662
7618
|
definition: definition,
|
|
7663
7619
|
custom: true,
|
|
7664
|
-
code:
|
|
7620
|
+
code: customRuleCode,
|
|
7665
7621
|
implements: definition.implements
|
|
7666
7622
|
};
|
|
7667
7623
|
ruleGroup.rules.push(rule);
|
|
@@ -7731,13 +7687,13 @@
|
|
|
7731
7687
|
}
|
|
7732
7688
|
|
|
7733
7689
|
var $schema$1 = "http://json-schema.org/draft-07/schema#";
|
|
7734
|
-
var $id
|
|
7690
|
+
var $id = "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#";
|
|
7735
7691
|
var description = "Meta-schema for $data reference (JSON Schema extension proposal)";
|
|
7736
|
-
var type
|
|
7737
|
-
var required
|
|
7692
|
+
var type = "object";
|
|
7693
|
+
var required = [
|
|
7738
7694
|
"$data"
|
|
7739
7695
|
];
|
|
7740
|
-
var properties
|
|
7696
|
+
var properties = {
|
|
7741
7697
|
$data: {
|
|
7742
7698
|
type: "string",
|
|
7743
7699
|
anyOf: [
|
|
@@ -7751,56 +7707,52 @@
|
|
|
7751
7707
|
}
|
|
7752
7708
|
};
|
|
7753
7709
|
var additionalProperties = false;
|
|
7754
|
-
var
|
|
7710
|
+
var require$$12 = {
|
|
7755
7711
|
$schema: $schema$1,
|
|
7756
|
-
$id: $id
|
|
7712
|
+
$id: $id,
|
|
7757
7713
|
description: description,
|
|
7758
|
-
type: type
|
|
7759
|
-
required: required
|
|
7760
|
-
properties: properties
|
|
7714
|
+
type: type,
|
|
7715
|
+
required: required,
|
|
7716
|
+
properties: properties,
|
|
7761
7717
|
additionalProperties: additionalProperties
|
|
7762
7718
|
};
|
|
7763
7719
|
|
|
7764
|
-
var
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
Ajv.prototype.
|
|
7781
|
-
Ajv.prototype.
|
|
7782
|
-
Ajv.prototype.
|
|
7783
|
-
Ajv.prototype.
|
|
7784
|
-
Ajv.prototype.
|
|
7785
|
-
|
|
7786
|
-
Ajv.prototype.
|
|
7787
|
-
Ajv.prototype.
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
Ajv.prototype.
|
|
7792
|
-
|
|
7793
|
-
Ajv.prototype.
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
Ajv.
|
|
7798
|
-
Ajv.
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
Ajv.ValidationError = error_classes.Validation;
|
|
7802
|
-
Ajv.MissingRefError = error_classes.MissingRef;
|
|
7803
|
-
Ajv.$dataMetaSchema = data;
|
|
7720
|
+
var compileSchema = compile_1
|
|
7721
|
+
, resolve = resolve_1
|
|
7722
|
+
, Cache = cache.exports
|
|
7723
|
+
, SchemaObject = schema_obj
|
|
7724
|
+
, stableStringify = fastJsonStableStringify
|
|
7725
|
+
, formats = formats_1
|
|
7726
|
+
, rules = rules$1
|
|
7727
|
+
, $dataMetaSchema = data
|
|
7728
|
+
, util = util$5;
|
|
7729
|
+
|
|
7730
|
+
var ajv = Ajv$1;
|
|
7731
|
+
|
|
7732
|
+
Ajv$1.prototype.validate = validate;
|
|
7733
|
+
Ajv$1.prototype.compile = compile;
|
|
7734
|
+
Ajv$1.prototype.addSchema = addSchema;
|
|
7735
|
+
Ajv$1.prototype.addMetaSchema = addMetaSchema;
|
|
7736
|
+
Ajv$1.prototype.validateSchema = validateSchema;
|
|
7737
|
+
Ajv$1.prototype.getSchema = getSchema;
|
|
7738
|
+
Ajv$1.prototype.removeSchema = removeSchema;
|
|
7739
|
+
Ajv$1.prototype.addFormat = addFormat;
|
|
7740
|
+
Ajv$1.prototype.errorsText = errorsText;
|
|
7741
|
+
|
|
7742
|
+
Ajv$1.prototype._addSchema = _addSchema;
|
|
7743
|
+
Ajv$1.prototype._compile = _compile;
|
|
7744
|
+
|
|
7745
|
+
Ajv$1.prototype.compileAsync = async;
|
|
7746
|
+
var customKeyword = keyword;
|
|
7747
|
+
Ajv$1.prototype.addKeyword = customKeyword.add;
|
|
7748
|
+
Ajv$1.prototype.getKeyword = customKeyword.get;
|
|
7749
|
+
Ajv$1.prototype.removeKeyword = customKeyword.remove;
|
|
7750
|
+
Ajv$1.prototype.validateKeyword = customKeyword.validate;
|
|
7751
|
+
|
|
7752
|
+
var errorClasses = error_classes;
|
|
7753
|
+
Ajv$1.ValidationError = errorClasses.Validation;
|
|
7754
|
+
Ajv$1.MissingRefError = errorClasses.MissingRef;
|
|
7755
|
+
Ajv$1.$dataMetaSchema = $dataMetaSchema;
|
|
7804
7756
|
|
|
7805
7757
|
var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema';
|
|
7806
7758
|
|
|
@@ -7813,16 +7765,16 @@
|
|
|
7813
7765
|
* @param {Object} opts optional options
|
|
7814
7766
|
* @return {Object} ajv instance
|
|
7815
7767
|
*/
|
|
7816
|
-
function Ajv(opts) {
|
|
7817
|
-
if (!(this instanceof Ajv)) return new Ajv(opts);
|
|
7768
|
+
function Ajv$1(opts) {
|
|
7769
|
+
if (!(this instanceof Ajv$1)) return new Ajv$1(opts);
|
|
7818
7770
|
opts = this._opts = util.copy(opts) || {};
|
|
7819
7771
|
setLogger(this);
|
|
7820
7772
|
this._schemas = {};
|
|
7821
7773
|
this._refs = {};
|
|
7822
7774
|
this._fragments = {};
|
|
7823
|
-
this._formats =
|
|
7775
|
+
this._formats = formats(opts.format);
|
|
7824
7776
|
|
|
7825
|
-
this._cache = opts.cache || new
|
|
7777
|
+
this._cache = opts.cache || new Cache;
|
|
7826
7778
|
this._loadingSchemas = {};
|
|
7827
7779
|
this._compilations = [];
|
|
7828
7780
|
this.RULES = rules();
|
|
@@ -7830,10 +7782,11 @@
|
|
|
7830
7782
|
|
|
7831
7783
|
opts.loopRequired = opts.loopRequired || Infinity;
|
|
7832
7784
|
if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true;
|
|
7833
|
-
if (opts.serialize === undefined) opts.serialize =
|
|
7785
|
+
if (opts.serialize === undefined) opts.serialize = stableStringify;
|
|
7834
7786
|
this._metaOpts = getMetaSchemaOptions(this);
|
|
7835
7787
|
|
|
7836
7788
|
if (opts.formats) addInitialFormats(this);
|
|
7789
|
+
if (opts.keywords) addInitialKeywords(this);
|
|
7837
7790
|
addDefaultMetaSchema(this);
|
|
7838
7791
|
if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta);
|
|
7839
7792
|
if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}});
|
|
@@ -7850,7 +7803,7 @@
|
|
|
7850
7803
|
* @param {Any} data to be validated
|
|
7851
7804
|
* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
|
|
7852
7805
|
*/
|
|
7853
|
-
function validate
|
|
7806
|
+
function validate(schemaKeyRef, data) {
|
|
7854
7807
|
var v;
|
|
7855
7808
|
if (typeof schemaKeyRef == 'string') {
|
|
7856
7809
|
v = this.getSchema(schemaKeyRef);
|
|
@@ -7873,7 +7826,7 @@
|
|
|
7873
7826
|
* @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords.
|
|
7874
7827
|
* @return {Function} validating function
|
|
7875
7828
|
*/
|
|
7876
|
-
function compile
|
|
7829
|
+
function compile(schema, _meta) {
|
|
7877
7830
|
var schemaObj = this._addSchema(schema, undefined, _meta);
|
|
7878
7831
|
return schemaObj.validate || this._compile(schemaObj);
|
|
7879
7832
|
}
|
|
@@ -7896,7 +7849,7 @@
|
|
|
7896
7849
|
var id = this._getId(schema);
|
|
7897
7850
|
if (id !== undefined && typeof id != 'string')
|
|
7898
7851
|
throw new Error('schema id must be string');
|
|
7899
|
-
key =
|
|
7852
|
+
key = resolve.normalizeId(key || id);
|
|
7900
7853
|
checkUnique(this, key);
|
|
7901
7854
|
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
|
|
7902
7855
|
return this;
|
|
@@ -7973,13 +7926,13 @@
|
|
|
7973
7926
|
|
|
7974
7927
|
|
|
7975
7928
|
function _getSchemaFragment(self, ref) {
|
|
7976
|
-
var res =
|
|
7929
|
+
var res = resolve.schema.call(self, { schema: {} }, ref);
|
|
7977
7930
|
if (res) {
|
|
7978
7931
|
var schema = res.schema
|
|
7979
7932
|
, root = res.root
|
|
7980
7933
|
, baseId = res.baseId;
|
|
7981
|
-
var v =
|
|
7982
|
-
self._fragments[ref] = new
|
|
7934
|
+
var v = compileSchema.call(self, schema, root, undefined, baseId);
|
|
7935
|
+
self._fragments[ref] = new SchemaObject({
|
|
7983
7936
|
ref: ref,
|
|
7984
7937
|
fragment: true,
|
|
7985
7938
|
schema: schema,
|
|
@@ -7993,7 +7946,7 @@
|
|
|
7993
7946
|
|
|
7994
7947
|
|
|
7995
7948
|
function _getSchemaObj(self, keyRef) {
|
|
7996
|
-
keyRef =
|
|
7949
|
+
keyRef = resolve.normalizeId(keyRef);
|
|
7997
7950
|
return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];
|
|
7998
7951
|
}
|
|
7999
7952
|
|
|
@@ -8031,7 +7984,7 @@
|
|
|
8031
7984
|
this._cache.del(cacheKey);
|
|
8032
7985
|
var id = this._getId(schemaKeyRef);
|
|
8033
7986
|
if (id) {
|
|
8034
|
-
id =
|
|
7987
|
+
id = resolve.normalizeId(id);
|
|
8035
7988
|
delete this._schemas[id];
|
|
8036
7989
|
delete this._refs[id];
|
|
8037
7990
|
}
|
|
@@ -8062,17 +8015,17 @@
|
|
|
8062
8015
|
|
|
8063
8016
|
shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
|
|
8064
8017
|
|
|
8065
|
-
var id =
|
|
8018
|
+
var id = resolve.normalizeId(this._getId(schema));
|
|
8066
8019
|
if (id && shouldAddSchema) checkUnique(this, id);
|
|
8067
8020
|
|
|
8068
8021
|
var willValidate = this._opts.validateSchema !== false && !skipValidation;
|
|
8069
8022
|
var recursiveMeta;
|
|
8070
|
-
if (willValidate && !(recursiveMeta = id && id ==
|
|
8023
|
+
if (willValidate && !(recursiveMeta = id && id == resolve.normalizeId(schema.$schema)))
|
|
8071
8024
|
this.validateSchema(schema, true);
|
|
8072
8025
|
|
|
8073
|
-
var localRefs =
|
|
8026
|
+
var localRefs = resolve.ids.call(this, schema);
|
|
8074
8027
|
|
|
8075
|
-
var schemaObj = new
|
|
8028
|
+
var schemaObj = new SchemaObject({
|
|
8076
8029
|
id: id,
|
|
8077
8030
|
schema: schema,
|
|
8078
8031
|
localRefs: localRefs,
|
|
@@ -8109,7 +8062,7 @@
|
|
|
8109
8062
|
}
|
|
8110
8063
|
|
|
8111
8064
|
var v;
|
|
8112
|
-
try { v =
|
|
8065
|
+
try { v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs); }
|
|
8113
8066
|
catch(e) {
|
|
8114
8067
|
delete schemaObj.validate;
|
|
8115
8068
|
throw e;
|
|
@@ -8205,12 +8158,12 @@
|
|
|
8205
8158
|
function addDefaultMetaSchema(self) {
|
|
8206
8159
|
var $dataSchema;
|
|
8207
8160
|
if (self._opts.$data) {
|
|
8208
|
-
$dataSchema = require$$
|
|
8161
|
+
$dataSchema = require$$12;
|
|
8209
8162
|
self.addMetaSchema($dataSchema, $dataSchema.$id, true);
|
|
8210
8163
|
}
|
|
8211
8164
|
if (self._opts.meta === false) return;
|
|
8212
|
-
var metaSchema = require$$
|
|
8213
|
-
if (self._opts.$data) metaSchema =
|
|
8165
|
+
var metaSchema = require$$13;
|
|
8166
|
+
if (self._opts.$data) metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA);
|
|
8214
8167
|
self.addMetaSchema(metaSchema, META_SCHEMA_ID, true);
|
|
8215
8168
|
self._refs['http://json-schema.org/schema'] = META_SCHEMA_ID;
|
|
8216
8169
|
}
|
|
@@ -8232,6 +8185,14 @@
|
|
|
8232
8185
|
}
|
|
8233
8186
|
|
|
8234
8187
|
|
|
8188
|
+
function addInitialKeywords(self) {
|
|
8189
|
+
for (var name in self._opts.keywords) {
|
|
8190
|
+
var keyword = self._opts.keywords[name];
|
|
8191
|
+
self.addKeyword(name, keyword);
|
|
8192
|
+
}
|
|
8193
|
+
}
|
|
8194
|
+
|
|
8195
|
+
|
|
8235
8196
|
function checkUnique(self, id) {
|
|
8236
8197
|
if (self._schemas[id] || self._refs[id])
|
|
8237
8198
|
throw new Error('schema with key or id "' + id + '" already exists');
|
|
@@ -8261,14 +8222,14 @@
|
|
|
8261
8222
|
|
|
8262
8223
|
function noop() {}
|
|
8263
8224
|
|
|
8264
|
-
var _Ajv = /*#__PURE__*/
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
})
|
|
8225
|
+
var _Ajv = /*#__PURE__*/_mergeNamespaces({
|
|
8226
|
+
__proto__: null,
|
|
8227
|
+
'default': ajv
|
|
8228
|
+
}, [ajv]);
|
|
8268
8229
|
|
|
8269
8230
|
var $ref = "#/definitions/Schema";
|
|
8270
|
-
var $schema
|
|
8271
|
-
var definitions
|
|
8231
|
+
var $schema = "http://json-schema.org/draft-07/schema#";
|
|
8232
|
+
var definitions = {
|
|
8272
8233
|
ActivityType: {
|
|
8273
8234
|
anyOf: [
|
|
8274
8235
|
{
|
|
@@ -8341,17 +8302,6 @@
|
|
|
8341
8302
|
}
|
|
8342
8303
|
]
|
|
8343
8304
|
},
|
|
8344
|
-
IActivityType: {
|
|
8345
|
-
"enum": [
|
|
8346
|
-
"filter",
|
|
8347
|
-
"project",
|
|
8348
|
-
"groupby",
|
|
8349
|
-
"sort",
|
|
8350
|
-
"limit",
|
|
8351
|
-
"mappings"
|
|
8352
|
-
],
|
|
8353
|
-
type: "string"
|
|
8354
|
-
},
|
|
8355
8305
|
IAggregate: {
|
|
8356
8306
|
additionalProperties: false,
|
|
8357
8307
|
properties: {
|
|
@@ -8426,9 +8376,7 @@
|
|
|
8426
8376
|
type: "string"
|
|
8427
8377
|
},
|
|
8428
8378
|
type: {
|
|
8429
|
-
"
|
|
8430
|
-
"count"
|
|
8431
|
-
],
|
|
8379
|
+
"const": "count",
|
|
8432
8380
|
type: "string"
|
|
8433
8381
|
}
|
|
8434
8382
|
},
|
|
@@ -8457,9 +8405,7 @@
|
|
|
8457
8405
|
type: "string"
|
|
8458
8406
|
},
|
|
8459
8407
|
type: {
|
|
8460
|
-
"
|
|
8461
|
-
"databomb"
|
|
8462
|
-
],
|
|
8408
|
+
"const": "databomb",
|
|
8463
8409
|
type: "string"
|
|
8464
8410
|
}
|
|
8465
8411
|
},
|
|
@@ -8551,9 +8497,7 @@
|
|
|
8551
8497
|
type: "array"
|
|
8552
8498
|
},
|
|
8553
8499
|
type: {
|
|
8554
|
-
"
|
|
8555
|
-
"="
|
|
8556
|
-
],
|
|
8500
|
+
"const": "=",
|
|
8557
8501
|
type: "string"
|
|
8558
8502
|
}
|
|
8559
8503
|
},
|
|
@@ -8602,9 +8546,7 @@
|
|
|
8602
8546
|
type: "string"
|
|
8603
8547
|
},
|
|
8604
8548
|
type: {
|
|
8605
|
-
"
|
|
8606
|
-
"boolean"
|
|
8607
|
-
],
|
|
8549
|
+
"const": "boolean",
|
|
8608
8550
|
type: "string"
|
|
8609
8551
|
}
|
|
8610
8552
|
},
|
|
@@ -8630,9 +8572,7 @@
|
|
|
8630
8572
|
type: "string"
|
|
8631
8573
|
},
|
|
8632
8574
|
type: {
|
|
8633
|
-
"
|
|
8634
|
-
"dataset"
|
|
8635
|
-
],
|
|
8575
|
+
"const": "dataset",
|
|
8636
8576
|
type: "string"
|
|
8637
8577
|
}
|
|
8638
8578
|
},
|
|
@@ -8653,9 +8593,7 @@
|
|
|
8653
8593
|
type: "string"
|
|
8654
8594
|
},
|
|
8655
8595
|
type: {
|
|
8656
|
-
"
|
|
8657
|
-
"number"
|
|
8658
|
-
],
|
|
8596
|
+
"const": "number",
|
|
8659
8597
|
type: "string"
|
|
8660
8598
|
}
|
|
8661
8599
|
},
|
|
@@ -8675,9 +8613,7 @@
|
|
|
8675
8613
|
type: "string"
|
|
8676
8614
|
},
|
|
8677
8615
|
type: {
|
|
8678
|
-
"
|
|
8679
|
-
"number64"
|
|
8680
|
-
],
|
|
8616
|
+
"const": "number64",
|
|
8681
8617
|
type: "string"
|
|
8682
8618
|
}
|
|
8683
8619
|
},
|
|
@@ -8703,9 +8639,7 @@
|
|
|
8703
8639
|
type: "string"
|
|
8704
8640
|
},
|
|
8705
8641
|
type: {
|
|
8706
|
-
"
|
|
8707
|
-
"object"
|
|
8708
|
-
],
|
|
8642
|
+
"const": "object",
|
|
8709
8643
|
type: "string"
|
|
8710
8644
|
}
|
|
8711
8645
|
},
|
|
@@ -8726,9 +8660,7 @@
|
|
|
8726
8660
|
type: "string"
|
|
8727
8661
|
},
|
|
8728
8662
|
type: {
|
|
8729
|
-
"
|
|
8730
|
-
"range"
|
|
8731
|
-
],
|
|
8663
|
+
"const": "range",
|
|
8732
8664
|
type: "string"
|
|
8733
8665
|
}
|
|
8734
8666
|
},
|
|
@@ -8761,9 +8693,7 @@
|
|
|
8761
8693
|
type: "string"
|
|
8762
8694
|
},
|
|
8763
8695
|
type: {
|
|
8764
|
-
"
|
|
8765
|
-
"set"
|
|
8766
|
-
],
|
|
8696
|
+
"const": "set",
|
|
8767
8697
|
type: "string"
|
|
8768
8698
|
}
|
|
8769
8699
|
},
|
|
@@ -8784,9 +8714,7 @@
|
|
|
8784
8714
|
type: "string"
|
|
8785
8715
|
},
|
|
8786
8716
|
type: {
|
|
8787
|
-
"
|
|
8788
|
-
"string"
|
|
8789
|
-
],
|
|
8717
|
+
"const": "string",
|
|
8790
8718
|
type: "string"
|
|
8791
8719
|
}
|
|
8792
8720
|
},
|
|
@@ -8819,9 +8747,7 @@
|
|
|
8819
8747
|
type: "array"
|
|
8820
8748
|
},
|
|
8821
8749
|
type: {
|
|
8822
|
-
"
|
|
8823
|
-
"filter"
|
|
8824
|
-
],
|
|
8750
|
+
"const": "filter",
|
|
8825
8751
|
type: "string"
|
|
8826
8752
|
}
|
|
8827
8753
|
},
|
|
@@ -8886,9 +8812,7 @@
|
|
|
8886
8812
|
type: "string"
|
|
8887
8813
|
},
|
|
8888
8814
|
type: {
|
|
8889
|
-
"
|
|
8890
|
-
"form"
|
|
8891
|
-
],
|
|
8815
|
+
"const": "form",
|
|
8892
8816
|
type: "string"
|
|
8893
8817
|
}
|
|
8894
8818
|
},
|
|
@@ -8915,9 +8839,7 @@
|
|
|
8915
8839
|
type: "array"
|
|
8916
8840
|
},
|
|
8917
8841
|
type: {
|
|
8918
|
-
"
|
|
8919
|
-
"groupby"
|
|
8920
|
-
],
|
|
8842
|
+
"const": "groupby",
|
|
8921
8843
|
type: "string"
|
|
8922
8844
|
}
|
|
8923
8845
|
},
|
|
@@ -8950,9 +8872,7 @@
|
|
|
8950
8872
|
type: "string"
|
|
8951
8873
|
},
|
|
8952
8874
|
type: {
|
|
8953
|
-
"
|
|
8954
|
-
"hipie"
|
|
8955
|
-
],
|
|
8875
|
+
"const": "hipie",
|
|
8956
8876
|
type: "string"
|
|
8957
8877
|
},
|
|
8958
8878
|
url: {
|
|
@@ -8989,9 +8909,7 @@
|
|
|
8989
8909
|
type: "number"
|
|
8990
8910
|
},
|
|
8991
8911
|
type: {
|
|
8992
|
-
"
|
|
8993
|
-
"limit"
|
|
8994
|
-
],
|
|
8912
|
+
"const": "limit",
|
|
8995
8913
|
type: "string"
|
|
8996
8914
|
}
|
|
8997
8915
|
},
|
|
@@ -9017,9 +8935,7 @@
|
|
|
9017
8935
|
type: "string"
|
|
9018
8936
|
},
|
|
9019
8937
|
type: {
|
|
9020
|
-
"
|
|
9021
|
-
"logicalfile"
|
|
9022
|
-
],
|
|
8938
|
+
"const": "logicalfile",
|
|
9023
8939
|
type: "string"
|
|
9024
8940
|
},
|
|
9025
8941
|
url: {
|
|
@@ -9053,9 +8969,7 @@
|
|
|
9053
8969
|
type: "string"
|
|
9054
8970
|
},
|
|
9055
8971
|
type: {
|
|
9056
|
-
"
|
|
9057
|
-
"map"
|
|
9058
|
-
],
|
|
8972
|
+
"const": "map",
|
|
9059
8973
|
type: "string"
|
|
9060
8974
|
}
|
|
9061
8975
|
},
|
|
@@ -9129,9 +9043,7 @@
|
|
|
9129
9043
|
type: "array"
|
|
9130
9044
|
},
|
|
9131
9045
|
type: {
|
|
9132
|
-
"
|
|
9133
|
-
"mappings"
|
|
9134
|
-
],
|
|
9046
|
+
"const": "mappings",
|
|
9135
9047
|
type: "string"
|
|
9136
9048
|
}
|
|
9137
9049
|
},
|
|
@@ -9154,9 +9066,7 @@
|
|
|
9154
9066
|
type: "array"
|
|
9155
9067
|
},
|
|
9156
9068
|
type: {
|
|
9157
|
-
"
|
|
9158
|
-
"multi"
|
|
9159
|
-
],
|
|
9069
|
+
"const": "multi",
|
|
9160
9070
|
type: "string"
|
|
9161
9071
|
}
|
|
9162
9072
|
},
|
|
@@ -9192,9 +9102,7 @@
|
|
|
9192
9102
|
type: "array"
|
|
9193
9103
|
},
|
|
9194
9104
|
type: {
|
|
9195
|
-
"
|
|
9196
|
-
"project"
|
|
9197
|
-
],
|
|
9105
|
+
"const": "project",
|
|
9198
9106
|
type: "string"
|
|
9199
9107
|
}
|
|
9200
9108
|
},
|
|
@@ -9257,9 +9165,7 @@
|
|
|
9257
9165
|
$ref: "#/definitions/OutputDict"
|
|
9258
9166
|
},
|
|
9259
9167
|
type: {
|
|
9260
|
-
"
|
|
9261
|
-
"rest"
|
|
9262
|
-
],
|
|
9168
|
+
"const": "rest",
|
|
9263
9169
|
type: "string"
|
|
9264
9170
|
},
|
|
9265
9171
|
url: {
|
|
@@ -9298,9 +9204,7 @@
|
|
|
9298
9204
|
type: "string"
|
|
9299
9205
|
},
|
|
9300
9206
|
type: {
|
|
9301
|
-
"
|
|
9302
|
-
"roxie"
|
|
9303
|
-
],
|
|
9207
|
+
"const": "roxie",
|
|
9304
9208
|
type: "string"
|
|
9305
9209
|
},
|
|
9306
9210
|
url: {
|
|
@@ -9354,9 +9258,7 @@
|
|
|
9354
9258
|
type: "string"
|
|
9355
9259
|
},
|
|
9356
9260
|
type: {
|
|
9357
|
-
"
|
|
9358
|
-
"scale"
|
|
9359
|
-
],
|
|
9261
|
+
"const": "scale",
|
|
9360
9262
|
type: "string"
|
|
9361
9263
|
}
|
|
9362
9264
|
},
|
|
@@ -9378,9 +9280,7 @@
|
|
|
9378
9280
|
type: "array"
|
|
9379
9281
|
},
|
|
9380
9282
|
type: {
|
|
9381
|
-
"
|
|
9382
|
-
"sort"
|
|
9383
|
-
],
|
|
9283
|
+
"const": "sort",
|
|
9384
9284
|
type: "string"
|
|
9385
9285
|
}
|
|
9386
9286
|
},
|
|
@@ -9416,9 +9316,7 @@
|
|
|
9416
9316
|
type: "string"
|
|
9417
9317
|
},
|
|
9418
9318
|
type: {
|
|
9419
|
-
"
|
|
9420
|
-
"template"
|
|
9421
|
-
],
|
|
9319
|
+
"const": "template",
|
|
9422
9320
|
type: "string"
|
|
9423
9321
|
}
|
|
9424
9322
|
},
|
|
@@ -9508,9 +9406,7 @@
|
|
|
9508
9406
|
$ref: "#/definitions/OutputDict"
|
|
9509
9407
|
},
|
|
9510
9408
|
type: {
|
|
9511
|
-
"
|
|
9512
|
-
"wuresult"
|
|
9513
|
-
],
|
|
9409
|
+
"const": "wuresult",
|
|
9514
9410
|
type: "string"
|
|
9515
9411
|
},
|
|
9516
9412
|
url: {
|
|
@@ -9627,20 +9523,12 @@
|
|
|
9627
9523
|
]
|
|
9628
9524
|
},
|
|
9629
9525
|
Range: {
|
|
9630
|
-
items:
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
},
|
|
9637
|
-
{
|
|
9638
|
-
type: [
|
|
9639
|
-
"number",
|
|
9640
|
-
"string"
|
|
9641
|
-
]
|
|
9642
|
-
}
|
|
9643
|
-
],
|
|
9526
|
+
items: {
|
|
9527
|
+
type: [
|
|
9528
|
+
"number",
|
|
9529
|
+
"string"
|
|
9530
|
+
]
|
|
9531
|
+
},
|
|
9644
9532
|
maxItems: 2,
|
|
9645
9533
|
minItems: 2,
|
|
9646
9534
|
type: "array"
|
|
@@ -9889,9 +9777,7 @@
|
|
|
9889
9777
|
$ref: "#/definitions/IProperties"
|
|
9890
9778
|
},
|
|
9891
9779
|
version: {
|
|
9892
|
-
"
|
|
9893
|
-
"2.2.1"
|
|
9894
|
-
],
|
|
9780
|
+
"const": "2.2.1",
|
|
9895
9781
|
type: "string"
|
|
9896
9782
|
}
|
|
9897
9783
|
},
|
|
@@ -9911,55 +9797,55 @@
|
|
|
9911
9797
|
type: "string"
|
|
9912
9798
|
}
|
|
9913
9799
|
};
|
|
9914
|
-
var v2
|
|
9800
|
+
var v2 = {
|
|
9915
9801
|
$ref: $ref,
|
|
9916
|
-
$schema: $schema
|
|
9917
|
-
definitions: definitions
|
|
9802
|
+
$schema: $schema,
|
|
9803
|
+
definitions: definitions
|
|
9918
9804
|
};
|
|
9919
9805
|
|
|
9920
9806
|
var _ddl2Schema = /*#__PURE__*/Object.freeze({
|
|
9921
9807
|
__proto__: null,
|
|
9922
9808
|
$ref: $ref,
|
|
9923
|
-
$schema: $schema
|
|
9924
|
-
definitions: definitions
|
|
9925
|
-
'default': v2
|
|
9809
|
+
$schema: $schema,
|
|
9810
|
+
definitions: definitions,
|
|
9811
|
+
'default': v2
|
|
9926
9812
|
});
|
|
9927
9813
|
|
|
9928
|
-
var Ajv
|
|
9929
|
-
var ddl2Schema = _ddl2Schema;
|
|
9930
|
-
var options = {
|
|
9931
|
-
allErrors: false,
|
|
9932
|
-
verbose: true,
|
|
9933
|
-
jsonPointers: false
|
|
9934
|
-
};
|
|
9935
|
-
function doValidate(ddl, schema) {
|
|
9936
|
-
var ajv = new Ajv
|
|
9937
|
-
var validate = ajv.compile(schema);
|
|
9938
|
-
var success = validate(ddl);
|
|
9939
|
-
return {
|
|
9940
|
-
success: success,
|
|
9941
|
-
errors: validate.errors
|
|
9942
|
-
};
|
|
9943
|
-
}
|
|
9944
|
-
function validate2(ddl) {
|
|
9945
|
-
return doValidate(ddl, _ddl2Schema);
|
|
9814
|
+
var Ajv = ajv || _Ajv;
|
|
9815
|
+
var ddl2Schema = _ddl2Schema;
|
|
9816
|
+
var options = {
|
|
9817
|
+
allErrors: false,
|
|
9818
|
+
verbose: true,
|
|
9819
|
+
jsonPointers: false
|
|
9820
|
+
};
|
|
9821
|
+
function doValidate(ddl, schema) {
|
|
9822
|
+
var ajv = new Ajv(options);
|
|
9823
|
+
var validate = ajv.compile(schema);
|
|
9824
|
+
var success = validate(ddl);
|
|
9825
|
+
return {
|
|
9826
|
+
success: success,
|
|
9827
|
+
errors: validate.errors
|
|
9828
|
+
};
|
|
9829
|
+
}
|
|
9830
|
+
function validate2(ddl) {
|
|
9831
|
+
return doValidate(ddl, _ddl2Schema);
|
|
9946
9832
|
}
|
|
9947
9833
|
|
|
9948
|
-
function isDDL2Schema(ref) {
|
|
9949
|
-
return ref.version !== undefined && ref.datasources !== undefined && ref.dataviews !== undefined;
|
|
9834
|
+
function isDDL2Schema(ref) {
|
|
9835
|
+
return ref.version !== undefined && ref.datasources !== undefined && ref.dataviews !== undefined;
|
|
9950
9836
|
}
|
|
9951
9837
|
|
|
9952
9838
|
exports.BUILD_VERSION = BUILD_VERSION;
|
|
9953
9839
|
exports.DDL1 = v1;
|
|
9954
|
-
exports.DDL2 = v2;
|
|
9840
|
+
exports.DDL2 = v2$1;
|
|
9955
9841
|
exports.PKG_NAME = PKG_NAME;
|
|
9956
9842
|
exports.PKG_VERSION = PKG_VERSION;
|
|
9957
9843
|
exports.ddl2Schema = ddl2Schema;
|
|
9958
9844
|
exports.isDDL2Schema = isDDL2Schema;
|
|
9959
|
-
exports.upgrade = upgrade
|
|
9845
|
+
exports.upgrade = upgrade;
|
|
9960
9846
|
exports.validate2 = validate2;
|
|
9961
9847
|
|
|
9962
9848
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9963
9849
|
|
|
9964
|
-
}))
|
|
9850
|
+
}));
|
|
9965
9851
|
//# sourceMappingURL=index.js.map
|