1- import { EmbeddedContentTypeUid , EntryEmbedable , EmbeddedObject } from '../Models/embedded-object' ;
1+ import { EntryEmbedable , EmbeddedObject } from '../Models/embedded-object' ;
22import { RenderOption , RenderObject , RenderContentType } from '../options/index' ;
33import { AssetAttributes , EntryAttributes , Metadata } from '../Models/metadata-model' ;
44import { defaultOptions } from '../options/default-options' ;
@@ -7,9 +7,9 @@ import { defaultOptions } from '../options/default-options';
77export function findEmbeddedEntry (
88 uid : string ,
99 contentTypeUid : string ,
10- embeddedEntries : EmbeddedContentTypeUid [ ] = [ ] ,
11- ) : EmbeddedContentTypeUid [ ] {
12- return embeddedEntries . filter ( ( entry ) => {
10+ embeddeditems : EmbeddedObject [ ] = [ ] ,
11+ ) : EmbeddedObject [ ] {
12+ return embeddeditems . filter ( ( entry ) => {
1313 if ( entry . uid === uid && entry . _content_type_uid === contentTypeUid ) {
1414 return entry ;
1515 }
@@ -24,26 +24,26 @@ export function findEmbeddedAsset(uid: string, embeddedAssets: EmbeddedObject[]
2424 } ) ;
2525}
2626
27- export function findEmbeddedObjects ( object : Metadata , entry : EntryEmbedable ) : ( EmbeddedContentTypeUid | EmbeddedObject ) [ ] {
27+ export function findEmbeddedObjects ( object : Metadata , entry : EntryEmbedable ) : ( EmbeddedObject ) [ ] {
2828 if ( object && object !== undefined && entry && entry !== undefined ) {
2929 if ( object . itemType === 'entry' ) {
3030 const embeddedEntry = object . attributes as EntryAttributes ;
3131 return findEmbeddedEntry (
3232 object . itemUid ,
3333 object . contentTypeUid ,
34- Object . values ( entry . _embedded_entries || [ ] ) . reduce ( ( accumulator , value ) => accumulator . concat ( value ) , [ ] ) ,
34+ Object . values ( entry . _embedded_items || [ ] ) . reduce ( ( accumulator , value ) => accumulator . concat ( value ) , [ ] ) ,
3535 ) ;
3636 } else {
3737 const embeddedAsset = object . attributes as AssetAttributes ;
38- return findEmbeddedAsset ( object . itemUid , Object . values ( entry . _embedded_assets || [ ] ) . reduce ( ( accumulator , value ) => accumulator . concat ( value ) , [ ] ) , ) ;
38+ return findEmbeddedAsset ( object . itemUid , Object . values ( entry . _embedded_items || [ ] ) . reduce ( ( accumulator , value ) => accumulator . concat ( value ) , [ ] ) , ) ;
3939 }
4040 }
4141 return [ ] ;
4242}
4343
4444export function findRenderString (
4545 metadata : Metadata ,
46- renderModel : EmbeddedContentTypeUid | EmbeddedObject ,
46+ renderModel : EmbeddedObject ,
4747 renderOptions ?: RenderOption ,
4848) : string {
4949 if ( ( ! renderModel && renderModel === undefined ) || ( ! metadata && metadata === undefined ) ) {
0 commit comments