From 69e92fd9be677a0b985026f2b5ffb5e58d524319 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Sun, 02 Mar 2025 16:50:33 +0000 Subject: [PATCH] rename some files --- packages/appview/src/routes.ts | 2 +- lexicons/app/bsky/actor/defs.json | 31 +++++++++++++++++++++++++++++++ lexicons/app/bsky/actor/profile.json | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ lexicons/app/bsky/profile/defs.json | 31 ------------------------------- lexicons/app/bsky/profile/profile.json | 53 ----------------------------------------------------- packages/appview/src/lib/hydrate.ts | 21 +++++++++++++++++++++ packages/appview/src/lib/status.ts | 21 --------------------- 7 file(s) changed, 106 insertion(s)(+), 106 deletion(s)(-) diff --git a/packages/appview/src/routes.ts b/packages/appview/src/routes.ts --- a/packages/appview/src/routes.ts +++ b/packages/appview/src/routes.ts @@ -9,7 +9,7 @@ import type { AppContext } from '#/index' import { env } from '#/lib/env' -import { statusToStatusView } from '#/lib/status' +import { statusToStatusView } from '#/lib/hydrate' type Session = { did: string } diff --git a/lexicons/app/bsky/actor/defs.json b/lexicons/app/bsky/actor/defs.json new file mode 100644 --- /dev/null +++ b/lexicons/app/bsky/actor/defs.json @@ -0,0 +1,31 @@ +{ + "lexicon": 1, + "id": "app.bsky.actor.defs", + "defs": { + "profileView": { + "type": "object", + "required": ["did", "handle"], + "properties": { + "did": { "type": "string", "format": "did" }, + "handle": { "type": "string", "format": "handle" }, + "displayName": { + "type": "string", + "maxGraphemes": 64, + "maxLength": 640 + }, + "description": { + "type": "string", + "maxGraphemes": 256, + "maxLength": 2560 + }, + "avatar": { "type": "string", "format": "uri" }, + "indexedAt": { "type": "string", "format": "datetime" }, + "createdAt": { "type": "string", "format": "datetime" }, + "labels": { + "type": "array", + "items": { "type": "ref", "ref": "com.atproto.label.defs#label" } + } + } + } + } +} diff --git a/lexicons/app/bsky/actor/profile.json b/lexicons/app/bsky/actor/profile.json new file mode 100644 --- /dev/null +++ b/lexicons/app/bsky/actor/profile.json @@ -0,0 +1,53 @@ +{ + "lexicon": 1, + "id": "app.bsky.actor.profile", + "defs": { + "main": { + "type": "record", + "description": "A declaration of a Bluesky account profile.", + "key": "literal:self", + "record": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "maxGraphemes": 64, + "maxLength": 640 + }, + "description": { + "type": "string", + "description": "Free-form profile description text.", + "maxGraphemes": 256, + "maxLength": 2560 + }, + "avatar": { + "type": "blob", + "description": "Small image to be displayed next to posts from account. AKA, 'profile picture'", + "accept": ["image/png", "image/jpeg"], + "maxSize": 1000000 + }, + "banner": { + "type": "blob", + "description": "Larger horizontal image to display behind profile view.", + "accept": ["image/png", "image/jpeg"], + "maxSize": 1000000 + }, + "labels": { + "type": "union", + "description": "Self-label values, specific to the Bluesky application, on the overall account.", + "refs": ["com.atproto.label.defs#selfLabels"] + }, + "joinedViaStarterPack": { + "type": "ref", + "ref": "com.atproto.repo.strongRef" + }, + "pinnedPost": { + "type": "ref", + "ref": "com.atproto.repo.strongRef" + }, + "createdAt": { "type": "string", "format": "datetime" } + } + } + } + } +} diff --git a/lexicons/app/bsky/profile/defs.json b/lexicons/app/bsky/profile/defs.json deleted file mode 100644 --- a/lexicons/app/bsky/profile/defs.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "lexicon": 1, - "id": "app.bsky.actor.defs", - "defs": { - "profileView": { - "type": "object", - "required": ["did", "handle"], - "properties": { - "did": { "type": "string", "format": "did" }, - "handle": { "type": "string", "format": "handle" }, - "displayName": { - "type": "string", - "maxGraphemes": 64, - "maxLength": 640 - }, - "description": { - "type": "string", - "maxGraphemes": 256, - "maxLength": 2560 - }, - "avatar": { "type": "string", "format": "uri" }, - "indexedAt": { "type": "string", "format": "datetime" }, - "createdAt": { "type": "string", "format": "datetime" }, - "labels": { - "type": "array", - "items": { "type": "ref", "ref": "com.atproto.label.defs#label" } - } - } - } - } -} diff --git a/lexicons/app/bsky/profile/profile.json b/lexicons/app/bsky/profile/profile.json deleted file mode 100644 --- a/lexicons/app/bsky/profile/profile.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "lexicon": 1, - "id": "app.bsky.actor.profile", - "defs": { - "main": { - "type": "record", - "description": "A declaration of a Bluesky account profile.", - "key": "literal:self", - "record": { - "type": "object", - "properties": { - "displayName": { - "type": "string", - "maxGraphemes": 64, - "maxLength": 640 - }, - "description": { - "type": "string", - "description": "Free-form profile description text.", - "maxGraphemes": 256, - "maxLength": 2560 - }, - "avatar": { - "type": "blob", - "description": "Small image to be displayed next to posts from account. AKA, 'profile picture'", - "accept": ["image/png", "image/jpeg"], - "maxSize": 1000000 - }, - "banner": { - "type": "blob", - "description": "Larger horizontal image to display behind profile view.", - "accept": ["image/png", "image/jpeg"], - "maxSize": 1000000 - }, - "labels": { - "type": "union", - "description": "Self-label values, specific to the Bluesky application, on the overall account.", - "refs": ["com.atproto.label.defs#selfLabels"] - }, - "joinedViaStarterPack": { - "type": "ref", - "ref": "com.atproto.repo.strongRef" - }, - "pinnedPost": { - "type": "ref", - "ref": "com.atproto.repo.strongRef" - }, - "createdAt": { "type": "string", "format": "datetime" } - } - } - } - } -} diff --git a/packages/appview/src/lib/hydrate.ts b/packages/appview/src/lib/hydrate.ts new file mode 100644 --- /dev/null +++ b/packages/appview/src/lib/hydrate.ts @@ -0,0 +1,21 @@ +import { XyzStatusphereDefs } from '@statusphere/lexicon' + +import { Status } from '#/db' +import { AppContext } from '#/index' + +export async function statusToStatusView( + status: Status, + ctx: AppContext, +): Promise { + return { + uri: status.uri, + status: status.status, + createdAt: status.createdAt, + profile: { + did: status.authorDid, + handle: await ctx.resolver + .resolveDidToHandle(status.authorDid) + .catch(() => 'invalid.handle'), + }, + } +} diff --git a/packages/appview/src/lib/status.ts b/packages/appview/src/lib/status.ts deleted file mode 100644 --- a/packages/appview/src/lib/status.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { XyzStatusphereDefs } from '@statusphere/lexicon' - -import { Status } from '#/db' -import { AppContext } from '#/index' - -export async function statusToStatusView( - status: Status, - ctx: AppContext, -): Promise { - return { - uri: status.uri, - status: status.status, - createdAt: status.createdAt, - profile: { - did: status.authorDid, - handle: await ctx.resolver - .resolveDidToHandle(status.authorDid) - .catch(() => 'invalid.handle'), - }, - } -} -- tangled.sh