@hestia-earth/schema-convert 7.7.1 → 7.8.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 (2) hide show
  1. package/json.js +5 -2
  2. package/package.json +1 -1
package/json.js CHANGED
@@ -194,10 +194,13 @@ var handleArrayError = function (func) { return function (value, index) {
194
194
  }; };
195
195
  /**
196
196
  * If the user provided a non-object where an object was expected, assume it was meant to be the `name` property.
197
+ * For non-Terms, we assume it is the `id`.
197
198
  *
198
199
  * @param value The value mapped as a Ref
199
200
  */
200
- var schemaRefValue = function (value) { return typeof value === 'object' ? value : ({ name: value }); };
201
+ var schemaRefValue = function (value, schemaType) {
202
+ return typeof value === 'object' ? value : schemaType === schema_1.SchemaType.Term ? { name: value } : { id: value };
203
+ };
201
204
  exports.cleanStringValue = function (value) { return (value.match(/^[\d]+\.[\d]+\.[\d]+$/) === null ? value.replace(/\.0$/, '') : value).trim(); };
202
205
  var propertyTypeToValue = {
203
206
  null: function (value) {
@@ -248,7 +251,7 @@ var propertyTypeToValue = {
248
251
  var $ref = _a.$ref;
249
252
  var schemaType = schema_1.refToSchemaType($ref);
250
253
  var schema = schemaType ? schemas[schemaType] : undefined;
251
- var data = schema ? mapContent(schemas, schema, _i)(schemaRefValue(value)) : safeParseJSON(value);
254
+ var data = schema ? mapContent(schemas, schema, _i)(schemaRefValue(value, schemaType)) : safeParseJSON(value);
252
255
  return utils_1.isEmpty(data) ? {} : (schema ? extendDataFromSchema(data, schema, schemaType, _i) : data);
253
256
  }
254
257
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/schema-convert",
3
- "version": "7.7.1",
3
+ "version": "7.8.0",
4
4
  "description": "Hestia Schema Converters",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",