@@ -4,6 +4,7 @@ import type {
44 Feature ,
55 Polygon ,
66 FeaturePropertyMission ,
7+ FeaturePropertyMissionChange ,
78 FeaturePropertyMissionLayer ,
89} from '../types/feature.js' ;
910import type {
@@ -219,31 +220,40 @@ export async function to_geojson(cot: CoT): Promise<Static<typeof Feature>> {
219220
220221 mission . missionChanges = [ ]
221222 for ( const change of changes ) {
222- mission . missionChanges . push ( {
223- contentUid : change . MissionChange . contentUid ?. _text ,
224- creatorUid : change . MissionChange . creatorUid ? ._text ,
223+ const mc : Static < typeof FeaturePropertyMissionChange > = {
224+ contentUid : change . MissionChange . contentUid ? change . MissionChange . contentUid . _text : undefined ,
225+ creatorUid : change . MissionChange . creatorUid . _text ,
225226 isFederatedChange : change . MissionChange . isFederatedChange . _text ,
226227 missionName : change . MissionChange . missionName . _text ,
227228 timestamp : change . MissionChange . timestamp . _text ,
228229 type : change . MissionChange . type . _text ,
229- contentResource : change . MissionChange . contentResource ? {
230- expiration : change . MissionChange . contentResource . expiration . _text ,
231- filename : change . MissionChange . contentResource . filename . _text ,
232- hash : change . MissionChange . contentResource . hash . _text ,
233- name : change . MissionChange . contentResource . name . _text ,
234- size : change . MissionChange . contentResource . size . _text ,
235- submissionTime : change . MissionChange . contentResource . submissionTime . _text ,
236- submitter : change . MissionChange . contentResource . submitter . _text ,
237- tool : change . MissionChange . contentResource . tool . _text ,
238- uid : change . MissionChange . contentResource . uid . _text ,
239- } : undefined ,
240- details : change . MissionChange . details ? {
230+ } ;
231+
232+ if ( change . MissionChange . contentResource ) {
233+ const cr = change . MissionChange . contentResource ;
234+ mc . contentResource = {
235+ expiration : cr . expiration . _text ,
236+ filename : cr . filename . _text ,
237+ hash : cr . hash . _text ,
238+ name : cr . name . _text ,
239+ size : parseInt ( cr . size . _text ) ,
240+ submissionTime : cr . submissionTime . _text ,
241+ submitter : cr . submitter . _text ,
242+ tool : cr . tool . _text ,
243+ uid : cr . uid . _text ,
244+ } ;
245+ }
246+
247+ if ( change . MissionChange . details ) {
248+ mc . details = {
241249 ...change . MissionChange . details . _attributes ,
242250 ...change . MissionChange . details . location
243251 ? change . MissionChange . details . location . _attributes
244252 : { }
245- } : undefined
246- } )
253+ } ;
254+ }
255+
256+ mission . missionChanges . push ( mc )
247257 }
248258 }
249259
0 commit comments