@microsoft/paris
Advanced tools
Comparing version 1.10.1 to 1.10.2
@@ -17,4 +17,5 @@ import { ModelEntity } from "../../config/entity.config"; | ||
pluralName?: string; | ||
forwardRefName?: string; | ||
entityConfig?: ModelEntity<TEntity, TRawData, TId>; | ||
valueObjectConfig?: EntityConfigBase; | ||
} |
@@ -9,4 +9,5 @@ import { ModelEntity } from "../entity.config"; | ||
target.pluralName = config.pluralName; | ||
target.forwardRefName = config.forwardRefName; | ||
entitiesService.addEntity(target, entity); | ||
}; | ||
} |
@@ -8,2 +8,3 @@ import { valueObjectsService } from "../services/value-objects.service"; | ||
target.pluralName = valueObjectConfig.pluralName; | ||
target.forwardRefName = valueObjectConfig.forwardRefName; | ||
target.valueObjectConfig = valueObjectConfig; | ||
@@ -10,0 +11,0 @@ valueObjectsService.addEntity(target, valueObjectConfig); |
@@ -13,2 +13,3 @@ import { ParisConfig } from "./paris-config"; | ||
pluralName: string; | ||
forwardRefName: string; | ||
fields?: EntityFields; | ||
@@ -43,2 +44,7 @@ idProperty?: keyof TRawData; | ||
/** | ||
* Unique name used to reference an entity | ||
* If not supplied, the singularName is used | ||
*/ | ||
forwardRefName?: string; | ||
/** | ||
* The property in the raw data used for the Entity's ID. | ||
@@ -45,0 +51,0 @@ */ |
@@ -9,5 +9,5 @@ import { DataEntityType } from "../../api/entity/data-entity.base"; | ||
getEntityByType(dataEntityType: DataEntityType): T; | ||
getEntityByName(entitySingularName: string): T; | ||
getEntityByName(forwardRefName: string): T; | ||
addEntity(dataEntityType: DataEntityType, entity: T): T; | ||
private getDataEntityTypeFields; | ||
} |
@@ -17,4 +17,4 @@ import { entityFieldsService } from "./entity-fields.service"; | ||
}; | ||
EntitiesServiceBase.prototype.getEntityByName = function (entitySingularName) { | ||
return this._allEntitiesByName.get(entitySingularName); | ||
EntitiesServiceBase.prototype.getEntityByName = function (forwardRefName) { | ||
return this._allEntitiesByName.get(forwardRefName.replace(/\s/g, "")); | ||
}; | ||
@@ -24,3 +24,3 @@ EntitiesServiceBase.prototype.addEntity = function (dataEntityType, entity) { | ||
this._allEntities.set(dataEntityType, entity); | ||
this._allEntitiesByName.set(dataEntityType.name, entity); | ||
this._allEntitiesByName.set((dataEntityType.forwardRefName || dataEntityType.singularName).replace(/\s/g, ""), entity); | ||
} | ||
@@ -27,0 +27,0 @@ entity.fields = this.getDataEntityTypeFields(dataEntityType); |
@@ -45,2 +45,6 @@ import { ModelBase } from "../config/model.base"; | ||
(modelWithEntityOrString.entityConfig || modelWithEntityOrString.valueObjectConfig); | ||
if (!modelWithEntity) { | ||
getModelDataError.message = getModelDataError.message + " modelWith: Couldn't find '" + modelWithEntity + "'. Did you add a 'forwardRefName' to the corresponding entity config?"; | ||
throw getModelDataError; | ||
} | ||
return this.modelEntity(rawData, modelWithEntity, options, query); | ||
@@ -47,0 +51,0 @@ } |
@@ -75,7 +75,6 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
var relationship = relationshipConstructor; | ||
var sourceEntityName = relationship.sourceEntityType.name, dataEntityName = relationship.dataEntityType.name, relationshipId = sourceEntityName + "_" + dataEntityName; | ||
var repository = this.relationshipRepositories.get(relationshipId); | ||
var repository = this.relationshipRepositories.get(relationship); | ||
if (!repository) { | ||
repository = new RelationshipRepository(relationship.sourceEntityType, relationship.dataEntityType, relationship.allowedTypes, this); | ||
this.relationshipRepositories.set(relationshipId, repository); | ||
this.relationshipRepositories.set(relationship, repository); | ||
} | ||
@@ -82,0 +81,0 @@ return repository; |
@@ -26,3 +26,3 @@ { | ||
"_spec": "json-stringify-safe@*", | ||
"_where": "/mnt/c/Users/aagreenw/code/paris", | ||
"_where": "/Users/maorfrankel/Workspace/paris", | ||
"author": { | ||
@@ -29,0 +29,0 @@ "name": "Isaac Z. Schlueter", |
{ | ||
"name": "@microsoft/paris", | ||
"version": "1.10.1", | ||
"version": "1.10.2", | ||
"description": "Library for the implementation of Domain Driven Design with TypeScript + RxJS", | ||
@@ -14,3 +14,3 @@ "repository": { | ||
"dev": "rollup -c -w", | ||
"prepublish": "npm run build && npm run test", | ||
"prepublish": "npm run build", | ||
"test": "jest", | ||
@@ -17,0 +17,0 @@ "test:watch": "jest --watch", |
@@ -8,2 +8,3 @@ import {Entity} from '../../lib/config/decorators/entity.decorator'; | ||
pluralName: 'Dogs', | ||
forwardRefName: 'DogEntity', | ||
endpoint: 'things', | ||
@@ -10,0 +11,0 @@ }) |
@@ -53,3 +53,3 @@ import {EntityField} from '../../lib/config/decorators/entity-field.decorator'; | ||
if (query && query.where && (<{ [index: string]: any }>query.where)['isDog']) { | ||
return 'Dog' | ||
return 'DogEntity' | ||
} | ||
@@ -56,0 +56,0 @@ return null |
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
262998
5405