Skip to content

Commit

Permalink
Custom feeds (#1001)
Browse files Browse the repository at this point in the history
* actor type in profiles

* skeleton lex

* more schemas

* first pass at feed composition

* cleanup services

* more tidying

* fix up tests

* bookmarking schemas

* make feeds records instead of actors

* some cleanup

* fleshing out feeds as records

* wip

* working into cfg & dev-env

* fix appview test util

* bookmarking + views

* tidy

* add displayName

* db migration

* wip test

* blob processing

* first test working!

* Sync-up snapshots

* wip

* Fix pds ctx type

* Sync lexicons on pds and api

* wip

* fully refactor

* Prep for open union in reply data in bsky appview, sync-up snapshots

* msgs & ports

* Make pds did cache sqlite-friendly

* Start scaffolding more feedgen tests

* revamp appview tests

* revamp pds tests

* merge in dev env utils

* ensure plc close

* add feed gen to dev-env

* second feed gen

* named feeds in mock

* fix issue with dev-env pds appview

* update bsky snaps

* Flesh-out some feed gen tests

* Fix feed gen reply test

* Test feed bookmarking

* update skeleton defs

* merge

* Sync-up pds with updated feed skeleton contract

* Fix feed bookmark viewer state

* add feed embeds

* Test inaccurate feed gen repost

* Tighten some error behaviors around feed gens

* generator view in record embed

* test

* bookmarked/subscribed -> saved

* updated snaps

* name & descript on alices feed

* add like counts

* proposed lex

* tweak

* fetch feed generator details

* add describeFeedGen to dev-env

* adds tests for getFeedGenerator

* Update lexicons/app/bsky/feed/getFeedGenerator.json

Co-authored-by: devin ivy <devinivy@gmail.com>

* update describe

* add cid to feed gen view

* add alice feed gen avatar

* generator displayName required

* update snaps

* Fix dev env public url (#1058)

* Fix the public url used by dev-env

* move publicUrl location

---------

Co-authored-by: dholms <dtholmgren@gmail.com>

* add defs for feed gen prefs & decrease displayName length

* build branch

* updated how saved feeds works

* cleanup lex

* mount route

* Starter bsky algos (#1046)

* implement some starter bsky algos

* add team dids

* tidy

* add quotepost check to whats hot classic

* tests

* carve out feedgen section of pds

* apply limits

* add describeFeedGenerator route

* Whats hot new (#1060)

* map out new whats hot

* only available in postgres

* Fix dev env public url (#1058)

* Fix the public url used by dev-env

* move publicUrl location

---------

Co-authored-by: dholms <dtholmgren@gmail.com>

* add defs for feed gen prefs & decrease displayName length

* build branch

* updated how saved feeds works

* build algos branch

* remove relative imports to @atproto/api

* update hot classic name

* rm build

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>

* v0.3.6

* v0.3.7

* v0.1.10

* update name of skyline

* build branch

* aws build

* getFeedGenerators test

* For now only use new replyRef union for custom feeds, for compat

* Don't use replyRef union on new feeds yet

---------

Co-authored-by: Devin Ivy <devinivy@gmail.com>
Co-authored-by: Paul Frazee <pfrazee@gmail.com>
  • Loading branch information
3 people authored May 19, 2023
1 parent 0899510 commit 8059e07
Show file tree
Hide file tree
Showing 114 changed files with 6,568 additions and 230 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-push-pds-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- custom-feeds
env:
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
USERNAME: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_USERNAME }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-and-push-pds-ghcr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- custom-feeds
env:
REGISTRY: ghcr.io
USERNAME: ${{ github.actor }}
Expand Down
23 changes: 22 additions & 1 deletion lexicons/app/bsky/actor/defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
"type": "union",
"refs": [
"#adultContentPref",
"#contentLabelPref"
"#contentLabelPref",
"#savedFeedsPref"
]
}
},
Expand All @@ -111,6 +112,26 @@
"label": {"type": "string"},
"visibility": {"type": "string", "knownValues": ["show", "warn", "hide"]}
}
},
"savedFeedsPref": {
"type": "object",
"required": ["pinned", "saved"],
"properties": {
"pinned": {
"type": "array",
"items": {
"type": "string",
"format": "at-uri"
}
},
"saved": {
"type": "array",
"items": {
"type": "string",
"format": "at-uri"
}
}
}
}
}
}
10 changes: 9 additions & 1 deletion lexicons/app/bsky/embed/record.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
"type": "object",
"required": ["record"],
"properties": {
"record": {"type": "union", "refs": ["#viewRecord", "#viewNotFound", "#viewBlocked"]}
"record": {
"type": "union",
"refs": [
"#viewRecord",
"#viewNotFound",
"#viewBlocked",
"app.bsky.feed.defs#generatorView"
]
}
}
},
"viewRecord": {
Expand Down
47 changes: 44 additions & 3 deletions lexicons/app/bsky/feed/defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"type": "object",
"required": ["post"],
"properties": {
"post": {"type": "ref", "ref": "app.bsky.feed.defs#postView"},
"post": {"type": "ref", "ref": "#postView"},
"reply": {"type": "ref", "ref": "#replyRef"},
"reason": {"type": "union", "refs": ["#reasonRepost"]}
}
Expand All @@ -50,8 +50,8 @@
"type": "object",
"required": ["root", "parent"],
"properties": {
"root": {"type": "ref", "ref": "app.bsky.feed.defs#postView"},
"parent": {"type": "ref", "ref": "app.bsky.feed.defs#postView"}
"root": {"type": "union", "refs": ["#postView", "#notFoundPost", "#blockedPost"]},
"parent": {"type": "union", "refs": ["#postView", "#notFoundPost", "#blockedPost"]}
}
},
"reasonRepost": {
Expand Down Expand Up @@ -89,6 +89,47 @@
"uri": {"type": "string", "format": "at-uri"},
"blocked": {"type": "boolean", "const": true}
}
},
"generatorView": {
"type": "object",
"required": ["uri", "cid", "creator", "displayName", "indexedAt"],
"properties": {
"uri": {"type": "string", "format": "at-uri"},
"cid": {"type": "string", "format": "cid"},
"did": {"type": "string", "format": "did"},
"creator": {"type": "ref", "ref": "app.bsky.actor.defs#profileView"},
"displayName": {"type": "string"},
"description": {"type": "string", "maxGraphemes": 300, "maxLength": 3000},
"descriptionFacets": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.richtext.facet"}
},
"avatar": {"type": "string"},
"likeCount": {"type": "integer", "minimum": 0 },
"viewer": {"type": "ref", "ref": "#generatorViewerState"},
"indexedAt": {"type": "string", "format": "datetime"}
}
},
"generatorViewerState": {
"type": "object",
"properties": {
"like": {"type": "string", "format": "at-uri"}
}
},
"skeletonFeedPost": {
"type": "object",
"required": ["post"],
"properties": {
"post": {"type": "string", "format": "at-uri"},
"reason": {"type": "union", "refs": ["#skeletonReasonRepost"]}
}
},
"skeletonReasonRepost": {
"type": "object",
"required": ["repost"],
"properties": {
"repost": {"type": "string", "ref": "at-uri"}
}
}
}
}
39 changes: 39 additions & 0 deletions lexicons/app/bsky/feed/describeFeedGenerator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"lexicon": 1,
"id": "app.bsky.feed.describeFeedGenerator",
"defs": {
"main": {
"type": "query",
"description": "Returns information about a given feed generator including TOS & offered feed URIs",
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["did", "feeds"],
"properties": {
"did": {"type": "string", "format": "did"},
"feeds": {
"type": "array",
"items": {"type": "ref", "ref": "#feed"}
},
"links": {"type": "ref", "ref": "#links"}
}
}
}
},
"feed": {
"type": "object",
"required": ["uri"],
"properties": {
"uri": {"type": "string", "format": "at-uri"}
}
},
"links": {
"type": "object",
"properties": {
"privacyPolicy": {"type": "string"},
"termsOfService": {"type": "string"}
}
}
}
}
30 changes: 30 additions & 0 deletions lexicons/app/bsky/feed/generator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"lexicon": 1,
"id": "app.bsky.feed.generator",
"defs": {
"main": {
"type": "record",
"description": "A declaration of the existence of a feed generator",
"key": "any",
"record": {
"type": "object",
"required": ["did", "displayName", "createdAt"],
"properties": {
"did": {"type": "string", "format": "did"},
"displayName": {"type": "string", "maxGraphemes": 24, "maxLength": 240},
"description": {"type": "string", "maxGraphemes": 300, "maxLength": 3000},
"descriptionFacets": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.richtext.facet"}
},
"avatar": {
"type": "blob",
"accept": ["image/png", "image/jpeg"],
"maxSize": 1000000
},
"createdAt": {"type": "string", "format": "datetime"}
}
}
}
}
}
33 changes: 33 additions & 0 deletions lexicons/app/bsky/feed/getActorFeeds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"lexicon": 1,
"id": "app.bsky.feed.getActorFeeds",
"defs": {
"main": {
"type": "query",
"description": "Retrieve a list of feeds created by a given actor",
"parameters": {
"type": "params",
"required": ["actor"],
"properties": {
"actor": {"type": "string", "format": "at-identifier"},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"cursor": {"type": "string"}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["feeds"],
"properties": {
"cursor": {"type": "string"},
"feeds": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.feed.defs#generatorView"}
}
}
}
}
}
}
}
36 changes: 36 additions & 0 deletions lexicons/app/bsky/feed/getFeed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"lexicon": 1,
"id": "app.bsky.feed.getFeed",
"defs": {
"main": {
"type": "query",
"description": "Compose and hydrate a feed from a user's selected feed generator",
"parameters": {
"type": "params",
"required": ["feed"],
"properties": {
"feed": {"type": "string", "format": "at-uri"},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"cursor": {"type": "string"}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["feed"],
"properties": {
"cursor": {"type": "string"},
"feed": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.feed.defs#feedViewPost"}
}
}
}
},
"errors": [
{"name": "UnknownFeed"}
]
}
}
}
29 changes: 29 additions & 0 deletions lexicons/app/bsky/feed/getFeedGenerator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"lexicon": 1,
"id": "app.bsky.feed.getFeedGenerator",
"defs": {
"main": {
"type": "query",
"description": "Get information about a specific feed offered by a feed generator, such as its online status",
"parameters": {
"type": "params",
"required": ["feed"],
"properties": {
"feed": {"type": "string", "format": "at-uri"}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["view", "isOnline", "isValid"],
"properties": {
"view": {"type": "ref", "ref": "app.bsky.feed.defs#generatorView"},
"isOnline": {"type": "boolean"},
"isValid": {"type": "boolean"}
}
}
}
}
}
}
33 changes: 33 additions & 0 deletions lexicons/app/bsky/feed/getFeedGenerators.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"lexicon": 1,
"id": "app.bsky.feed.getFeedGenerators",
"defs": {
"main": {
"type": "query",
"description": "Get information about a list of feed generators",
"parameters": {
"type": "params",
"required": ["feeds"],
"properties": {
"feeds": {
"type": "array",
"items": {"type": "string", "format": "at-uri"}
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["feeds"],
"properties": {
"feeds": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.feed.defs#generatorView"}
}
}
}
}
}
}
}
36 changes: 36 additions & 0 deletions lexicons/app/bsky/feed/getFeedSkeleton.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"lexicon": 1,
"id": "app.bsky.feed.getFeedSkeleton",
"defs": {
"main": {
"type": "query",
"description": "A skeleton of a feed provided by a feed generator",
"parameters": {
"type": "params",
"required": ["feed"],
"properties": {
"feed": {"type": "string", "format": "at-uri"},
"limit": {"type": "integer", "minimum": 1, "maximum": 100, "default": 50},
"cursor": {"type": "string"}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["feed"],
"properties": {
"cursor": {"type": "string"},
"feed": {
"type": "array",
"items": {"type": "ref", "ref": "app.bsky.feed.defs#skeletonFeedPost"}
}
}
}
},
"errors": [
{"name": "UnknownFeed"}
]
}
}
}
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@atproto/api",
"version": "0.3.4",
"version": "0.3.7",
"main": "src/index.ts",
"scripts": {
"codegen": "lex gen-api ./src/client ../../lexicons/com/atproto/*/* ../../lexicons/app/bsky/*/*",
Expand Down
Loading

0 comments on commit 8059e07

Please sign in to comment.