componentsjs-generator
Advanced tools
Comparing version 1.4.0 to 1.4.1
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
<a name="v1.4.1"></a> | ||
## [v1.4.1](https://github.com/LinkedSoftwareDependencies/Components-Generator.js/compare/v1.4.0...v1.4.1) - 2020-11-09 | ||
### Fixed | ||
* [Fix collectEntries params being required and unique](https://github.com/LinkedSoftwareDependencies/Components-Generator.js/commit/93c3b42e2ad4600f8180a3efc63df2a1e9a4f9f9) | ||
* [Fix indexed field names appearing twice in IRIs](https://github.com/LinkedSoftwareDependencies/Components-Generator.js/commit/5abbcf2fbb9404a138fff7b319b864af705213e9) | ||
<a name="v1.4.0"></a> | ||
@@ -5,0 +12,0 @@ ## [v1.4.0](https://github.com/LinkedSoftwareDependencies/Components-Generator.js/compare/v1.3.0...v1.4.0) - 2020-11-06 |
@@ -101,2 +101,3 @@ import type { ContextParser, JsonLdContextNormalized } from 'jsonld-context-parser'; | ||
* @param subParamData The sub-parameter of the parameter with nested range. | ||
* @param fieldId The @id of the field. | ||
* @param scope The current field scope. | ||
@@ -108,3 +109,3 @@ */ | ||
}; | ||
}, parameters: ParameterDefinition[], subParamData: ParameterData<ParameterRangeResolved>, scope: FieldScope): ConstructorFieldDefinition; | ||
}, parameters: ParameterDefinition[], subParamData: ParameterData<ParameterRangeResolved>, fieldId: string, scope: FieldScope): ConstructorFieldDefinition; | ||
/** | ||
@@ -111,0 +112,0 @@ * Construct a parameter definition from the given parameter data with raw range. |
@@ -190,6 +190,10 @@ "use strict"; | ||
parameterDataToConstructorArgument(context, classReference, parameterData, parameters, fieldId, scope) { | ||
// Append the current field name to the scope | ||
if (parameterData.type === 'field') { | ||
scope = Object.assign(Object.assign({}, scope), { parentFieldNames: [...scope.parentFieldNames, parameterData.name] }); | ||
} | ||
if (parameterData.range.type === 'nested') { | ||
// Create a hash object with `fields` entries. | ||
// Each entry's value is (indirectly) recursively handled by this method again. | ||
const fields = parameterData.range.value.map(subParamData => this.constructFieldDefinitionNested(context, classReference, parameterData, parameters, subParamData, scope)); | ||
const fields = parameterData.range.value.map(subParamData => this.constructFieldDefinitionNested(context, classReference, parameterData, parameters, subParamData, fieldId, scope)); | ||
return { fields }; | ||
@@ -211,13 +215,10 @@ } | ||
* @param subParamData The sub-parameter of the parameter with nested range. | ||
* @param fieldId The @id of the field. | ||
* @param scope The current field scope. | ||
*/ | ||
constructFieldDefinitionNested(context, classReference, parameterData, parameters, subParamData, scope) { | ||
constructFieldDefinitionNested(context, classReference, parameterData, parameters, subParamData, fieldId, scope) { | ||
if (subParamData.type === 'field') { | ||
const subScope = { | ||
parentFieldNames: [...scope.parentFieldNames, subParamData.name], | ||
fieldIdsHash: scope.fieldIdsHash, | ||
}; | ||
return { | ||
keyRaw: subParamData.name, | ||
value: this.parameterDataToConstructorArgument(context, classReference, subParamData, parameters, this.fieldNameToId(context, classReference, subParamData.name, scope), subScope), | ||
value: this.parameterDataToConstructorArgument(context, classReference, subParamData, parameters, this.fieldNameToId(context, classReference, subParamData.name, scope), scope), | ||
}; | ||
@@ -230,4 +231,7 @@ } | ||
} | ||
// Remove the last element of the parent field names when we're in an indexed field, | ||
// to avoid the field name to be in the IRI twice. | ||
scope = Object.assign(Object.assign({}, scope), { parentFieldNames: scope.parentFieldNames.slice(0, -1) }); | ||
// Determine parameter id's | ||
const idCollectEntries = this.fieldNameToId(context, classReference, parameterData.name, scope); | ||
const idCollectEntries = fieldId; | ||
const idKey = this.fieldNameToId(context, classReference, `${parameterData.name}_key`, scope); | ||
@@ -253,2 +257,5 @@ const idValue = this.fieldNameToId(context, classReference, `${parameterData.name}_value`, scope); | ||
}; | ||
// Params for collected entries are never required, and can have more than one entry. | ||
parameterData.unique = false; | ||
parameterData.required = false; | ||
this.populateOptionalParameterFields(parameter, parameterData); | ||
@@ -255,0 +262,0 @@ parameters.push(parameter); |
{ | ||
"name": "componentsjs-generator", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "Automatically generate component files from TypeScript classes for the Components.js dependency injection framework", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
139233
2753