@@ -65,7 +65,7 @@ interface FinderPathLookupResponse {
6565interface CitationLookupSuccess {
6666 success : true ;
6767 citationKey : string ;
68- bibliographyMetadata : Record < string , unknown > ;
68+ bibliographyMetadata : string | null ;
6969 devonthinkRecords : FinderPathRecord [ ] ;
7070}
7171
@@ -221,40 +221,14 @@ const isValuePresent = (value: unknown): boolean => {
221221 return true ;
222222} ;
223223
224- const buildMetadataPayload = ( match : BibliographyMetadataMatch ) : Record < string , unknown > => {
225- const result : Record < string , unknown > = { } ;
226-
224+ const buildMetadataPayload = ( match : BibliographyMetadataMatch ) : string | null => {
227225 if ( match . source === "json" ) {
228- // Return only the core bibliographic fields, not the entire item
229226 const item = match . item ;
230- if ( isValuePresent ( item . author ) ) result . author = item . author ;
231- if ( isValuePresent ( item . title ) ) result . title = item . title ;
232- if ( isValuePresent ( item [ "container-title" ] ) )
233- result [ "container-title" ] = item [ "container-title" ] ;
234- if ( isValuePresent ( item . volume ) ) result . volume = item . volume ;
235- if ( isValuePresent ( item . issue ) ) result . issue = item . issue ;
236- if ( isValuePresent ( item . page ) ) result . page = item . page ;
237- if ( isValuePresent ( item . issued ) ) result . issued = item . issued ;
238- if ( isValuePresent ( item . DOI ) ) result . DOI = item . DOI ;
239- if ( isValuePresent ( item . ISBN ) ) result . ISBN = item . ISBN ;
240- if ( isValuePresent ( item . type ) ) result . type = item . type ;
227+ return isValuePresent ( item . title ) ? String ( item . title ) : null ;
241228 } else {
242- // For BibTeX, return only essential fields
243- if ( isValuePresent ( match . entry . type ) ) result . entryType = match . entry . type ;
244- if ( isValuePresent ( match . entry . fields . author ) ) result . author = match . entry . fields . author ;
245- if ( isValuePresent ( match . entry . fields . title ) ) result . title = match . entry . fields . title ;
246- if ( isValuePresent ( match . entry . fields . journal ) ) result . journal = match . entry . fields . journal ;
247- if ( isValuePresent ( match . entry . fields . booktitle ) )
248- result . booktitle = match . entry . fields . booktitle ;
249- if ( isValuePresent ( match . entry . fields . year ) ) result . year = match . entry . fields . year ;
250- if ( isValuePresent ( match . entry . fields . volume ) ) result . volume = match . entry . fields . volume ;
251- if ( isValuePresent ( match . entry . fields . number ) ) result . number = match . entry . fields . number ;
252- if ( isValuePresent ( match . entry . fields . pages ) ) result . pages = match . entry . fields . pages ;
253- if ( isValuePresent ( match . entry . fields . doi ) ) result . doi = match . entry . fields . doi ;
254- if ( isValuePresent ( match . entry . fields . isbn ) ) result . isbn = match . entry . fields . isbn ;
229+ // For BibTeX, extract title from fields
230+ return isValuePresent ( match . entry . fields . title ) ? String ( match . entry . fields . title ) : null ;
255231 }
256-
257- return result ;
258232} ;
259233
260234const findRecordsByCitationKey = async (
0 commit comments