99 "path/filepath"
1010 "strings"
1111
12- "github.com/mendixlabs/mxcli/mdl/types"
1312 "github.com/mendixlabs/mxcli/model"
1413 "github.com/mendixlabs/mxcli/sdk/javaactions"
1514 "github.com/mendixlabs/mxcli/sdk/pages"
@@ -81,7 +80,7 @@ func (r *Reader) parseSnippet(unitID, containerID string, contents []byte) (*pag
8180}
8281
8382// parseJavaAction parses Java action contents from BSON.
84- func (r * Reader ) parseJavaAction (unitID , containerID string , contents []byte ) (* types. JavaAction , error ) {
83+ func (r * Reader ) parseJavaAction (unitID , containerID string , contents []byte ) (* JavaAction , error ) {
8584 contents , err := r .resolveContents (unitID , contents )
8685 if err != nil {
8786 return nil , err
@@ -92,7 +91,7 @@ func (r *Reader) parseJavaAction(unitID, containerID string, contents []byte) (*
9291 return nil , fmt .Errorf ("failed to unmarshal BSON: %w" , err )
9392 }
9493
95- ja := & types. JavaAction {}
94+ ja := & JavaAction {}
9695 ja .ID = model .ID (unitID )
9796 ja .TypeName = "JavaActions$JavaAction"
9897 ja .ContainerID = model .ID (containerID )
@@ -138,7 +137,7 @@ func WriteJSON(element any) ([]byte, error) {
138137}
139138
140139// parseJavaScriptAction parses JavaScript action contents from BSON.
141- func (r * Reader ) parseJavaScriptAction (unitID , containerID string , contents []byte ) (* types. JavaScriptAction , error ) {
140+ func (r * Reader ) parseJavaScriptAction (unitID , containerID string , contents []byte ) (* JavaScriptAction , error ) {
142141 contents , err := r .resolveContents (unitID , contents )
143142 if err != nil {
144143 return nil , err
@@ -149,7 +148,7 @@ func (r *Reader) parseJavaScriptAction(unitID, containerID string, contents []by
149148 return nil , fmt .Errorf ("failed to unmarshal BSON: %w" , err )
150149 }
151150
152- jsa := & types. JavaScriptAction {}
151+ jsa := & JavaScriptAction {}
153152 jsa .ID = model .ID (unitID )
154153 jsa .TypeName = "JavaScriptActions$JavaScriptAction"
155154 jsa .ContainerID = model .ID (containerID )
@@ -250,7 +249,7 @@ func (r *Reader) parseJavaScriptAction(unitID, containerID string, contents []by
250249}
251250
252251// ReadJavaScriptActionByName reads a JavaScript action by qualified name (Module.ActionName).
253- func (r * Reader ) ReadJavaScriptActionByName (qualifiedName string ) (* types. JavaScriptAction , error ) {
252+ func (r * Reader ) ReadJavaScriptActionByName (qualifiedName string ) (* JavaScriptAction , error ) {
254253 units , err := r .listUnitsByType ("JavaScriptActions$JavaScriptAction" )
255254 if err != nil {
256255 return nil , err
@@ -364,7 +363,7 @@ func (r *Reader) parsePageTemplate(unitID, containerID string, contents []byte)
364363}
365364
366365// parseNavigationDocument parses navigation document contents from BSON.
367- func (r * Reader ) parseNavigationDocument (unitID , containerID string , contents []byte ) (* types. NavigationDocument , error ) {
366+ func (r * Reader ) parseNavigationDocument (unitID , containerID string , contents []byte ) (* NavigationDocument , error ) {
368367 contents , err := r .resolveContents (unitID , contents )
369368 if err != nil {
370369 return nil , err
@@ -375,7 +374,7 @@ func (r *Reader) parseNavigationDocument(unitID, containerID string, contents []
375374 return nil , fmt .Errorf ("failed to unmarshal BSON: %w" , err )
376375 }
377376
378- nav := & types. NavigationDocument {}
377+ nav := & NavigationDocument {}
379378 nav .ID = model .ID (unitID )
380379 nav .TypeName = "Navigation$NavigationDocument"
381380 nav .ContainerID = model .ID (containerID )
@@ -400,9 +399,9 @@ func (r *Reader) parseNavigationDocument(unitID, containerID string, contents []
400399}
401400
402401// parseNavigationProfile parses a single navigation profile from BSON.
403- func parseNavigationProfile (raw map [string ]any ) * types. NavigationProfile {
402+ func parseNavigationProfile (raw map [string ]any ) * NavigationProfile {
404403 typeName := extractString (raw ["$Type" ])
405- profile := & types. NavigationProfile {
404+ profile := & NavigationProfile {
406405 Name : extractString (raw ["Name" ]),
407406 Kind : extractString (raw ["Kind" ]),
408407 }
@@ -414,13 +413,13 @@ func parseNavigationProfile(raw map[string]any) *types.NavigationProfile {
414413 page := extractString (hp ["HomePagePage" ])
415414 nanoflow := extractString (hp ["HomePageNanoflow" ])
416415 if page != "" || nanoflow != "" {
417- profile .HomePage = & types. NavHomePage {Page : page , Microflow : nanoflow }
416+ profile .HomePage = & NavHomePage {Page : page , Microflow : nanoflow }
418417 }
419418 }
420419 // Native role-based home pages
421420 for _ , item := range extractBsonArray (raw ["RoleBasedNativeHomePages" ]) {
422421 if rbMap , ok := item .(map [string ]any ); ok {
423- rbh := & types. NavRoleBasedHome {
422+ rbh := & NavRoleBasedHome {
424423 UserRole : extractString (rbMap ["UserRole" ]),
425424 Page : extractString (rbMap ["HomePagePage" ]),
426425 Microflow : extractString (rbMap ["HomePageNanoflow" ]),
@@ -446,13 +445,13 @@ func parseNavigationProfile(raw map[string]any) *types.NavigationProfile {
446445 page := extractString (hp ["Page" ])
447446 mf := extractString (hp ["Microflow" ])
448447 if page != "" || mf != "" {
449- profile .HomePage = & types. NavHomePage {Page : page , Microflow : mf }
448+ profile .HomePage = & NavHomePage {Page : page , Microflow : mf }
450449 }
451450 }
452451 // Role-based home pages (stored as "HomeItems")
453452 for _ , item := range extractBsonArray (raw ["HomeItems" ]) {
454453 if rbMap , ok := item .(map [string ]any ); ok {
455- rbh := & types. NavRoleBasedHome {
454+ rbh := & NavRoleBasedHome {
456455 UserRole : extractString (rbMap ["UserRole" ]),
457456 Page : extractString (rbMap ["Page" ]),
458457 Microflow : extractString (rbMap ["Microflow" ]),
@@ -489,7 +488,7 @@ func parseNavigationProfile(raw map[string]any) *types.NavigationProfile {
489488 // Offline entity configs (both web and native)
490489 for _ , item := range extractBsonArray (raw ["OfflineEntityConfigs" ]) {
491490 if oeMap , ok := item .(map [string ]any ); ok {
492- oe := & types. NavOfflineEntity {
491+ oe := & NavOfflineEntity {
493492 Entity : extractString (oeMap ["Entity" ]),
494493 SyncMode : extractString (oeMap ["SyncMode" ]),
495494 Constraint : extractString (oeMap ["Constraint" ]),
@@ -504,8 +503,8 @@ func parseNavigationProfile(raw map[string]any) *types.NavigationProfile {
504503}
505504
506505// parseNavMenuItem parses a Menus$MenuItem from BSON.
507- func parseNavMenuItem (raw map [string ]any ) * types. NavMenuItem {
508- mi := & types. NavMenuItem {}
506+ func parseNavMenuItem (raw map [string ]any ) * NavMenuItem {
507+ mi := & NavMenuItem {}
509508
510509 // Extract caption text (Caption → Items → first Translation → Text)
511510 if caption , ok := raw ["Caption" ].(map [string ]any ); ok {
@@ -553,8 +552,8 @@ func parseNavMenuItem(raw map[string]any) *types.NavMenuItem {
553552}
554553
555554// parseNavMenuItemFromBottomBar parses a NativePages$BottomBarItem as a NavMenuItem.
556- func parseNavMenuItemFromBottomBar (raw map [string ]any ) * types. NavMenuItem {
557- mi := & types. NavMenuItem {}
555+ func parseNavMenuItemFromBottomBar (raw map [string ]any ) * NavMenuItem {
556+ mi := & NavMenuItem {}
558557 if caption , ok := raw ["Caption" ].(map [string ]any ); ok {
559558 mi .Caption = extractTextFromBson (caption )
560559 }
@@ -590,7 +589,7 @@ func extractTextFromBson(raw map[string]any) string {
590589}
591590
592591// parseImageCollection parses image collection contents from BSON.
593- func (r * Reader ) parseImageCollection (unitID , containerID string , contents []byte ) (* types. ImageCollection , error ) {
592+ func (r * Reader ) parseImageCollection (unitID , containerID string , contents []byte ) (* ImageCollection , error ) {
594593 contents , err := r .resolveContents (unitID , contents )
595594 if err != nil {
596595 return nil , err
@@ -601,7 +600,7 @@ func (r *Reader) parseImageCollection(unitID, containerID string, contents []byt
601600 return nil , fmt .Errorf ("failed to unmarshal BSON: %w" , err )
602601 }
603602
604- ic := & types. ImageCollection {}
603+ ic := & ImageCollection {}
605604 ic .ID = model .ID (unitID )
606605 ic .TypeName = "Images$ImageCollection"
607606 ic .ContainerID = model .ID (containerID )
@@ -620,7 +619,7 @@ func (r *Reader) parseImageCollection(unitID, containerID string, contents []byt
620619 if images , ok := raw ["Images" ].(bson.A ); ok {
621620 for _ , img := range images {
622621 if imgMap , ok := img .(map [string ]any ); ok {
623- image := types. Image {}
622+ image := Image {}
624623 if id := extractID (imgMap ["$ID" ]); id != "" {
625624 image .ID = model .ID (id )
626625 }
@@ -644,7 +643,7 @@ func (r *Reader) parseImageCollection(unitID, containerID string, contents []byt
644643}
645644
646645// parseJsonStructure parses JSON structure contents from BSON.
647- func (r * Reader ) parseJsonStructure (unitID , containerID string , contents []byte ) (* types. JsonStructure , error ) {
646+ func (r * Reader ) parseJsonStructure (unitID , containerID string , contents []byte ) (* JsonStructure , error ) {
648647 contents , err := r .resolveContents (unitID , contents )
649648 if err != nil {
650649 return nil , err
@@ -655,7 +654,7 @@ func (r *Reader) parseJsonStructure(unitID, containerID string, contents []byte)
655654 return nil , fmt .Errorf ("failed to unmarshal BSON: %w" , err )
656655 }
657656
658- js := & types. JsonStructure {}
657+ js := & JsonStructure {}
659658 js .ID = model .ID (unitID )
660659 js .TypeName = "JsonStructures$JsonStructure"
661660 js .ContainerID = model .ID (containerID )
@@ -689,8 +688,8 @@ func (r *Reader) parseJsonStructure(unitID, containerID string, contents []byte)
689688}
690689
691690// parseJsonElement recursively parses a JsonStructures$JsonElement from BSON.
692- func parseJsonElement (raw map [string ]any ) * types. JsonElement {
693- elem := & types. JsonElement {
691+ func parseJsonElement (raw map [string ]any ) * JsonElement {
692+ elem := & JsonElement {
694693 MaxLength : - 1 ,
695694 FractionDigits : - 1 ,
696695 TotalDigits : - 1 ,
0 commit comments