import { ComposedNarrativeSchema , composeEntityDefinitions , EntityDefinitionWithOrigin , NarrativeSchema , } from "narrative-schema-common" ; import { resolveAliasesAndKeyByName } from "narrative-schema-label" ; export const compose = async ( narrativeSchemas ) : Promise < ComposedNarrativeSchema > => { let labels = [ ] ; let rules = [ ] ; let styling = [ ] ; for ( const narrativeSchema of narrativeSchemas ) { labels = composeEntityDefinitions ( narrativeSchema , "labels" , labels ) ; rules = composeEntityDefinitions ( narrativeSchema , "rules" , rules ) ; styling = composeEntityDefinitions ( narrativeSchema , "styling" , styling ) ; } return { components : narrativeSchemas , labels , rules , styling , labelByName : resolveAliasesAndKeyByName ( labels ) , } ; } ;