@hpcc-js/ddl-shim 2.17.20 → 2.17.21

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 = {
@@ -1696,11 +1716,11 @@ function __spreadArray(to, from, pack) {
1696
1716
  ar[i] = from[i];
1697
1717
  }
1698
1718
  }
1699
- return to.concat(ar || from);
1719
+ return to.concat(ar || Array.prototype.slice.call(from));
1700
1720
  }
1701
1721
 
1702
1722
  var PKG_NAME = "@hpcc-js/ddl-shim";
1703
- var PKG_VERSION = "2.17.20";
1723
+ var PKG_VERSION = "2.17.21";
1704
1724
 
1705
1725
  function isWorkunitDatasource(ref) {
1706
1726
  return ref.WUID !== undefined;
@@ -1950,7 +1970,7 @@ function apply_to_properties_layout(ddl2, dermObj) {
1950
1970
  });
1951
1971
  return retVal;
1952
1972
  }
1953
- function upgrade(ddl2, dermObj) {
1973
+ function upgrade$1(ddl2, dermObj) {
1954
1974
  apply_to_dataviews(ddl2, dermObj);
1955
1975
  return apply_to_properties_layout(ddl2, dermObj);
1956
1976
  }
@@ -2170,7 +2190,7 @@ var DDLUpgrade = /** @class */ (function () {
2170
2190
  break;
2171
2191
  default:
2172
2192
  groupByColumns.push(this.toLowerCase(field.id));
2173
- throw new Error("Unhandled field function: " + field.properties.function);
2193
+ throw new Error("Unhandled field function: ".concat(field.properties.function));
2174
2194
  }
2175
2195
  }
2176
2196
  else {
@@ -2181,7 +2201,7 @@ var DDLUpgrade = /** @class */ (function () {
2181
2201
  this._ddl2DataviewActivities[viz.id].project.transformations = projectTransformations;
2182
2202
  }
2183
2203
  if (aggrFields.length) {
2184
- this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns);
2204
+ this._ddl2DataviewActivities[viz.id].groupBy.groupByIDs = __spreadArray([], groupByColumns, true);
2185
2205
  this._ddl2DataviewActivities[viz.id].groupBy.aggregates = aggrFields;
2186
2206
  }
2187
2207
  }
@@ -2199,7 +2219,7 @@ var DDLUpgrade = /** @class */ (function () {
2199
2219
  case "MAX":
2200
2220
  return "max";
2201
2221
  }
2202
- throw new Error("Unknown DDL1 Function Type: " + func);
2222
+ throw new Error("Unknown DDL1 Function Type: ".concat(func));
2203
2223
  };
2204
2224
  DDLUpgrade.prototype.readMappings = function () {
2205
2225
  for (var _i = 0, _a = this._ddl.dashboards; _i < _a.length; _i++) {
@@ -2226,7 +2246,7 @@ var DDLUpgrade = /** @class */ (function () {
2226
2246
  this.readSliderMappings(viz);
2227
2247
  }
2228
2248
  else {
2229
- throw new Error("Unkown DDL1 mapping type: " + viz.type);
2249
+ throw new Error("Unkown DDL1 mapping type: ".concat(viz.type));
2230
2250
  }
2231
2251
  }
2232
2252
  }
@@ -2341,7 +2361,7 @@ var DDLUpgrade = /** @class */ (function () {
2341
2361
  var flag = _a[_i];
2342
2362
  if (flag.fieldid) {
2343
2363
  mappings.transformations.push({
2344
- fieldID: "annotation_" + idx++,
2364
+ fieldID: "annotation_".concat(idx++),
2345
2365
  type: "map",
2346
2366
  sourceFieldID: this.toLowerCase(flag.fieldid),
2347
2367
  default: {},
@@ -2400,7 +2420,7 @@ var DDLUpgrade = /** @class */ (function () {
2400
2420
  var mapping = update.mappings[key];
2401
2421
  var dsFilter = (mapping && dsFilters[mapping]) ? dsFilters[mapping].filter : undefined;
2402
2422
  if (!dsFilter) {
2403
- console.warn("Select Mapping \"" + mapping + "\" in viz \"" + viz.id + "\" not found in filters for \"" + otherViz.id + "\"");
2423
+ console.warn("Select Mapping \"".concat(mapping, "\" in viz \"").concat(viz.id, "\" not found in filters for \"").concat(otherViz.id, "\""));
2404
2424
  }
2405
2425
  else {
2406
2426
  condition.mappings.push({
@@ -2651,12 +2671,12 @@ var DDLUpgrade = /** @class */ (function () {
2651
2671
  };
2652
2672
  return DDLUpgrade;
2653
2673
  }());
2654
- function upgrade$1(ddl, baseUrl, wuid, toLowerCase, dermatologyJson) {
2674
+ function upgrade(ddl, baseUrl, wuid, toLowerCase, dermatologyJson) {
2655
2675
  if (toLowerCase === void 0) { toLowerCase = true; }
2656
2676
  if (dermatologyJson === void 0) { dermatologyJson = {}; }
2657
2677
  var ddlUp = new DDLUpgrade(ddl, baseUrl, wuid, toLowerCase);
2658
2678
  var retVal = ddlUp.write();
2659
- retVal.properties = upgrade(retVal, dermatologyJson);
2679
+ retVal.properties = upgrade$1(retVal, dermatologyJson);
2660
2680
  return retVal;
2661
2681
  }
2662
2682
 
@@ -2679,17 +2699,17 @@ switch (args[0]) {
2679
2699
  var layoutJson_1 = {};
2680
2700
  if (layoutPath) {
2681
2701
  try {
2682
- layoutJson_1 = JSON.parse(fs.readFileSync(layoutPath).toString());
2702
+ layoutJson_1 = JSON.parse(fs__namespace.readFileSync(layoutPath).toString());
2683
2703
  }
2684
2704
  catch (e) {
2685
2705
  console.error(e);
2686
2706
  }
2687
2707
  }
2688
- fs.readFile(srcPath, "utf8", function (err, data) {
2708
+ fs__namespace.readFile(srcPath, "utf8", function (err, data) {
2689
2709
  if (err)
2690
2710
  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) {
2711
+ var ddl2 = upgrade(JSON.parse(data), baseUrl_1 || "http://localhost:8010", wuid_1 || "WUID", args[0] === "--upgrade", layoutJson_1);
2712
+ fs__namespace.writeFile(destPath_1, JSON.stringify(ddl2), function (err) {
2693
2713
  if (err)
2694
2714
  throw err;
2695
2715
  console.log("complete");