diff --git a/atproto/repo.go b/atproto/repo.go index f859abb..0d1517d 100644 --- a/atproto/repo.go +++ b/atproto/repo.go @@ -184,9 +184,11 @@ func prepareWrites[T any](records []T, collection string) ([]map[string]any, err if err := json.Unmarshal(b, &recMap); err != nil { return nil, fmt.Errorf("failed to unmarshal record: %w", err) } - recMap["$type"] = "com.atproto.repo.applyWrites#create" - recMap["collection"] = collection - writes[i] = recMap + writes[i] = map[string]any{ + "$type": "com.atproto.repo.applyWrites#create", + "collection": collection, + "value": recMap, + } } return writes, nil diff --git a/atproto/repo_test.go b/atproto/repo_test.go index 473ed98..d50a5f2 100644 --- a/atproto/repo_test.go +++ b/atproto/repo_test.go @@ -691,6 +691,13 @@ func TestPrepareWrites(t *testing.T) { if w["collection"] != "app.bsky.feed.post" { t.Errorf("write[%d] collection = %s, want app.bsky.feed.post", i, w["collection"]) } + if value, ok := w["value"].(map[string]any); !ok { + t.Errorf("write[%d] value should be a map, got %T", i, w["value"]) + } else { + if value["text"] != "Hello" && value["text"] != "World" { + t.Errorf("write[%d] value text = %s, want Hello or World", i, value["text"]) + } + } } }, }, diff --git a/flake.nix b/flake.nix index 92808da..6931f63 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,7 @@ let lazuli = pkgs.buildGoModule rec { name = "lazuli"; - version = "0.1.5"; + version = "0.1.6"; src = pkgs.nix-gitignore.gitignoreSource [ "*.csv" "*.zip" "*.json" ] ./.; vendorHash = "sha256-O6R8jC8Ms5gsY2FUmuL8lTGTODfMW1CsSWuWbN27zeY="; ldflags = [ diff --git a/main.go b/main.go index 7aef455..ec210ee 100644 --- a/main.go +++ b/main.go @@ -606,6 +606,7 @@ func (a *App) runImport(ctx context.Context, cmd *cli.Command) error { DryRun: dryRun, ATProtoClient: repoClient, ProgressLog: progressLog, + ClientAgent: fmt.Sprintf("lazuli/%s", Version), Storage: a.storage, Limiter: limiter, }