function toArray ( value ) { return typeof value === 'string' ? [ value ] : value ; } /**
 * Provides an array of paths for OpenSearch source filtering
 */ export function includedFields ( type = '*' , fields ? ) { if ( ! fields || fields . length === 0 ) { return ; } const sourceFields = toArray ( fields ) ; const sourceType = toArray ( type ) ; return sourceType . reduce ( ( acc , t ) => { return [ ... acc , ... sourceFields . map ( ( f ) => `${ t }.${ f }` ) ] ; } , [ ] ) . concat ( 'namespace' ) . concat ( 'namespaces' ) . concat ( 'type' ) . concat ( 'references' ) . concat ( 'migrationVersion' ) . concat ( 'updated_at' ) . concat ( 'originId' ) . concat ( fields ) ; }