@@ -14,7 +14,7 @@ import { WriteInfo } from '../types';
14
14
import { META_XML_SUFFIX , SourcePath , XML_NS_KEY , XML_NS_URL } from '../../common' ;
15
15
import { ComponentSet } from '../../collections' ;
16
16
import { DecompositionStateValue } from '../convertContext' ;
17
- import { DecompositionStrategy } from '../../registry' ;
17
+ import { DecompositionStrategy , MetadataType } from '../../registry' ;
18
18
import { BaseMetadataTransformer } from './baseMetadataTransformer' ;
19
19
20
20
Messages . importMessagesDirectory ( __dirname ) ;
@@ -64,7 +64,7 @@ export class DecomposedMetadataTransformer extends BaseMetadataTransformer {
64
64
const composedMetadata = await getComposedMetadataEntries ( component ) ;
65
65
66
66
for ( const [ tagKey , tagValue ] of composedMetadata ) {
67
- const childTypeId = type . children ?. directories ?. [ tagKey ] ;
67
+ const childTypeId = tagToChildTypeId ( { tagKey, type } ) ;
68
68
if ( childTypeId ) {
69
69
const childType = type . children ?. types [ childTypeId ] ;
70
70
if ( ! childType ) {
@@ -240,3 +240,8 @@ const extractUniqueElementValue = (xml: JsonMap, elementName?: string): string |
240
240
241
241
const getStandardElements = ( xml : JsonMap ) : string | undefined =>
242
242
getString ( xml , 'fullName' ) ?? getString ( xml , 'name' ) ?? undefined ;
243
+
244
+ /** use the given xmlElementName name if it exists, otherwise use see if one matches the directories */
245
+ const tagToChildTypeId = ( { tagKey, type } : { tagKey : string ; type : MetadataType } ) : string | undefined =>
246
+ Object . values ( type . children ?. types ?? { } ) . find ( ( c ) => c . xmlElementName === tagKey ) ?. id ??
247
+ type . children ?. directories ?. [ tagKey ] ;
0 commit comments