diff --git a/web/lex.config.ts b/web/lex.config.ts index c49894eb8..48107d000 100644 --- a/web/lex.config.ts +++ b/web/lex.config.ts @@ -23,6 +23,11 @@ export default defineLexiconConfig({ "../lexicons/label/**/*.json", "../lexicons/markup/**/*.json", "../lexicons/org/tangled/repo/{manifest,declaration,defs}.json", + "../lexicons/org/tangled/track/{ticket,defs,getTicketView}.json", + "../lexicons/org/tangled/review/patch.json", + "../lexicons/org/tangled/git/oid.json", + "../lexicons/org/tangled/markup/**/*.json", + "../lexicons/org/tangled/label/defs.json", "../lexicons/org/tangled/temp/actor/*.json", "../lexicons/org/tangled/temp/git/*.json", "../lexicons/org/tangled/temp/server/*.json", diff --git a/web/src/lib/api/lexicons/index.ts b/web/src/lib/api/lexicons/index.ts index 218ff651e..d47284219 100644 --- a/web/src/lib/api/lexicons/index.ts +++ b/web/src/lib/api/lexicons/index.ts @@ -2,9 +2,16 @@ export * as ComBadExamplePocketDefs from "./types/com/bad-example/pocket/defs.js export * as ComBadExamplePocketGetPreferences from "./types/com/bad-example/pocket/getPreferences.js"; export * as ComBadExamplePocketPutPreferences from "./types/com/bad-example/pocket/putPreferences.js"; export * as OrgTangledFeedSubscription from "./types/org/tangled/feed/subscription.js"; +export * as OrgTangledGitOid from "./types/org/tangled/git/oid.js"; +export * as OrgTangledLabelDefs from "./types/org/tangled/label/defs.js"; +export * as OrgTangledMarkupEmbedImage from "./types/org/tangled/markup/embed/image.js"; +export * as OrgTangledMarkupEmbedVideo from "./types/org/tangled/markup/embed/video.js"; +export * as OrgTangledMarkupMarkdown from "./types/org/tangled/markup/markdown.js"; +export * as OrgTangledMarkupPlaintext from "./types/org/tangled/markup/plaintext.js"; export * as OrgTangledRepoDeclaration from "./types/org/tangled/repo/declaration.js"; export * as OrgTangledRepoDefs from "./types/org/tangled/repo/defs.js"; export * as OrgTangledRepoManifest from "./types/org/tangled/repo/manifest.js"; +export * as OrgTangledReviewPatch from "./types/org/tangled/review/patch.js"; export * as OrgTangledTempAccountAddEmail from "./types/org/tangled/temp/account/addEmail.js"; export * as OrgTangledTempAccountBeginSignup from "./types/org/tangled/temp/account/beginSignup.js"; export * as OrgTangledTempAccountCompleteSignup from "./types/org/tangled/temp/account/completeSignup.js"; @@ -49,6 +56,7 @@ export * as OrgTangledTempNotificationUpdateSeen from "./types/org/tangled/temp/ export * as OrgTangledTempRepoDisableSite from "./types/org/tangled/temp/repo/disableSite.js"; export * as OrgTangledTempRepoGetSiteConfig from "./types/org/tangled/temp/repo/getSiteConfig.js"; export * as OrgTangledTempRepoUpdateSiteConfig from "./types/org/tangled/temp/repo/updateSiteConfig.js"; +export * as OrgTangledTempReviewListPatches from "./types/org/tangled/temp/review/listPatches.js"; export * as OrgTangledTempSearchSearchCode from "./types/org/tangled/temp/search/searchCode.js"; export * as OrgTangledTempServerAddMember from "./types/org/tangled/temp/server/addMember.js"; export * as OrgTangledTempServerBanUser from "./types/org/tangled/temp/server/banUser.js"; @@ -77,6 +85,9 @@ export * as OrgTangledTempWebhookListWebhooks from "./types/org/tangled/temp/web export * as OrgTangledTempWebhookRetryDelivery from "./types/org/tangled/temp/webhook/retryDelivery.js"; export * as OrgTangledTempWebhookToggleWebhook from "./types/org/tangled/temp/webhook/toggleWebhook.js"; export * as OrgTangledTempWebhookUpdateWebhook from "./types/org/tangled/temp/webhook/updateWebhook.js"; +export * as OrgTangledTrackDefs from "./types/org/tangled/track/defs.js"; +export * as OrgTangledTrackGetTicketView from "./types/org/tangled/track/getTicketView.js"; +export * as OrgTangledTrackTicket from "./types/org/tangled/track/ticket.js"; export * as ShTangledActorDefs from "./types/sh/tangled/actor/defs.js"; export * as ShTangledActorGetProfile from "./types/sh/tangled/actor/getProfile.js"; export * as ShTangledActorGetProfileActivity from "./types/sh/tangled/actor/getProfileActivity.js"; diff --git a/web/src/lib/api/lexicons/types/org/tangled/git/oid.ts b/web/src/lib/api/lexicons/types/org/tangled/git/oid.ts new file mode 100644 index 000000000..eada837ae --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/git/oid.ts @@ -0,0 +1,23 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.git.oid"), + ), + /** + * @minLength 40 + * @maxLength 64 + */ + oid: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(40, 64), + ]), +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/org/tangled/label/defs.ts b/web/src/lib/api/lexicons/types/org/tangled/label/defs.ts new file mode 100644 index 000000000..2745fec27 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/label/defs.ts @@ -0,0 +1,20 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _labelTokenSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.label.defs#labelToken"), + ), + /** + * Record-key of org.tangled.label.definition owned by this repository. + */ + key: /*#__PURE__*/ v.recordKeyString(), +}); + +type labelToken$schematype = typeof _labelTokenSchema; + +export interface labelTokenSchema extends labelToken$schematype {} + +export const labelTokenSchema = _labelTokenSchema as labelTokenSchema; + +export interface LabelToken extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/org/tangled/markup/embed/image.ts b/web/src/lib/api/lexicons/types/org/tangled/markup/embed/image.ts new file mode 100644 index 000000000..3eef162f8 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/markup/embed/image.ts @@ -0,0 +1,24 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.markup.embed.image"), + ), + /** + * @accept image/* + * @maxSize 1000000 + */ + image: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.blob(), [ + /*#__PURE__*/ v.blobSize(1000000), + /*#__PURE__*/ v.blobAccept(["image/*"]), + ]), +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/org/tangled/markup/embed/video.ts b/web/src/lib/api/lexicons/types/org/tangled/markup/embed/video.ts new file mode 100644 index 000000000..15b0a1ace --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/markup/embed/video.ts @@ -0,0 +1,24 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.markup.embed.video"), + ), + /** + * @accept video/mp4 + * @maxSize 5000000 + */ + video: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.blob(), [ + /*#__PURE__*/ v.blobSize(5000000), + /*#__PURE__*/ v.blobAccept(["video/mp4"]), + ]), +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/org/tangled/markup/markdown.ts b/web/src/lib/api/lexicons/types/org/tangled/markup/markdown.ts new file mode 100644 index 000000000..901169592 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/markup/markdown.ts @@ -0,0 +1,58 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import * as OrgTangledMarkupEmbedImage from "./embed/image.js"; +import * as OrgTangledMarkupEmbedVideo from "./embed/video.js"; + +const _inlineSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.markup.markdown#inline"), + ), + /** + * Final post-processed markdown content that will be rendered + * @maxLength 1024 + * @maxGraphemes 256 + */ + text: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 1024), + /*#__PURE__*/ v.stringGraphemes(0, 256), + ]), +}); +const _mainSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.markup.markdown"), + ), + /** + * list of blobs referenced in markdown + */ + get blobs() { + return /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array( + /*#__PURE__*/ v.variant([ + OrgTangledMarkupEmbedImage.mainSchema, + OrgTangledMarkupEmbedVideo.mainSchema, + ]), + ), + ); + }, + /** + * Final post-processed markdown content that will be rendered + * @maxLength 262144 + * @maxGraphemes 65536 + */ + text: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 262144), + /*#__PURE__*/ v.stringGraphemes(0, 65536), + ]), +}); + +type inline$schematype = typeof _inlineSchema; +type main$schematype = typeof _mainSchema; + +export interface inlineSchema extends inline$schematype {} +export interface mainSchema extends main$schematype {} + +export const inlineSchema = _inlineSchema as inlineSchema; +export const mainSchema = _mainSchema as mainSchema; + +export interface Inline extends v.InferInput {} +export interface Main extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/org/tangled/markup/plaintext.ts b/web/src/lib/api/lexicons/types/org/tangled/markup/plaintext.ts new file mode 100644 index 000000000..739635f2b --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/markup/plaintext.ts @@ -0,0 +1,22 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; + +const _mainSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.markup.plaintext"), + ), + /** + * @maxLength 262144 + */ + text: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 262144), + ]), +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} diff --git a/web/src/lib/api/lexicons/types/org/tangled/review/patch.ts b/web/src/lib/api/lexicons/types/org/tangled/review/patch.ts new file mode 100644 index 000000000..c29acf1be --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/review/patch.ts @@ -0,0 +1,36 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as OrgTangledGitOid from "../git/oid.js"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.string(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("org.tangled.review.patch"), + get base() { + return OrgTangledGitOid.mainSchema; + }, + createdAt: /*#__PURE__*/ v.datetimeString(), + get head() { + return OrgTangledGitOid.mainSchema; + }, + /** + * ticket-id + */ + ticket: /*#__PURE__*/ v.recordKeyString(), + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "org.tangled.review.patch": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/temp/review/listPatches.ts b/web/src/lib/api/lexicons/types/org/tangled/temp/review/listPatches.ts new file mode 100644 index 000000000..c14c23cac --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/temp/review/listPatches.ts @@ -0,0 +1,87 @@ +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("org.tangled.temp.review.listPatches#listItem"), + ), + cid: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.cidString()), + uri: /*#__PURE__*/ v.resourceUriString(), + /** + * Embedded org.tangled.review.patch record + */ + value: /*#__PURE__*/ v.unknown(), +}); +const _mainSchema = /*#__PURE__*/ v.query( + "org.tangled.temp.review.listPatches", + { + 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, + ), + /** + * Absolute offset for random-access pagination. Mutually exclusive with cursor; offsets drift under concurrent writes, so follow up with the returned cursor. + * @minimum 0 + */ + offset: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), + /** + * Sort direction by createdAt. + * @default "desc" + */ + order: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.string<"asc" | "desc" | (string & {})>(), + "desc", + ), + /** + * AT-URI of the org.tangled.track.ticket the patches belong to. + */ + ticket: /*#__PURE__*/ v.resourceUriString(), + }), + output: { + type: "lex", + schema: /*#__PURE__*/ v.object({ + cursor: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get items() { + return /*#__PURE__*/ v.array(listItemSchema); + }, + /** + * Total items in the full list; omitted for filtered or merged views + */ + total: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), + }), + }, + }, +); + +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 { + "org.tangled.temp.review.listPatches": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/track/defs.ts b/web/src/lib/api/lexicons/types/org/tangled/track/defs.ts new file mode 100644 index 000000000..e27b5ecd3 --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/track/defs.ts @@ -0,0 +1,58 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import * as OrgTangledMarkupMarkdown from "../markup/markdown.js"; +import * as ShTangledActorDefs from "../../../sh/tangled/actor/defs.js"; +import * as ShTangledRepoDefs from "../../../sh/tangled/repo/defs.js"; + +const _ticketStateSchema = /*#__PURE__*/ v.literalEnum([ + "closed", + "completed", + "open", +]); +const _ticketViewDetailedSchema = /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.literal("org.tangled.track.defs#ticketViewDetailed"), + ), + /** + * Last editor of the ticket record (`x-tngl-editor`). + */ + get author() { + return ShTangledActorDefs.profileViewBasicSchema; + }, + get body() { + return /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.variant([OrgTangledMarkupMarkdown.mainSchema]), + ); + }, + cid: /*#__PURE__*/ v.cidString(), + createdAt: /*#__PURE__*/ v.datetimeString(), + get repo() { + return ShTangledRepoDefs.repoViewBasicSchema; + }, + get state() { + return ticketStateSchema; + }, + /** + * Present when the ticket is a pull request. + */ + targetBranch: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), + get title() { + return /*#__PURE__*/ v.variant([OrgTangledMarkupMarkdown.inlineSchema]); + }, + uri: /*#__PURE__*/ v.resourceUriString(), +}); + +type ticketState$schematype = typeof _ticketStateSchema; +type ticketViewDetailed$schematype = typeof _ticketViewDetailedSchema; + +export interface ticketStateSchema extends ticketState$schematype {} +export interface ticketViewDetailedSchema extends ticketViewDetailed$schematype {} + +export const ticketStateSchema = _ticketStateSchema as ticketStateSchema; +export const ticketViewDetailedSchema = + _ticketViewDetailedSchema as ticketViewDetailedSchema; + +export type TicketState = v.InferInput; +export interface TicketViewDetailed extends v.InferInput< + typeof ticketViewDetailedSchema +> {} diff --git a/web/src/lib/api/lexicons/types/org/tangled/track/getTicketView.ts b/web/src/lib/api/lexicons/types/org/tangled/track/getTicketView.ts new file mode 100644 index 000000000..0d850b37e --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/track/getTicketView.ts @@ -0,0 +1,31 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as OrgTangledTrackDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.query("org.tangled.track.getTicketView", { + params: /*#__PURE__*/ v.object({ + uri: /*#__PURE__*/ v.resourceUriString(), + }), + output: { + type: "lex", + get schema() { + return OrgTangledTrackDefs.ticketViewDetailedSchema; + }, + }, +}); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface $params extends v.InferInput {} +export type $output = v.InferXRPCBodyInput; + +declare module "@atcute/lexicons/ambient" { + interface XRPCQueries { + "org.tangled.track.getTicketView": mainSchema; + } +} diff --git a/web/src/lib/api/lexicons/types/org/tangled/track/ticket.ts b/web/src/lib/api/lexicons/types/org/tangled/track/ticket.ts new file mode 100644 index 000000000..5e9fb02fd --- /dev/null +++ b/web/src/lib/api/lexicons/types/org/tangled/track/ticket.ts @@ -0,0 +1,62 @@ +import type {} from "@atcute/lexicons"; +import * as v from "@atcute/lexicons/validations"; +import type {} from "@atcute/lexicons/ambient"; +import * as ComAtprotoLabelDefs from "@atcute/atproto/types/label/defs"; +import * as OrgTangledLabelDefs from "../label/defs.js"; +import * as OrgTangledMarkupMarkdown from "../markup/markdown.js"; +import * as OrgTangledTrackDefs from "./defs.js"; + +const _mainSchema = /*#__PURE__*/ v.record( + /*#__PURE__*/ v.string(), + /*#__PURE__*/ v.object({ + $type: /*#__PURE__*/ v.literal("org.tangled.track.ticket"), + get body() { + return /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.variant([OrgTangledMarkupMarkdown.mainSchema]), + ); + }, + createdAt: /*#__PURE__*/ v.datetimeString(), + /** + * Self-label values for this record. + */ + get labels() { + return /*#__PURE__*/ v.optional(ComAtprotoLabelDefs.selfLabelsSchema); + }, + get state() { + return OrgTangledTrackDefs.ticketStateSchema; + }, + get tangledLabels() { + return /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.array( + /*#__PURE__*/ v.variant([OrgTangledLabelDefs.labelTokenSchema]), + ), + ); + }, + /** + * Target branch name. Must not include the `refs/heads/` prefix. + * @maxLength 244 + */ + targetBranch: /*#__PURE__*/ v.optional( + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ + /*#__PURE__*/ v.stringLength(0, 244), + ]), + ), + get title() { + return /*#__PURE__*/ v.variant([OrgTangledMarkupMarkdown.inlineSchema]); + }, + }), +); + +type main$schematype = typeof _mainSchema; + +export interface mainSchema extends main$schematype {} + +export const mainSchema = _mainSchema as mainSchema; + +export interface Main extends v.InferInput {} + +declare module "@atcute/lexicons/ambient" { + interface Records { + "org.tangled.track.ticket": mainSchema; + } +}