@hestia-earth/schema-convert 21.3.0 → 21.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/default-values.js CHANGED
@@ -36,7 +36,7 @@ var defaultName = function (product, country, region, endDate, treatment, descri
36
36
  (product === null || product === void 0 ? void 0 : product.name) || 'No Product',
37
37
  (0, exports.siteLocationName)(region, country),
38
38
  endDate,
39
- treatment,
39
+ (0, utils_1.ellipsis)(treatment, 20),
40
40
  (0, utils_1.ellipsis)(description, 30)
41
41
  ].filter(Boolean).join(' - ');
42
42
  };
package/json.js CHANGED
@@ -455,6 +455,15 @@ var extendDataFromSchema = function (_a, schema, type, ignoreInternal, addDefaul
455
455
  }, {}) :
456
456
  {})), nodeType(id, type, '@id' in data)), true);
457
457
  };
458
+ var validateArrayType = function (schema, def, key, value) {
459
+ return typeof value !== 'object' || def.type !== 'array' || Array.isArray(value) || (0, exports.throwCSVError)({
460
+ schema: schema.title,
461
+ message: 'object-array-invalid',
462
+ schemaKey: key,
463
+ key: key,
464
+ value: value
465
+ });
466
+ };
458
467
  var mapContent = function (schemas, schema, ignoreInternal) { return function (json) {
459
468
  return Object.keys(json)
460
469
  .filter(nonEmptyCell)
@@ -464,6 +473,8 @@ var mapContent = function (schemas, schema, ignoreInternal) { return function (j
464
473
  var propertyDefinition = getPropertyDefinition(schema, key, false, json);
465
474
  var valueType = getValueType(schema, json);
466
475
  var type = getPropertyType(propertyDefinition, key, valueType);
476
+ // console.log(key, propertyDefinition, valueType, type, typeof value);
477
+ validateArrayType(schema, propertyDefinition, key, value);
467
478
  var newValue = key === VALUE_TYPE_KEY ? '' : propertyInvalidFormat(schema, key, value, function () {
468
479
  return Array.isArray(type) ? value : propertyTypeToValue[type](value, schemas, propertyDefinition, ignoreInternal);
469
480
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/schema-convert",
3
- "version": "21.3.0",
3
+ "version": "21.4.0",
4
4
  "description": "Hestia Schema Converters",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",