@hestia-earth/schema-convert 7.9.0 → 8.0.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 -4
  2. package/package.json +1 -1
package/json.js CHANGED
@@ -261,7 +261,8 @@ var propertyTypeToValue = {
261
261
  var schemaType = schema_1.refToSchemaType($ref);
262
262
  var schema = schemaType ? schemas[schemaType] : undefined;
263
263
  var data = schema ? mapContent(schemas, schema, _i)(schemaRefValue(value, schemaType)) : safeParseJSON(value);
264
- return utils_1.isEmpty(data) ? {} : (schema ? extendDataFromSchema(data, schema, schemaType, _i) : data);
264
+ var includeDefaults = [schema_1.SchemaType.Actor].includes(schemaType); // only nested node allowed
265
+ return utils_1.isEmpty(data) ? {} : (schema ? extendDataFromSchema(data, schema, schemaType, _i, includeDefaults) : data);
265
266
  }
266
267
  };
267
268
  var getPropertyDefinition = function (schema, key, ignoreErrors, value) {
@@ -305,11 +306,11 @@ var nodeType = function (id, type, existingNode) {
305
306
  if (existingNode === void 0) { existingNode = false; }
306
307
  return type ? (schema_1.isTypeNode(type) ? (existingNode ? { '@type': type } : { id: id, type: type }) : { type: type }) : {};
307
308
  };
308
- var extendDataFromSchema = function (_a, schema, type, ignoreInternal, top) {
309
+ var extendDataFromSchema = function (_a, schema, type, ignoreInternal, addDefaults) {
309
310
  if (ignoreInternal === void 0) { ignoreInternal = false; }
310
- if (top === void 0) { top = false; }
311
+ if (addDefaults === void 0) { addDefaults = false; }
311
312
  var id = _a.id, _t = _a.type, data = __rest(_a, ["id", "type"]);
312
- return utils_1.reduceUndefinedValues(__assign(__assign(__assign({}, filterProperties(data, ignoreInternal ? [] : internalProperties(schema))), (top && schema ?
313
+ return utils_1.reduceUndefinedValues(__assign(__assign(__assign({}, filterProperties(data, ignoreInternal ? [] : internalProperties(schema))), (addDefaults && !('@id' in data) && schema ?
313
314
  getDefaultProperties(schema, data, ignoreInternal).reduce(function (prev, _a) {
314
315
  var _b;
315
316
  var property = _a.property, defaultValue = _a.defaultValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/schema-convert",
3
- "version": "7.9.0",
3
+ "version": "8.0.0",
4
4
  "description": "Hestia Schema Converters",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",