@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/cli.js
CHANGED
|
@@ -4,6 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
var fs = require('fs');
|
|
6
6
|
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
26
|
+
|
|
7
27
|
var $ref = "#/definitions/Schema";
|
|
8
28
|
var $schema = "http://json-schema.org/draft-07/schema#";
|
|
9
29
|
var definitions = {
|
|
@@ -79,17 +99,6 @@ var definitions = {
|
|
|
79
99
|
}
|
|
80
100
|
]
|
|
81
101
|
},
|
|
82
|
-
IActivityType: {
|
|
83
|
-
"enum": [
|
|
84
|
-
"filter",
|
|
85
|
-
"project",
|
|
86
|
-
"groupby",
|
|
87
|
-
"sort",
|
|
88
|
-
"limit",
|
|
89
|
-
"mappings"
|
|
90
|
-
],
|
|
91
|
-
type: "string"
|
|
92
|
-
},
|
|
93
102
|
IAggregate: {
|
|
94
103
|
additionalProperties: false,
|
|
95
104
|
properties: {
|
|
@@ -164,9 +173,7 @@ var definitions = {
|
|
|
164
173
|
type: "string"
|
|
165
174
|
},
|
|
166
175
|
type: {
|
|
167
|
-
"
|
|
168
|
-
"count"
|
|
169
|
-
],
|
|
176
|
+
"const": "count",
|
|
170
177
|
type: "string"
|
|
171
178
|
}
|
|
172
179
|
},
|
|
@@ -195,9 +202,7 @@ var definitions = {
|
|
|
195
202
|
type: "string"
|
|
196
203
|
},
|
|
197
204
|
type: {
|
|
198
|
-
"
|
|
199
|
-
"databomb"
|
|
200
|
-
],
|
|
205
|
+
"const": "databomb",
|
|
201
206
|
type: "string"
|
|
202
207
|
}
|
|
203
208
|
},
|
|
@@ -289,9 +294,7 @@ var definitions = {
|
|
|
289
294
|
type: "array"
|
|
290
295
|
},
|
|
291
296
|
type: {
|
|
292
|
-
"
|
|
293
|
-
"="
|
|
294
|
-
],
|
|
297
|
+
"const": "=",
|
|
295
298
|
type: "string"
|
|
296
299
|
}
|
|
297
300
|
},
|
|
@@ -340,9 +343,7 @@ var definitions = {
|
|
|
340
343
|
type: "string"
|
|
341
344
|
},
|
|
342
345
|
type: {
|
|
343
|
-
"
|
|
344
|
-
"boolean"
|
|
345
|
-
],
|
|
346
|
+
"const": "boolean",
|
|
346
347
|
type: "string"
|
|
347
348
|
}
|
|
348
349
|
},
|
|
@@ -368,9 +369,7 @@ var definitions = {
|
|
|
368
369
|
type: "string"
|
|
369
370
|
},
|
|
370
371
|
type: {
|
|
371
|
-
"
|
|
372
|
-
"dataset"
|
|
373
|
-
],
|
|
372
|
+
"const": "dataset",
|
|
374
373
|
type: "string"
|
|
375
374
|
}
|
|
376
375
|
},
|
|
@@ -391,9 +390,7 @@ var definitions = {
|
|
|
391
390
|
type: "string"
|
|
392
391
|
},
|
|
393
392
|
type: {
|
|
394
|
-
"
|
|
395
|
-
"number"
|
|
396
|
-
],
|
|
393
|
+
"const": "number",
|
|
397
394
|
type: "string"
|
|
398
395
|
}
|
|
399
396
|
},
|
|
@@ -413,9 +410,7 @@ var definitions = {
|
|
|
413
410
|
type: "string"
|
|
414
411
|
},
|
|
415
412
|
type: {
|
|
416
|
-
"
|
|
417
|
-
"number64"
|
|
418
|
-
],
|
|
413
|
+
"const": "number64",
|
|
419
414
|
type: "string"
|
|
420
415
|
}
|
|
421
416
|
},
|
|
@@ -441,9 +436,7 @@ var definitions = {
|
|
|
441
436
|
type: "string"
|
|
442
437
|
},
|
|
443
438
|
type: {
|
|
444
|
-
"
|
|
445
|
-
"object"
|
|
446
|
-
],
|
|
439
|
+
"const": "object",
|
|
447
440
|
type: "string"
|
|
448
441
|
}
|
|
449
442
|
},
|
|
@@ -464,9 +457,7 @@ var definitions = {
|
|
|
464
457
|
type: "string"
|
|
465
458
|
},
|
|
466
459
|
type: {
|
|
467
|
-
"
|
|
468
|
-
"range"
|
|
469
|
-
],
|
|
460
|
+
"const": "range",
|
|
470
461
|
type: "string"
|
|
471
462
|
}
|
|
472
463
|
},
|
|
@@ -499,9 +490,7 @@ var definitions = {
|
|
|
499
490
|
type: "string"
|
|
500
491
|
},
|
|
501
492
|
type: {
|
|
502
|
-
"
|
|
503
|
-
"set"
|
|
504
|
-
],
|
|
493
|
+
"const": "set",
|
|
505
494
|
type: "string"
|
|
506
495
|
}
|
|
507
496
|
},
|
|
@@ -522,9 +511,7 @@ var definitions = {
|
|
|
522
511
|
type: "string"
|
|
523
512
|
},
|
|
524
513
|
type: {
|
|
525
|
-
"
|
|
526
|
-
"string"
|
|
527
|
-
],
|
|
514
|
+
"const": "string",
|
|
528
515
|
type: "string"
|
|
529
516
|
}
|
|
530
517
|
},
|
|
@@ -557,9 +544,7 @@ var definitions = {
|
|
|
557
544
|
type: "array"
|
|
558
545
|
},
|
|
559
546
|
type: {
|
|
560
|
-
"
|
|
561
|
-
"filter"
|
|
562
|
-
],
|
|
547
|
+
"const": "filter",
|
|
563
548
|
type: "string"
|
|
564
549
|
}
|
|
565
550
|
},
|
|
@@ -624,9 +609,7 @@ var definitions = {
|
|
|
624
609
|
type: "string"
|
|
625
610
|
},
|
|
626
611
|
type: {
|
|
627
|
-
"
|
|
628
|
-
"form"
|
|
629
|
-
],
|
|
612
|
+
"const": "form",
|
|
630
613
|
type: "string"
|
|
631
614
|
}
|
|
632
615
|
},
|
|
@@ -653,9 +636,7 @@ var definitions = {
|
|
|
653
636
|
type: "array"
|
|
654
637
|
},
|
|
655
638
|
type: {
|
|
656
|
-
"
|
|
657
|
-
"groupby"
|
|
658
|
-
],
|
|
639
|
+
"const": "groupby",
|
|
659
640
|
type: "string"
|
|
660
641
|
}
|
|
661
642
|
},
|
|
@@ -688,9 +669,7 @@ var definitions = {
|
|
|
688
669
|
type: "string"
|
|
689
670
|
},
|
|
690
671
|
type: {
|
|
691
|
-
"
|
|
692
|
-
"hipie"
|
|
693
|
-
],
|
|
672
|
+
"const": "hipie",
|
|
694
673
|
type: "string"
|
|
695
674
|
},
|
|
696
675
|
url: {
|
|
@@ -727,9 +706,7 @@ var definitions = {
|
|
|
727
706
|
type: "number"
|
|
728
707
|
},
|
|
729
708
|
type: {
|
|
730
|
-
"
|
|
731
|
-
"limit"
|
|
732
|
-
],
|
|
709
|
+
"const": "limit",
|
|
733
710
|
type: "string"
|
|
734
711
|
}
|
|
735
712
|
},
|
|
@@ -755,9 +732,7 @@ var definitions = {
|
|
|
755
732
|
type: "string"
|
|
756
733
|
},
|
|
757
734
|
type: {
|
|
758
|
-
"
|
|
759
|
-
"logicalfile"
|
|
760
|
-
],
|
|
735
|
+
"const": "logicalfile",
|
|
761
736
|
type: "string"
|
|
762
737
|
},
|
|
763
738
|
url: {
|
|
@@ -791,9 +766,7 @@ var definitions = {
|
|
|
791
766
|
type: "string"
|
|
792
767
|
},
|
|
793
768
|
type: {
|
|
794
|
-
"
|
|
795
|
-
"map"
|
|
796
|
-
],
|
|
769
|
+
"const": "map",
|
|
797
770
|
type: "string"
|
|
798
771
|
}
|
|
799
772
|
},
|
|
@@ -867,9 +840,7 @@ var definitions = {
|
|
|
867
840
|
type: "array"
|
|
868
841
|
},
|
|
869
842
|
type: {
|
|
870
|
-
"
|
|
871
|
-
"mappings"
|
|
872
|
-
],
|
|
843
|
+
"const": "mappings",
|
|
873
844
|
type: "string"
|
|
874
845
|
}
|
|
875
846
|
},
|
|
@@ -892,9 +863,7 @@ var definitions = {
|
|
|
892
863
|
type: "array"
|
|
893
864
|
},
|
|
894
865
|
type: {
|
|
895
|
-
"
|
|
896
|
-
"multi"
|
|
897
|
-
],
|
|
866
|
+
"const": "multi",
|
|
898
867
|
type: "string"
|
|
899
868
|
}
|
|
900
869
|
},
|
|
@@ -930,9 +899,7 @@ var definitions = {
|
|
|
930
899
|
type: "array"
|
|
931
900
|
},
|
|
932
901
|
type: {
|
|
933
|
-
"
|
|
934
|
-
"project"
|
|
935
|
-
],
|
|
902
|
+
"const": "project",
|
|
936
903
|
type: "string"
|
|
937
904
|
}
|
|
938
905
|
},
|
|
@@ -995,9 +962,7 @@ var definitions = {
|
|
|
995
962
|
$ref: "#/definitions/OutputDict"
|
|
996
963
|
},
|
|
997
964
|
type: {
|
|
998
|
-
"
|
|
999
|
-
"rest"
|
|
1000
|
-
],
|
|
965
|
+
"const": "rest",
|
|
1001
966
|
type: "string"
|
|
1002
967
|
},
|
|
1003
968
|
url: {
|
|
@@ -1036,9 +1001,7 @@ var definitions = {
|
|
|
1036
1001
|
type: "string"
|
|
1037
1002
|
},
|
|
1038
1003
|
type: {
|
|
1039
|
-
"
|
|
1040
|
-
"roxie"
|
|
1041
|
-
],
|
|
1004
|
+
"const": "roxie",
|
|
1042
1005
|
type: "string"
|
|
1043
1006
|
},
|
|
1044
1007
|
url: {
|
|
@@ -1092,9 +1055,7 @@ var definitions = {
|
|
|
1092
1055
|
type: "string"
|
|
1093
1056
|
},
|
|
1094
1057
|
type: {
|
|
1095
|
-
"
|
|
1096
|
-
"scale"
|
|
1097
|
-
],
|
|
1058
|
+
"const": "scale",
|
|
1098
1059
|
type: "string"
|
|
1099
1060
|
}
|
|
1100
1061
|
},
|
|
@@ -1116,9 +1077,7 @@ var definitions = {
|
|
|
1116
1077
|
type: "array"
|
|
1117
1078
|
},
|
|
1118
1079
|
type: {
|
|
1119
|
-
"
|
|
1120
|
-
"sort"
|
|
1121
|
-
],
|
|
1080
|
+
"const": "sort",
|
|
1122
1081
|
type: "string"
|
|
1123
1082
|
}
|
|
1124
1083
|
},
|
|
@@ -1154,9 +1113,7 @@ var definitions = {
|
|
|
1154
1113
|
type: "string"
|
|
1155
1114
|
},
|
|
1156
1115
|
type: {
|
|
1157
|
-
"
|
|
1158
|
-
"template"
|
|
1159
|
-
],
|
|
1116
|
+
"const": "template",
|
|
1160
1117
|
type: "string"
|
|
1161
1118
|
}
|
|
1162
1119
|
},
|
|
@@ -1246,9 +1203,7 @@ var definitions = {
|
|
|
1246
1203
|
$ref: "#/definitions/OutputDict"
|
|
1247
1204
|
},
|
|
1248
1205
|
type: {
|
|
1249
|
-
"
|
|
1250
|
-
"wuresult"
|
|
1251
|
-
],
|
|
1206
|
+
"const": "wuresult",
|
|
1252
1207
|
type: "string"
|
|
1253
1208
|
},
|
|
1254
1209
|
url: {
|
|
@@ -1365,20 +1320,12 @@ var definitions = {
|
|
|
1365
1320
|
]
|
|
1366
1321
|
},
|
|
1367
1322
|
Range: {
|
|
1368
|
-
items:
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
},
|
|
1375
|
-
{
|
|
1376
|
-
type: [
|
|
1377
|
-
"number",
|
|
1378
|
-
"string"
|
|
1379
|
-
]
|
|
1380
|
-
}
|
|
1381
|
-
],
|
|
1323
|
+
items: {
|
|
1324
|
+
type: [
|
|
1325
|
+
"number",
|
|
1326
|
+
"string"
|
|
1327
|
+
]
|
|
1328
|
+
},
|
|
1382
1329
|
maxItems: 2,
|
|
1383
1330
|
minItems: 2,
|
|
1384
1331
|
type: "array"
|
|
@@ -1627,9 +1574,7 @@ var definitions = {
|
|
|
1627
1574
|
$ref: "#/definitions/IProperties"
|
|
1628
1575
|
},
|
|
1629
1576
|
version: {
|
|
1630
|
-
"
|
|
1631
|
-
"2.2.1"
|
|
1632
|
-
],
|
|
1577
|
+
"const": "2.2.1",
|
|
1633
1578
|
type: "string"
|
|
1634
1579
|
}
|
|
1635
1580
|
},
|
|
@@ -1696,1010 +1641,1010 @@ function __spreadArray(to, from, pack) {
|
|
|
1696
1641
|
ar[i] = from[i];
|
|
1697
1642
|
}
|
|
1698
1643
|
}
|
|
1699
|
-
return to.concat(ar || from);
|
|
1644
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1700
1645
|
}
|
|
1701
1646
|
|
|
1702
|
-
var PKG_NAME = "@hpcc-js/ddl-shim";
|
|
1703
|
-
var PKG_VERSION = "2.
|
|
1647
|
+
var PKG_NAME = "@hpcc-js/ddl-shim";
|
|
1648
|
+
var PKG_VERSION = "2.18.1";
|
|
1704
1649
|
|
|
1705
|
-
function isWorkunitDatasource(ref) {
|
|
1706
|
-
return ref.WUID !== undefined;
|
|
1707
|
-
}
|
|
1708
|
-
function isDatabombDatasource(ref) {
|
|
1709
|
-
return ref.databomb === true;
|
|
1710
|
-
}
|
|
1711
|
-
function isHipieDatasource(ref) {
|
|
1712
|
-
return ref.URL !== undefined;
|
|
1713
|
-
}
|
|
1714
|
-
function isPieVisualization(viz) {
|
|
1715
|
-
return viz.type === "PIE" || viz.type === "BAR";
|
|
1716
|
-
}
|
|
1717
|
-
function isLineVisualization(viz) {
|
|
1718
|
-
return viz.type === "LINE";
|
|
1719
|
-
}
|
|
1720
|
-
function isChoroVisualization(viz) {
|
|
1721
|
-
return viz.type === "CHORO";
|
|
1722
|
-
}
|
|
1723
|
-
function isTableVisualization(viz) {
|
|
1724
|
-
return viz.type === "TABLE";
|
|
1725
|
-
}
|
|
1726
|
-
function isSliderVisualization(viz) {
|
|
1727
|
-
return viz.type === "SLIDER";
|
|
1728
|
-
}
|
|
1729
|
-
function isGraphVisualization(viz) {
|
|
1730
|
-
return viz.type === "GRAPH";
|
|
1731
|
-
}
|
|
1732
|
-
function isFormVisualization(viz) {
|
|
1733
|
-
return viz.type === "FORM";
|
|
1650
|
+
function isWorkunitDatasource(ref) {
|
|
1651
|
+
return ref.WUID !== undefined;
|
|
1652
|
+
}
|
|
1653
|
+
function isDatabombDatasource(ref) {
|
|
1654
|
+
return ref.databomb === true;
|
|
1655
|
+
}
|
|
1656
|
+
function isHipieDatasource(ref) {
|
|
1657
|
+
return ref.URL !== undefined;
|
|
1658
|
+
}
|
|
1659
|
+
function isPieVisualization(viz) {
|
|
1660
|
+
return viz.type === "PIE" || viz.type === "BAR";
|
|
1661
|
+
}
|
|
1662
|
+
function isLineVisualization(viz) {
|
|
1663
|
+
return viz.type === "LINE";
|
|
1664
|
+
}
|
|
1665
|
+
function isChoroVisualization(viz) {
|
|
1666
|
+
return viz.type === "CHORO";
|
|
1667
|
+
}
|
|
1668
|
+
function isTableVisualization(viz) {
|
|
1669
|
+
return viz.type === "TABLE";
|
|
1670
|
+
}
|
|
1671
|
+
function isSliderVisualization(viz) {
|
|
1672
|
+
return viz.type === "SLIDER";
|
|
1673
|
+
}
|
|
1674
|
+
function isGraphVisualization(viz) {
|
|
1675
|
+
return viz.type === "GRAPH";
|
|
1676
|
+
}
|
|
1677
|
+
function isFormVisualization(viz) {
|
|
1678
|
+
return viz.type === "FORM";
|
|
1734
1679
|
}
|
|
1735
1680
|
|
|
1736
|
-
function isRoxieServiceRef(ref) {
|
|
1737
|
-
return ref.request !== undefined;
|
|
1681
|
+
function isRoxieServiceRef(ref) {
|
|
1682
|
+
return ref.request !== undefined;
|
|
1738
1683
|
}
|
|
1739
1684
|
|
|
1740
|
-
var classMappings = {
|
|
1741
|
-
c3chart_Bar: "chart_Bar",
|
|
1742
|
-
c3chart_Column: "chart_Column",
|
|
1743
|
-
c3chart_Pie: "chart_Pie",
|
|
1744
|
-
c3chart_Area: "chart_Area",
|
|
1745
|
-
c3chart_Line: "chart_Line",
|
|
1746
|
-
amchart_Bar: "chart_Bar",
|
|
1747
|
-
amchart_Column: "chart_Column",
|
|
1748
|
-
amchart_Pie: "chart_Pie",
|
|
1749
|
-
amchart_Area: "chart_Area",
|
|
1750
|
-
amchart_Line: "chart_Line",
|
|
1751
|
-
google_Bar: "chart_Bar",
|
|
1752
|
-
google_Column: "chart_Column",
|
|
1753
|
-
google_Pie: "chart_Pie",
|
|
1754
|
-
google_Area: "chart_Area",
|
|
1755
|
-
google_Line: "chart_Line",
|
|
1756
|
-
other_Table: "dgrid_Table"
|
|
1757
|
-
};
|
|
1758
|
-
var propertyMappings = {
|
|
1759
|
-
xAxisLabelRotation: [
|
|
1760
|
-
{ name: "xAxisOverlapMode", transform: function (n) { return "rotate"; } },
|
|
1761
|
-
{ name: "xAxisLabelRotation", transform: function (n) { return n; } }
|
|
1762
|
-
],
|
|
1763
|
-
tooltipLabelColor: {
|
|
1764
|
-
name: "tooltipLabelColor"
|
|
1765
|
-
},
|
|
1766
|
-
tooltipSeriesColor: {
|
|
1767
|
-
name: "tooltipSeriesColor"
|
|
1768
|
-
},
|
|
1769
|
-
tooltipValueColor: {
|
|
1770
|
-
name: "tooltipValueColor"
|
|
1771
|
-
},
|
|
1772
|
-
tooltipValueFormat: {
|
|
1773
|
-
name: "tooltipValueFormat"
|
|
1774
|
-
},
|
|
1775
|
-
timePattern: {
|
|
1776
|
-
name: "xAxisTypeTimePattern"
|
|
1777
|
-
},
|
|
1778
|
-
smoothLines: {
|
|
1779
|
-
name: "interpolate",
|
|
1780
|
-
transform: function (n) {
|
|
1781
|
-
if (n === false)
|
|
1782
|
-
return "linear";
|
|
1783
|
-
return "catmullRom";
|
|
1784
|
-
}
|
|
1785
|
-
},
|
|
1786
|
-
holePercent: {
|
|
1787
|
-
name: "innerRadius"
|
|
1788
|
-
},
|
|
1789
|
-
flip: {
|
|
1790
|
-
name: "orientation",
|
|
1791
|
-
transform: function (n) { return n ? "vertical" : "horizontal"; }
|
|
1792
|
-
},
|
|
1793
|
-
bottomText: {
|
|
1794
|
-
name: "xAxisTitle"
|
|
1795
|
-
},
|
|
1796
|
-
xAxisTypeTimePattern: {
|
|
1797
|
-
name: "xAxisTypeTimePattern"
|
|
1798
|
-
},
|
|
1799
|
-
yAxisTypeTimePattern: {
|
|
1800
|
-
name: "yAxisTypeTimePattern"
|
|
1801
|
-
},
|
|
1802
|
-
valueFormat: {
|
|
1803
|
-
name: "tooltipValueFormat"
|
|
1804
|
-
},
|
|
1805
|
-
stacked: {
|
|
1806
|
-
name: "yAxisStacked"
|
|
1807
|
-
},
|
|
1808
|
-
showYGrid: {
|
|
1809
|
-
name: "yAxisGuideLines"
|
|
1810
|
-
},
|
|
1811
|
-
showXGrid: {
|
|
1812
|
-
name: "xAxisGuideLines"
|
|
1813
|
-
},
|
|
1814
|
-
showValueLabel: {
|
|
1815
|
-
name: "showValue"
|
|
1816
|
-
},
|
|
1817
|
-
low: {
|
|
1818
|
-
name: "yAxisDomainLow"
|
|
1819
|
-
},
|
|
1820
|
-
high: {
|
|
1821
|
-
name: "yAxisDomainHigh"
|
|
1822
|
-
},
|
|
1823
|
-
fillOpacity: {
|
|
1824
|
-
name: "interpolateFillOpacity"
|
|
1825
|
-
},
|
|
1826
|
-
areaFillOpacity: {
|
|
1827
|
-
name: "interpolateFillOpacity"
|
|
1828
|
-
},
|
|
1829
|
-
showToolbar: {
|
|
1830
|
-
name: "titleVisible"
|
|
1831
|
-
},
|
|
1832
|
-
showCSV: {
|
|
1833
|
-
name: "downloadButtonVisible"
|
|
1834
|
-
}
|
|
1835
|
-
};
|
|
1836
|
-
function findKeyVal(object, key, val) {
|
|
1837
|
-
var value;
|
|
1838
|
-
for (var k in object) {
|
|
1839
|
-
if (k === key && object[k] === val) {
|
|
1840
|
-
value = object;
|
|
1841
|
-
break;
|
|
1842
|
-
}
|
|
1843
|
-
if (object[k] && typeof object[k] === "object") {
|
|
1844
|
-
value = findKeyVal(object[k], key, val);
|
|
1845
|
-
if (value !== undefined) {
|
|
1846
|
-
break;
|
|
1847
|
-
}
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
return value;
|
|
1851
|
-
}
|
|
1852
|
-
function apply_to_dataviews(ddl2, dermObj) {
|
|
1853
|
-
ddl2.dataviews.forEach(apply_to_dataview);
|
|
1854
|
-
function apply_to_dataview(dv) {
|
|
1855
|
-
var widgetId = dv.id;
|
|
1856
|
-
var dermPanelObj = findKeyVal(dermObj, "__id", widgetId);
|
|
1857
|
-
if (dermPanelObj) {
|
|
1858
|
-
var dermPanelProps = dermPanelObj.__properties;
|
|
1859
|
-
var dermWidgetObj = dermPanelObj.__properties.chart ? dermPanelObj.__properties.chart : dermPanelObj.__properties.widget;
|
|
1860
|
-
var dermWidgetProps = dermWidgetObj.__properties;
|
|
1861
|
-
apply_class_mapping(dermWidgetObj);
|
|
1862
|
-
apply_panel_property_mapping(dermPanelProps, dermWidgetProps);
|
|
1863
|
-
apply_widget_property_mapping(dermPanelProps, dermWidgetProps);
|
|
1864
|
-
if (dv.visualization.properties.chartType) {
|
|
1865
|
-
dv.visualization.properties.charttype = dv.visualization.properties.chartType;
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
else {
|
|
1869
|
-
console.warn(widgetId + " not found in dermObj");
|
|
1870
|
-
}
|
|
1871
|
-
function apply_class_mapping(dermWidgetObj) {
|
|
1872
|
-
dv.visualization.__class = swap_with_supported_class(dermWidgetObj.__class);
|
|
1873
|
-
dv.visualization.properties.__class = "marshaller_VizChartPanel";
|
|
1874
|
-
if (!dv.visualization.properties.widget)
|
|
1875
|
-
dv.visualization.properties.widget = {};
|
|
1876
|
-
dv.visualization.properties.widget.__class = dv.visualization.__class;
|
|
1877
|
-
function swap_with_supported_class(_class) {
|
|
1878
|
-
return classMappings[_class] ? classMappings[_class] : _class;
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
function apply_panel_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
1882
|
-
dv.visualization.title = dermPanelProps.title || "";
|
|
1883
|
-
dv.visualization.description = "";
|
|
1884
|
-
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
1885
|
-
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
1886
|
-
for (var propName in dermPanelProps) {
|
|
1887
|
-
if (typeof propertyMappings[propName] !== "undefined") {
|
|
1888
|
-
var newPropName = propertyMappings[propName].name;
|
|
1889
|
-
if (typeof propertyMappings[propName].transform === "function") {
|
|
1890
|
-
dv.visualization.properties[newPropName] = propertyMappings[propName].transform(dermPanelProps[propName]);
|
|
1891
|
-
}
|
|
1892
|
-
else {
|
|
1893
|
-
dv.visualization.properties[newPropName] = dermPanelProps[propName];
|
|
1894
|
-
}
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
if (dermWidgetProps && dermWidgetProps.showLegend && dv.visualization.properties) {
|
|
1898
|
-
dv.visualization.properties.legendVisible = true;
|
|
1899
|
-
}
|
|
1900
|
-
}
|
|
1901
|
-
function apply_widget_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
1902
|
-
dv.visualization.title = dv.visualization.title || dermWidgetProps.title || "";
|
|
1903
|
-
dv.visualization.description = ""; // TODO - should this map to anything?
|
|
1904
|
-
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
1905
|
-
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
1906
|
-
var _loop_1 = function (propName) {
|
|
1907
|
-
if (typeof propertyMappings[propName] !== "undefined") {
|
|
1908
|
-
if (propertyMappings[propName] instanceof Array) {
|
|
1909
|
-
propertyMappings[propName].forEach(function (p) {
|
|
1910
|
-
var newPropName = p.name;
|
|
1911
|
-
dv.visualization.properties.widget[newPropName] = p.transform(dermWidgetProps[propName]);
|
|
1912
|
-
if (typeof propertyMappings[propName].transform === "function") {
|
|
1913
|
-
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
1914
|
-
}
|
|
1915
|
-
else {
|
|
1916
|
-
dv.visualization.properties.widget[newPropName] = dermWidgetProps[propName];
|
|
1917
|
-
}
|
|
1918
|
-
});
|
|
1919
|
-
}
|
|
1920
|
-
else {
|
|
1921
|
-
var newPropName = propertyMappings[propName].name;
|
|
1922
|
-
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1925
|
-
};
|
|
1926
|
-
for (var propName in dermWidgetProps) {
|
|
1927
|
-
_loop_1(propName);
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
}
|
|
1931
|
-
}
|
|
1932
|
-
function apply_to_properties_layout(ddl2, dermObj) {
|
|
1933
|
-
var retVal = {
|
|
1934
|
-
layout: []
|
|
1935
|
-
};
|
|
1936
|
-
if (!dermObj || !dermObj.__properties)
|
|
1937
|
-
return;
|
|
1938
|
-
dermObj.__properties.content.forEach(function (cell) {
|
|
1939
|
-
var cellPosition = {
|
|
1940
|
-
// TODO - if "id" could be avoided then layouts could apply to any dashboard with the same number of widgets
|
|
1941
|
-
id: cell.__properties.widget.__id,
|
|
1942
|
-
position: [
|
|
1943
|
-
cell.__properties.gridCol,
|
|
1944
|
-
cell.__properties.gridRow,
|
|
1945
|
-
cell.__properties.gridColSpan,
|
|
1946
|
-
cell.__properties.gridRowSpan
|
|
1947
|
-
]
|
|
1948
|
-
};
|
|
1949
|
-
retVal.layout.push(cellPosition);
|
|
1950
|
-
});
|
|
1951
|
-
return retVal;
|
|
1952
|
-
}
|
|
1953
|
-
function upgrade(ddl2, dermObj) {
|
|
1954
|
-
apply_to_dataviews(ddl2, dermObj);
|
|
1955
|
-
return apply_to_properties_layout(ddl2, dermObj);
|
|
1685
|
+
var classMappings = {
|
|
1686
|
+
c3chart_Bar: "chart_Bar",
|
|
1687
|
+
c3chart_Column: "chart_Column",
|
|
1688
|
+
c3chart_Pie: "chart_Pie",
|
|
1689
|
+
c3chart_Area: "chart_Area",
|
|
1690
|
+
c3chart_Line: "chart_Line",
|
|
1691
|
+
amchart_Bar: "chart_Bar",
|
|
1692
|
+
amchart_Column: "chart_Column",
|
|
1693
|
+
amchart_Pie: "chart_Pie",
|
|
1694
|
+
amchart_Area: "chart_Area",
|
|
1695
|
+
amchart_Line: "chart_Line",
|
|
1696
|
+
google_Bar: "chart_Bar",
|
|
1697
|
+
google_Column: "chart_Column",
|
|
1698
|
+
google_Pie: "chart_Pie",
|
|
1699
|
+
google_Area: "chart_Area",
|
|
1700
|
+
google_Line: "chart_Line",
|
|
1701
|
+
other_Table: "dgrid_Table"
|
|
1702
|
+
};
|
|
1703
|
+
var propertyMappings = {
|
|
1704
|
+
xAxisLabelRotation: [
|
|
1705
|
+
{ name: "xAxisOverlapMode", transform: function (n) { return "rotate"; } },
|
|
1706
|
+
{ name: "xAxisLabelRotation", transform: function (n) { return n; } }
|
|
1707
|
+
],
|
|
1708
|
+
tooltipLabelColor: {
|
|
1709
|
+
name: "tooltipLabelColor"
|
|
1710
|
+
},
|
|
1711
|
+
tooltipSeriesColor: {
|
|
1712
|
+
name: "tooltipSeriesColor"
|
|
1713
|
+
},
|
|
1714
|
+
tooltipValueColor: {
|
|
1715
|
+
name: "tooltipValueColor"
|
|
1716
|
+
},
|
|
1717
|
+
tooltipValueFormat: {
|
|
1718
|
+
name: "tooltipValueFormat"
|
|
1719
|
+
},
|
|
1720
|
+
timePattern: {
|
|
1721
|
+
name: "xAxisTypeTimePattern"
|
|
1722
|
+
},
|
|
1723
|
+
smoothLines: {
|
|
1724
|
+
name: "interpolate",
|
|
1725
|
+
transform: function (n) {
|
|
1726
|
+
if (n === false)
|
|
1727
|
+
return "linear";
|
|
1728
|
+
return "catmullRom";
|
|
1729
|
+
}
|
|
1730
|
+
},
|
|
1731
|
+
holePercent: {
|
|
1732
|
+
name: "innerRadius"
|
|
1733
|
+
},
|
|
1734
|
+
flip: {
|
|
1735
|
+
name: "orientation",
|
|
1736
|
+
transform: function (n) { return n ? "vertical" : "horizontal"; }
|
|
1737
|
+
},
|
|
1738
|
+
bottomText: {
|
|
1739
|
+
name: "xAxisTitle"
|
|
1740
|
+
},
|
|
1741
|
+
xAxisTypeTimePattern: {
|
|
1742
|
+
name: "xAxisTypeTimePattern"
|
|
1743
|
+
},
|
|
1744
|
+
yAxisTypeTimePattern: {
|
|
1745
|
+
name: "yAxisTypeTimePattern"
|
|
1746
|
+
},
|
|
1747
|
+
valueFormat: {
|
|
1748
|
+
name: "tooltipValueFormat"
|
|
1749
|
+
},
|
|
1750
|
+
stacked: {
|
|
1751
|
+
name: "yAxisStacked"
|
|
1752
|
+
},
|
|
1753
|
+
showYGrid: {
|
|
1754
|
+
name: "yAxisGuideLines"
|
|
1755
|
+
},
|
|
1756
|
+
showXGrid: {
|
|
1757
|
+
name: "xAxisGuideLines"
|
|
1758
|
+
},
|
|
1759
|
+
showValueLabel: {
|
|
1760
|
+
name: "showValue"
|
|
1761
|
+
},
|
|
1762
|
+
low: {
|
|
1763
|
+
name: "yAxisDomainLow"
|
|
1764
|
+
},
|
|
1765
|
+
high: {
|
|
1766
|
+
name: "yAxisDomainHigh"
|
|
1767
|
+
},
|
|
1768
|
+
fillOpacity: {
|
|
1769
|
+
name: "interpolateFillOpacity"
|
|
1770
|
+
},
|
|
1771
|
+
areaFillOpacity: {
|
|
1772
|
+
name: "interpolateFillOpacity"
|
|
1773
|
+
},
|
|
1774
|
+
showToolbar: {
|
|
1775
|
+
name: "titleVisible"
|
|
1776
|
+
},
|
|
1777
|
+
showCSV: {
|
|
1778
|
+
name: "downloadButtonVisible"
|
|
1779
|
+
}
|
|
1780
|
+
};
|
|
1781
|
+
function findKeyVal(object, key, val) {
|
|
1782
|
+
var value;
|
|
1783
|
+
for (var k in object) {
|
|
1784
|
+
if (k === key && object[k] === val) {
|
|
1785
|
+
value = object;
|
|
1786
|
+
break;
|
|
1787
|
+
}
|
|
1788
|
+
if (object[k] && typeof object[k] === "object") {
|
|
1789
|
+
value = findKeyVal(object[k], key, val);
|
|
1790
|
+
if (value !== undefined) {
|
|
1791
|
+
break;
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
return value;
|
|
1796
|
+
}
|
|
1797
|
+
function apply_to_dataviews(ddl2, dermObj) {
|
|
1798
|
+
ddl2.dataviews.forEach(apply_to_dataview);
|
|
1799
|
+
function apply_to_dataview(dv) {
|
|
1800
|
+
var widgetId = dv.id;
|
|
1801
|
+
var dermPanelObj = findKeyVal(dermObj, "__id", widgetId);
|
|
1802
|
+
if (dermPanelObj) {
|
|
1803
|
+
var dermPanelProps = dermPanelObj.__properties;
|
|
1804
|
+
var dermWidgetObj = dermPanelObj.__properties.chart ? dermPanelObj.__properties.chart : dermPanelObj.__properties.widget;
|
|
1805
|
+
var dermWidgetProps = dermWidgetObj.__properties;
|
|
1806
|
+
apply_class_mapping(dermWidgetObj);
|
|
1807
|
+
apply_panel_property_mapping(dermPanelProps, dermWidgetProps);
|
|
1808
|
+
apply_widget_property_mapping(dermPanelProps, dermWidgetProps);
|
|
1809
|
+
if (dv.visualization.properties.chartType) {
|
|
1810
|
+
dv.visualization.properties.charttype = dv.visualization.properties.chartType;
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
else {
|
|
1814
|
+
console.warn(widgetId + " not found in dermObj");
|
|
1815
|
+
}
|
|
1816
|
+
function apply_class_mapping(dermWidgetObj) {
|
|
1817
|
+
dv.visualization.__class = swap_with_supported_class(dermWidgetObj.__class);
|
|
1818
|
+
dv.visualization.properties.__class = "marshaller_VizChartPanel";
|
|
1819
|
+
if (!dv.visualization.properties.widget)
|
|
1820
|
+
dv.visualization.properties.widget = {};
|
|
1821
|
+
dv.visualization.properties.widget.__class = dv.visualization.__class;
|
|
1822
|
+
function swap_with_supported_class(_class) {
|
|
1823
|
+
return classMappings[_class] ? classMappings[_class] : _class;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
function apply_panel_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
1827
|
+
dv.visualization.title = dermPanelProps.title || "";
|
|
1828
|
+
dv.visualization.description = "";
|
|
1829
|
+
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
1830
|
+
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
1831
|
+
for (var propName in dermPanelProps) {
|
|
1832
|
+
if (typeof propertyMappings[propName] !== "undefined") {
|
|
1833
|
+
var newPropName = propertyMappings[propName].name;
|
|
1834
|
+
if (typeof propertyMappings[propName].transform === "function") {
|
|
1835
|
+
dv.visualization.properties[newPropName] = propertyMappings[propName].transform(dermPanelProps[propName]);
|
|
1836
|
+
}
|
|
1837
|
+
else {
|
|
1838
|
+
dv.visualization.properties[newPropName] = dermPanelProps[propName];
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
if (dermWidgetProps && dermWidgetProps.showLegend && dv.visualization.properties) {
|
|
1843
|
+
dv.visualization.properties.legendVisible = true;
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
function apply_widget_property_mapping(dermPanelProps, dermWidgetProps) {
|
|
1847
|
+
dv.visualization.title = dv.visualization.title || dermWidgetProps.title || "";
|
|
1848
|
+
dv.visualization.description = ""; // TODO - should this map to anything?
|
|
1849
|
+
dv.visualization.visibility = dv.visualization.visibility === "flyout" ? "flyout" : "normal";
|
|
1850
|
+
dv.visualization.chartType = dv.visualization.__class.split("_")[1];
|
|
1851
|
+
var _loop_1 = function (propName) {
|
|
1852
|
+
if (typeof propertyMappings[propName] !== "undefined") {
|
|
1853
|
+
if (propertyMappings[propName] instanceof Array) {
|
|
1854
|
+
propertyMappings[propName].forEach(function (p) {
|
|
1855
|
+
var newPropName = p.name;
|
|
1856
|
+
dv.visualization.properties.widget[newPropName] = p.transform(dermWidgetProps[propName]);
|
|
1857
|
+
if (typeof propertyMappings[propName].transform === "function") {
|
|
1858
|
+
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
1859
|
+
}
|
|
1860
|
+
else {
|
|
1861
|
+
dv.visualization.properties.widget[newPropName] = dermWidgetProps[propName];
|
|
1862
|
+
}
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
else {
|
|
1866
|
+
var newPropName = propertyMappings[propName].name;
|
|
1867
|
+
dv.visualization.properties.widget[newPropName] = propertyMappings[propName].transform(dermWidgetProps[propName]);
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
};
|
|
1871
|
+
for (var propName in dermWidgetProps) {
|
|
1872
|
+
_loop_1(propName);
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
function apply_to_properties_layout(ddl2, dermObj) {
|
|
1878
|
+
var retVal = {
|
|
1879
|
+
layout: []
|
|
1880
|
+
};
|
|
1881
|
+
if (!dermObj || !dermObj.__properties)
|
|
1882
|
+
return;
|
|
1883
|
+
dermObj.__properties.content.forEach(function (cell) {
|
|
1884
|
+
var cellPosition = {
|
|
1885
|
+
// TODO - if "id" could be avoided then layouts could apply to any dashboard with the same number of widgets
|
|
1886
|
+
id: cell.__properties.widget.__id,
|
|
1887
|
+
position: [
|
|
1888
|
+
cell.__properties.gridCol,
|
|
1889
|
+
cell.__properties.gridRow,
|
|
1890
|
+
cell.__properties.gridColSpan,
|
|
1891
|
+
cell.__properties.gridRowSpan
|
|
1892
|
+
]
|
|
1893
|
+
};
|
|
1894
|
+
retVal.layout.push(cellPosition);
|
|
1895
|
+
});
|
|
1896
|
+
return retVal;
|
|
1897
|
+
}
|
|
1898
|
+
function upgrade$1(ddl2, dermObj) {
|
|
1899
|
+
apply_to_dataviews(ddl2, dermObj);
|
|
1900
|
+
return apply_to_properties_layout(ddl2, dermObj);
|
|
1956
1901
|
}
|
|
1957
1902
|
|
|
1958
|
-
function faCharFix(faChar) {
|
|
1959
|
-
return faChar;
|
|
1960
|
-
}
|
|
1961
|
-
var DDLUpgrade = /** @class */ (function () {
|
|
1962
|
-
function DDLUpgrade(ddl, baseUrl, wuid, toLowerCase) {
|
|
1963
|
-
if (baseUrl === void 0) { baseUrl = "http://localhost:8010"; }
|
|
1964
|
-
if (wuid === void 0) { wuid = "WUID"; }
|
|
1965
|
-
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
1966
|
-
this._datasources = {};
|
|
1967
|
-
this._datasourceUpdates = {};
|
|
1968
|
-
this._visualizations = {};
|
|
1969
|
-
this._ddl2Datasources = {};
|
|
1970
|
-
this._ddl2DatasourceFields = {};
|
|
1971
|
-
this._ddl2Dataviews = {};
|
|
1972
|
-
this._ddl2DataviewActivities = {};
|
|
1973
|
-
this._ddl = ddl;
|
|
1974
|
-
this._baseUrl = baseUrl;
|
|
1975
|
-
this._wuid = wuid;
|
|
1976
|
-
this._toLowerCase = toLowerCase;
|
|
1977
|
-
this.indexDDL();
|
|
1978
|
-
this.readDDL();
|
|
1979
|
-
}
|
|
1980
|
-
DDLUpgrade.prototype.toLowerCase = function (s) {
|
|
1981
|
-
return this._toLowerCase ? s.toLowerCase() : s;
|
|
1982
|
-
};
|
|
1983
|
-
DDLUpgrade.prototype.isVizDatasourceRoxie = function (viz) {
|
|
1984
|
-
if (viz.source) {
|
|
1985
|
-
var ds = this._datasources[viz.source.id];
|
|
1986
|
-
if (isHipieDatasource(ds)) {
|
|
1987
|
-
return true;
|
|
1988
|
-
}
|
|
1989
|
-
}
|
|
1990
|
-
return false;
|
|
1991
|
-
};
|
|
1992
|
-
DDLUpgrade.prototype.getDatasourceOutputs = function (dsID, vizID) {
|
|
1993
|
-
var retVal = [];
|
|
1994
|
-
var datasource = this._datasources[dsID];
|
|
1995
|
-
for (var _i = 0, _a = datasource.outputs; _i < _a.length; _i++) {
|
|
1996
|
-
var output = _a[_i];
|
|
1997
|
-
if (output.notify) {
|
|
1998
|
-
for (var _b = 0, _c = output.notify; _b < _c.length; _b++) {
|
|
1999
|
-
var notify = _c[_b];
|
|
2000
|
-
if (notify === vizID) {
|
|
2001
|
-
retVal.push({
|
|
2002
|
-
datasource: datasource,
|
|
2003
|
-
output: output
|
|
2004
|
-
});
|
|
2005
|
-
}
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
return retVal;
|
|
2010
|
-
};
|
|
2011
|
-
DDLUpgrade.prototype.getDatasourceFilters = function (dsID, vizID) {
|
|
2012
|
-
var retVal = {};
|
|
2013
|
-
for (var _i = 0, _a = this.getDatasourceOutputs(dsID, vizID); _i < _a.length; _i++) {
|
|
2014
|
-
var dsOut = _a[_i];
|
|
2015
|
-
if (dsOut.output.filter) {
|
|
2016
|
-
for (var _b = 0, _c = dsOut.output.filter; _b < _c.length; _b++) {
|
|
2017
|
-
var filter = _c[_b];
|
|
2018
|
-
retVal[filter.fieldid] = {
|
|
2019
|
-
datasource: dsOut.datasource,
|
|
2020
|
-
output: dsOut.output,
|
|
2021
|
-
filter: filter
|
|
2022
|
-
};
|
|
2023
|
-
}
|
|
2024
|
-
}
|
|
2025
|
-
}
|
|
2026
|
-
return retVal;
|
|
2027
|
-
};
|
|
2028
|
-
DDLUpgrade.prototype.indexDDL = function () {
|
|
2029
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
2030
|
-
var dash = _a[_i];
|
|
2031
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
2032
|
-
var viz = _c[_b];
|
|
2033
|
-
this._visualizations[viz.id] = viz;
|
|
2034
|
-
}
|
|
2035
|
-
}
|
|
2036
|
-
for (var _d = 0, _e = this._ddl.datasources; _d < _e.length; _d++) {
|
|
2037
|
-
var ds = _e[_d];
|
|
2038
|
-
this._datasources[ds.id] = ds;
|
|
2039
|
-
for (var _f = 0, _g = ds.outputs; _f < _g.length; _f++) {
|
|
2040
|
-
var output = _g[_f];
|
|
2041
|
-
if (output.notify) {
|
|
2042
|
-
for (var _h = 0, _j = output.notify; _h < _j.length; _h++) {
|
|
2043
|
-
var notify = _j[_h];
|
|
2044
|
-
this._datasourceUpdates[notify] = {
|
|
2045
|
-
id: ds.id,
|
|
2046
|
-
output: output.from || output.id
|
|
2047
|
-
};
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
};
|
|
2053
|
-
DDLUpgrade.prototype.readDDL = function () {
|
|
2054
|
-
for (var _i = 0, _a = this._ddl.datasources; _i < _a.length; _i++) {
|
|
2055
|
-
var ds = _a[_i];
|
|
2056
|
-
if (isWorkunitDatasource(ds)) {
|
|
2057
|
-
var ddl2DS = {
|
|
2058
|
-
type: "wuresult",
|
|
2059
|
-
id: ds.id,
|
|
2060
|
-
url: this._baseUrl,
|
|
2061
|
-
wuid: this._wuid,
|
|
2062
|
-
outputs: {}
|
|
2063
|
-
};
|
|
2064
|
-
for (var _b = 0, _c = ds.outputs; _b < _c.length; _b++) {
|
|
2065
|
-
var output = _c[_b];
|
|
2066
|
-
this.output2output(output, ddl2DS.outputs);
|
|
2067
|
-
}
|
|
2068
|
-
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
2069
|
-
}
|
|
2070
|
-
else if (isDatabombDatasource(ds)) ;
|
|
2071
|
-
else {
|
|
2072
|
-
var urlParts = ds.URL.split("/WsEcl/submit/query/");
|
|
2073
|
-
var hostParts = urlParts[0];
|
|
2074
|
-
var roxieParts = urlParts[1].split("/");
|
|
2075
|
-
var ddl2DS = {
|
|
2076
|
-
type: "hipie",
|
|
2077
|
-
id: ds.id,
|
|
2078
|
-
url: hostParts,
|
|
2079
|
-
querySet: roxieParts[0],
|
|
2080
|
-
queryID: roxieParts[1],
|
|
2081
|
-
inputs: [],
|
|
2082
|
-
outputs: {}
|
|
2083
|
-
};
|
|
2084
|
-
for (var _d = 0, _e = ds.outputs; _d < _e.length; _d++) {
|
|
2085
|
-
var output = _e[_d];
|
|
2086
|
-
this.output2output(output, ddl2DS.outputs);
|
|
2087
|
-
}
|
|
2088
|
-
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2091
|
-
for (var _f = 0, _g = this._ddl.dashboards; _f < _g.length; _f++) {
|
|
2092
|
-
var dash = _g[_f];
|
|
2093
|
-
for (var _h = 0, _j = dash.visualizations; _h < _j.length; _h++) {
|
|
2094
|
-
var viz = _j[_h];
|
|
2095
|
-
if (viz.type === "FORM") {
|
|
2096
|
-
this._ddl2Datasources[viz.id] = {
|
|
2097
|
-
type: "form",
|
|
2098
|
-
id: viz.id,
|
|
2099
|
-
fields: this.formFields2field(viz.fields)
|
|
2100
|
-
};
|
|
2101
|
-
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
2102
|
-
}
|
|
2103
|
-
else if (viz.type === "SLIDER") {
|
|
2104
|
-
this._ddl2Datasources[viz.id] = {
|
|
2105
|
-
type: "form",
|
|
2106
|
-
id: viz.id,
|
|
2107
|
-
fields: this.formFields2field(viz.fields, true)
|
|
2108
|
-
};
|
|
2109
|
-
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
2110
|
-
}
|
|
2111
|
-
this._ddl2Dataviews[viz.id] = this.anyViz2view(viz);
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
|
-
this.readGroupBy();
|
|
2115
|
-
this.readFilters();
|
|
2116
|
-
this.readSort();
|
|
2117
|
-
this.readMappings();
|
|
2118
|
-
};
|
|
2119
|
-
DDLUpgrade.prototype.readGroupBy = function () {
|
|
2120
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
2121
|
-
var dash = _a[_i];
|
|
2122
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
2123
|
-
var viz = _c[_b];
|
|
2124
|
-
if (viz.fields) {
|
|
2125
|
-
var projectTransformations = [];
|
|
2126
|
-
var groupByColumns = [];
|
|
2127
|
-
var aggrFields = [];
|
|
2128
|
-
for (var _d = 0, _e = viz.fields; _d < _e.length; _d++) {
|
|
2129
|
-
var field = _e[_d];
|
|
2130
|
-
if (field.properties && field.properties.function) {
|
|
2131
|
-
switch (field.properties.function) {
|
|
2132
|
-
case "SUM":
|
|
2133
|
-
case "MIN":
|
|
2134
|
-
case "MAX":
|
|
2135
|
-
aggrFields.push({
|
|
2136
|
-
type: this.func2aggr(field.properties.function),
|
|
2137
|
-
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
2138
|
-
fieldID: this.toLowerCase(field.id)
|
|
2139
|
-
});
|
|
2140
|
-
break;
|
|
2141
|
-
case "AVE":
|
|
2142
|
-
aggrFields.push({
|
|
2143
|
-
type: this.func2aggr(field.properties.function),
|
|
2144
|
-
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
2145
|
-
baseCountFieldID: field.properties.params.param2 ? this.toLowerCase(field.properties.params.param2) : undefined,
|
|
2146
|
-
fieldID: this.toLowerCase(field.id)
|
|
2147
|
-
});
|
|
2148
|
-
break;
|
|
2149
|
-
case "SCALE":
|
|
2150
|
-
if (typeof field.properties.params.param1 === "object") {
|
|
2151
|
-
var props = field.properties.params.param1;
|
|
2152
|
-
switch (props.function) {
|
|
2153
|
-
case "SUM":
|
|
2154
|
-
case "MIN":
|
|
2155
|
-
case "MAX":
|
|
2156
|
-
aggrFields.push({
|
|
2157
|
-
type: this.func2aggr(props.function),
|
|
2158
|
-
inFieldID: this.toLowerCase(props.params.param1),
|
|
2159
|
-
fieldID: this.toLowerCase(field.id)
|
|
2160
|
-
});
|
|
2161
|
-
break;
|
|
2162
|
-
}
|
|
2163
|
-
}
|
|
2164
|
-
projectTransformations.push({
|
|
2165
|
-
type: "scale",
|
|
2166
|
-
sourceFieldID: this.toLowerCase(field.id),
|
|
2167
|
-
fieldID: this.toLowerCase(field.id),
|
|
2168
|
-
factor: +field.properties.params.param2
|
|
2169
|
-
});
|
|
2170
|
-
break;
|
|
2171
|
-
default:
|
|
2172
|
-
groupByColumns.push(this.toLowerCase(field.id));
|
|
2173
|
-
throw new Error("Unhandled field function: "
|
|
2174
|
-
}
|
|
2175
|
-
}
|
|
2176
|
-
else {
|
|
2177
|
-
groupByColumns.push(this.toLowerCase(field.id));
|
|
2178
|
-
}
|
|
2179
|
-
}
|
|
2180
|
-
if (projectTransformations.length) {
|
|
2181
|
-
this._ddl2DataviewActivities[viz.id].project.transformations = projectTransformations;
|
|
2182
|
-
}
|
|
2183
|
-
if (aggrFields.length) {
|
|
2184
|
-
this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns);
|
|
2185
|
-
this._ddl2DataviewActivities[viz.id].groupBy.aggregates = aggrFields;
|
|
2186
|
-
}
|
|
2187
|
-
}
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
};
|
|
2191
|
-
DDLUpgrade.prototype.func2aggr = function (func) {
|
|
2192
|
-
switch (func) {
|
|
2193
|
-
case "SUM":
|
|
2194
|
-
return "sum";
|
|
2195
|
-
case "AVE":
|
|
2196
|
-
return "mean";
|
|
2197
|
-
case "MIN":
|
|
2198
|
-
return "min";
|
|
2199
|
-
case "MAX":
|
|
2200
|
-
return "max";
|
|
2201
|
-
}
|
|
2202
|
-
throw new Error("Unknown DDL1 Function Type: "
|
|
2203
|
-
};
|
|
2204
|
-
DDLUpgrade.prototype.readMappings = function () {
|
|
2205
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
2206
|
-
var dash = _a[_i];
|
|
2207
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
2208
|
-
var viz = _c[_b];
|
|
2209
|
-
if (isFormVisualization(viz)) ;
|
|
2210
|
-
else if (isPieVisualization(viz)) {
|
|
2211
|
-
this.readPieMappings(viz);
|
|
2212
|
-
}
|
|
2213
|
-
else if (isChoroVisualization(viz)) {
|
|
2214
|
-
this.readChoroMappings(viz);
|
|
2215
|
-
}
|
|
2216
|
-
else if (isLineVisualization(viz)) {
|
|
2217
|
-
this.readLineMappings(viz);
|
|
2218
|
-
}
|
|
2219
|
-
else if (isTableVisualization(viz)) {
|
|
2220
|
-
this.readTableMappings(viz);
|
|
2221
|
-
}
|
|
2222
|
-
else if (isGraphVisualization(viz)) {
|
|
2223
|
-
this.readGraphMappings(viz);
|
|
2224
|
-
}
|
|
2225
|
-
else if (isSliderVisualization(viz)) {
|
|
2226
|
-
this.readSliderMappings(viz);
|
|
2227
|
-
}
|
|
2228
|
-
else {
|
|
2229
|
-
throw new Error("Unkown DDL1 mapping type: "
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
|
-
};
|
|
2234
|
-
DDLUpgrade.prototype.readPieMappings = function (viz) {
|
|
2235
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
2236
|
-
mappings.transformations.push({
|
|
2237
|
-
fieldID: "label",
|
|
2238
|
-
type: "=",
|
|
2239
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
2240
|
-
});
|
|
2241
|
-
mappings.transformations.push({
|
|
2242
|
-
fieldID: "weight",
|
|
2243
|
-
type: "=",
|
|
2244
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
2245
|
-
});
|
|
2246
|
-
};
|
|
2247
|
-
DDLUpgrade.prototype.readChoroMappings = function (viz) {
|
|
2248
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
2249
|
-
mappings.transformations.push({
|
|
2250
|
-
fieldID: "label",
|
|
2251
|
-
type: "=",
|
|
2252
|
-
sourceFieldID: this.toLowerCase(this.anyChoroMapping2label(viz.source.mappings))
|
|
2253
|
-
});
|
|
2254
|
-
mappings.transformations.push({
|
|
2255
|
-
fieldID: "weight",
|
|
2256
|
-
type: "=",
|
|
2257
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
2258
|
-
});
|
|
2259
|
-
};
|
|
2260
|
-
DDLUpgrade.prototype.anyChoroMapping2label = function (mapping) {
|
|
2261
|
-
return mapping.state || mapping.county || mapping.geohash;
|
|
2262
|
-
};
|
|
2263
|
-
DDLUpgrade.prototype.readLineMappings = function (viz) {
|
|
2264
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
2265
|
-
mappings.transformations.push({
|
|
2266
|
-
fieldID: viz.source.mappings.x[0],
|
|
2267
|
-
type: "=",
|
|
2268
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.x[0])
|
|
2269
|
-
});
|
|
2270
|
-
for (var i = 0; i < viz.source.mappings.y.length; ++i) {
|
|
2271
|
-
mappings.transformations.push({
|
|
2272
|
-
fieldID: viz.source.mappings.y[i],
|
|
2273
|
-
type: "=",
|
|
2274
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.y[i])
|
|
2275
|
-
});
|
|
2276
|
-
}
|
|
2277
|
-
};
|
|
2278
|
-
DDLUpgrade.prototype.readTableMappings = function (viz) {
|
|
2279
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
2280
|
-
for (var i = 0; i < viz.label.length; ++i) {
|
|
2281
|
-
mappings.transformations.push({
|
|
2282
|
-
fieldID: viz.label[i],
|
|
2283
|
-
type: "=",
|
|
2284
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.value[i])
|
|
2285
|
-
});
|
|
2286
|
-
}
|
|
2287
|
-
};
|
|
2288
|
-
DDLUpgrade.prototype.readGraphEnums = function (valueMappings, annotation) {
|
|
2289
|
-
if (annotation === void 0) { annotation = false; }
|
|
2290
|
-
var retVal = [];
|
|
2291
|
-
if (valueMappings) {
|
|
2292
|
-
for (var value in valueMappings) {
|
|
2293
|
-
var newValue = {};
|
|
2294
|
-
for (var key in valueMappings[value]) {
|
|
2295
|
-
if (key === "faChar") {
|
|
2296
|
-
newValue[key] = faCharFix(valueMappings[value][key]);
|
|
2297
|
-
}
|
|
2298
|
-
else if (annotation && key.indexOf("icon_") === 0) {
|
|
2299
|
-
console.log("Deprecated flag property: " + key);
|
|
2300
|
-
newValue[key.split("icon_")[1]] = valueMappings[value][key];
|
|
2301
|
-
}
|
|
2302
|
-
else {
|
|
2303
|
-
newValue[key] = valueMappings[value][key];
|
|
2304
|
-
}
|
|
2305
|
-
}
|
|
2306
|
-
// remove v1.x "0" annotations as they equated to "nothing" ---
|
|
2307
|
-
if (!annotation || value !== "0") {
|
|
2308
|
-
retVal.push({
|
|
2309
|
-
value: value,
|
|
2310
|
-
newValue: newValue
|
|
2311
|
-
});
|
|
2312
|
-
}
|
|
2313
|
-
}
|
|
2314
|
-
}
|
|
2315
|
-
return retVal;
|
|
2316
|
-
};
|
|
2317
|
-
DDLUpgrade.prototype.readGraphMappings = function (viz) {
|
|
2318
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
2319
|
-
mappings.transformations.push({
|
|
2320
|
-
fieldID: "uid",
|
|
2321
|
-
type: "=",
|
|
2322
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.uid)
|
|
2323
|
-
});
|
|
2324
|
-
mappings.transformations.push({
|
|
2325
|
-
fieldID: "label",
|
|
2326
|
-
type: "=",
|
|
2327
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
2328
|
-
});
|
|
2329
|
-
if (viz.icon.fieldid) {
|
|
2330
|
-
mappings.transformations.push({
|
|
2331
|
-
fieldID: "icon",
|
|
2332
|
-
type: "map",
|
|
2333
|
-
sourceFieldID: this.toLowerCase(viz.icon.fieldid),
|
|
2334
|
-
default: { fachar: faCharFix(viz.icon.faChar) },
|
|
2335
|
-
mappings: this.readGraphEnums(viz.icon.valuemappings)
|
|
2336
|
-
});
|
|
2337
|
-
}
|
|
2338
|
-
var idx = 0;
|
|
2339
|
-
if (viz.flag) {
|
|
2340
|
-
for (var _i = 0, _a = viz.flag; _i < _a.length; _i++) {
|
|
2341
|
-
var flag = _a[_i];
|
|
2342
|
-
if (flag.fieldid) {
|
|
2343
|
-
mappings.transformations.push({
|
|
2344
|
-
fieldID: "annotation_"
|
|
2345
|
-
type: "map",
|
|
2346
|
-
sourceFieldID: this.toLowerCase(flag.fieldid),
|
|
2347
|
-
default: {},
|
|
2348
|
-
mappings: this.readGraphEnums(flag.valuemappings, true)
|
|
2349
|
-
});
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
mappings.transformations.push({
|
|
2354
|
-
fieldID: "links",
|
|
2355
|
-
type: "=",
|
|
2356
|
-
sourceFieldID: this.toLowerCase(viz.source.link.childfile),
|
|
2357
|
-
transformations: [{
|
|
2358
|
-
fieldID: "uid",
|
|
2359
|
-
type: "=",
|
|
2360
|
-
sourceFieldID: this.toLowerCase(viz.source.link.mappings.uid)
|
|
2361
|
-
}]
|
|
2362
|
-
});
|
|
2363
|
-
};
|
|
2364
|
-
DDLUpgrade.prototype.readSliderMappings = function (viz) {
|
|
2365
|
-
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
2366
|
-
mappings.transformations.push({
|
|
2367
|
-
fieldID: "label",
|
|
2368
|
-
type: "=",
|
|
2369
|
-
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
2370
|
-
});
|
|
2371
|
-
};
|
|
2372
|
-
DDLUpgrade.prototype.readFilters = function () {
|
|
2373
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
2374
|
-
var dash = _a[_i];
|
|
2375
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
2376
|
-
var viz = _c[_b];
|
|
2377
|
-
if (viz.events) {
|
|
2378
|
-
for (var eventID in viz.events) {
|
|
2379
|
-
var event_1 = viz.events[eventID];
|
|
2380
|
-
for (var _d = 0, _e = event_1.updates; _d < _e.length; _d++) {
|
|
2381
|
-
var update = _e[_d];
|
|
2382
|
-
var otherViz = this._ddl2Dataviews[update.visualization];
|
|
2383
|
-
var dsFilters = this.getDatasourceFilters(update.datasource, otherViz.id);
|
|
2384
|
-
if (update.mappings) {
|
|
2385
|
-
if (isRoxieServiceRef(otherViz.datasource)) {
|
|
2386
|
-
for (var key in update.mappings) {
|
|
2387
|
-
otherViz.datasource.request.push({
|
|
2388
|
-
source: viz.id,
|
|
2389
|
-
remoteFieldID: this.toLowerCase(key),
|
|
2390
|
-
localFieldID: this.toLowerCase(update.mappings[key])
|
|
2391
|
-
});
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
else {
|
|
2395
|
-
var condition = {
|
|
2396
|
-
viewID: viz.id,
|
|
2397
|
-
mappings: []
|
|
2398
|
-
};
|
|
2399
|
-
for (var key in update.mappings) {
|
|
2400
|
-
var mapping = update.mappings[key];
|
|
2401
|
-
var dsFilter = (mapping && dsFilters[mapping]) ? dsFilters[mapping].filter : undefined;
|
|
2402
|
-
if (!dsFilter) {
|
|
2403
|
-
console.warn("Select Mapping \""
|
|
2404
|
-
}
|
|
2405
|
-
else {
|
|
2406
|
-
condition.mappings.push({
|
|
2407
|
-
remoteFieldID: this.toLowerCase(key),
|
|
2408
|
-
localFieldID: this.toLowerCase(update.mappings[key]),
|
|
2409
|
-
condition: this.rule2condition(dsFilter.rule),
|
|
2410
|
-
nullable: dsFilter.nullable
|
|
2411
|
-
});
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
this._ddl2DataviewActivities[otherViz.id].filters.conditions.push(condition);
|
|
2415
|
-
}
|
|
2416
|
-
}
|
|
2417
|
-
}
|
|
2418
|
-
}
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
}
|
|
2422
|
-
};
|
|
2423
|
-
DDLUpgrade.prototype.rule2condition = function (_) {
|
|
2424
|
-
switch (_) {
|
|
2425
|
-
case "set":
|
|
2426
|
-
return "in";
|
|
2427
|
-
case "notequals":
|
|
2428
|
-
return "!=";
|
|
2429
|
-
}
|
|
2430
|
-
return _;
|
|
2431
|
-
};
|
|
2432
|
-
DDLUpgrade.prototype.readSort = function () {
|
|
2433
|
-
var _this = this;
|
|
2434
|
-
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
2435
|
-
var dash = _a[_i];
|
|
2436
|
-
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
2437
|
-
var viz = _c[_b];
|
|
2438
|
-
if (viz.source) {
|
|
2439
|
-
if (viz.source.sort) {
|
|
2440
|
-
var vizSort = this._ddl2DataviewActivities[viz.id].sort;
|
|
2441
|
-
vizSort.conditions = viz.source.sort.map(function (s) {
|
|
2442
|
-
if (s.indexOf("-") === 0) {
|
|
2443
|
-
return {
|
|
2444
|
-
fieldID: _this.toLowerCase(s.substr(1)),
|
|
2445
|
-
descending: true
|
|
2446
|
-
};
|
|
2447
|
-
}
|
|
2448
|
-
return {
|
|
2449
|
-
fieldID: _this.toLowerCase(s),
|
|
2450
|
-
descending: false
|
|
2451
|
-
};
|
|
2452
|
-
});
|
|
2453
|
-
}
|
|
2454
|
-
if (viz.source.first) {
|
|
2455
|
-
var vizLimit = this._ddl2DataviewActivities[viz.id].limit;
|
|
2456
|
-
vizLimit.limit = +viz.source.first;
|
|
2457
|
-
}
|
|
2458
|
-
}
|
|
2459
|
-
}
|
|
2460
|
-
}
|
|
2461
|
-
};
|
|
2462
|
-
DDLUpgrade.prototype.anyViz2view = function (viz) {
|
|
2463
|
-
var project = {
|
|
2464
|
-
type: "project",
|
|
2465
|
-
transformations: []
|
|
2466
|
-
};
|
|
2467
|
-
var filters = {
|
|
2468
|
-
type: "filter",
|
|
2469
|
-
conditions: []
|
|
2470
|
-
};
|
|
2471
|
-
var groupBy = {
|
|
2472
|
-
type: "groupby",
|
|
2473
|
-
groupByIDs: [],
|
|
2474
|
-
aggregates: []
|
|
2475
|
-
};
|
|
2476
|
-
var sort = {
|
|
2477
|
-
type: "sort",
|
|
2478
|
-
conditions: []
|
|
2479
|
-
};
|
|
2480
|
-
var limit = {
|
|
2481
|
-
type: "limit",
|
|
2482
|
-
limit: 0
|
|
2483
|
-
};
|
|
2484
|
-
var mappings = {
|
|
2485
|
-
type: "mappings",
|
|
2486
|
-
transformations: []
|
|
2487
|
-
};
|
|
2488
|
-
this._ddl2DataviewActivities[viz.id] = {
|
|
2489
|
-
project: project,
|
|
2490
|
-
filters: filters,
|
|
2491
|
-
sort: sort,
|
|
2492
|
-
groupBy: groupBy,
|
|
2493
|
-
limit: limit,
|
|
2494
|
-
mappings: mappings
|
|
2495
|
-
};
|
|
2496
|
-
var datasourceRef = this.isVizDatasourceRoxie(viz) ? {
|
|
2497
|
-
id: this._datasourceUpdates[viz.id].id,
|
|
2498
|
-
request: [],
|
|
2499
|
-
output: this._datasourceUpdates[viz.id].output
|
|
2500
|
-
} : {
|
|
2501
|
-
id: this._datasourceUpdates[viz.id].id,
|
|
2502
|
-
output: this._datasourceUpdates[viz.id].output
|
|
2503
|
-
};
|
|
2504
|
-
return {
|
|
2505
|
-
id: viz.id,
|
|
2506
|
-
datasource: datasourceRef,
|
|
2507
|
-
activities: [
|
|
2508
|
-
project,
|
|
2509
|
-
filters,
|
|
2510
|
-
sort,
|
|
2511
|
-
groupBy,
|
|
2512
|
-
limit
|
|
2513
|
-
],
|
|
2514
|
-
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 || {}) })
|
|
2515
|
-
};
|
|
2516
|
-
};
|
|
2517
|
-
DDLUpgrade.prototype.type2chartType = function (chartType) {
|
|
2518
|
-
switch (chartType) {
|
|
2519
|
-
case "LINE":
|
|
2520
|
-
return { chartType: "Line", __class: "chart_Line" };
|
|
2521
|
-
case "BUBBLE":
|
|
2522
|
-
return { chartType: "Bubble", __class: "chart_Bubble" };
|
|
2523
|
-
case "PIE":
|
|
2524
|
-
return { chartType: "Pie", __class: "chart_Pie" };
|
|
2525
|
-
case "BAR":
|
|
2526
|
-
return { chartType: "Column", __class: "chart_Column" };
|
|
2527
|
-
case "FORM":
|
|
2528
|
-
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
2529
|
-
case "WORD_CLOUD":
|
|
2530
|
-
return { chartType: "WordCloud", __class: "chart_WordCloud" };
|
|
2531
|
-
case "CHORO":
|
|
2532
|
-
return { chartType: "ChoroplethStates", __class: "map_ChoroplethStates" };
|
|
2533
|
-
case "SUMMARY":
|
|
2534
|
-
return { chartType: "Summary", __class: "chart_Summary" };
|
|
2535
|
-
case "SLIDER":
|
|
2536
|
-
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
2537
|
-
case "HEAT_MAP":
|
|
2538
|
-
return { chartType: "HeatMap", __class: "other_HeatMap" };
|
|
2539
|
-
case "2DCHART":
|
|
2540
|
-
return { chartType: "Column", __class: "chart_Column" };
|
|
2541
|
-
case "GRAPH":
|
|
2542
|
-
return { chartType: "AdjacencyGraph", __class: "graph_AdjacencyGraph" };
|
|
2543
|
-
case "TABLE":
|
|
2544
|
-
default:
|
|
2545
|
-
return { chartType: "Table", __class: "dgrid_Table" };
|
|
2546
|
-
}
|
|
2547
|
-
};
|
|
2548
|
-
DDLUpgrade.prototype.formFields2field = function (fields, slider) {
|
|
2549
|
-
var _this = this;
|
|
2550
|
-
if (slider === void 0) { slider = false; }
|
|
2551
|
-
if (!fields)
|
|
2552
|
-
return [];
|
|
2553
|
-
return fields.map(function (field) {
|
|
2554
|
-
switch (field.properties.type) {
|
|
2555
|
-
case "range":
|
|
2556
|
-
return {
|
|
2557
|
-
type: "range",
|
|
2558
|
-
id: field.id,
|
|
2559
|
-
default: (field.properties.default ? field.properties.default : undefined)
|
|
2560
|
-
};
|
|
2561
|
-
case "dataset":
|
|
2562
|
-
return {
|
|
2563
|
-
type: "dataset",
|
|
2564
|
-
id: field.id,
|
|
2565
|
-
default: [],
|
|
2566
|
-
children: []
|
|
2567
|
-
};
|
|
2568
|
-
default:
|
|
2569
|
-
return {
|
|
2570
|
-
type: _this.formFieldType2fieldType(field.properties.datatype, slider),
|
|
2571
|
-
id: field.id,
|
|
2572
|
-
default: field.properties.default ? field.properties.default[0] : undefined
|
|
2573
|
-
};
|
|
2574
|
-
}
|
|
2575
|
-
});
|
|
2576
|
-
};
|
|
2577
|
-
DDLUpgrade.prototype.formFieldType2fieldType = function (fieldType, slider) {
|
|
2578
|
-
switch (fieldType) {
|
|
2579
|
-
case "bool":
|
|
2580
|
-
case "boolean":
|
|
2581
|
-
return "boolean";
|
|
2582
|
-
case "integer":
|
|
2583
|
-
case "unsigned":
|
|
2584
|
-
case "float":
|
|
2585
|
-
case "double":
|
|
2586
|
-
case "real":
|
|
2587
|
-
return "number";
|
|
2588
|
-
case "string":
|
|
2589
|
-
return "string";
|
|
2590
|
-
default:
|
|
2591
|
-
return slider ? "number" : "string";
|
|
2592
|
-
}
|
|
2593
|
-
};
|
|
2594
|
-
DDLUpgrade.prototype.output2output = function (output, target) {
|
|
2595
|
-
target[output.from || output.id] = {
|
|
2596
|
-
fields: this.filters2fields(output.filter)
|
|
2597
|
-
};
|
|
2598
|
-
};
|
|
2599
|
-
DDLUpgrade.prototype.filters2fields = function (filters) {
|
|
2600
|
-
if (!filters)
|
|
2601
|
-
return [];
|
|
2602
|
-
return filters.filter(function (filter) {
|
|
2603
|
-
var idParts = filter.fieldid.split("-");
|
|
2604
|
-
return idParts.length === 1 || idParts[1] === "range";
|
|
2605
|
-
}).map(function (filter) {
|
|
2606
|
-
var idParts = filter.fieldid.split("-");
|
|
2607
|
-
var retVal = {
|
|
2608
|
-
type: "string",
|
|
2609
|
-
id: idParts[0]
|
|
2610
|
-
};
|
|
2611
|
-
return retVal;
|
|
2612
|
-
});
|
|
2613
|
-
};
|
|
2614
|
-
DDLUpgrade.prototype.getVizField = function (vizID, fieldID) {
|
|
2615
|
-
return {
|
|
2616
|
-
type: "string",
|
|
2617
|
-
id: "",
|
|
2618
|
-
default: ""
|
|
2619
|
-
};
|
|
2620
|
-
};
|
|
2621
|
-
DDLUpgrade.prototype.writeDatasources = function () {
|
|
2622
|
-
var retVal = [];
|
|
2623
|
-
for (var id in this._ddl2Datasources) {
|
|
2624
|
-
retVal.push(this._ddl2Datasources[id]);
|
|
2625
|
-
}
|
|
2626
|
-
return retVal;
|
|
2627
|
-
};
|
|
2628
|
-
DDLUpgrade.prototype.writeDataviews = function () {
|
|
2629
|
-
var retVal = [];
|
|
2630
|
-
for (var id in this._ddl2Dataviews) {
|
|
2631
|
-
retVal.push(this._ddl2Dataviews[id]);
|
|
2632
|
-
}
|
|
2633
|
-
return retVal;
|
|
2634
|
-
};
|
|
2635
|
-
DDLUpgrade.prototype.writeProperties = function () {
|
|
2636
|
-
return {
|
|
2637
|
-
// TODO
|
|
2638
|
-
};
|
|
2639
|
-
};
|
|
2640
|
-
DDLUpgrade.prototype.write = function () {
|
|
2641
|
-
return {
|
|
2642
|
-
version: "2.2.1",
|
|
2643
|
-
createdBy: {
|
|
2644
|
-
name: PKG_NAME,
|
|
2645
|
-
version: PKG_VERSION
|
|
2646
|
-
},
|
|
2647
|
-
datasources: this.writeDatasources(),
|
|
2648
|
-
dataviews: this.writeDataviews(),
|
|
2649
|
-
properties: this.writeProperties()
|
|
2650
|
-
};
|
|
2651
|
-
};
|
|
2652
|
-
return DDLUpgrade;
|
|
2653
|
-
}());
|
|
2654
|
-
function upgrade
|
|
2655
|
-
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
2656
|
-
if (dermatologyJson === void 0) { dermatologyJson = {}; }
|
|
2657
|
-
var ddlUp = new DDLUpgrade(ddl, baseUrl, wuid, toLowerCase);
|
|
2658
|
-
var retVal = ddlUp.write();
|
|
2659
|
-
retVal.properties = upgrade(retVal, dermatologyJson);
|
|
2660
|
-
return retVal;
|
|
1903
|
+
function faCharFix(faChar) {
|
|
1904
|
+
return faChar;
|
|
1905
|
+
}
|
|
1906
|
+
var DDLUpgrade = /** @class */ (function () {
|
|
1907
|
+
function DDLUpgrade(ddl, baseUrl, wuid, toLowerCase) {
|
|
1908
|
+
if (baseUrl === void 0) { baseUrl = "http://localhost:8010"; }
|
|
1909
|
+
if (wuid === void 0) { wuid = "WUID"; }
|
|
1910
|
+
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
1911
|
+
this._datasources = {};
|
|
1912
|
+
this._datasourceUpdates = {};
|
|
1913
|
+
this._visualizations = {};
|
|
1914
|
+
this._ddl2Datasources = {};
|
|
1915
|
+
this._ddl2DatasourceFields = {};
|
|
1916
|
+
this._ddl2Dataviews = {};
|
|
1917
|
+
this._ddl2DataviewActivities = {};
|
|
1918
|
+
this._ddl = ddl;
|
|
1919
|
+
this._baseUrl = baseUrl;
|
|
1920
|
+
this._wuid = wuid;
|
|
1921
|
+
this._toLowerCase = toLowerCase;
|
|
1922
|
+
this.indexDDL();
|
|
1923
|
+
this.readDDL();
|
|
1924
|
+
}
|
|
1925
|
+
DDLUpgrade.prototype.toLowerCase = function (s) {
|
|
1926
|
+
return this._toLowerCase ? s.toLowerCase() : s;
|
|
1927
|
+
};
|
|
1928
|
+
DDLUpgrade.prototype.isVizDatasourceRoxie = function (viz) {
|
|
1929
|
+
if (viz.source) {
|
|
1930
|
+
var ds = this._datasources[viz.source.id];
|
|
1931
|
+
if (isHipieDatasource(ds)) {
|
|
1932
|
+
return true;
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
return false;
|
|
1936
|
+
};
|
|
1937
|
+
DDLUpgrade.prototype.getDatasourceOutputs = function (dsID, vizID) {
|
|
1938
|
+
var retVal = [];
|
|
1939
|
+
var datasource = this._datasources[dsID];
|
|
1940
|
+
for (var _i = 0, _a = datasource.outputs; _i < _a.length; _i++) {
|
|
1941
|
+
var output = _a[_i];
|
|
1942
|
+
if (output.notify) {
|
|
1943
|
+
for (var _b = 0, _c = output.notify; _b < _c.length; _b++) {
|
|
1944
|
+
var notify = _c[_b];
|
|
1945
|
+
if (notify === vizID) {
|
|
1946
|
+
retVal.push({
|
|
1947
|
+
datasource: datasource,
|
|
1948
|
+
output: output
|
|
1949
|
+
});
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
return retVal;
|
|
1955
|
+
};
|
|
1956
|
+
DDLUpgrade.prototype.getDatasourceFilters = function (dsID, vizID) {
|
|
1957
|
+
var retVal = {};
|
|
1958
|
+
for (var _i = 0, _a = this.getDatasourceOutputs(dsID, vizID); _i < _a.length; _i++) {
|
|
1959
|
+
var dsOut = _a[_i];
|
|
1960
|
+
if (dsOut.output.filter) {
|
|
1961
|
+
for (var _b = 0, _c = dsOut.output.filter; _b < _c.length; _b++) {
|
|
1962
|
+
var filter = _c[_b];
|
|
1963
|
+
retVal[filter.fieldid] = {
|
|
1964
|
+
datasource: dsOut.datasource,
|
|
1965
|
+
output: dsOut.output,
|
|
1966
|
+
filter: filter
|
|
1967
|
+
};
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
return retVal;
|
|
1972
|
+
};
|
|
1973
|
+
DDLUpgrade.prototype.indexDDL = function () {
|
|
1974
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
1975
|
+
var dash = _a[_i];
|
|
1976
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
1977
|
+
var viz = _c[_b];
|
|
1978
|
+
this._visualizations[viz.id] = viz;
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
for (var _d = 0, _e = this._ddl.datasources; _d < _e.length; _d++) {
|
|
1982
|
+
var ds = _e[_d];
|
|
1983
|
+
this._datasources[ds.id] = ds;
|
|
1984
|
+
for (var _f = 0, _g = ds.outputs; _f < _g.length; _f++) {
|
|
1985
|
+
var output = _g[_f];
|
|
1986
|
+
if (output.notify) {
|
|
1987
|
+
for (var _h = 0, _j = output.notify; _h < _j.length; _h++) {
|
|
1988
|
+
var notify = _j[_h];
|
|
1989
|
+
this._datasourceUpdates[notify] = {
|
|
1990
|
+
id: ds.id,
|
|
1991
|
+
output: output.from || output.id
|
|
1992
|
+
};
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
};
|
|
1998
|
+
DDLUpgrade.prototype.readDDL = function () {
|
|
1999
|
+
for (var _i = 0, _a = this._ddl.datasources; _i < _a.length; _i++) {
|
|
2000
|
+
var ds = _a[_i];
|
|
2001
|
+
if (isWorkunitDatasource(ds)) {
|
|
2002
|
+
var ddl2DS = {
|
|
2003
|
+
type: "wuresult",
|
|
2004
|
+
id: ds.id,
|
|
2005
|
+
url: this._baseUrl,
|
|
2006
|
+
wuid: this._wuid,
|
|
2007
|
+
outputs: {}
|
|
2008
|
+
};
|
|
2009
|
+
for (var _b = 0, _c = ds.outputs; _b < _c.length; _b++) {
|
|
2010
|
+
var output = _c[_b];
|
|
2011
|
+
this.output2output(output, ddl2DS.outputs);
|
|
2012
|
+
}
|
|
2013
|
+
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
2014
|
+
}
|
|
2015
|
+
else if (isDatabombDatasource(ds)) ;
|
|
2016
|
+
else {
|
|
2017
|
+
var urlParts = ds.URL.split("/WsEcl/submit/query/");
|
|
2018
|
+
var hostParts = urlParts[0];
|
|
2019
|
+
var roxieParts = urlParts[1].split("/");
|
|
2020
|
+
var ddl2DS = {
|
|
2021
|
+
type: "hipie",
|
|
2022
|
+
id: ds.id,
|
|
2023
|
+
url: hostParts,
|
|
2024
|
+
querySet: roxieParts[0],
|
|
2025
|
+
queryID: roxieParts[1],
|
|
2026
|
+
inputs: [],
|
|
2027
|
+
outputs: {}
|
|
2028
|
+
};
|
|
2029
|
+
for (var _d = 0, _e = ds.outputs; _d < _e.length; _d++) {
|
|
2030
|
+
var output = _e[_d];
|
|
2031
|
+
this.output2output(output, ddl2DS.outputs);
|
|
2032
|
+
}
|
|
2033
|
+
this._ddl2Datasources[ds.id] = ddl2DS;
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
for (var _f = 0, _g = this._ddl.dashboards; _f < _g.length; _f++) {
|
|
2037
|
+
var dash = _g[_f];
|
|
2038
|
+
for (var _h = 0, _j = dash.visualizations; _h < _j.length; _h++) {
|
|
2039
|
+
var viz = _j[_h];
|
|
2040
|
+
if (viz.type === "FORM") {
|
|
2041
|
+
this._ddl2Datasources[viz.id] = {
|
|
2042
|
+
type: "form",
|
|
2043
|
+
id: viz.id,
|
|
2044
|
+
fields: this.formFields2field(viz.fields)
|
|
2045
|
+
};
|
|
2046
|
+
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
2047
|
+
}
|
|
2048
|
+
else if (viz.type === "SLIDER") {
|
|
2049
|
+
this._ddl2Datasources[viz.id] = {
|
|
2050
|
+
type: "form",
|
|
2051
|
+
id: viz.id,
|
|
2052
|
+
fields: this.formFields2field(viz.fields, true)
|
|
2053
|
+
};
|
|
2054
|
+
this._datasourceUpdates[viz.id] = { id: viz.id };
|
|
2055
|
+
}
|
|
2056
|
+
this._ddl2Dataviews[viz.id] = this.anyViz2view(viz);
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
this.readGroupBy();
|
|
2060
|
+
this.readFilters();
|
|
2061
|
+
this.readSort();
|
|
2062
|
+
this.readMappings();
|
|
2063
|
+
};
|
|
2064
|
+
DDLUpgrade.prototype.readGroupBy = function () {
|
|
2065
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
2066
|
+
var dash = _a[_i];
|
|
2067
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
2068
|
+
var viz = _c[_b];
|
|
2069
|
+
if (viz.fields) {
|
|
2070
|
+
var projectTransformations = [];
|
|
2071
|
+
var groupByColumns = [];
|
|
2072
|
+
var aggrFields = [];
|
|
2073
|
+
for (var _d = 0, _e = viz.fields; _d < _e.length; _d++) {
|
|
2074
|
+
var field = _e[_d];
|
|
2075
|
+
if (field.properties && field.properties.function) {
|
|
2076
|
+
switch (field.properties.function) {
|
|
2077
|
+
case "SUM":
|
|
2078
|
+
case "MIN":
|
|
2079
|
+
case "MAX":
|
|
2080
|
+
aggrFields.push({
|
|
2081
|
+
type: this.func2aggr(field.properties.function),
|
|
2082
|
+
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
2083
|
+
fieldID: this.toLowerCase(field.id)
|
|
2084
|
+
});
|
|
2085
|
+
break;
|
|
2086
|
+
case "AVE":
|
|
2087
|
+
aggrFields.push({
|
|
2088
|
+
type: this.func2aggr(field.properties.function),
|
|
2089
|
+
inFieldID: this.toLowerCase(field.properties.params.param1),
|
|
2090
|
+
baseCountFieldID: field.properties.params.param2 ? this.toLowerCase(field.properties.params.param2) : undefined,
|
|
2091
|
+
fieldID: this.toLowerCase(field.id)
|
|
2092
|
+
});
|
|
2093
|
+
break;
|
|
2094
|
+
case "SCALE":
|
|
2095
|
+
if (typeof field.properties.params.param1 === "object") {
|
|
2096
|
+
var props = field.properties.params.param1;
|
|
2097
|
+
switch (props.function) {
|
|
2098
|
+
case "SUM":
|
|
2099
|
+
case "MIN":
|
|
2100
|
+
case "MAX":
|
|
2101
|
+
aggrFields.push({
|
|
2102
|
+
type: this.func2aggr(props.function),
|
|
2103
|
+
inFieldID: this.toLowerCase(props.params.param1),
|
|
2104
|
+
fieldID: this.toLowerCase(field.id)
|
|
2105
|
+
});
|
|
2106
|
+
break;
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
projectTransformations.push({
|
|
2110
|
+
type: "scale",
|
|
2111
|
+
sourceFieldID: this.toLowerCase(field.id),
|
|
2112
|
+
fieldID: this.toLowerCase(field.id),
|
|
2113
|
+
factor: +field.properties.params.param2
|
|
2114
|
+
});
|
|
2115
|
+
break;
|
|
2116
|
+
default:
|
|
2117
|
+
groupByColumns.push(this.toLowerCase(field.id));
|
|
2118
|
+
throw new Error("Unhandled field function: ".concat(field.properties.function));
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
else {
|
|
2122
|
+
groupByColumns.push(this.toLowerCase(field.id));
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
if (projectTransformations.length) {
|
|
2126
|
+
this._ddl2DataviewActivities[viz.id].project.transformations = projectTransformations;
|
|
2127
|
+
}
|
|
2128
|
+
if (aggrFields.length) {
|
|
2129
|
+
this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns, true);
|
|
2130
|
+
this._ddl2DataviewActivities[viz.id].groupBy.aggregates = aggrFields;
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
};
|
|
2136
|
+
DDLUpgrade.prototype.func2aggr = function (func) {
|
|
2137
|
+
switch (func) {
|
|
2138
|
+
case "SUM":
|
|
2139
|
+
return "sum";
|
|
2140
|
+
case "AVE":
|
|
2141
|
+
return "mean";
|
|
2142
|
+
case "MIN":
|
|
2143
|
+
return "min";
|
|
2144
|
+
case "MAX":
|
|
2145
|
+
return "max";
|
|
2146
|
+
}
|
|
2147
|
+
throw new Error("Unknown DDL1 Function Type: ".concat(func));
|
|
2148
|
+
};
|
|
2149
|
+
DDLUpgrade.prototype.readMappings = function () {
|
|
2150
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
2151
|
+
var dash = _a[_i];
|
|
2152
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
2153
|
+
var viz = _c[_b];
|
|
2154
|
+
if (isFormVisualization(viz)) ;
|
|
2155
|
+
else if (isPieVisualization(viz)) {
|
|
2156
|
+
this.readPieMappings(viz);
|
|
2157
|
+
}
|
|
2158
|
+
else if (isChoroVisualization(viz)) {
|
|
2159
|
+
this.readChoroMappings(viz);
|
|
2160
|
+
}
|
|
2161
|
+
else if (isLineVisualization(viz)) {
|
|
2162
|
+
this.readLineMappings(viz);
|
|
2163
|
+
}
|
|
2164
|
+
else if (isTableVisualization(viz)) {
|
|
2165
|
+
this.readTableMappings(viz);
|
|
2166
|
+
}
|
|
2167
|
+
else if (isGraphVisualization(viz)) {
|
|
2168
|
+
this.readGraphMappings(viz);
|
|
2169
|
+
}
|
|
2170
|
+
else if (isSliderVisualization(viz)) {
|
|
2171
|
+
this.readSliderMappings(viz);
|
|
2172
|
+
}
|
|
2173
|
+
else {
|
|
2174
|
+
throw new Error("Unkown DDL1 mapping type: ".concat(viz.type));
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
};
|
|
2179
|
+
DDLUpgrade.prototype.readPieMappings = function (viz) {
|
|
2180
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
2181
|
+
mappings.transformations.push({
|
|
2182
|
+
fieldID: "label",
|
|
2183
|
+
type: "=",
|
|
2184
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
2185
|
+
});
|
|
2186
|
+
mappings.transformations.push({
|
|
2187
|
+
fieldID: "weight",
|
|
2188
|
+
type: "=",
|
|
2189
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
2190
|
+
});
|
|
2191
|
+
};
|
|
2192
|
+
DDLUpgrade.prototype.readChoroMappings = function (viz) {
|
|
2193
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
2194
|
+
mappings.transformations.push({
|
|
2195
|
+
fieldID: "label",
|
|
2196
|
+
type: "=",
|
|
2197
|
+
sourceFieldID: this.toLowerCase(this.anyChoroMapping2label(viz.source.mappings))
|
|
2198
|
+
});
|
|
2199
|
+
mappings.transformations.push({
|
|
2200
|
+
fieldID: "weight",
|
|
2201
|
+
type: "=",
|
|
2202
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.weight[0])
|
|
2203
|
+
});
|
|
2204
|
+
};
|
|
2205
|
+
DDLUpgrade.prototype.anyChoroMapping2label = function (mapping) {
|
|
2206
|
+
return mapping.state || mapping.county || mapping.geohash;
|
|
2207
|
+
};
|
|
2208
|
+
DDLUpgrade.prototype.readLineMappings = function (viz) {
|
|
2209
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
2210
|
+
mappings.transformations.push({
|
|
2211
|
+
fieldID: viz.source.mappings.x[0],
|
|
2212
|
+
type: "=",
|
|
2213
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.x[0])
|
|
2214
|
+
});
|
|
2215
|
+
for (var i = 0; i < viz.source.mappings.y.length; ++i) {
|
|
2216
|
+
mappings.transformations.push({
|
|
2217
|
+
fieldID: viz.source.mappings.y[i],
|
|
2218
|
+
type: "=",
|
|
2219
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.y[i])
|
|
2220
|
+
});
|
|
2221
|
+
}
|
|
2222
|
+
};
|
|
2223
|
+
DDLUpgrade.prototype.readTableMappings = function (viz) {
|
|
2224
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
2225
|
+
for (var i = 0; i < viz.label.length; ++i) {
|
|
2226
|
+
mappings.transformations.push({
|
|
2227
|
+
fieldID: viz.label[i],
|
|
2228
|
+
type: "=",
|
|
2229
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.value[i])
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
};
|
|
2233
|
+
DDLUpgrade.prototype.readGraphEnums = function (valueMappings, annotation) {
|
|
2234
|
+
if (annotation === void 0) { annotation = false; }
|
|
2235
|
+
var retVal = [];
|
|
2236
|
+
if (valueMappings) {
|
|
2237
|
+
for (var value in valueMappings) {
|
|
2238
|
+
var newValue = {};
|
|
2239
|
+
for (var key in valueMappings[value]) {
|
|
2240
|
+
if (key === "faChar") {
|
|
2241
|
+
newValue[key] = faCharFix(valueMappings[value][key]);
|
|
2242
|
+
}
|
|
2243
|
+
else if (annotation && key.indexOf("icon_") === 0) {
|
|
2244
|
+
console.log("Deprecated flag property: " + key);
|
|
2245
|
+
newValue[key.split("icon_")[1]] = valueMappings[value][key];
|
|
2246
|
+
}
|
|
2247
|
+
else {
|
|
2248
|
+
newValue[key] = valueMappings[value][key];
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
// remove v1.x "0" annotations as they equated to "nothing" ---
|
|
2252
|
+
if (!annotation || value !== "0") {
|
|
2253
|
+
retVal.push({
|
|
2254
|
+
value: value,
|
|
2255
|
+
newValue: newValue
|
|
2256
|
+
});
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
return retVal;
|
|
2261
|
+
};
|
|
2262
|
+
DDLUpgrade.prototype.readGraphMappings = function (viz) {
|
|
2263
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
2264
|
+
mappings.transformations.push({
|
|
2265
|
+
fieldID: "uid",
|
|
2266
|
+
type: "=",
|
|
2267
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.uid)
|
|
2268
|
+
});
|
|
2269
|
+
mappings.transformations.push({
|
|
2270
|
+
fieldID: "label",
|
|
2271
|
+
type: "=",
|
|
2272
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
2273
|
+
});
|
|
2274
|
+
if (viz.icon.fieldid) {
|
|
2275
|
+
mappings.transformations.push({
|
|
2276
|
+
fieldID: "icon",
|
|
2277
|
+
type: "map",
|
|
2278
|
+
sourceFieldID: this.toLowerCase(viz.icon.fieldid),
|
|
2279
|
+
default: { fachar: faCharFix(viz.icon.faChar) },
|
|
2280
|
+
mappings: this.readGraphEnums(viz.icon.valuemappings)
|
|
2281
|
+
});
|
|
2282
|
+
}
|
|
2283
|
+
var idx = 0;
|
|
2284
|
+
if (viz.flag) {
|
|
2285
|
+
for (var _i = 0, _a = viz.flag; _i < _a.length; _i++) {
|
|
2286
|
+
var flag = _a[_i];
|
|
2287
|
+
if (flag.fieldid) {
|
|
2288
|
+
mappings.transformations.push({
|
|
2289
|
+
fieldID: "annotation_".concat(idx++),
|
|
2290
|
+
type: "map",
|
|
2291
|
+
sourceFieldID: this.toLowerCase(flag.fieldid),
|
|
2292
|
+
default: {},
|
|
2293
|
+
mappings: this.readGraphEnums(flag.valuemappings, true)
|
|
2294
|
+
});
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
mappings.transformations.push({
|
|
2299
|
+
fieldID: "links",
|
|
2300
|
+
type: "=",
|
|
2301
|
+
sourceFieldID: this.toLowerCase(viz.source.link.childfile),
|
|
2302
|
+
transformations: [{
|
|
2303
|
+
fieldID: "uid",
|
|
2304
|
+
type: "=",
|
|
2305
|
+
sourceFieldID: this.toLowerCase(viz.source.link.mappings.uid)
|
|
2306
|
+
}]
|
|
2307
|
+
});
|
|
2308
|
+
};
|
|
2309
|
+
DDLUpgrade.prototype.readSliderMappings = function (viz) {
|
|
2310
|
+
var mappings = this._ddl2DataviewActivities[viz.id].mappings;
|
|
2311
|
+
mappings.transformations.push({
|
|
2312
|
+
fieldID: "label",
|
|
2313
|
+
type: "=",
|
|
2314
|
+
sourceFieldID: this.toLowerCase(viz.source.mappings.label)
|
|
2315
|
+
});
|
|
2316
|
+
};
|
|
2317
|
+
DDLUpgrade.prototype.readFilters = function () {
|
|
2318
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
2319
|
+
var dash = _a[_i];
|
|
2320
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
2321
|
+
var viz = _c[_b];
|
|
2322
|
+
if (viz.events) {
|
|
2323
|
+
for (var eventID in viz.events) {
|
|
2324
|
+
var event_1 = viz.events[eventID];
|
|
2325
|
+
for (var _d = 0, _e = event_1.updates; _d < _e.length; _d++) {
|
|
2326
|
+
var update = _e[_d];
|
|
2327
|
+
var otherViz = this._ddl2Dataviews[update.visualization];
|
|
2328
|
+
var dsFilters = this.getDatasourceFilters(update.datasource, otherViz.id);
|
|
2329
|
+
if (update.mappings) {
|
|
2330
|
+
if (isRoxieServiceRef(otherViz.datasource)) {
|
|
2331
|
+
for (var key in update.mappings) {
|
|
2332
|
+
otherViz.datasource.request.push({
|
|
2333
|
+
source: viz.id,
|
|
2334
|
+
remoteFieldID: this.toLowerCase(key),
|
|
2335
|
+
localFieldID: this.toLowerCase(update.mappings[key])
|
|
2336
|
+
});
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
else {
|
|
2340
|
+
var condition = {
|
|
2341
|
+
viewID: viz.id,
|
|
2342
|
+
mappings: []
|
|
2343
|
+
};
|
|
2344
|
+
for (var key in update.mappings) {
|
|
2345
|
+
var mapping = update.mappings[key];
|
|
2346
|
+
var dsFilter = (mapping && dsFilters[mapping]) ? dsFilters[mapping].filter : undefined;
|
|
2347
|
+
if (!dsFilter) {
|
|
2348
|
+
console.warn("Select Mapping \"".concat(mapping, "\" in viz \"").concat(viz.id, "\" not found in filters for \"").concat(otherViz.id, "\""));
|
|
2349
|
+
}
|
|
2350
|
+
else {
|
|
2351
|
+
condition.mappings.push({
|
|
2352
|
+
remoteFieldID: this.toLowerCase(key),
|
|
2353
|
+
localFieldID: this.toLowerCase(update.mappings[key]),
|
|
2354
|
+
condition: this.rule2condition(dsFilter.rule),
|
|
2355
|
+
nullable: dsFilter.nullable
|
|
2356
|
+
});
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
this._ddl2DataviewActivities[otherViz.id].filters.conditions.push(condition);
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
};
|
|
2368
|
+
DDLUpgrade.prototype.rule2condition = function (_) {
|
|
2369
|
+
switch (_) {
|
|
2370
|
+
case "set":
|
|
2371
|
+
return "in";
|
|
2372
|
+
case "notequals":
|
|
2373
|
+
return "!=";
|
|
2374
|
+
}
|
|
2375
|
+
return _;
|
|
2376
|
+
};
|
|
2377
|
+
DDLUpgrade.prototype.readSort = function () {
|
|
2378
|
+
var _this = this;
|
|
2379
|
+
for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
|
|
2380
|
+
var dash = _a[_i];
|
|
2381
|
+
for (var _b = 0, _c = dash.visualizations; _b < _c.length; _b++) {
|
|
2382
|
+
var viz = _c[_b];
|
|
2383
|
+
if (viz.source) {
|
|
2384
|
+
if (viz.source.sort) {
|
|
2385
|
+
var vizSort = this._ddl2DataviewActivities[viz.id].sort;
|
|
2386
|
+
vizSort.conditions = viz.source.sort.map(function (s) {
|
|
2387
|
+
if (s.indexOf("-") === 0) {
|
|
2388
|
+
return {
|
|
2389
|
+
fieldID: _this.toLowerCase(s.substr(1)),
|
|
2390
|
+
descending: true
|
|
2391
|
+
};
|
|
2392
|
+
}
|
|
2393
|
+
return {
|
|
2394
|
+
fieldID: _this.toLowerCase(s),
|
|
2395
|
+
descending: false
|
|
2396
|
+
};
|
|
2397
|
+
});
|
|
2398
|
+
}
|
|
2399
|
+
if (viz.source.first) {
|
|
2400
|
+
var vizLimit = this._ddl2DataviewActivities[viz.id].limit;
|
|
2401
|
+
vizLimit.limit = +viz.source.first;
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
};
|
|
2407
|
+
DDLUpgrade.prototype.anyViz2view = function (viz) {
|
|
2408
|
+
var project = {
|
|
2409
|
+
type: "project",
|
|
2410
|
+
transformations: []
|
|
2411
|
+
};
|
|
2412
|
+
var filters = {
|
|
2413
|
+
type: "filter",
|
|
2414
|
+
conditions: []
|
|
2415
|
+
};
|
|
2416
|
+
var groupBy = {
|
|
2417
|
+
type: "groupby",
|
|
2418
|
+
groupByIDs: [],
|
|
2419
|
+
aggregates: []
|
|
2420
|
+
};
|
|
2421
|
+
var sort = {
|
|
2422
|
+
type: "sort",
|
|
2423
|
+
conditions: []
|
|
2424
|
+
};
|
|
2425
|
+
var limit = {
|
|
2426
|
+
type: "limit",
|
|
2427
|
+
limit: 0
|
|
2428
|
+
};
|
|
2429
|
+
var mappings = {
|
|
2430
|
+
type: "mappings",
|
|
2431
|
+
transformations: []
|
|
2432
|
+
};
|
|
2433
|
+
this._ddl2DataviewActivities[viz.id] = {
|
|
2434
|
+
project: project,
|
|
2435
|
+
filters: filters,
|
|
2436
|
+
sort: sort,
|
|
2437
|
+
groupBy: groupBy,
|
|
2438
|
+
limit: limit,
|
|
2439
|
+
mappings: mappings
|
|
2440
|
+
};
|
|
2441
|
+
var datasourceRef = this.isVizDatasourceRoxie(viz) ? {
|
|
2442
|
+
id: this._datasourceUpdates[viz.id].id,
|
|
2443
|
+
request: [],
|
|
2444
|
+
output: this._datasourceUpdates[viz.id].output
|
|
2445
|
+
} : {
|
|
2446
|
+
id: this._datasourceUpdates[viz.id].id,
|
|
2447
|
+
output: this._datasourceUpdates[viz.id].output
|
|
2448
|
+
};
|
|
2449
|
+
return {
|
|
2450
|
+
id: viz.id,
|
|
2451
|
+
datasource: datasourceRef,
|
|
2452
|
+
activities: [
|
|
2453
|
+
project,
|
|
2454
|
+
filters,
|
|
2455
|
+
sort,
|
|
2456
|
+
groupBy,
|
|
2457
|
+
limit
|
|
2458
|
+
],
|
|
2459
|
+
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 || {}) })
|
|
2460
|
+
};
|
|
2461
|
+
};
|
|
2462
|
+
DDLUpgrade.prototype.type2chartType = function (chartType) {
|
|
2463
|
+
switch (chartType) {
|
|
2464
|
+
case "LINE":
|
|
2465
|
+
return { chartType: "Line", __class: "chart_Line" };
|
|
2466
|
+
case "BUBBLE":
|
|
2467
|
+
return { chartType: "Bubble", __class: "chart_Bubble" };
|
|
2468
|
+
case "PIE":
|
|
2469
|
+
return { chartType: "Pie", __class: "chart_Pie" };
|
|
2470
|
+
case "BAR":
|
|
2471
|
+
return { chartType: "Column", __class: "chart_Column" };
|
|
2472
|
+
case "FORM":
|
|
2473
|
+
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
2474
|
+
case "WORD_CLOUD":
|
|
2475
|
+
return { chartType: "WordCloud", __class: "chart_WordCloud" };
|
|
2476
|
+
case "CHORO":
|
|
2477
|
+
return { chartType: "ChoroplethStates", __class: "map_ChoroplethStates" };
|
|
2478
|
+
case "SUMMARY":
|
|
2479
|
+
return { chartType: "Summary", __class: "chart_Summary" };
|
|
2480
|
+
case "SLIDER":
|
|
2481
|
+
return { chartType: "FieldForm", __class: "form_FieldForm" };
|
|
2482
|
+
case "HEAT_MAP":
|
|
2483
|
+
return { chartType: "HeatMap", __class: "other_HeatMap" };
|
|
2484
|
+
case "2DCHART":
|
|
2485
|
+
return { chartType: "Column", __class: "chart_Column" };
|
|
2486
|
+
case "GRAPH":
|
|
2487
|
+
return { chartType: "AdjacencyGraph", __class: "graph_AdjacencyGraph" };
|
|
2488
|
+
case "TABLE":
|
|
2489
|
+
default:
|
|
2490
|
+
return { chartType: "Table", __class: "dgrid_Table" };
|
|
2491
|
+
}
|
|
2492
|
+
};
|
|
2493
|
+
DDLUpgrade.prototype.formFields2field = function (fields, slider) {
|
|
2494
|
+
var _this = this;
|
|
2495
|
+
if (slider === void 0) { slider = false; }
|
|
2496
|
+
if (!fields)
|
|
2497
|
+
return [];
|
|
2498
|
+
return fields.map(function (field) {
|
|
2499
|
+
switch (field.properties.type) {
|
|
2500
|
+
case "range":
|
|
2501
|
+
return {
|
|
2502
|
+
type: "range",
|
|
2503
|
+
id: field.id,
|
|
2504
|
+
default: (field.properties.default ? field.properties.default : undefined)
|
|
2505
|
+
};
|
|
2506
|
+
case "dataset":
|
|
2507
|
+
return {
|
|
2508
|
+
type: "dataset",
|
|
2509
|
+
id: field.id,
|
|
2510
|
+
default: [],
|
|
2511
|
+
children: []
|
|
2512
|
+
};
|
|
2513
|
+
default:
|
|
2514
|
+
return {
|
|
2515
|
+
type: _this.formFieldType2fieldType(field.properties.datatype, slider),
|
|
2516
|
+
id: field.id,
|
|
2517
|
+
default: field.properties.default ? field.properties.default[0] : undefined
|
|
2518
|
+
};
|
|
2519
|
+
}
|
|
2520
|
+
});
|
|
2521
|
+
};
|
|
2522
|
+
DDLUpgrade.prototype.formFieldType2fieldType = function (fieldType, slider) {
|
|
2523
|
+
switch (fieldType) {
|
|
2524
|
+
case "bool":
|
|
2525
|
+
case "boolean":
|
|
2526
|
+
return "boolean";
|
|
2527
|
+
case "integer":
|
|
2528
|
+
case "unsigned":
|
|
2529
|
+
case "float":
|
|
2530
|
+
case "double":
|
|
2531
|
+
case "real":
|
|
2532
|
+
return "number";
|
|
2533
|
+
case "string":
|
|
2534
|
+
return "string";
|
|
2535
|
+
default:
|
|
2536
|
+
return slider ? "number" : "string";
|
|
2537
|
+
}
|
|
2538
|
+
};
|
|
2539
|
+
DDLUpgrade.prototype.output2output = function (output, target) {
|
|
2540
|
+
target[output.from || output.id] = {
|
|
2541
|
+
fields: this.filters2fields(output.filter)
|
|
2542
|
+
};
|
|
2543
|
+
};
|
|
2544
|
+
DDLUpgrade.prototype.filters2fields = function (filters) {
|
|
2545
|
+
if (!filters)
|
|
2546
|
+
return [];
|
|
2547
|
+
return filters.filter(function (filter) {
|
|
2548
|
+
var idParts = filter.fieldid.split("-");
|
|
2549
|
+
return idParts.length === 1 || idParts[1] === "range";
|
|
2550
|
+
}).map(function (filter) {
|
|
2551
|
+
var idParts = filter.fieldid.split("-");
|
|
2552
|
+
var retVal = {
|
|
2553
|
+
type: "string",
|
|
2554
|
+
id: idParts[0]
|
|
2555
|
+
};
|
|
2556
|
+
return retVal;
|
|
2557
|
+
});
|
|
2558
|
+
};
|
|
2559
|
+
DDLUpgrade.prototype.getVizField = function (vizID, fieldID) {
|
|
2560
|
+
return {
|
|
2561
|
+
type: "string",
|
|
2562
|
+
id: "",
|
|
2563
|
+
default: ""
|
|
2564
|
+
};
|
|
2565
|
+
};
|
|
2566
|
+
DDLUpgrade.prototype.writeDatasources = function () {
|
|
2567
|
+
var retVal = [];
|
|
2568
|
+
for (var id in this._ddl2Datasources) {
|
|
2569
|
+
retVal.push(this._ddl2Datasources[id]);
|
|
2570
|
+
}
|
|
2571
|
+
return retVal;
|
|
2572
|
+
};
|
|
2573
|
+
DDLUpgrade.prototype.writeDataviews = function () {
|
|
2574
|
+
var retVal = [];
|
|
2575
|
+
for (var id in this._ddl2Dataviews) {
|
|
2576
|
+
retVal.push(this._ddl2Dataviews[id]);
|
|
2577
|
+
}
|
|
2578
|
+
return retVal;
|
|
2579
|
+
};
|
|
2580
|
+
DDLUpgrade.prototype.writeProperties = function () {
|
|
2581
|
+
return {
|
|
2582
|
+
// TODO
|
|
2583
|
+
};
|
|
2584
|
+
};
|
|
2585
|
+
DDLUpgrade.prototype.write = function () {
|
|
2586
|
+
return {
|
|
2587
|
+
version: "2.2.1",
|
|
2588
|
+
createdBy: {
|
|
2589
|
+
name: PKG_NAME,
|
|
2590
|
+
version: PKG_VERSION
|
|
2591
|
+
},
|
|
2592
|
+
datasources: this.writeDatasources(),
|
|
2593
|
+
dataviews: this.writeDataviews(),
|
|
2594
|
+
properties: this.writeProperties()
|
|
2595
|
+
};
|
|
2596
|
+
};
|
|
2597
|
+
return DDLUpgrade;
|
|
2598
|
+
}());
|
|
2599
|
+
function upgrade(ddl, baseUrl, wuid, toLowerCase, dermatologyJson) {
|
|
2600
|
+
if (toLowerCase === void 0) { toLowerCase = true; }
|
|
2601
|
+
if (dermatologyJson === void 0) { dermatologyJson = {}; }
|
|
2602
|
+
var ddlUp = new DDLUpgrade(ddl, baseUrl, wuid, toLowerCase);
|
|
2603
|
+
var retVal = ddlUp.write();
|
|
2604
|
+
retVal.properties = upgrade$1(retVal, dermatologyJson);
|
|
2605
|
+
return retVal;
|
|
2661
2606
|
}
|
|
2662
2607
|
|
|
2663
|
-
var args = process.argv.slice(2);
|
|
2664
|
-
switch (args[0]) {
|
|
2665
|
-
case "--echo":
|
|
2666
|
-
process.stdout.write(args[1]);
|
|
2667
|
-
break;
|
|
2668
|
-
case "--schema":
|
|
2669
|
-
process.stdout.write(JSON.stringify(ddl2Schema));
|
|
2670
|
-
break;
|
|
2671
|
-
case "--upgrade":
|
|
2672
|
-
case "--upgradeNoLower":
|
|
2673
|
-
var srcPath = args[1];
|
|
2674
|
-
var destPath_1 = args[2];
|
|
2675
|
-
var baseUrl_1 = args[3];
|
|
2676
|
-
var wuid_1 = args[4];
|
|
2677
|
-
var layoutPath = args[5];
|
|
2678
|
-
if (srcPath && destPath_1 && srcPath !== destPath_1) {
|
|
2679
|
-
var layoutJson_1 = {};
|
|
2680
|
-
if (layoutPath) {
|
|
2681
|
-
try {
|
|
2682
|
-
layoutJson_1 = JSON.parse(
|
|
2683
|
-
}
|
|
2684
|
-
catch (e) {
|
|
2685
|
-
console.error(e);
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2688
|
-
|
|
2689
|
-
if (err)
|
|
2690
|
-
throw err;
|
|
2691
|
-
var ddl2 = upgrade
|
|
2692
|
-
|
|
2693
|
-
if (err)
|
|
2694
|
-
throw err;
|
|
2695
|
-
console.log("complete");
|
|
2696
|
-
});
|
|
2697
|
-
});
|
|
2698
|
-
}
|
|
2699
|
-
break;
|
|
2700
|
-
case "--help":
|
|
2701
|
-
break;
|
|
2702
|
-
default:
|
|
2703
|
-
process.stdout.write("\nUsage: <command>\n\nwhere <command> is one of:\n --schema: output DDL2 schmea.\n --upgrade ddl1 [baseUrl wuid [layout]]: updgrade ddl and layout version 1 to ddl version 2.\n --upgradeNoLower ddl1 [baseUrl wuid [layout]]: updgrade ddl and layout version 1 to ddl version 2 without changing field IDs upper/lower casing.\n --help: this message.\n");
|
|
2608
|
+
var args = process.argv.slice(2);
|
|
2609
|
+
switch (args[0]) {
|
|
2610
|
+
case "--echo":
|
|
2611
|
+
process.stdout.write(args[1]);
|
|
2612
|
+
break;
|
|
2613
|
+
case "--schema":
|
|
2614
|
+
process.stdout.write(JSON.stringify(ddl2Schema));
|
|
2615
|
+
break;
|
|
2616
|
+
case "--upgrade":
|
|
2617
|
+
case "--upgradeNoLower":
|
|
2618
|
+
var srcPath = args[1];
|
|
2619
|
+
var destPath_1 = args[2];
|
|
2620
|
+
var baseUrl_1 = args[3];
|
|
2621
|
+
var wuid_1 = args[4];
|
|
2622
|
+
var layoutPath = args[5];
|
|
2623
|
+
if (srcPath && destPath_1 && srcPath !== destPath_1) {
|
|
2624
|
+
var layoutJson_1 = {};
|
|
2625
|
+
if (layoutPath) {
|
|
2626
|
+
try {
|
|
2627
|
+
layoutJson_1 = JSON.parse(fs__namespace.readFileSync(layoutPath).toString());
|
|
2628
|
+
}
|
|
2629
|
+
catch (e) {
|
|
2630
|
+
console.error(e);
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
fs__namespace.readFile(srcPath, "utf8", function (err, data) {
|
|
2634
|
+
if (err)
|
|
2635
|
+
throw err;
|
|
2636
|
+
var ddl2 = upgrade(JSON.parse(data), baseUrl_1 || "http://localhost:8010", wuid_1 || "WUID", args[0] === "--upgrade", layoutJson_1);
|
|
2637
|
+
fs__namespace.writeFile(destPath_1, JSON.stringify(ddl2), function (err) {
|
|
2638
|
+
if (err)
|
|
2639
|
+
throw err;
|
|
2640
|
+
console.log("complete");
|
|
2641
|
+
});
|
|
2642
|
+
});
|
|
2643
|
+
}
|
|
2644
|
+
break;
|
|
2645
|
+
case "--help":
|
|
2646
|
+
break;
|
|
2647
|
+
default:
|
|
2648
|
+
process.stdout.write("\nUsage: <command>\n\nwhere <command> is one of:\n --schema: output DDL2 schmea.\n --upgrade ddl1 [baseUrl wuid [layout]]: updgrade ddl and layout version 1 to ddl version 2.\n --upgradeNoLower ddl1 [baseUrl wuid [layout]]: updgrade ddl and layout version 1 to ddl version 2 without changing field IDs upper/lower casing.\n --help: this message.\n");
|
|
2704
2649
|
}
|
|
2705
2650
|
//# sourceMappingURL=cli.js.map
|