Skip to content

Commit

Permalink
Handling updates (bluesky-social#231)
Browse files Browse the repository at this point in the history
* disabled udpates

* remove update tests

* update schemas

* crud operations

* working cids into db layer

* crud working

* views tests working & updated snapshots

* rm tests for likes on reposts

* fix up repo tests

* quick pr feedback

* recordKey -> rkey & nameOrDid -> user

* reference records by uri & cid obj

* fix dev-env
  • Loading branch information
dholms authored Oct 12, 2022
1 parent 0b6bf87 commit bfaf3a8
Show file tree
Hide file tree
Showing 97 changed files with 1,309 additions and 757 deletions.
7 changes: 4 additions & 3 deletions lexicons/atproto.com/repoCreateRecord.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Create a new record.",
"parameters": {
"did": {"type": "string", "required": true, "description": "The DID of the repo."},
"type": {"type": "string", "required": true, "description": "The NSID of the record type."},
"collection": {"type": "string", "required": true, "description": "The NSID of the record collection."},
"validate": {"type": "boolean", "default": true, "description": "Validate the record?"}
},
"input": {
Expand All @@ -17,9 +17,10 @@
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["uri"],
"required": ["uri", "cid"],
"properties": {
"uri": {"type": "string"}
"uri": {"type": "string"},
"cid": {"type": "string"}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions lexicons/atproto.com/repoDeleteRecord.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Delete a record.",
"parameters": {
"did": {"type": "string", "required": true, "description": "The DID of the repo."},
"type": {"type": "string", "required": true, "description": "The NSID of the record type."},
"tid": {"type": "string", "required": true, "description": "The TID of the record."}
"collection": {"type": "string", "required": true, "description": "The NSID of the record collection."},
"rkey": {"type": "string", "required": true, "description": "The key of the record."}
}
}
2 changes: 1 addition & 1 deletion lexicons/atproto.com/repoDescribe.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "query",
"description": "Get information about the repo, including the list of collections.",
"parameters": {
"nameOrDid": {"type": "string", "required": true, "description": "The username or DID of the repo."}
"user": {"type": "string", "required": true, "description": "The username or DID of the repo."}
},
"output": {
"encoding": "application/json",
Expand Down
8 changes: 5 additions & 3 deletions lexicons/atproto.com/repoGetRecord.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
"type": "query",
"description": "Fetch a record.",
"parameters": {
"nameOrDid": {"type": "string", "required": true, "description": "The name or DID of the repo."},
"type": {"type": "string", "required": true, "description": "The NSID of the record type."},
"tid": {"type": "string", "required": true, "description": "The TID of the record."}
"user": {"type": "string", "required": true, "description": "The username or DID of the repo."},
"collection": {"type": "string", "required": true, "description": "The NSID of the collection."},
"rkey": {"type": "string", "required": true, "description": "The key of the record."},
"cid": {"type": "string", "required": false, "description": "The CID of the version of the record. If not specified, then return the most recent version."}
},
"output": {
"encoding": "application/json",
Expand All @@ -15,6 +16,7 @@
"required": ["uri", "value"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"value": {"type": "object"}
}
}
Expand Down
7 changes: 4 additions & 3 deletions lexicons/atproto.com/repoListRecords.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"type": "query",
"description": "List a range of records in a collection.",
"parameters": {
"nameOrDid": {"type": "string", "required": true, "description": "The username or DID of the repo."},
"type": {"type": "string", "required": true, "description": "The NSID of the record type."},
"user": {"type": "string", "required": true, "description": "The username or DID of the repo."},
"collection": {"type": "string", "required": true, "description": "The NSID of the record type."},
"limit": {"type": "number", "minimum": 1, "default": 50, "description": "The number of records to return. TODO-max number?"},
"before": {"type": "string", "description": "A TID to filter the range of records returned."},
"after": {"type": "string", "description": "A TID to filter the range of records returned."},
Expand All @@ -21,9 +21,10 @@
"type": "array",
"items": {
"type": "object",
"required": ["uri", "value"],
"required": ["uri", "cid", "value"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"value": {"type": "object"}
}
}
Expand Down
9 changes: 5 additions & 4 deletions lexicons/atproto.com/repoPutRecord.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"description": "Write a record.",
"parameters": {
"did": {"type": "string", "required": true, "description": "The DID of the repo."},
"type": {"type": "string", "required": true, "description": "The NSID of the record type."},
"tid": {"type": "string", "required": true, "description": "The TID of the record."},
"collection": {"type": "string", "required": true, "description": "The NSID of the record type."},
"rkey": {"type": "string", "required": true, "description": "The TID of the record."},
"validate": {"type": "boolean", "default": true, "description": "Validate the record?"}
},
"input": {
Expand All @@ -17,9 +17,10 @@
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["uri"],
"required": ["uri", "cid"],
"properties": {
"uri": {"type": "string"}
"uri": {"type": "string"},
"cid": {"type": "string"}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion lexicons/bsky.app/getAuthorFeed.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
"$defs": {
"feedItem": {
"type": "object",
"required": ["cursor", "uri", "author", "record", "replyCount", "repostCount", "likeCount", "indexedAt"],
"required": ["cursor", "uri", "cid", "author", "record", "replyCount", "repostCount", "likeCount", "indexedAt"],
"properties": {
"cursor": {"type": "string"},
"uri": {"type": "string"},
"cid": {"type": "string"},
"author": {"$ref": "#/$defs/user"},
"repostedBy": {"$ref": "#/$defs/user"},
"record": {"type": "object"},
Expand Down
3 changes: 2 additions & 1 deletion lexicons/bsky.app/getHomeFeed.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
"$defs": {
"feedItem": {
"type": "object",
"required": ["cursor", "uri", "author", "record", "replyCount", "repostCount", "likeCount", "indexedAt"],
"required": ["cursor", "uri", "cid", "author", "record", "replyCount", "repostCount", "likeCount", "indexedAt"],
"properties": {
"cursor": {"type": "string"},
"uri": {"type": "string"},
"cid": {"type": "string"},
"author": {"$ref": "#/$defs/user"},
"repostedBy": {"$ref": "#/$defs/user"},
"record": {"type": "object"},
Expand Down
2 changes: 2 additions & 0 deletions lexicons/bsky.app/getLikedBy.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"type": "query",
"parameters": {
"uri": {"type": "string", "required": true},
"cid": {"type": "string", "required": false},
"limit": {"type": "number", "maximum": 100},
"before": {"type": "string"}
},
Expand All @@ -14,6 +15,7 @@
"required": ["uri", "likedBy"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"likedBy": {
"type": "array",
"items": {
Expand Down
3 changes: 2 additions & 1 deletion lexicons/bsky.app/getNotifications.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
"$defs": {
"notification": {
"type": "object",
"required": ["uri", "author", "reason", "record", "isRead", "indexedAt"],
"required": ["uri", "cid", "author", "reason", "record", "isRead", "indexedAt"],
"properties": {
"uri": {"type": "string", "format": "uri"},
"cid": {"type": "string" },
"author": {
"type": "object",
"required": ["did", "name"],
Expand Down
3 changes: 2 additions & 1 deletion lexicons/bsky.app/getPostThread.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
"$defs": {
"post": {
"type": "object",
"required": ["uri", "author", "record", "replyCount", "likeCount", "repostCount", "indexedAt"],
"required": ["uri", "cid", "author", "record", "replyCount", "likeCount", "repostCount", "indexedAt"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"author": {"$ref": "#/$defs/user"},
"record": {"type": "object"},
"embed": {
Expand Down
3 changes: 2 additions & 1 deletion lexicons/bsky.app/getProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
"$defs": {
"badge": {
"type": "object",
"required": ["uri"],
"required": ["uri", "cid"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"},
"error": {"type": "string"},
"issuer": {
"type": "object",
Expand Down
1 change: 1 addition & 0 deletions lexicons/bsky.app/getRepostedBy.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"type": "query",
"parameters": {
"uri": {"type": "string", "required": true},
"cid": {"type": "string", "required": false},
"limit": {"type": "number", "maximum": 100},
"before": {"type": "string"}
},
Expand Down
12 changes: 11 additions & 1 deletion lexicons/bsky.app/like.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@
"type": "object",
"required": ["subject", "createdAt"],
"properties": {
"subject": {"type": "string"},
"subject": {"$ref": "#/$defs/subject"},
"createdAt": {"type": "string", "format": "date-time"}
},
"$defs": {
"subject": {
"type": "object",
"required": ["uri", "cid"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"}
}
}
}
}
}
14 changes: 11 additions & 3 deletions lexicons/bsky.app/post.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@
"entities": {"$ref": "#/$defs/entity"},
"reply": {
"type": "object",
"required": ["root"],
"required": ["root", "parent"],
"properties": {
"root": {"type": "string"},
"parent": {"type": "string"}
"root": {"$ref": "#/$defs/postRef"},
"parent": {"$ref": "#/$defs/postRef"}
}
},
"createdAt": {"type": "string", "format": "date-time"}
},
"$defs": {
"postRef": {
"type": "object",
"required": ["uri", "cid"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"}
}
},
"entity": {
"type": "array",
"items": {
Expand Down
5 changes: 3 additions & 2 deletions lexicons/bsky.app/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
"$defs": {
"badgeRef": {
"type": "object",
"required": ["uri"],
"required": ["uri", "cid"],
"properties": {
"uri": {"type": "string"}
"uri": {"type": "string"},
"cid": {"type": "string"}
}
}
}
Expand Down
12 changes: 11 additions & 1 deletion lexicons/bsky.app/repost.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@
"type": "object",
"required": ["subject", "createdAt"],
"properties": {
"subject": {"type": "string"},
"subject": {"$ref": "#/$defs/subject"},
"createdAt": {"type": "string", "format": "date-time"}
},
"$defs": {
"subject": {
"type": "object",
"required": ["uri", "cid"],
"properties": {
"uri": {"type": "string"},
"cid": {"type": "string"}
}
}
}
}
}
Loading

0 comments on commit bfaf3a8

Please sign in to comment.