@hpcc-js/ddl-shim 2.17.25 → 2.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- "enum": [
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
- type: [
1371
- "number",
1372
- "string"
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
- "enum": [
1631
- "2.2.1"
1632
- ],
1577
+ "const": "2.2.1",
1633
1578
  type: "string"
1634
1579
  }
1635
1580
  },
@@ -1696,11 +1641,11 @@ 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
1647
  var PKG_NAME = "@hpcc-js/ddl-shim";
1703
- var PKG_VERSION = "2.17.25";
1648
+ var PKG_VERSION = "2.19.1";
1704
1649
 
1705
1650
  function isWorkunitDatasource(ref) {
1706
1651
  return ref.WUID !== undefined;
@@ -1950,7 +1895,7 @@ function apply_to_properties_layout(ddl2, dermObj) {
1950
1895
  });
1951
1896
  return retVal;
1952
1897
  }
1953
- function upgrade(ddl2, dermObj) {
1898
+ function upgrade$1(ddl2, dermObj) {
1954
1899
  apply_to_dataviews(ddl2, dermObj);
1955
1900
  return apply_to_properties_layout(ddl2, dermObj);
1956
1901
  }
@@ -2170,7 +2115,7 @@ var DDLUpgrade = /** @class */ (function () {
2170
2115
  break;
2171
2116
  default:
2172
2117
  groupByColumns.push(this.toLowerCase(field.id));
2173
- throw new Error("Unhandled field function: " + field.properties.function);
2118
+ throw new Error("Unhandled field function: ".concat(field.properties.function));
2174
2119
  }
2175
2120
  }
2176
2121
  else {
@@ -2181,7 +2126,7 @@ var DDLUpgrade = /** @class */ (function () {
2181
2126
  this._ddl2DataviewActivities[viz.id].project.transformations = projectTransformations;
2182
2127
  }
2183
2128
  if (aggrFields.length) {
2184
- this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns);
2129
+ this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns, true);
2185
2130
  this._ddl2DataviewActivities[viz.id].groupBy.aggregates = aggrFields;
2186
2131
  }
2187
2132
  }
@@ -2199,7 +2144,7 @@ var DDLUpgrade = /** @class */ (function () {
2199
2144
  case "MAX":
2200
2145
  return "max";
2201
2146
  }
2202
- throw new Error("Unknown DDL1 Function Type: " + func);
2147
+ throw new Error("Unknown DDL1 Function Type: ".concat(func));
2203
2148
  };
2204
2149
  DDLUpgrade.prototype.readMappings = function () {
2205
2150
  for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
@@ -2226,7 +2171,7 @@ var DDLUpgrade = /** @class */ (function () {
2226
2171
  this.readSliderMappings(viz);
2227
2172
  }
2228
2173
  else {
2229
- throw new Error("Unkown DDL1 mapping type: " + viz.type);
2174
+ throw new Error("Unkown DDL1 mapping type: ".concat(viz.type));
2230
2175
  }
2231
2176
  }
2232
2177
  }
@@ -2296,7 +2241,7 @@ var DDLUpgrade = /** @class */ (function () {
2296
2241
  newValue[key] = faCharFix(valueMappings[value][key]);
2297
2242
  }
2298
2243
  else if (annotation && key.indexOf("icon_") === 0) {
2299
- console.log("Deprecated flag property: " + key);
2244
+ console.warn("Deprecated flag property: " + key);
2300
2245
  newValue[key.split("icon_")[1]] = valueMappings[value][key];
2301
2246
  }
2302
2247
  else {
@@ -2341,7 +2286,7 @@ var DDLUpgrade = /** @class */ (function () {
2341
2286
  var flag = _a[_i];
2342
2287
  if (flag.fieldid) {
2343
2288
  mappings.transformations.push({
2344
- fieldID: "annotation_" + idx++,
2289
+ fieldID: "annotation_".concat(idx++),
2345
2290
  type: "map",
2346
2291
  sourceFieldID: this.toLowerCase(flag.fieldid),
2347
2292
  default: {},
@@ -2400,7 +2345,7 @@ var DDLUpgrade = /** @class */ (function () {
2400
2345
  var mapping = update.mappings[key];
2401
2346
  var dsFilter = (mapping && dsFilters[mapping]) ? dsFilters[mapping].filter : undefined;
2402
2347
  if (!dsFilter) {
2403
- console.warn("Select Mapping \"" + mapping + "\" in viz \"" + viz.id + "\" not found in filters for \"" + otherViz.id + "\"");
2348
+ console.warn("Select Mapping \"".concat(mapping, "\" in viz \"").concat(viz.id, "\" not found in filters for \"").concat(otherViz.id, "\""));
2404
2349
  }
2405
2350
  else {
2406
2351
  condition.mappings.push({
@@ -2651,12 +2596,12 @@ var DDLUpgrade = /** @class */ (function () {
2651
2596
  };
2652
2597
  return DDLUpgrade;
2653
2598
  }());
2654
- function upgrade$1(ddl, baseUrl, wuid, toLowerCase, dermatologyJson) {
2599
+ function upgrade(ddl, baseUrl, wuid, toLowerCase, dermatologyJson) {
2655
2600
  if (toLowerCase === void 0) { toLowerCase = true; }
2656
2601
  if (dermatologyJson === void 0) { dermatologyJson = {}; }
2657
2602
  var ddlUp = new DDLUpgrade(ddl, baseUrl, wuid, toLowerCase);
2658
2603
  var retVal = ddlUp.write();
2659
- retVal.properties = upgrade(retVal, dermatologyJson);
2604
+ retVal.properties = upgrade$1(retVal, dermatologyJson);
2660
2605
  return retVal;
2661
2606
  }
2662
2607
 
@@ -2679,20 +2624,20 @@ switch (args[0]) {
2679
2624
  var layoutJson_1 = {};
2680
2625
  if (layoutPath) {
2681
2626
  try {
2682
- layoutJson_1 = JSON.parse(fs.readFileSync(layoutPath).toString());
2627
+ layoutJson_1 = JSON.parse(fs__namespace.readFileSync(layoutPath).toString());
2683
2628
  }
2684
2629
  catch (e) {
2685
2630
  console.error(e);
2686
2631
  }
2687
2632
  }
2688
- fs.readFile(srcPath, "utf8", function (err, data) {
2633
+ fs__namespace.readFile(srcPath, "utf8", function (err, data) {
2689
2634
  if (err)
2690
2635
  throw err;
2691
- var ddl2 = upgrade$1(JSON.parse(data), baseUrl_1 || "http://localhost:8010", wuid_1 || "WUID", args[0] === "--upgrade", layoutJson_1);
2692
- fs.writeFile(destPath_1, JSON.stringify(ddl2), function (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) {
2693
2638
  if (err)
2694
2639
  throw err;
2695
- console.log("complete");
2640
+ console.info("complete");
2696
2641
  });
2697
2642
  });
2698
2643
  }