Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account migration #736

Closed
wants to merge 313 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
313 commits
Select commit Hold shift + click to select a range
6700e0a
added bytes & cid refs
dholms Mar 16, 2023
b6a7bc3
add ipld<>json
dholms Mar 16, 2023
0cfa504
fixin up a could tings
dholms Mar 16, 2023
d63eaba
Merge pull request #664 from bluesky-social/lex/declaration-assertion…
devinivy Mar 16, 2023
f630edf
Merge remote-tracking branch 'origin/lex-refactor' into lex/votes-to-…
devinivy Mar 16, 2023
7d01ff3
Merge pull request #665 from bluesky-social/lex/votes-to-likes
devinivy Mar 16, 2023
b6e0e31
Merge pull request #668 from bluesky-social/lex/votes-to-likes-app-mi…
devinivy Mar 16, 2023
e30055c
Merge remote-tracking branch 'origin/lex-refactor' into lex/xrpc-methods
devinivy Mar 16, 2023
bec35f0
Add app.bsky.richtext.facet, replace post entities with facets
devinivy Mar 16, 2023
a49d009
Merge pull request #671 from bluesky-social/lex/str-length
dholms Mar 16, 2023
21bb3df
plural actors
dholms Mar 16, 2023
807f903
Merge pull request #663 from bluesky-social/lex/xrpc-methods
dholms Mar 16, 2023
006db84
Merge pull request #670 from bluesky-social/lex/xrpc-methods-app-migr…
dholms Mar 16, 2023
db501a9
wip
dholms Mar 16, 2023
05817c8
Setup backlinks table on pds
devinivy Mar 16, 2023
62ee871
wip
dholms Mar 16, 2023
eb3dab2
send & recieve cids/bytes with xrpc
dholms Mar 16, 2023
ec50e5a
Track backlinks when indexing records on pds
devinivy Mar 16, 2023
1e2c276
handle ipld vals in xrpc server
dholms Mar 16, 2023
31e013f
added cids & bytes to codegen
dholms Mar 16, 2023
7b87b1a
merging
dholms Mar 16, 2023
5aa758b
In createRecord, add deletions to avoid duplicate likes/follows/reposts
devinivy Mar 16, 2023
cb5250f
Tests and fixes for prevention of dupe follows, likes, reposts
devinivy Mar 16, 2023
77e2f9c
Merge remote-tracking branch 'origin/lex-refactor' into lex/unique-re…
devinivy Mar 16, 2023
0c6e3cd
Backlink migration tidy
devinivy Mar 16, 2023
e2d3c4d
cleanup dag json parser
dholms Mar 16, 2023
14a975e
merged
dholms Mar 16, 2023
d6a98a6
Fix dupe backlink inserts
devinivy Mar 16, 2023
e4f7858
Tidy
devinivy Mar 16, 2023
014fb88
blob refs + codegen
dholms Mar 16, 2023
6541d74
Make profile displayName optional
devinivy Mar 16, 2023
7a37b8d
Test view and updateProfile for empty display name
devinivy Mar 16, 2023
5cbb6db
working into pds
dholms Mar 16, 2023
bcc171d
Make aggregate counts optional on post and profile views
devinivy Mar 16, 2023
a79950a
Make viewer state optional on post view for consistency
devinivy Mar 16, 2023
e1e2d22
Remove deprecated myState field on profile view
devinivy Mar 17, 2023
d3fa68d
Tidy repo method descriptions
devinivy Mar 17, 2023
d0a8ddd
tests & types & fixes
dholms Mar 17, 2023
2568538
Implementation and tests for putRecord
devinivy Mar 17, 2023
b85bc80
Remove updateProfile method
devinivy Mar 17, 2023
f3fa5b8
Update repo service so that head can be taken for update externally
devinivy Mar 17, 2023
8aed22e
Lex updates for compare-and-swap records/commits
devinivy Mar 17, 2023
c9c8ba7
Add error to lex for bad repo compare-and-swaps
devinivy Mar 17, 2023
57dfa56
Improve update-at-head thru repo service
devinivy Mar 17, 2023
29749c0
common package
dholms Mar 17, 2023
ca91a6e
Implement and test compare-and-swaps on repo write methods
devinivy Mar 17, 2023
eebd868
Use lex discriminator for applyWrites
devinivy Mar 17, 2023
bd8f1c2
Merge remote-tracking branch 'origin/lex-refactor' into lex/richtext
devinivy Mar 17, 2023
57fa01f
Remove post entity/facet index
devinivy Mar 17, 2023
b0254c8
Merge pull request #674 from bluesky-social/lex/richtext
devinivy Mar 17, 2023
82615c2
Merge remote-tracking branch 'origin/lex-refactor' into lex/unique-re…
devinivy Mar 17, 2023
cdc8332
Merge remote-tracking branch 'origin/lex-refactor' into lex/empty-dis…
devinivy Mar 17, 2023
bb0111f
Update lex descriptions to clarify repo write semantics
devinivy Mar 17, 2023
698e77f
Make deleteRecord idempotent w/ tests
devinivy Mar 17, 2023
85babfb
merged
dholms Mar 17, 2023
d3d2547
merged
dholms Mar 17, 2023
f597c0a
cleanup
dholms Mar 17, 2023
d125cd4
fix things up
dholms Mar 17, 2023
f4d3869
merge main
dholms Mar 17, 2023
5cb55c8
adding more formats
dholms Mar 17, 2023
9d04f1a
merge
dholms Mar 17, 2023
5eee3cd
tests
dholms Mar 17, 2023
36bed38
updating schema
dholms Mar 17, 2023
23938d3
Only generate tid rkeys on pds, support literal rkeys on client
devinivy Mar 18, 2023
155b5d5
Add backlink indexes
devinivy Mar 18, 2023
bb02c10
Merge pull request #684 from bluesky-social/lex/optional-agg-fields
devinivy Mar 18, 2023
a9a8b17
Merge pull request #680 from bluesky-social/lex/unique-record-relations
devinivy Mar 18, 2023
5a16061
Update format of post embed views, fix external uri validation
devinivy Mar 18, 2023
48b2295
fixing up tests
dholms Mar 18, 2023
161c0b2
Include embeds on record embeds
devinivy Mar 18, 2023
8d6dfe2
Merge pull request #673 from bluesky-social/lex/cids-and-bytes
dholms Mar 18, 2023
6e3848e
Merge branch 'lex-refactor' into lex/more-formats
dholms Mar 18, 2023
f2897bd
cleanup
dholms Mar 18, 2023
d365982
merged
dholms Mar 18, 2023
7820c33
Notify users when they are quoted
devinivy Mar 18, 2023
46ab845
Remove determineRkey indirection
devinivy Mar 18, 2023
85fb0ac
Merge branch 'lex-refactor' into lex/empty-display-name
devinivy Mar 18, 2023
b57dd8d
Merge remote-tracking branch 'origin/lex/empty-display-name' into lex…
devinivy Mar 18, 2023
6bbdded
Merge remote-tracking branch 'origin/lex/put-record-profiles' into le…
devinivy Mar 18, 2023
d3c4caf
fix api tests
dholms Mar 18, 2023
67eb07e
support concatenated cbor
dholms Mar 18, 2023
7f84bd1
Merge branch 'lex/more-formats' into lex/cbor-cids
dholms Mar 18, 2023
d8c85bf
integrating to server
dholms Mar 18, 2023
348983f
re-enable tests
dholms Mar 18, 2023
bc6ff1f
fix up tests
dholms Mar 18, 2023
57aa457
Thread compare-and-swaps down into repo service rather than use pinne…
devinivy Mar 19, 2023
9c23c60
Tidy
devinivy Mar 19, 2023
7c2d7e4
Update packages/common/tests/ipld-multi.test.ts
dholms Mar 19, 2023
1003e81
Update packages/lexicon/src/validators/formats.ts
dholms Mar 19, 2023
e3d8b32
pr feedback
dholms Mar 19, 2023
65b09b0
pr feedback
dholms Mar 19, 2023
3f49eed
Add postgres-specific migration path for missing profile display names
devinivy Mar 19, 2023
473306f
Tidy/clarify deep embeds
devinivy Mar 19, 2023
2ac5020
Tidy
devinivy Mar 19, 2023
e6f4a13
rm unused escape
dholms Mar 19, 2023
92ecee7
Merge pull request #691 from bluesky-social/lex/embeds-in-embeds
devinivy Mar 19, 2023
5eaa03c
Merge pull request #692 from bluesky-social/lex/notif-for-quote
devinivy Mar 19, 2023
a7de238
merged feature branch
dholms Mar 20, 2023
94e3d2c
Merge pull request #693 from bluesky-social/lex/cbor-cids
dholms Mar 20, 2023
113108d
update snaps
dholms Mar 20, 2023
6586d04
Merge pull request #688 from bluesky-social/lex/more-formats
dholms Mar 20, 2023
e4bbdce
merged feature branch
dholms Mar 20, 2023
6c2b01f
decrease crud race count
dholms Mar 20, 2023
e4377cc
Merge pull request #683 from bluesky-social/lex/empty-display-name
devinivy Mar 20, 2023
05056c6
Merge remote-tracking branch 'origin/lex-refactor' into lex/put-recor…
devinivy Mar 20, 2023
42bd7b0
update subscribeRepos lexicon
dholms Mar 20, 2023
2792570
Merge remote-tracking branch 'origin/lex/put-record-profiles' into le…
devinivy Mar 20, 2023
6153590
Fix applyWrite lexicon re: collection fields
devinivy Mar 20, 2023
34b805d
sign post event type
dholms Mar 20, 2023
779c4e9
Merge pull request #685 from bluesky-social/lex/put-record-profiles
devinivy Mar 20, 2023
7e59d57
Merge pull request #686 from bluesky-social/lex/cas-repo-writes
devinivy Mar 20, 2023
f0e673b
update cids & bytes json encoding
dholms Mar 20, 2023
8aec000
update lex blob & cid-link types
dholms Mar 21, 2023
38f4db7
updated codegen & pds
dholms Mar 21, 2023
921e3d3
number -> float
dholms Mar 21, 2023
a8c600c
missed a couple
dholms Mar 21, 2023
c452b43
Merge remote-tracking branch 'origin/lex/cas-repo-writes' into lex/re…
devinivy Mar 21, 2023
7704d2d
remove old image constraints
dholms Mar 21, 2023
ee6627b
Merge pull request #690 from bluesky-social/lex/repo-write-method-sem…
devinivy Mar 21, 2023
352a281
pr feedback + descripts
dholms Mar 21, 2023
03e085e
no hardcoded port numbers
dholms Mar 21, 2023
6e96a31
remove separate tooLarge evt
dholms Mar 21, 2023
678c33d
fix dumb build error
dholms Mar 21, 2023
e4aa9b1
Merge branch 'lex/types-revamp' into lex/floats
dholms Mar 21, 2023
6fe3d01
Merge pull request #699 from bluesky-social/lex/types-revamp
dholms Mar 22, 2023
8a72869
Merge pull request #700 from bluesky-social/lex/floats
dholms Mar 22, 2023
eeda57f
merged feature branch
dholms Mar 22, 2023
fa3cc59
Merge pull request #679 from bluesky-social/lex/blob-types
dholms Mar 22, 2023
d3d79ea
fixin gup lex + xrpc server
dholms Mar 22, 2023
1fbe7a8
Merge pull request #625 from jiftechnify/fix-typo-apt
dholms Mar 22, 2023
8fc74d0
better parsing of message types
dholms Mar 22, 2023
9546ed8
dont mutate body in subscription
dholms Mar 22, 2023
319b4ee
bugfix in subscription
dholms Mar 22, 2023
a8fe0fd
rm commented out code
dholms Mar 22, 2023
f5fa8b4
init feature branch
dholms Mar 22, 2023
179707e
undo
dholms Mar 22, 2023
7331d60
Merge pull request #698 from bluesky-social/subscribe-repos-lex
dholms Mar 22, 2023
53ffc0e
Merge pull request #703 from bluesky-social/subscribe-repos-route-rework
dholms Mar 22, 2023
5a043ba
Remove old lexicons
devinivy Mar 23, 2023
1df8f73
Merge remote-tracking branch 'origin/main' into lex-refactor
devinivy Mar 23, 2023
b2510e5
Remove creator from profile view
devinivy Mar 23, 2023
8e17b13
wip
dholms Mar 23, 2023
a3093e7
Merge pull request #707 from bluesky-social/lex/fix-removed-lexicons
devinivy Mar 23, 2023
55d0da8
rework seqs
dholms Mar 23, 2023
bd47e6a
fixed up tests
dholms Mar 23, 2023
6890991
bug fixing
dholms Mar 23, 2023
8de76f5
sequence handles & notify in dbTxn
dholms Mar 23, 2023
5090601
tidy
dholms Mar 23, 2023
4ec8e33
update lex to include times
dholms Mar 23, 2023
912de10
test syncing handle changes
dholms Mar 23, 2023
a376d26
one more fix
dholms Mar 24, 2023
1021f6b
handle too big evts
dholms Mar 24, 2023
2dca67d
dont thread sequencer through everything
dholms Mar 24, 2023
c8fe29d
Split common into server vs web-friendly versions
devinivy Mar 24, 2023
1fab778
Make lexicon, identifier web-safe using common-web
devinivy Mar 24, 2023
4d9db87
Switch api package to be a browser build, fix identifier package for …
devinivy Mar 24, 2023
3cfc08c
Fix pds and repo for lexicon package changes, tidy
devinivy Mar 24, 2023
08f3645
Make common-web a browser build, tidy
devinivy Mar 24, 2023
61becce
Merge pull request #714 from bluesky-social/lex/browser-friendly-api
devinivy Mar 24, 2023
39cf537
fixing up deps
dholms Mar 24, 2023
6feb2a6
Merge branch 'main' into lex-refactor
dholms Mar 24, 2023
8ad1de6
merged lex-refactor
dholms Mar 24, 2023
9861d98
fix up test
dholms Mar 24, 2023
b7be89f
merged in lex
dholms Mar 24, 2023
fc90e22
turn off caching in actions
dholms Mar 24, 2023
f68eed0
Standardize repo write interfaces around repo input
devinivy Mar 25, 2023
7209980
Update repo write endpoints for repo input field
devinivy Mar 25, 2023
bb749f6
Remove scene follows during app migration
devinivy Mar 25, 2023
cf7438d
API package updates (#712)
pfrazee Mar 27, 2023
4636e69
Update packages/pds/src/api/com/atproto/repo/applyWrites.ts
dholms Mar 27, 2023
5287841
pr feedback
dholms Mar 27, 2023
a343768
Merge pull request #717 from bluesky-social/lex/std-record-repo-inter…
devinivy Mar 27, 2023
e70a904
Merge pull request #718 from bluesky-social/lex/remove-scene-follows
devinivy Mar 27, 2023
688b94a
fix flaky timing streaming tests
dholms Mar 27, 2023
1170a1d
simplify emptyPromise
dholms Mar 27, 2023
a9424bf
fixed up open handles
dholms Mar 27, 2023
b7cd157
Merge branch 'lex-refactor' into streaming-test-fix
dholms Mar 27, 2023
cc2be46
fix missed repo syntax
dholms Mar 27, 2023
17eb84d
Merge branch 'lex-refactor' into streaming-test-fix
dholms Mar 27, 2023
6d7a618
fix error in test from fkey constraint
dholms Mar 27, 2023
5ac7009
fix another api agent bug
dholms Mar 27, 2023
45a18d4
Merge branch 'lex-refactor' into streaming-test-fix
dholms Mar 27, 2023
fc4afd6
Embed consistency, add complex record embed
devinivy Mar 27, 2023
68e603a
Tidy embed lex descriptions
devinivy Mar 27, 2023
00b553d
Merge pull request #721 from bluesky-social/streaming-test-fix
dholms Mar 27, 2023
3c13bdb
Merge branch 'lex-refactor' into feature/subscription-revamp
dholms Mar 27, 2023
14a4031
Merge branch 'lex-refactor' into feature/subscription-revamp
dholms Mar 27, 2023
8762d3b
merged
dholms Mar 27, 2023
f6dc2cc
rename pg schemas
dholms Mar 27, 2023
3214c42
use swc for jest
dholms Mar 27, 2023
a20cea5
fix up deps
dholms Mar 27, 2023
bccb130
cleanup
dholms Mar 27, 2023
b9a923a
Merge branch 'swc-jest' into lex-refactor
dholms Mar 27, 2023
1008ee4
Merge branch 'lex-refactor' into feature/subscription-revamp
dholms Mar 27, 2023
94677b6
Merge branch 'feature/subscription-revamp' into rework-seqs
dholms Mar 27, 2023
90f1724
Update pds indexing, views, tests for complex record embeds
devinivy Mar 27, 2023
88721f2
Merge remote-tracking branch 'origin/lex-refactor' into lex/complex-e…
devinivy Mar 27, 2023
2a1cc17
fixing up profile view semantics
dholms Mar 27, 2023
ef1eec8
wip
dholms Mar 28, 2023
0be657d
update snaps
dholms Mar 28, 2023
6bec87c
Merge pull request #711 from bluesky-social/rework-seqs
dholms Mar 28, 2023
8810d6f
Rename embed.complexRecord to embed.recordWithMedia
devinivy Mar 28, 2023
b644065
Merge pull request #724 from bluesky-social/lex/actor-views
dholms Mar 28, 2023
3965a6b
Tidy aroud record w/ media embeds
devinivy Mar 28, 2023
f6a8900
Merge remote-tracking branch 'origin/lex-refactor' into lex/complex-e…
devinivy Mar 28, 2023
78c5763
Merge pull request #723 from bluesky-social/lex/complex-embeds
devinivy Mar 28, 2023
c47adb4
Add grapheme utilities to api RichText (#720)
pfrazee Mar 28, 2023
eafe1a5
Fix: app.bsky.feed.getPostThread#... to app.bsky.feed.defs#... (#726)
pfrazee Mar 28, 2023
808270c
Update bskyagent to use repo param
pfrazee Mar 28, 2023
602dff2
Minor typing fix
devinivy Mar 28, 2023
955ca9b
setting up rebase in repo & storage
dholms Mar 28, 2023
0e576d3
repo tests
dholms Mar 28, 2023
037ce35
Add exports to api package: blobref & lex/json converters (#727)
pfrazee Mar 28, 2023
5d25919
Switch all lingering references of recordRef to strongRef
devinivy Mar 28, 2023
dead53b
Update lexicon for richtext facets to have multiple features, byte sl…
devinivy Mar 28, 2023
1608b89
Implement multi-feature richtext facets on pds
devinivy Mar 28, 2023
816d6a1
integrate into services & sequencer
dholms Mar 28, 2023
2d67bce
Merge pull request #728 from bluesky-social/lex/namespace-fixes
devinivy Mar 28, 2023
d7c7509
more tests
dholms Mar 28, 2023
670bbe2
Update api package to use updated richtext facets
pfrazee Mar 28, 2023
3c27a9f
one more test
dholms Mar 28, 2023
2028cad
Merge pull request #705 from bluesky-social/feature/subscription-revamp
dholms Mar 28, 2023
e8c4724
Merge pull request #729 from bluesky-social/lex/facet-features
devinivy Mar 28, 2023
fa9dd66
Minor fixes to admin repo/record views
devinivy Mar 28, 2023
f27655e
Merge pull request #731 from bluesky-social/lex/admin-views-fix
devinivy Mar 28, 2023
40a560c
Merge remote-tracking branch 'origin/main' into lex-refactor
devinivy Mar 28, 2023
6431c78
Fix app migration exports, remove old app migration
devinivy Mar 28, 2023
be0c3e2
allow bringing your own did
dholms Mar 28, 2023
ace17dc
Fix: sort richtext facets so they can render correctly
pfrazee Mar 28, 2023
d0b547c
refactoring createAccount
dholms Mar 29, 2023
ef1b80d
Disable app migration dummy checks that don't work on live deploy
devinivy Mar 29, 2023
1848477
Optimize lex de/serialization using simple checks
devinivy Mar 29, 2023
d7557af
Tidy comment typos
devinivy Mar 29, 2023
e4b1827
Merge pull request #732 from bluesky-social/lex/optimize-lex-serializ…
devinivy Mar 29, 2023
9176993
App migration to cleanup notifications for likes, follows, old scene …
devinivy Mar 29, 2023
833c06e
Merge pull request #733 from bluesky-social/lex/fix-vote-to-like-notifs
devinivy Mar 29, 2023
2219182
Fix notification reason for change from vote to like
devinivy Mar 29, 2023
f7da8d3
Merge pull request #735 from bluesky-social/lex/notif-app-migration-fix
devinivy Mar 29, 2023
bf7c2fb
handle migrating dids & plc operations
dholms Mar 29, 2023
0804acf
tidy
dholms Mar 29, 2023
25b724a
uploadRepo lex
dholms Mar 29, 2023
3ea08c9
Merge branch 'lex-refactor' into account-migration
dholms Mar 30, 2023
04c0cd7
adding uploadRepo method
dholms Mar 30, 2023
9a118ed
Merge branch 'lex-refactor' into repo-rebase
dholms Mar 30, 2023
4198fa4
Merge branch 'repo-rebase' into account-migration
dholms Mar 30, 2023
e1ca522
merge main
dholms Mar 31, 2023
a309df3
Merge branch 'repo-rebase' into account-migration
dholms Mar 31, 2023
0f7c101
uploadRepo -> importRepo
dholms Mar 31, 2023
9daf606
merged main
dholms Apr 4, 2023
13bcf4d
updated deps
dholms Apr 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions lexicons/com/atproto/repo/importRepo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"lexicon": 1,
"id": "com.atproto.repo.importRepo",
"defs": {
"main": {
"type": "procedure",
"description": "Import a full repo, overwriting existing",
"input": {
"encoding": "application/vnd.ipld.car"
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["head"],
"properties": {
"head": {"type": "string", "format": "cid"}
}
}
}
}
}
}
1 change: 1 addition & 0 deletions lexicons/com/atproto/server/createAccount.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"properties": {
"email": {"type": "string"},
"handle": {"type": "string", "format": "handle"},
"did": {"type": "string", "format": "did"},
"inviteCode": {"type": "string"},
"password": {"type": "string"},
"recoveryKey": {"type": "string"}
Expand Down
8 changes: 7 additions & 1 deletion lexicons/com/atproto/server/describeServer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["availableUserDomains"],
"required": ["availableUserDomains", "repoSigningKey"],
"properties": {
"inviteCodeRequired": {"type": "boolean"},
"availableUserDomains": {"type": "array", "items": {"type": "string"}},
"repoSigningKey": {"type": "string"},
"plcRotationKeys": {
"type": "array",
"items": {"type": "string"},
"maxLength": 4
},
"links": {"type": "ref", "ref": "#links"}
}
}
Expand Down
13 changes: 13 additions & 0 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createReco
import * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord'
import * as ComAtprotoRepoDescribeRepo from './types/com/atproto/repo/describeRepo'
import * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord'
import * as ComAtprotoRepoImportRepo from './types/com/atproto/repo/importRepo'
import * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords'
import * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord'
import * as ComAtprotoRepoStrongRef from './types/com/atproto/repo/strongRef'
Expand Down Expand Up @@ -105,6 +106,7 @@ export * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createReco
export * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord'
export * as ComAtprotoRepoDescribeRepo from './types/com/atproto/repo/describeRepo'
export * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord'
export * as ComAtprotoRepoImportRepo from './types/com/atproto/repo/importRepo'
export * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords'
export * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord'
export * as ComAtprotoRepoStrongRef from './types/com/atproto/repo/strongRef'
Expand Down Expand Up @@ -462,6 +464,17 @@ export class RepoNS {
})
}

importRepo(
data?: ComAtprotoRepoImportRepo.InputSchema,
opts?: ComAtprotoRepoImportRepo.CallOptions,
): Promise<ComAtprotoRepoImportRepo.Response> {
return this._service.xrpc
.call('com.atproto.repo.importRepo', opts?.qp, data, opts)
.catch((e) => {
throw ComAtprotoRepoImportRepo.toKnownErr(e)
})
}

listRecords(
params?: ComAtprotoRepoListRecords.QueryParams,
opts?: ComAtprotoRepoListRecords.CallOptions,
Expand Down
43 changes: 42 additions & 1 deletion packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,32 @@ export const schemaDict = {
},
},
},
ComAtprotoRepoImportRepo: {
lexicon: 1,
id: 'com.atproto.repo.importRepo',
defs: {
main: {
type: 'procedure',
description: 'Import a full repo, overwriting existing',
input: {
encoding: 'application/vnd.ipld.car',
},
output: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['head'],
properties: {
head: {
type: 'string',
format: 'cid',
},
},
},
},
},
},
},
ComAtprotoRepoListRecords: {
lexicon: 1,
id: 'com.atproto.repo.listRecords',
Expand Down Expand Up @@ -1630,6 +1656,10 @@ export const schemaDict = {
type: 'string',
format: 'handle',
},
did: {
type: 'string',
format: 'did',
},
inviteCode: {
type: 'string',
},
Expand Down Expand Up @@ -1836,7 +1866,7 @@ export const schemaDict = {
encoding: 'application/json',
schema: {
type: 'object',
required: ['availableUserDomains'],
required: ['availableUserDomains', 'repoSigningKey'],
properties: {
inviteCodeRequired: {
type: 'boolean',
Expand All @@ -1847,6 +1877,16 @@ export const schemaDict = {
type: 'string',
},
},
repoSigningKey: {
type: 'string',
},
plcRotationKeys: {
type: 'array',
items: {
type: 'string',
},
maxLength: 4,
},
links: {
type: 'ref',
ref: 'lex:com.atproto.server.describeServer#links',
Expand Down Expand Up @@ -4195,6 +4235,7 @@ export const ids = {
ComAtprotoRepoDeleteRecord: 'com.atproto.repo.deleteRecord',
ComAtprotoRepoDescribeRepo: 'com.atproto.repo.describeRepo',
ComAtprotoRepoGetRecord: 'com.atproto.repo.getRecord',
ComAtprotoRepoImportRepo: 'com.atproto.repo.importRepo',
ComAtprotoRepoListRecords: 'com.atproto.repo.listRecords',
ComAtprotoRepoPutRecord: 'com.atproto.repo.putRecord',
ComAtprotoRepoStrongRef: 'com.atproto.repo.strongRef',
Expand Down
35 changes: 35 additions & 0 deletions packages/api/src/client/types/com/atproto/repo/importRepo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* GENERATED CODE - DO NOT MODIFY
*/
import { Headers, XRPCError } from '@atproto/xrpc'
import { ValidationResult, BlobRef } from '@atproto/lexicon'
import { isObj, hasProp } from '../../../../util'
import { lexicons } from '../../../../lexicons'
import { CID } from 'multiformats/cid'

export interface QueryParams {}

export type InputSchema = string | Uint8Array

export interface OutputSchema {
head: string
[k: string]: unknown
}

export interface CallOptions {
headers?: Headers
qp?: QueryParams
encoding: 'application/vnd.ipld.car'
}

export interface Response {
success: boolean
headers: Headers
data: OutputSchema
}

export function toKnownErr(e: any) {
if (e instanceof XRPCError) {
}
return e
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface QueryParams {}
export interface InputSchema {
email: string
handle: string
did?: string
inviteCode?: string
password: string
recoveryKey?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export type InputSchema = undefined
export interface OutputSchema {
inviteCodeRequired?: boolean
availableUserDomains: string[]
repoSigningKey: string
plcRotationKeys?: string[]
links?: Links
[k: string]: unknown
}
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@atproto/did-resolver": "*",
"@atproto/pds": "*",
"@atproto/uri": "*",
"@did-plc/lib": "^0.0.1",
"@did-plc/lib": "0.0.3",
"@did-plc/server": "^0.0.1",
"better-sqlite3": "^7.6.2",
"chalk": "^5.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/did-resolver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"did-resolver": "^4.0.0"
},
"devDependencies": {
"@did-plc/lib": "^0.0.1",
"@did-plc/lib": "0.0.3",
"@did-plc/server": "^0.0.1",
"cors": "^2.8.5",
"express": "^4.18.2",
Expand Down
1 change: 0 additions & 1 deletion packages/did-resolver/src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export class DidResolver {
did: string,
options: DIDResolutionOptions = {},
): Promise<DIDResolutionResult> {
log.info({ did }, 'resolving did')
const res = await this.resolver.resolve(did, options)
log.info({ did, res }, 'resolved did')
return res
Expand Down
2 changes: 1 addition & 1 deletion packages/pds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@atproto/repo": "*",
"@atproto/uri": "*",
"@atproto/xrpc-server": "*",
"@did-plc/lib": "^0.0.1",
"@did-plc/lib": "0.0.3",
"better-sqlite3": "^7.6.2",
"bytes": "^3.1.2",
"cors": "^2.8.5",
Expand Down
61 changes: 61 additions & 0 deletions packages/pds/src/api/com/atproto/repo/importRepo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import { readCarWithRoot, MemoryBlockstore, Repo } from '@atproto/repo'
import * as ui8 from 'uint8arrays'
import SqlRepoStorage from '../../../../sql-repo-storage'
import { InvalidRequestError } from '@atproto/xrpc-server'
import { prepareCreate, PreparedCreate } from '../../../../repo'

export default function (server: Server, ctx: AppContext) {
server.com.atproto.repo.importRepo({
auth: ctx.accessVerifierCheckTakedown,
handler: async ({ auth, input }) => {
const requester = auth.credentials.did
let carBytes = new Uint8Array([])
for await (const chunk of input.body) {
carBytes = ui8.concat([carBytes, new Uint8Array(chunk)])
}
const car = await readCarWithRoot(carBytes)
const storage = new MemoryBlockstore(car.blocks)
const repo = await Repo.load(storage, car.root)
const contents = await repo.getContents()

const creates: PreparedCreate[] = []
for (const collection of Object.keys(contents)) {
for (const rkey of Object.keys(contents[collection])) {
creates.push(
await prepareCreate({
did: requester,
collection,
rkey,
record: contents[collection][rkey],
}),
)
}
}

const head = await ctx.db.transaction(async (dbTxn) => {
const repoSrvc = ctx.services.repo(dbTxn)
const storage = new SqlRepoStorage(ctx.db, requester)
const prevHead = await storage.getHead()
if (prevHead !== null) {
throw new InvalidRequestError(
`Repo already exists for user: ${requester}`,
)
}
return await repoSrvc.createRepo(
requester,
creates,
new Date().toISOString(),
)
})

return {
encoding: 'application/json',
body: {
head: head.toString(),
},
}
},
})
}
2 changes: 2 additions & 0 deletions packages/pds/src/api/com/atproto/repo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import createRecord from './createRecord'
import deleteRecord from './deleteRecord'
import describeRepo from './describeRepo'
import getRecord from './getRecord'
import importRepo from './importRepo'
import listRecords from './listRecords'
import putRecord from './putRecord'
import uploadBlob from './uploadBlob'
Expand All @@ -15,6 +16,7 @@ export default function (server: Server, ctx: AppContext) {
deleteRecord(server, ctx)
describeRepo(server, ctx)
getRecord(server, ctx)
importRepo(server, ctx)
listRecords(server, ctx)
putRecord(server, ctx)
uploadBlob(server, ctx)
Expand Down
Loading