From 15dbf73d8302714d7f0bbda2c37b8fe63cceee90 Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Mon, 27 Jul 2026 09:52:42 +0000 Subject: [PATCH] web/src/lib/api/lexicons/*: codegen Signed-off-by: Seongmin Lee --- .gitattributes | 1 + web/src/lib/api/lexicons/types/sh/tangled/actor/defs.ts | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ web/src/lib/api/lexicons/types/sh/tangled/feed/getTimeline.ts | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ web/src/lib/api/lexicons/types/sh/tangled/publicKey/listKeys.ts | 75 --------------------------------------------------------------------------- web/src/lib/api/lexicons/types/sh/tangled/repo/defs.ts | 41 +++++++++++++++++++++++++++++++++++++++++ 5 file(s) changed, 227 insertion(s)(+), 75 deletion(s)(-) diff --git a/.gitattributes b/.gitattributes --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ api/tangled/** linguist-generated -diff api/tangled/*_ext.go -linguist-generated diff flake.lock -diff +web/src/lib/api/lexicons/** linguist-generated -diff diff --git a/web/src/lib/api/lexicons/types/sh/tangled/actor/defs.ts b/web/src/lib/api/lexicons/types/sh/tangled/actor/defs.ts new file mode 100644 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/actor/defs.ts @@ -0,0 +1,56 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _profileViewBasicSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.actor.defs#profileViewBasic"), + ), + avatar: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.genericUriString()), + did: /*#__PURE__*/ v.didString(), + handle: /*#__PURE__*/ v.handleString(), + get viewer() { + return /*#__PURE__*/ v.optional(viewerStateSchema); + }, +}); +const _profileViewDetailedSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.actor.defs#profileViewDetailed"), + ), + avatar: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.genericUriString()), + did: /*#__PURE__*/ v.didString(), + followersCount: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), + followsCount: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), + handle: /*#__PURE__*/ v.handleString(), + get viewer() { + return /*#__PURE__*/ v.optional(viewerStateSchema); + }, +}); +const _viewerStateSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.actor.defs#viewerState"), + ), + followedBy: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), + following: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), +}); + +type profileViewBasic$schematype = typeof _profileViewBasicSchema; +type profileViewDetailed$schematype = typeof _profileViewDetailedSchema; +type viewerState$schematype = typeof _viewerStateSchema; + +export interface profileViewBasicSchema extends profileViewBasic$schematype {} +export interface profileViewDetailedSchema extends profileViewDetailed$schematype {} +export interface viewerStateSchema extends viewerState$schematype {} + +export const profileViewBasicSchema = + _profileViewBasicSchema as profileViewBasicSchema; +export const profileViewDetailedSchema = + _profileViewDetailedSchema as profileViewDetailedSchema; +export const viewerStateSchema = _viewerStateSchema as viewerStateSchema; + +export interface ProfileViewBasic extends v.InferInput< + typeof profileViewBasicSchema +> {} +export interface ProfileViewDetailed extends v.InferInput< + typeof profileViewDetailedSchema +> {} +export interface ViewerState extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/feed/getTimeline.ts b/web/src/lib/api/lexicons/types/sh/tangled/feed/getTimeline.ts new file mode 100644 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/feed/getTimeline.ts @@ -0,0 +1,129 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ShTangledActorDefs from "../actor/defs.js"; +import * as ShTangledRepoDefs from "../repo/defs.js"; + +const _followEventSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.feed.getTimeline#followEvent"), + ), + get actor() { + return ShTangledActorDefs.profileViewBasicSchema; + }, + cid: /*#__PURE__*/ v.cidString(), + get subject() { + return ShTangledActorDefs.profileViewDetailedSchema; + }, + uri: /*#__PURE__*/ v.resourceUriString(), +}); +const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.feed.getTimeline", { + params: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + followingOnly: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean()), + /** + * @minimum 1 + * @maximum 100 + * @default 50 + */ + limit: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ + /*#__PURE__*/ v.integerRange(1, 100), + ]), + 50, + ), + /** + * TODO: deprecate this and use auth instead. + */ + viewer: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get feed() { + return /*#__PURE__*/ v.array(timelineItemSchema); + }, + }), + }, +}); +const _repoEventSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.feed.getTimeline#repoEvent"), + ), + cid: /*#__PURE__*/ v.cidString(), + get repo() { + return ShTangledRepoDefs.repoViewBasicSchema; + }, + /** + * Fork parent, present only if this repo is a fork. + */ + get source() { + return /*#__PURE__*/ v.optional(ShTangledRepoDefs.repoViewBasicSchema); + }, + uri: /*#__PURE__*/ v.resourceUriString(), +}); +const _starEventSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.feed.getTimeline#starEvent"), + ), + /** + * Who starred. + */ + get actor() { + return ShTangledActorDefs.profileViewBasicSchema; + }, + cid: /*#__PURE__*/ v.cidString(), + /** + * The starred repo. + */ + get repo() { + return ShTangledRepoDefs.repoViewBasicSchema; + }, + uri: /*#__PURE__*/ v.resourceUriString(), +}); +const _timelineItemSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.feed.getTimeline#timelineItem"), + ), + get event() { + return /*#__PURE__*/ v.variant([ + followEventSchema, + repoEventSchema, + starEventSchema, + ]); + }, + eventAt: /*#__PURE__*/ v.datetimeString(), +}); + +type followEvent$schematype = typeof _followEventSchema; +type main$schematype = typeof _mainSchema; +type repoEvent$schematype = typeof _repoEventSchema; +type starEvent$schematype = typeof _starEventSchema; +type timelineItem$schematype = typeof _timelineItemSchema; + +export interface followEventSchema extends followEvent$schematype {} +export interface mainSchema extends main$schematype {} +export interface repoEventSchema extends repoEvent$schematype {} +export interface starEventSchema extends starEvent$schematype {} +export interface timelineItemSchema extends timelineItem$schematype {} + +export const followEventSchema = _followEventSchema as followEventSchema; +export const mainSchema = _mainSchema as mainSchema; +export const repoEventSchema = _repoEventSchema as repoEventSchema; +export const starEventSchema = _starEventSchema as starEventSchema; +export const timelineItemSchema = _timelineItemSchema as timelineItemSchema; + +export interface FollowEvent extends v.InferInput {} +export interface RepoEvent extends v.InferInput {} +export interface StarEvent extends v.InferInput {} +export interface TimelineItem extends v.InferInput {} + +export interface $params extends v.InferInput {} +export interface $output extends v.InferXRPCBodyInput {} + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "sh.tangled.feed.getTimeline": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/publicKey/listKeys.ts b/web/src/lib/api/lexicons/types/sh/tangled/publicKey/listKeys.ts deleted file mode 100644 --- a/web/src/lib/api/lexicons/types/sh/tangled/publicKey/listKeys.ts +++ /dev/null @@ -1,75 +0,0 @@ -import type {} from "@atcute/lexicons"; -import * as v from "@atcute/lexicons/validations"; -import type {} from "@atcute/lexicons/ambient"; - -const _listItemSchema = /*#__PURE__*/ v.object({ - $type: /*#__PURE__*/ v.optional( - /*#__PURE__*/ v.literal("sh.tangled.publicKey.listKeys#listItem"), - ), - cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), - uri: /*#__PURE__*/ v.resourceUriString(), - /** - * Embedded sh.tangled.publicKey record - */ - value: /*#__PURE__*/ v.unknown(), -}); -const _mainSchema = /*#__PURE__*/ v.query("sh.tangled.publicKey.listKeys", { - params: /*#__PURE__*/ v.object({ - /** - * Pagination cursor - */ - cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), - /** - * @minimum 1 - * @maximum 1000 - * @default 50 - */ - limit: /*#__PURE__*/ v.optional( - /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ - /*#__PURE__*/ v.integerRange(1, 1000), - ]), - 50, - ), - /** - * Sort direction by createdAt. - * @default "desc" - */ - order: /*#__PURE__*/ v.optional( - /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), - "desc", - ), - /** - * Owner DID whose public-key records to list. - */ - subject: /*#__PURE__*/ v.didString(), - }), - output: { - type: "lex", - schema: /*#__PURE__*/ v.object({ - cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), - get items() { - return /*#__PURE__*/ v.array(listItemSchema); - }, - }), - }, -}); - -type listItem$schematype = typeof _listItemSchema; -type main$schematype = typeof _mainSchema; - -export interface listItemSchema extends listItem$schematype {} -export interface mainSchema extends main$schematype {} - -export const listItemSchema = _listItemSchema as listItemSchema; -export const mainSchema = _mainSchema as mainSchema; - -export interface ListItem extends v.InferInput {} - -export interface $params extends v.InferInput {} -export interface $output extends v.InferXRPCBodyInput {} - -declare module "@atcute/lexicons/ambient" { - interface XRPCQueries { - "sh.tangled.publicKey.listKeys": mainSchema; - } -} diff --git a/web/src/lib/api/lexicons/types/sh/tangled/repo/defs.ts b/web/src/lib/api/lexicons/types/sh/tangled/repo/defs.ts new file mode 100644 --- /dev/null +++ b/web/src/lib/api/lexicons/types/sh/tangled/repo/defs.ts @@ -0,0 +1,41 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import * as ShTangledActorDefs from "../actor/defs.js"; + +const _repoViewBasicSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.defs#repoViewBasic"), + ), + createdAt: /*#__PURE__*/ v.datetimeString(), + description: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + did: /*#__PURE__*/ v.didString(), + isStarred: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean()), + get owner() { + return ShTangledActorDefs.profileViewBasicSchema; + }, + slug: /*#__PURE__*/ v.string(), + starCount: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), + get viewer() { + return /*#__PURE__*/ v.optional(viewerStateSchema); + }, +}); +const _viewerStateSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("sh.tangled.repo.defs#viewerState"), + ), + star: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), +}); + +type repoViewBasic$schematype = typeof _repoViewBasicSchema; +type viewerState$schematype = typeof _viewerStateSchema; + +export interface repoViewBasicSchema extends repoViewBasic$schematype {} +export interface viewerStateSchema extends viewerState$schematype {} + +export const repoViewBasicSchema = _repoViewBasicSchema as repoViewBasicSchema; +export const viewerStateSchema = _viewerStateSchema as viewerStateSchema; + +export interface RepoViewBasic extends v.InferInput< + typeof repoViewBasicSchema +> {} +export interface ViewerState extends v.InferInput {} -- tangled.sh