like malachite (atproto-lastfm-importer) but in go and bluer
go spotify tealfm lastfm atproto

atproto: fix broken applyWrites since refactor

karitham.dev 3cc2546c c7ec171f

verified
+14 -4
+5 -3
atproto/repo.go
··· 184 184 if err := json.Unmarshal(b, &recMap); err != nil { 185 185 return nil, fmt.Errorf("failed to unmarshal record: %w", err) 186 186 } 187 - recMap["$type"] = "com.atproto.repo.applyWrites#create" 188 - recMap["collection"] = collection 189 - writes[i] = recMap 187 + writes[i] = map[string]any{ 188 + "$type": "com.atproto.repo.applyWrites#create", 189 + "collection": collection, 190 + "value": recMap, 191 + } 190 192 } 191 193 192 194 return writes, nil
+7
atproto/repo_test.go
··· 691 691 if w["collection"] != "app.bsky.feed.post" { 692 692 t.Errorf("write[%d] collection = %s, want app.bsky.feed.post", i, w["collection"]) 693 693 } 694 + if value, ok := w["value"].(map[string]any); !ok { 695 + t.Errorf("write[%d] value should be a map, got %T", i, w["value"]) 696 + } else { 697 + if value["text"] != "Hello" && value["text"] != "World" { 698 + t.Errorf("write[%d] value text = %s, want Hello or World", i, value["text"]) 699 + } 700 + } 694 701 } 695 702 }, 696 703 },
+1 -1
flake.nix
··· 17 17 let 18 18 lazuli = pkgs.buildGoModule rec { 19 19 name = "lazuli"; 20 - version = "0.1.5"; 20 + version = "0.1.6"; 21 21 src = pkgs.nix-gitignore.gitignoreSource [ "*.csv" "*.zip" "*.json" ] ./.; 22 22 vendorHash = "sha256-O6R8jC8Ms5gsY2FUmuL8lTGTODfMW1CsSWuWbN27zeY="; 23 23 ldflags = [
+1
main.go
··· 606 606 DryRun: dryRun, 607 607 ATProtoClient: repoClient, 608 608 ProgressLog: progressLog, 609 + ClientAgent: fmt.Sprintf("lazuli/%s", Version), 609 610 Storage: a.storage, 610 611 Limiter: limiter, 611 612 }