Comparing version 1.1.11 to 1.1.12
@@ -6,3 +6,2 @@ import { IJsonPropertiesMapper, TJsonaModel, TJsonaRelationships, TJsonApiBody, TJsonApiData, IJsonaModelBuilder } from '../JsonaTypes'; | ||
protected includedInObject: any; | ||
protected dataInObject: any; | ||
protected cachedModels: {}; | ||
@@ -9,0 +8,0 @@ constructor(propertiesMapper: any); |
@@ -43,4 +43,7 @@ "use strict"; | ||
var model; | ||
if (entityKey && Object.keys(data).length === 2) { | ||
var onlyTypeIdInData = Object.keys(data).length === 2 && data.type && data.id; | ||
if (entityKey && onlyTypeIdInData) { | ||
// checks for built model in cachedModels is a protection from creating models on recursive relationships | ||
// NOTE: onlyTypeIdInData need for prevent return empty, cached model (for collections with recursive relations) | ||
// https://github.com/olosegres/jsona/issues/17 | ||
model = this.cachedModels[entityKey]; | ||
@@ -47,0 +50,0 @@ if (model) { |
{ | ||
"name": "jsona", | ||
"description": "Provide data formatters (data model builder & json builder) to work with JSON API specification v1.0 in your JavaScript / TypeScript code", | ||
"version": "1.1.11", | ||
"version": "1.1.12", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "json-api", |
@@ -6,3 +6,3 @@ # Jsona | ||
[![Build Status](https://travis-ci.org/olosegres/jsona.svg?branch=master)](https://travis-ci.org/olosegres/jsona) | ||
[![dependencies](https://img.shields.io/gemnasium/mathiasbynens/he.svg)](https://www.npmjs.com/package/jsona/) | ||
[![dependencies](https://camo.githubusercontent.com/cdc54d1641f5e11e246a2707063ecad092c96d11/68747470733a2f2f64617669642d646d2e6f72672f6477796c2f657374612e737667)](https://www.npmjs.com/package/jsona/) | ||
[![downloads](https://img.shields.io/npm/dm/jsona.svg)](https://www.npmjs.com/package/jsona/) | ||
@@ -9,0 +9,0 @@ |
@@ -23,3 +23,2 @@ import { | ||
protected includedInObject; | ||
protected dataInObject; | ||
protected cachedModels = {}; | ||
@@ -64,3 +63,2 @@ | ||
buildModelByData(data: TJsonApiData): TJsonaModel { | ||
const entityKey = createEntityKey(data); | ||
@@ -70,4 +68,8 @@ | ||
if (entityKey && Object.keys(data).length === 2) { | ||
const onlyTypeIdInData = Object.keys(data).length === 2 && data.type && data.id; | ||
if (entityKey && onlyTypeIdInData) { | ||
// checks for built model in cachedModels is a protection from creating models on recursive relationships | ||
// NOTE: onlyTypeIdInData need for prevent return empty, cached model (for collections with recursive relations) | ||
// https://github.com/olosegres/jsona/issues/17 | ||
model = this.cachedModels[entityKey]; | ||
@@ -74,0 +76,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
126576
1995