@hestia-earth/schema-convert 23.3.0 → 23.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.
Files changed (3) hide show
  1. package/json.d.ts +2 -1
  2. package/json.js +3 -2
  3. package/package.json +1 -1
package/json.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { SchemaType } from '@hestia-earth/schema';
1
+ import { NodeType, SchemaType } from '@hestia-earth/schema';
2
2
  import { definitions } from '@hestia-earth/json-schema/types';
3
+ export declare const acceptedNodeTypes: NodeType[];
3
4
  export interface INode {
4
5
  type: SchemaType;
5
6
  id?: string;
package/json.js CHANGED
@@ -84,7 +84,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
84
84
  };
85
85
  var _a, _b;
86
86
  Object.defineProperty(exports, "__esModule", { value: true });
87
- exports.toJson = exports.filterEmptyNode = exports.formatNode = exports.cleanStringValue = exports.throwCSVError = void 0;
87
+ exports.toJson = exports.filterEmptyNode = exports.formatNode = exports.cleanStringValue = exports.throwCSVError = exports.acceptedNodeTypes = void 0;
88
88
  var csvtojson = require("csvtojson");
89
89
  var levenshtein = require("fast-levenshtein");
90
90
  var wkt_1 = require("@terraformer/wkt");
@@ -92,6 +92,7 @@ var schema_1 = require("@hestia-earth/schema");
92
92
  var types_1 = require("@hestia-earth/json-schema/types");
93
93
  var utils_1 = require("./utils");
94
94
  var default_values_1 = require("./default-values");
95
+ exports.acceptedNodeTypes = Object.values(schema_1.NodeType).filter(function (val) { return val !== schema_1.NodeType.Term; });
95
96
  var IGNORE_FIELD_KEY = '-';
96
97
  var VALUE_TYPE_KEY = 'valueType';
97
98
  var DEFAULT_ARRAY_DELIMITER = ';';
@@ -502,7 +503,7 @@ var mapContent = function (schemas, schema, ignoreInternal) { return function (j
502
503
  }; };
503
504
  var formatNode = function (schemas, type, data, ignoreInternal, top) {
504
505
  if (top === void 0) { top = false; }
505
- var schema = type in schemas ? schemas[type] : schemaNotFoundError(type);
506
+ var schema = type in schemas && exports.acceptedNodeTypes.includes(type) ? schemas[type] : schemaNotFoundError(type);
506
507
  var content = mapContent(schemas, schema, ignoreInternal)(data);
507
508
  return (0, utils_1.reduceUndefinedValues)(__assign({ id: isEmptyCell(data.id) ? undefined : data.id }, extendDataFromSchema(content, schema, type, ignoreInternal, top)), true);
508
509
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/schema-convert",
3
- "version": "23.3.0",
3
+ "version": "23.4.0",
4
4
  "description": "Hestia Schema Converters",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",